This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-145 by this push:
new bd19fda [STREAMPIPES-178] Migrate pipeline view to Angular
bd19fda is described below
commit bd19fda5401a081e612f4094e2d5f3e2b4c71ed3
Author: Dominik Riemer <[email protected]>
AuthorDate: Sun Jul 26 21:57:24 2020 +0200
[STREAMPIPES-178] Migrate pipeline view to Angular
---
.../model/pipeline/PipelineCategory.java | 6 +-
ui/deployment/modules.yml | 10 +-
ui/src/app/core-model/gen/streampipes-model.ts | 22 +-
.../widgets/number/number-widget.component.ts | 3 +-
.../widgets/table/table-widget.component.ts | 2 +-
.../category-already-in-pipeline.filter.ts | 26 +--
.../pipeline-details.controller.ts | 65 ------
.../pipeline-details/pipeline-details.tmpl.html | 97 --------
.../pipeline-overview.component.html | 90 ++++++++
.../pipeline-overview.component.scss | 15 ++
.../pipeline-overview.component.ts | 104 +++++++++
.../dialog/delete-pipeline-dialog.tmpl.html | 56 -----
.../delete-pipeline-dialog.component.html | 52 +++++
.../delete-pipeline-dialog.component.scss} | 15 +-
.../delete-pipeline-dialog.component.ts} | 52 ++---
.../dialog/import-pipeline-dialog.tmpl.html | 73 ------
.../import-pipeline-dialog.component.html | 68 ++++++
.../import-pipeline-dialog.component.scss} | 15 +-
.../import-pipeline-dialog.component.ts} | 85 +++----
.../dialog/pipeline-categories-dialog.tmpl.html | 170 --------------
.../pipeline-categories-dialog.component.html | 146 ++++++++++++
.../pipeline-categories-dialog.component.scss} | 15 +-
.../pipeline-categories-dialog.component.ts} | 104 +++++----
.../dialog/pipeline-status-dialog.tmpl.html | 74 ------
.../pipeline-status-dialog.component.html | 59 +++++
.../pipeline-status-dialog.component.scss} | 23 +-
.../pipeline-status-dialog.component.ts} | 33 +--
.../dialog/start-all-pipelines-dialog.tmpl.html | 57 -----
.../start-all-pipelines-dialog.component.html | 49 ++++
.../start-all-pipelines-dialog.component.scss} | 15 +-
.../start-all-pipelines-dialog.component.ts} | 92 ++++----
ui/src/app/pipelines/pipeline-category.filter.ts | 29 ++-
ui/src/app/pipelines/pipelines.component.html | 76 +++++++
...tails.component.ts => pipelines.component.scss} | 21 +-
ui/src/app/pipelines/pipelines.component.ts | 205 +++++++++++++++++
ui/src/app/pipelines/pipelines.controller.ts | 247 ---------------------
ui/src/app/pipelines/pipelines.html | 98 --------
ui/src/app/pipelines/pipelines.module.ts | 84 +++++--
.../services/pipeline-operations.service.ts | 129 +++++------
.../app/platform-services/apis/pipeline.service.ts | 32 ++-
40 files changed, 1268 insertions(+), 1346 deletions(-)
diff --git
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineCategory.java
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineCategory.java
index 364dfb8..da975cb 100644
---
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineCategory.java
+++
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineCategory.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.model.pipeline;
+import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import org.apache.streampipes.model.shared.annotation.TsModel;
@@ -26,8 +27,11 @@ public class PipelineCategory {
private String categoryName;
private String categoryDescription;
-
+
+ @JsonProperty("_id")
private @SerializedName("_id") String categoryId;
+
+ @JsonProperty("_rev")
private @SerializedName("_rev") String rev;
public PipelineCategory() {
diff --git a/ui/deployment/modules.yml b/ui/deployment/modules.yml
index d8309ac..ef08be6 100644
--- a/ui/deployment/modules.yml
+++ b/ui/deployment/modules.yml
@@ -43,11 +43,11 @@ spConnect:
homeImage: '/assets/img/home/editor.png'
admin: False
spPipelines:
- ng5: False
- ng1_templateUrl: '../pipelines/pipelines.html'
- ng5_moduleName: ''
- ng5_component: ''
- ng5_componentPath: ''
+ ng5: True
+ ng1_templateUrl: ''
+ ng5_moduleName: 'PipelinesModule'
+ ng5_component: 'PipelinesComponent'
+ ng5_componentPath: '../pipelines/pipelines.component'
path: './pipelines/pipelines.module'
link: 'streampipes.pipelines'
url: '/pipelines/:pipeline'
diff --git a/ui/src/app/core-model/gen/streampipes-model.ts
b/ui/src/app/core-model/gen/streampipes-model.ts
index fe939ab..700257c 100644
--- a/ui/src/app/core-model/gen/streampipes-model.ts
+++ b/ui/src/app/core-model/gen/streampipes-model.ts
@@ -19,7 +19,7 @@
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
-// Generated using typescript-generator version 2.23.603 on 2020-07-19
11:52:14.
+// Generated using typescript-generator version 2.24.612 on 2020-07-25
11:23:04.
export class AbstractStreamPipesEntity {
"@class": "org.apache.streampipes.model.base.NamedStreamPipesEntity" |
"org.apache.streampipes.model.connect.adapter.AdapterDescription" |
"org.apache.streampipes.model.connect.adapter.AdapterSetDescription" |
"org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription" |
"org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription" |
"org.apache.streampipes.model.connect.adapter.AdapterStreamDescription" |
"org.apache.streampipes.model.connect.adapter.G [...]
@@ -187,9 +187,9 @@ export class AdapterDescription extends
NamedStreamPipesEntity {
instance.config =
__getCopyArrayFn(StaticProperty.fromDataUnion)(data.config);
instance.rules =
__getCopyArrayFn(TransformationRuleDescription.fromDataUnion)(data.rules);
instance.category =
__getCopyArrayFn(__identity<string>())(data.category);
+ instance.schemaRules =
__getCopyArrayFn(__identity<any>())(data.schemaRules);
instance.valueRules =
__getCopyArrayFn(__identity<any>())(data.valueRules);
instance.streamRules =
__getCopyArrayFn(__identity<any>())(data.streamRules);
- instance.schemaRules =
__getCopyArrayFn(__identity<any>())(data.schemaRules);
instance.couchDBId = data.couchDBId;
instance._rev = data._rev;
return instance;
@@ -1563,9 +1563,9 @@ export class GenericAdapterSetDescription extends
AdapterSetDescription implemen
}
const instance = target || new GenericAdapterSetDescription();
super.fromData(data, instance);
- instance.eventSchema = EventSchema.fromData(data.eventSchema);
- instance.formatDescription =
FormatDescription.fromData(data.formatDescription);
instance.protocolDescription =
ProtocolDescription.fromData(data.protocolDescription);
+ instance.formatDescription =
FormatDescription.fromData(data.formatDescription);
+ instance.eventSchema = EventSchema.fromData(data.eventSchema);
return instance;
}
}
@@ -1582,9 +1582,9 @@ export class GenericAdapterStreamDescription extends
AdapterStreamDescription im
}
const instance = target || new GenericAdapterStreamDescription();
super.fromData(data, instance);
- instance.eventSchema = EventSchema.fromData(data.eventSchema);
- instance.formatDescription =
FormatDescription.fromData(data.formatDescription);
instance.protocolDescription =
ProtocolDescription.fromData(data.protocolDescription);
+ instance.formatDescription =
FormatDescription.fromData(data.formatDescription);
+ instance.eventSchema = EventSchema.fromData(data.eventSchema);
return instance;
}
}
@@ -1977,10 +1977,10 @@ export class Pipeline extends ElementComposition {
}
export class PipelineCategory {
+ _id: string;
+ _rev: string;
categoryDescription: string;
- categoryId: string;
categoryName: string;
- rev: string;
static fromData(data: PipelineCategory, target?: PipelineCategory):
PipelineCategory {
if (!data) {
@@ -1989,8 +1989,8 @@ export class PipelineCategory {
const instance = target || new PipelineCategory();
instance.categoryName = data.categoryName;
instance.categoryDescription = data.categoryDescription;
- instance.categoryId = data.categoryId;
- instance.rev = data.rev;
+ instance._id = data._id;
+ instance._rev = data._rev;
return instance;
}
}
@@ -2440,8 +2440,8 @@ export class SpDataSet extends SpDataStream {
instance.supportedGrounding =
EventGrounding.fromData(data.supportedGrounding);
instance.datasetInvocationId = data.datasetInvocationId;
instance.correspondingPipeline = data.correspondingPipeline;
- instance.brokerHostname = data.brokerHostname;
instance.actualTopicName = data.actualTopicName;
+ instance.brokerHostname = data.brokerHostname;
return instance;
}
}
diff --git
a/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts
b/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts
index f466066..0c1a9e3 100644
--- a/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts
+++ b/ui/src/app/dashboard/components/widgets/number/number-widget.component.ts
@@ -22,9 +22,8 @@ import {BaseStreamPipesWidget} from "../base/base-widget";
import {StaticPropertyExtractor} from
"../../../sdk/extractor/static-property-extractor";
import {NumberConfig} from "./number-config";
import {ResizeService} from "../../../services/resize.service";
-import {EventProperty} from
"../../../../connect/schema-editor/model/EventProperty";
-import {EventPropertyPrimitive} from
"../../../../connect/schema-editor/model/EventPropertyPrimitive";
import {DashboardService} from "../../../services/dashboard.service";
+import {EventPropertyPrimitive} from
"../../../../core-model/gen/streampipes-model";
@Component({
selector: 'number-widget',
diff --git
a/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
b/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
index 102a766..5af1d0d 100644
--- a/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
+++ b/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
@@ -47,7 +47,7 @@ export class TableWidgetComponent extends
BaseStreamPipesWidget implements OnIni
super.ngOnInit();
this.widgetDataConfig.schema.eventProperties.forEach((key, index) => {
- this.semanticTypes[key.runtimeName] = key.domainProperty
+ this.semanticTypes[key.runtimeName] = key.domainProperties[0]
});
}
diff --git a/ui/src/app/pipelines/category-already-in-pipeline.filter.ts
b/ui/src/app/pipelines/category-already-in-pipeline.filter.ts
index 0f0deb3..6def4a8 100644
--- a/ui/src/app/pipelines/category-already-in-pipeline.filter.ts
+++ b/ui/src/app/pipelines/category-already-in-pipeline.filter.ts
@@ -16,18 +16,18 @@
*
*/
-import * as angular from 'angular';
+import {Pipe, PipeTransform} from "@angular/core";
+import {Pipeline} from "../core-model/gen/streampipes-model";
-export function CategoryAlreadyInPipelineFilter() {
- return function(pipelines, categoryId) {
- var result = [];
- angular.forEach(pipelines, function(pipeline) {
- var inPipeline = false;
- angular.forEach(pipeline.pipelineCategories,
function(category) {
- if (category == categoryId) inPipeline = true;
- })
- if (!inPipeline) result.push(pipeline);
- })
- return result;
- };
+@Pipe({
+ name: 'categoryAlreadyInPipelineFilter',
+ pure: false
+})
+export class CategoryAlreadyInPipelinePipe implements PipeTransform {
+
+ transform(pipelines: Pipeline[], categoryId: string): any {
+ return pipelines.filter(pipeline => {
+ return !pipeline.pipelineCategories ||
!(pipeline.pipelineCategories.some(pc => pc === categoryId));
+ });
+ }
};
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.controller.ts
b/ui/src/app/pipelines/components/pipeline-details/pipeline-details.controller.ts
deleted file mode 100644
index 11c11e0..0000000
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.controller.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import * as angular from "angular";
-
-export class PipelineDetailsController {
-
- pipelines: any;
- starting: any;
- stopping: any;
- refreshPipelines: any;
- PipelineOperationsService: any;
- activeCategory: any;
- dtOptions = {paging: false, searching: false, "order": [], "columns": [
- { "orderable": false },
- null,
- null,
- { "orderable": false },
- ]};
-
- constructor(PipelineOperationsService) {
- this.PipelineOperationsService = PipelineOperationsService;
- this.starting = false;
- this.stopping = false;
- }
-
- $onInit() {
- this.toggleRunningOperation = this.toggleRunningOperation.bind(this);
-
- angular.forEach(this.pipelines, pipeline => {
- if (pipeline.immediateStart) {
- if (!pipeline.running) {
- this.PipelineOperationsService.startPipeline(pipeline._id,
this.toggleRunningOperation, this.refreshPipelines);
- }
- }
- });
-
- }
-
- toggleRunningOperation(currentOperation) {
- if (currentOperation === 'starting') {
- this.starting = !(this.starting);
- } else {
- this.stopping = !(this.stopping);
- }
- }
-
-}
-
-PipelineDetailsController.$inject = ['PipelineOperationsService'];
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.tmpl.html
b/ui/src/app/pipelines/components/pipeline-details/pipeline-details.tmpl.html
deleted file mode 100644
index a8e3769..0000000
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.tmpl.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<table datatable="" dt-options="ctrl.dtOptions" class="row-border hover"
- ng-if="ctrl.pipelines.length > 0">
- <thead>
- <tr>
- <th>Start</th>
- <th>Name</th>
- <th>Last modified</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="pipeline in ctrl.pipelines | pipelineCategoryFilter:
ctrl.activeCategory | orderBy:'+name'">
- <td>
- <sp-button sp-button-icon
-
ng-click="ctrl.PipelineOperationsService.startPipeline(pipeline._id,
ctrl.toggleRunningOperation, ctrl.refreshPipelines)"
- class="md-icon-button"
- ng-disabled="ctrl.starting" ng-if="!pipeline.running">
- <i class="material-icons">play_arrow</i>
- <md-tooltip md-direction="top">
- Start Pipeline
- </md-tooltip>
- </sp-button>
- <sp-button sp-button-icon
-
ng-click="ctrl.PipelineOperationsService.stopPipeline(pipeline._id,
ctrl.toggleRunningOperation, ctrl.refreshPipelines)"
- class="md-icon-button"
- ng-disabled="ctrl.stopping" ng-if="pipeline.running">
- <i class="material-icons">stop</i>
- <md-tooltip md-direction="top">
- Stop Pipeline
- </md-tooltip>
- </sp-button>
- </td>
- <td>
- <h4 style="margin-bottom:0px;">{{pipeline.name}}</h4>
- <h5>{{pipeline.description != '' ? pipeline.description :
'-'}}</h5>
- </td>
- <td>
- <h5>{{pipeline.createdAt | date:'dd.MM.yyyy HH:mm'}}</h5>
- </td>
- <td>
- <div layout="row">
- <span flex flex-order="1" layout="row" layout-align="center
center">
- <sp-button sp-button-icon
ng-click="ctrl.PipelineOperationsService.showPipelineDetails(pipeline._id)"
- class="md-icon-button"><i
class="material-icons">search</i>
- <md-tooltip md-direction="top">
- Show Pipeline
- </md-tooltip>
- </sp-button>
- </span>
- <span flex flex-order="2" layout="row" layout-align="center
center">
- <sp-button ng-disabled="pipeline.running" sp-button-icon
ng-click="ctrl.PipelineOperationsService.modifyPipeline(pipeline._id)"
class="md-icon-button">
- <i class="material-icons">mode_edit</i>
- <md-tooltip md-direction="top">
- Modify Pipeline
- </md-tooltip>
- </sp-button>
- </span>
- <span flex flex-order="4" layout="row" layout-align="center
center">
- <sp-button sp-button-icon
-
ng-click="ctrl.PipelineOperationsService.showDeleteDialog(pipeline,
ctrl.refreshPipelines)"
- class="md-icon-button"><i class="material-icons">delete</i>
- <md-tooltip md-direction="top">
- Delete Pipeline
- </md-tooltip>
- </sp-button>
- </span>
-<!-- <span flex flex-order="4" layout="row"
layout-align="center center">-->
-<!-- <sp-button sp-button-icon
ng-click="ctrl.PipelineOperationsService.showLogs(pipeline._id)"
class="md-icon-button"><i class="material-icons">info</i>-->
-<!-- <md-tooltip md-direction="top">-->
-<!-- Show Logs-->
-<!-- </md-tooltip>-->
-<!-- </sp-button>-->
-<!-- </span>-->
- </div>
- </td>
- </tr>
- </tbody>
-</table>
-
diff --git
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
new file mode 100644
index 0000000..2af6afe
--- /dev/null
+++
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
@@ -0,0 +1,90 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div fxFlex="100" fxLayout="column" *ngIf="filteredPipelinesAvailable"
style="margin:1px;">
+ <table fxFlex="100" mat-table [dataSource]="dataSource">
+ <ng-container matColumnDef="start">
+ <th mat-header-cell *matHeaderCellDef> Start</th>
+ <td mat-cell *matCellDef="let pipeline">
+ <button color="primary" mat-button mat-icon-button
matTooltip="Start pipeline" matTooltipPosition="above"
+
(click)="pipelineOperationsService.startPipeline(pipeline._id,
toggleRunningOperation, refreshPipelinesEmitter)"
+ [disabled]="starting" *ngIf="!pipeline.running">
+ <i class="material-icons">play_arrow</i>
+ </button>
+ <button color="primary" mat-button mat-icon-button
matTooltip="Stop pipeline" matTooltipPosition="above"
+
(click)="pipelineOperationsService.stopPipeline(pipeline._id,
toggleRunningOperation, refreshPipelinesEmitter)"
+ [disabled]="stopping" *ngIf="pipeline.running">
+ <i class="material-icons">stop</i>
+ </button>
+ </td>
+ </ng-container>
+
+ <ng-container matColumnDef="name">
+ <th mat-header-cell *matHeaderCellDef> Name</th>
+ <td mat-cell *matCellDef="let pipeline">
+ <h4 style="margin-bottom:0px;">{{pipeline.name}}</h4>
+ <h5>{{pipeline.description != '' ? pipeline.description :
'-'}}</h5>
+ </td>
+ </ng-container>
+
+ <ng-container matColumnDef="lastModified">
+ <th mat-header-cell *matHeaderCellDef> Created</th>
+ <td mat-cell *matCellDef="let pipeline">
+ <h5>{{pipeline.createdAt | date:'dd.MM.yyyy HH:mm'}}</h5>
+ </td>
+ </ng-container>
+
+ <ng-container matColumnDef="action">
+ <th mat-header-cell *matHeaderCellDef> Action</th>
+ <td mat-cell *matCellDef="let pipeline">
+ <div fxLayout="row">
+ <span fxFlex fxFlexOrder="1" fxLayout="row"
fxLayoutAlign="center center">
+ <button color="primary"mat-button mat-icon-button
matTooltip="Show pipeline" matTooltipPosition="above"
+
(click)="pipelineOperationsService.showPipelineDetails(pipeline._id)"><i
+ class="material-icons">search</i>
+ </button>
+ </span>
+ <span fxFlex fxFlexOrder="2" fxLayout="row"
fxLayoutAlign="center center">
+ <button color="primary"mat-button mat-icon-button
matTooltip="Modify pipeline" matTooltipPosition="above"
+ [disabled]="pipeline.running"
+
(click)="pipelineOperationsService.modifyPipeline(pipeline._id)">
+ <i class="material-icons">mode_edit</i>
+ </button>
+ </span>
+ <span fxFlex fxFlexOrder="3" layout="row"
fxLayoutAlign="center center">
+ <button color="primary" mat-button mat-icon-button
matTooltip="Delete pipeline" matTooltipPosition="above"
+
(click)="pipelineOperationsService.showDeleteDialog(pipeline,
refreshPipelinesEmitter)">
+ <i class="material-icons">delete</i>
+ </button>
+ </span>
+ </div>
+ </td>
+ </ng-container>
+
+ <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
+ <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
+
+ </table>
+ <div fxFlex="100" fxLayoutAlign="end end">
+ <mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"
[pageSize]="10"></mat-paginator>
+ </div>
+</div>
+<div fxFlex="100" fxLayout="column" fxLayoutAlign="center center"
*ngIf="!filteredPipelinesAvailable">
+ <h5>(no pipelines available)</h5>
+</div>
+
diff --git
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.scss
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.scss
new file mode 100644
index 0000000..20756bd
--- /dev/null
+++
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.scss
@@ -0,0 +1,15 @@
+.mat-table {
+ background: #FAFAFA;
+}
+
+.mat-paginator {
+ border-top: 1px solid rgba(0,0,0,.12);
+ background: #FAFAFA;
+}
+
+.mat-row:nth-child(even) {
+ background-color: #FAFAFA;
+}
+.mat-row:nth-child(odd) {
+ background-color:#ffffff;
+}
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
new file mode 100644
index 0000000..4e74da9
--- /dev/null
+++
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import {Pipeline} from "../../../core-model/gen/streampipes-model";
+import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from
"@angular/core";
+import {PipelineOperationsService} from
"../../services/pipeline-operations.service";
+import {MatTableDataSource} from "@angular/material/table";
+import {MatPaginator} from "@angular/material/paginator";
+
+
+@Component({
+ selector: 'pipeline-overview',
+ templateUrl: './pipeline-overview.component.html',
+ styleUrls: ['./pipeline-overview.component.scss']
+})
+export class PipelineOverviewComponent implements OnInit {
+
+ _pipelines: Array<Pipeline>;
+ _activeCategoryId: string;
+
+ filteredPipelinesAvailable: boolean = false;
+
+ @Output()
+ refreshPipelinesEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
+
+ displayedColumns: string[] = ['start', 'name', 'lastModified', 'action'];
+
+ dataSource: MatTableDataSource<Pipeline>;
+
+ @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
+ pageSize: number = 1;
+
+ starting: any;
+ stopping: any;
+
+ constructor(public pipelineOperationsService: PipelineOperationsService) {
+ this.starting = false;
+ this.stopping = false;
+ }
+
+ ngOnInit() {
+ this.toggleRunningOperation = this.toggleRunningOperation.bind(this);
+
+ this.pipelines.forEach(pipeline => {
+ if ((pipeline as any).immediateStart) {
+ if (!pipeline.running) {
+ this.pipelineOperationsService.startPipeline(pipeline._id,
this.toggleRunningOperation, this.refreshPipelinesEmitter);
+ }
+ }
+ });
+ }
+
+ toggleRunningOperation(currentOperation) {
+ if (currentOperation === 'starting') {
+ this.starting = !(this.starting);
+ } else {
+ this.stopping = !(this.stopping);
+ }
+ }
+
+ get pipelines() {
+ return this._pipelines;
+ }
+
+ @Input()
+ set pipelines(pipelines: Array<Pipeline>) {
+ this._pipelines = pipelines;
+ this.dataSource = new MatTableDataSource<Pipeline>(this.filterPipelines());
+ this.dataSource.paginator = this.paginator;
+ }
+
+ get activeCategoryId(): string {
+ return this._activeCategoryId;
+ }
+
+ @Input()
+ set activeCategoryId(activeCategoryId: string) {
+ this._activeCategoryId = activeCategoryId;
+ if (this._pipelines) {
+ this.dataSource = new
MatTableDataSource<Pipeline>(this.filterPipelines());
+ }
+ }
+
+ filterPipelines(): Pipeline[] {
+ let filteredPipelines: Pipeline[] = this._pipelines.filter(pipeline =>
!(this._activeCategoryId) || (pipeline.pipelineCategories &&
pipeline.pipelineCategories.some(pc => pc === this.activeCategoryId)));
+ this.filteredPipelinesAvailable = filteredPipelines.length > 0;
+ return filteredPipelines;
+ }
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/delete-pipeline-dialog.tmpl.html
b/ui/src/app/pipelines/dialog/delete-pipeline-dialog.tmpl.html
deleted file mode 100644
index 9f3a0a6..0000000
--- a/ui/src/app/pipelines/dialog/delete-pipeline-dialog.tmpl.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<md-dialog aria-label="Pipeline Status" flex="70" class="colored-frame">
- <form>
- <md-toolbar>
- <div class="md-toolbar-tools">
- <h2>Delete pipeline</h2>
- <span flex></span>
- <md-button class="md-icon-button" ng-click="ctrl.cancel()">
- <md-icon md-svg-icon="navigation:ic_close_24px"
aria-label="Close dialog"></md-icon>
- </md-button>
- </div>
- </md-toolbar>
- <md-dialog-content layout-align="center center" flex="100"
class="md-dialog-content">
- <div ng-if="!ctrl.isInProgress">
- <div flex="100" layout-align="center center" layout="column">
- <b><h4>Do you really want to delete pipeline
{{ctrl.pipeline.name}}?</h4></b>
- <b><h4 ng-if="ctrl.pipeline.running">This pipeline is
still running.</h4></b>
- <b><h5>This operation cannot be undone.</h5></b>
- </div>
-
- <div flex="100" layout-align="center center" layout="column">
- <sp-button ng-if="!ctrl.pipeline.running" sp-button-blue
ng-click="ctrl.deletePipeline()">Delete pipeline</sp-button>
- <sp-button ng-if="ctrl.pipeline.running" sp-button-blue
ng-click="ctrl.stopAndDeletePipeline()">Stop and delete pipeline</sp-button>
- </div>
- </div>
- <div flex="100" layout-align="center center" layout="column"
ng-if="ctrl.isInProgress">
- <div layout="row" layout-sm="column"
layout-align="space-around">
- <md-progress-circular
md-mode="indeterminate"></md-progress-circular>
- </div>
- <b><h4>{{ctrl.currentStatus}}</h4></b>
- </div>
- </md-dialog-content>
- <md-dialog-actions layout="row">
- <sp-button sp-button-gray ng-click="ctrl.hide()">
- Cancel
- </sp-button>
- </md-dialog-actions>
- </form>
-</md-dialog>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.html
b/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.html
new file mode 100644
index 0000000..ab26a9f
--- /dev/null
+++
b/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.html
@@ -0,0 +1,52 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div class="sp-dialog-container">
+ <div class="sp-dialog-content p-15">
+ <div *ngIf="!isInProgress" fxLayout="column">
+ <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column">
+ <b><h4>Do you really want to delete pipeline
{{pipeline.name}}?</h4></b>
+ <b><h4 *ngIf="pipeline.running">This pipeline is still
running.</h4></b>
+ <b><h5>This operation cannot be undone.</h5></b>
+ </div>
+
+ <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column">
+ <button mat-button mat-raised-button color="primary"
*ngIf="!pipeline.running"
+ (click)="deletePipeline()">Delete
+ pipeline
+ </button>
+ <button mat-button mat-raised-button color="primary"
*ngIf="pipeline.running"
+ (click)="stopAndDeletePipeline()">Stop and
+ delete pipeline
+ </button>
+ </div>
+ </div>
+ <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column"
*ngIf="isInProgress">
+ <div fxLayout="row" fxLayoutAlign="space-around">
+ <mat-spinner [mode]="'indeterminate'"></mat-spinner>
+ </div>
+ <b><h4>{{currentStatus}}</h4></b>
+ </div>
+ </div>
+ <mat-divider></mat-divider>
+ <div class="sp-dialog-actions actions-align-right">
+ <button mat-button mat-raised-button class="mat-basic"
(click)="close(false)">
+ Close
+ </button>
+ </div>
+</div>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
b/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.scss
similarity index 68%
copy from
ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
copy to
ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.scss
index dd37aa0..0a776e5 100644
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
+++
b/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.scss
@@ -16,17 +16,4 @@
*
*/
-import {PipelineDetailsController} from "./pipeline-details.controller";
-
-declare const require: any;
-
-export let PipelineDetailsComponent = {
- template: require('./pipeline-details.tmpl.html'),
- bindings: {
- pipelines: "=",
- refreshPipelines: "&",
- activeCategory: "<"
- },
- controller: PipelineDetailsController,
- controllerAs: 'ctrl'
-};
+@import '../../../../scss/sp/sp-dialog.scss';
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/delete-pipeline-dialog.controller.ts
b/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.ts
similarity index 54%
rename from ui/src/app/pipelines/dialog/delete-pipeline-dialog.controller.ts
rename to
ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.ts
index c00433e..d487fa8 100644
--- a/ui/src/app/pipelines/dialog/delete-pipeline-dialog.controller.ts
+++
b/ui/src/app/pipelines/dialog/delete-pipeline/delete-pipeline-dialog.component.ts
@@ -16,55 +16,49 @@
*
*/
-export class DeletePipelineDialogController {
+import {Component, Input} from "@angular/core";
+import {Pipeline} from "../../../core-model/gen/streampipes-model";
+import {PipelineService} from
"../../../platform-services/apis/pipeline.service";
+import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
- $mdDialog: any;
- PipelineOperationsService: any;
+@Component({
+ selector: 'delete-pipeline-dialog',
+ templateUrl: './delete-pipeline-dialog.component.html',
+ styleUrls: ['./delete-pipeline-dialog.component.scss']
+})
+export class DeletePipelineDialogComponent {
- pipeline: any;
- refreshPipelines: any;
- RestApi: any;
+ @Input()
+ pipeline: Pipeline;
- isInProgress: any = false;
+ isInProgress: boolean = false;
currentStatus: any;
- constructor($mdDialog, RestApi, pipeline, refreshPipelines) {
- this.$mdDialog = $mdDialog;
- this.RestApi = RestApi;
- this.pipeline = pipeline;
- this.refreshPipelines = refreshPipelines;
+ constructor(private dialogRef: DialogRef<DeletePipelineDialogComponent>,
+ private pipelineService: PipelineService) {
}
- hide() {
- this.$mdDialog.hide();
- };
-
- cancel() {
- this.$mdDialog.cancel();
+ close(refreshPipelines: boolean) {
+ this.dialogRef.close(refreshPipelines);
};
deletePipeline() {
this.isInProgress = true;
this.currentStatus = "Deleting pipeline...";
- this.RestApi.deleteOwnPipeline(this.pipeline._id)
- .then(data => {
- this.refreshPipelines();
- this.hide();
+ this.pipelineService.deleteOwnPipeline(this.pipeline._id)
+ .subscribe(data => {
+ this.close(true);
});
}
stopAndDeletePipeline() {
this.isInProgress = true;
this.currentStatus = "Stopping pipeline...";
- this.RestApi.stopPipeline(this.pipeline._id)
- .then(data => {
+ this.pipelineService.stopPipeline(this.pipeline._id)
+ .subscribe(data => {
this.deletePipeline();
}, data => {
this.deletePipeline();
});
}
-
-
-}
-
-DeletePipelineDialogController.$inject = ['$mdDialog', 'RestApi', 'pipeline',
'refreshPipelines'];
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/import-pipeline-dialog.tmpl.html
b/ui/src/app/pipelines/dialog/import-pipeline-dialog.tmpl.html
deleted file mode 100644
index 90faeda..0000000
--- a/ui/src/app/pipelines/dialog/import-pipeline-dialog.tmpl.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<md-dialog aria-label="import pipelines" flex="60" class="colored-frame">
- <form>
- <md-toolbar>
- <div class="md-toolbar-tools">
- <h2>Installation</h2>
- <span flex></span>
- <md-button class="md-icon-button" ng-click="ctrl.cancel()">
- <md-icon md-svg-icon="navigation:ic_close_24px"
aria-label="Close dialog"></md-icon>
- </md-button>
- </div>
- </md-toolbar>
- <md-dialog-content class="md-dialog-content">
- <div flex="100">
- <!-- Select element to visualize -->
- <div flex="100" style="margin:5px;width:100%">
- <div ng-if="ctrl.page == 'upload-pipelines'">
- <h4>{{ctrl.pages[0].description}}</h4>
- <sp-button sp-button-blue
ngf-select="ctrl.upload($file)">Upload Pipeline JSON</sp-button>
- </div>
-
- <!-- Select Type -->
- <div ng-if="ctrl.page == 'select-pipelines'">
- <h4>{{ctrl.pages[1].description}}</h4>
- <div ng-repeat="availablePipeline in
ctrl.availablePipelines">
- <md-checkbox
ng-model="availablePipeline.selectedForUpload">
- {{availablePipeline.name}}
- </md-checkbox>
- </div>
- </div>
-
- <!-- Select Scheme -->
- <div ng-if="ctrl.page == 'import-pipelines'">
- <b><h4>{{ctrl.pages[2].description}}</h4></b>
- <md-progress-circular md-mode="indeterminate"
class="md-accent"
-
ng-show="ctrl.importing"></md-progress-circular>
- </div>
-
- </div>
- </div>
- </md-dialog-content>
- <md-divider/>
- <md-dialog-actions layout="row">
- <sp-button sp-button-gray ng-click="ctrl.cancel()">
- Cancel
- </sp-button>
- <sp-button sp-button-gray ng-click="ctrl.back()"
- ng-if="!('upload-pipelines'===ctrl.page)">
- Back
- </sp-button>
- <sp-button id="save-viz-button" ng-click="ctrl.startImport()"
sp-button-blue ng-if="ctrl.page === 'select-pipelines'">
- Import
- </sp-button>
- </md-dialog-actions>
- </form>
-</md-dialog>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.html
b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.html
new file mode 100644
index 0000000..68d73c1
--- /dev/null
+++
b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.html
@@ -0,0 +1,68 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div class="sp-dialog-container">
+ <div class="sp-dialog-content p-15">
+ <div fxFlex="100">
+ <!-- Select element to visualize -->
+ <div fxFlex="100" style="margin:5px;width:100%">
+ <div *ngIf="page == 'upload-pipelines'">
+ <h4>{{pages[0].description}}</h4>
+ <input type="file"
+ id="file"
+ (change)="handleFileInput($event.target.files)">
+<!-- <button mat-button
ngf-select="ctrl.upload($file)">Upload Pipeline JSON</button>-->
+ </div>
+
+ <!-- Select Type -->
+ <div *ngIf="page == 'select-pipelines'">
+ <h4>{{pages[1].description}}</h4>
+ <div *ngFor="let availablePipeline of availablePipelines">
+ <mat-checkbox
(click)="toggleSelectedPipeline(availablePipeline)">
+ {{availablePipeline.name}}
+ </mat-checkbox>
+ </div>
+ </div>
+
+ <!-- Select Scheme -->
+ <div ng-if="page == 'import-pipelines'">
+ <div fxLayout="column" fxLayoutAlign="center center"
*ngIf="importing">
+ <b><h4>{{pages[2].description}}</h4></b>
+ <mat-spinner [mode]="'indeterminate'" class="md-accent"
+ ></mat-spinner>
+ <b><h4>Importing {{selectedPipelines.length}}
{{selectedPipelines.length == 1 ? 'pipeline' : 'pipelines'}}...</h4></b>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ <mat-divider></mat-divider>
+ <div class="sp-dialog-actions actions-align-right">
+ <button mat-button mat-raised-button class="mat-basic"
(click)="close(false)" style="margin-right:10px;">
+ Close
+ </button>
+ <button mat-button mat-raised-button class="mat-basic"
(click)="back()" *ngIf="!('upload-pipelines'===page)"
style="margin-right:10px;">
+ Back
+ </button>
+ <button mat-button mat-raised-button color="primary"
(click)="startImport()"
+ *ngIf="page === 'select-pipelines'">
+ Import
+ </button>
+ </div>
+</div>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss
similarity index 68%
copy from
ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
copy to
ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss
index dd37aa0..0a776e5 100644
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
+++
b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss
@@ -16,17 +16,4 @@
*
*/
-import {PipelineDetailsController} from "./pipeline-details.controller";
-
-declare const require: any;
-
-export let PipelineDetailsComponent = {
- template: require('./pipeline-details.tmpl.html'),
- bindings: {
- pipelines: "=",
- refreshPipelines: "&",
- activeCategory: "<"
- },
- controller: PipelineDetailsController,
- controllerAs: 'ctrl'
-};
+@import '../../../../scss/sp/sp-dialog.scss';
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/import-pipeline-dialog.controller.ts
b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts
similarity index 53%
rename from ui/src/app/pipelines/dialog/import-pipeline-dialog.controller.ts
rename to
ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts
index bfad259..943d8c8 100644
--- a/ui/src/app/pipelines/dialog/import-pipeline-dialog.controller.ts
+++
b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts
@@ -16,25 +16,27 @@
*
*/
-import {RestApi} from "../../services/rest-api.service";
-
-export class ImportPipelineDialogController {
-
- $mdDialog: any;
- PipelineOperationsService: any;
-
- refreshPipelines: any;
- RestApi: RestApi;
+import {Component, OnInit} from "@angular/core";
+import {PipelineService} from
"../../../platform-services/apis/pipeline.service";
+import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
+import {forkJoin} from "rxjs";
+import {Pipeline} from "../../../core-model/gen/streampipes-model";
+
+@Component({
+ selector: 'import-pipeline-dialog',
+ templateUrl: './import-pipeline-dialog.component.html',
+ styleUrls: ['./import-pipeline-dialog.component.scss']
+})
+export class ImportPipelineDialogComponent {
isInProgress: any = false;
currentStatus: any;
page = "upload-pipelines";
- availablePipelines: any[];
- selectedPipelines: any[];
+ availablePipelines: Pipeline[] = [];
+ selectedPipelines: Pipeline[] = [];
importing: boolean = false;
- $q: any;
pages = [{
type: "upload-pipelines",
@@ -50,33 +52,23 @@ export class ImportPipelineDialogController {
description: ""
}];
- constructor($mdDialog, RestApi: RestApi, refreshPipelines, $q) {
- this.$mdDialog = $mdDialog;
- this.RestApi = RestApi;
- this.refreshPipelines = refreshPipelines;
- this.$q = $q;
- }
-
- $onInit() {
-
-
+ constructor(private PipelineService: PipelineService,
+ private DialogRef: DialogRef<ImportPipelineDialogComponent>) {
}
- upload(file) {
+ handleFileInput(files: any) {
+ let file = files[0];
var aReader = new FileReader();
aReader.readAsText(file, "UTF-8");
aReader.onload = evt => {
this.availablePipelines = JSON.parse(aReader.result as string);
+ console.log(this.availablePipelines);
this.page = "select-pipelines";
}
- };
-
- hide() {
- this.$mdDialog.hide();
- };
+ }
- cancel() {
- this.$mdDialog.cancel();
+ close(refreshPipelines: boolean) {
+ this.DialogRef.close(refreshPipelines);
};
back() {
@@ -87,23 +79,32 @@ export class ImportPipelineDialogController {
}
}
+ toggleSelectedPipeline(pipeline: Pipeline) {
+ console.log(pipeline);
+ if (this.selectedPipelines.some(p => p._id = pipeline._id)) {
+ this.selectedPipelines.splice(this.selectedPipelines.findIndex(sp
=> sp._id === pipeline._id), 1);
+ } else {
+ this.selectedPipelines.push(pipeline);
+ }
+ }
+
storePipelines() {
- var promises = [];
- this.selectedPipelines.forEach(pipeline => {
- pipeline._rev = undefined;
- pipeline._id = undefined;
- promises.push(this.RestApi.storePipeline(pipeline));
- });
- this.$q.all(promises).then(result => {
- this.importing = false;
- this.refreshPipelines();
- this.hide();
- });
+ console.log(this.selectedPipelines);
+ var promises = [];
+ this.selectedPipelines.forEach(pipeline => {
+ pipeline._rev = undefined;
+ pipeline._id = undefined;
+ promises.push(this.PipelineService.storePipeline(pipeline));
+ });
+
+ forkJoin(promises).subscribe(results => {
+ this.importing = false;
+ this.close(true);
+ })
}
startImport() {
this.page = 'import-pipelines';
- this.selectedPipelines = this.availablePipelines.filter(p =>
p.selectedForUpload);
this.importing = true;
this.storePipelines();
}
diff --git a/ui/src/app/pipelines/dialog/pipeline-categories-dialog.tmpl.html
b/ui/src/app/pipelines/dialog/pipeline-categories-dialog.tmpl.html
deleted file mode 100644
index 37ecad9..0000000
--- a/ui/src/app/pipelines/dialog/pipeline-categories-dialog.tmpl.html
+++ /dev/null
@@ -1,170 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<md-dialog aria-label="Pipeline Categories" flex="70" class="colored-frame">
- <form>
- <md-toolbar>
- <div class="md-toolbar-tools">
- <h2>Pipeline Categories</h2>
- <span flex></span>
- <md-button class="md-icon-button" ng-click="ctrl.cancel()">
- <md-icon md-svg-icon="navigation:ic_close_24px"
aria-label="Close dialog"></md-icon>
- </md-button>
- </div>
- </md-toolbar>
- <md-dialog-content class="md-dialog-content">
-
- <div ng-repeat="pipelineCategory in ctrl.pipelineCategories">
- <div style="border: 5px;border-color:blue;">
- <md-list-item layout="row" layout-align="start start"
class="md-with-secondary"
- style="padding:5px;margin-bottom:5px;"
class="sp-primary-border-1px">
- <div class="md-list-item-text" flex="80"
layout="column">
- <div flex layout="column">
-
<h4><b>{{pipelineCategory.categoryName}}</b></h4>
-
<h5><i>{{pipelineCategory.categoryDescription}}</i></h5>
- <div
ng-show="ctrl.categoryDetailsVisible[pipelineCategory._id]">
- <div
ng-show="ctrl.addPipelineToCategorySelected[pipelineCategory._id]"
- style="padding:10px;">
- <md-list-item layout="row"
class="md-with-secondary">
- <div class="md-list-item-text"
flex="80" layout="column">
- <md-select
ng-model="pipelineCategory.selectedPipelineId"
- placeholder="Select
Pipeline">
- <md-option
-
ng-repeat="pipeline in ctrl.pipelines | categoryAlreadyInPipelineFilter:
pipelineCategory._id | orderBy:'+name'"
-
value="{{pipeline._id}}">
-
<b>{{pipeline.name}}</b><br/>
- </md-option>
- <md-option
-
ng-repeat="pipeline in ctrl.systemPipelines | categoryAlreadyInPipelineFilter:
pipelineCategory._id | orderBy:'+name'"
-
value="{{pipeline._id}}">
-
<b>{{pipeline.name}}</b><br/>
- </md-option>
- </md-select>
- </div>
- <div class="md-list-item-text"
flex="20" layout="row"
- layout-align="end center">
- <div flex="50" layout="row"
layout-align="center end">
- <md-button
ng-click="ctrl.addPipelineToCategory(pipelineCategory)"
-
class="md-icon-button md-accent">
- <md-icon
md-svg-icon="content:ic_save_24px"
-
aria-label="Save"></md-icon>
- </md-button>
- </div>
- <div flex="50" layout="row"
layout-align="center end">
- <md-button
-
ng-click="ctrl.showAddToCategoryInput(pipelineCategory._id, false)"
-
class="md-icon-button">
- <md-icon
md-svg-icon="content:ic_clear_24px"
-
aria-label="Delete"></md-icon>
- </md-button>
- </div>
- </div>
- </md-list-item>
- </div>
- <div ng-repeat="pipeline in ctrl.pipelines
| pipelineCategoryFilter: pipelineCategory._id | orderBy:'+name'">
- <md-list-item layout="row"
class="md-with-secondary" style="padding-left:10px;">
- <div class="md-list-item-text"
flex="80" layout="column">
- {{pipeline.name}}
- </div>
- <div class="md-list-item-text"
flex="20" layout="column"
- layout-align="end center">
- <md-button
-
ng-click="ctrl.removePipelineFromCategory(pipeline, pipelineCategory._id)"
- class="md-icon-button">
- <md-icon
md-svg-icon="content:ic_remove_circle_outline_24px"
-
aria-label="Delete"></md-icon>
- </md-button>
- </div>
- </md-list-item>
- </div>
- </div>
- </div>
-
- </div>
- <div flex="20" layout="row">
- <div class="md-list-item-text" flex="33"
layout="row" layout-align="center start">
- <md-button class="md-icon-button"
ng-show="categoryDetailsVisible[pipelineCategory._id]"
-
ng-click="ctrl.toggleCategoryDetailsVisibility(pipelineCategory._id)">
- <i class="material-icons"
class="sp-accent">arrow_drop_up</i>
- <md-tooltip md-direction="top">
- Hide Details
- </md-tooltip>
- </md-button>
- <md-button class="md-icon-button"
-
ng-show="!ctrl.categoryDetailsVisible[pipelineCategory._id]"
-
ng-click="ctrl.toggleCategoryDetailsVisibility(pipelineCategory._id)">
- <i class="material-icons"
class="sp-accent">arrow_drop_down</i>
- <md-tooltip md-direction="top">
- Show Details
- </md-tooltip>
- </md-button>
- </div>
- <div class="md-list-item-text" flex="33"
layout="row" layout-align="center start">
- <md-button
ng-click="ctrl.showAddToCategoryInput(pipelineCategory._id, true)"
- class="md-accent md-icon-button">
- <md-icon
md-svg-icon="content:ic_add_circle_outline_24px"
- aria-label="Add
Pipeline"></md-icon>
- <md-tooltip md-direction="top">
- Add Pipeline to Category
- </md-tooltip>
- </md-button>
- </div>
- <div class="md-list-item-text" flex="33"
layout="row" layout-align="center start">
- <md-button
ng-click="ctrl.deletePipelineCategory(pipelineCategory._id)"
- class="md-icon-button">
- <md-icon
md-svg-icon="action:ic_delete_24px" aria-label="Delete"></md-icon>
- <md-tooltip md-direction="top">
- Delete Category
- </md-tooltip>
- </md-button>
- </div>
- </div>
- </md-list-item>
- </div>
- <md-divider/>
- </div>
- <div ng-show="ctrl.addSelected">
- <md-list-item layout="row" class="md-with-secondary">
- <div class="md-list-item-text" flex="20" layout="column">
- <md-input-container><label>Name</label> <input
- type="text"
ng-model="ctrl.newCategory.categoryName">
- </md-input-container>
- </div>
- <div class="md-list-item-text" flex="60" layout="column">
- <md-input-container><label>Description</label> <input
- type="text"
ng-model="ctrl.newCategory.categoryDescription">
- </md-input-container>
- </div>
- <div class="md-list-item-text" flex="20" layout="column">
- <md-button ng-click="ctrl.addPipelineCategory()"
class="md-accent md-icon-button">
- <md-icon md-svg-icon="content:ic_save_24px"
aria-label="Delete"></md-icon>
- </md-button>
- </div>
- </md-list-item>
- </div>
- <div style="margin-top:10px;">
- <sp-button sp-button-blue ng-click="ctrl.showAddInput()">Add
Category</sp-button>
- </div>
- </md-dialog-content>
- <md-dialog-actions layout="row">
- <sp-button sp-button-gray ng-click="ctrl.hide()">
- Close
- </sp-button>
- </md-dialog-actions>
- </form>
-</md-dialog>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.html
b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.html
new file mode 100644
index 0000000..d4d7082
--- /dev/null
+++
b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.html
@@ -0,0 +1,146 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div class="sp-dialog-container">
+ <div class="sp-dialog-content p-15">
+ <div *ngFor="let pipelineCategory of pipelineCategories"
fxLayout="column">
+ <div style="border: 5px;border-color:blue;">
+ <div fxFlex="80" fxLayout="column">
+ <div fxFlex fxLayout="column">
+ <h4><b>{{pipelineCategory.categoryName}}</b></h4>
+
<h5><i>{{pipelineCategory.categoryDescription}}</i></h5>
+ <div
*ngIf="categoryDetailsVisible[pipelineCategory._id]">
+ <div
*ngIf="addPipelineToCategorySelected[pipelineCategory._id]"
+ style="padding:10px;">
+ <div class="md-list-item-text" fxFlex="80"
fxLayout="column">
+ <mat-select
[(ngModel)]="selectedPipelineId"
+ placeholder="Select Pipeline">
+ <mat-option
+ *ngFor="let pipeline of
pipelines | categoryAlreadyInPipelineFilter: pipelineCategory._id"
+ [value]="pipeline._id">
+ <b>{{pipeline.name}}</b><br/>
+ </mat-option>
+ <mat-option
+ *ngFor="let systemPipeline of
systemPipelines | categoryAlreadyInPipelineFilter: pipelineCategory._id"
+ [value]="systemPipeline._id">
+ <b>{{systemPipeline.name}}</b><br/>
+ </mat-option>
+ </mat-select>
+ </div>
+ <div class="md-list-item-text" fxFlex="20"
fxLayout="row"
+ fxLayoutAlign="end center">
+ <div fxFlex="50" fxLayout="row"
fxLayoutAlign="center end">
+ <button mat-button mat-icon-button
+
(click)="addPipelineToCategory(pipelineCategory)"
+ color="primary">
+ <mat-icon>save</mat-icon>
+ </button>
+ </div>
+ <div fxFlex="50" fxLayout="row"
fxLayoutAlign="center end">
+ <button mat-button mat-icon-button
+
(click)="showAddToCategoryInput(pipelineCategory._id, false)"
+ color="primary">
+ <mat-icon>delete</mat-icon>
+ </button>
+ </div>
+ </div>
+ </div>
+ <div *ngFor="let pipeline of pipelines |
pipelineInCategoryFilter: pipelineCategory._id">
+ <div class="md-list-item-text" fxFlex="80"
fxLayout="column">
+ {{pipeline.name}}
+ </div>
+ <div class="md-list-item-text" fxFlex="20"
fxLayout="column"
+ fxLayoutAlign="end center">
+ <button mat-button mat-icon-button
+
(click)="removePipelineFromCategory(pipeline, pipelineCategory._id)"
+ color="primary">
+ <mat-icon>delete</mat-icon>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ <div fxFlex="20" fxLayout="row">
+ <div class="md-list-item-text" fxFlex="33" fxLayout="row"
fxLayoutAlign="center start">
+ <button mat-button mat-icon-button
*ngIf="categoryDetailsVisible[pipelineCategory._id]"
+
(click)="toggleCategoryDetailsVisibility(pipelineCategory._id)"
+ color="primary"
+ matTooltip="Hide Details"
matTooltipPosition="above">
+ <mat-icon>expand_less</mat-icon>
+ </button>
+ <button mat-button mat-icon-button
+
*ngIf="!categoryDetailsVisible[pipelineCategory._id]"
+
(click)="toggleCategoryDetailsVisibility(pipelineCategory._id)"
+ color="primary"
+ matTooltip="Show Details"
matTooltipPosition="above">
+ <mat-icon>expand_more</mat-icon>
+ </button>
+ </div>
+ <div class="md-list-item-text" fxFlex="33" fxLayout="row"
fxLayoutAlign="center start">
+ <button mat-button mat-icon-button
+
(click)="showAddToCategoryInput(pipelineCategory._id, true)"
+ color="primary"
+ matTooltip="Add Pipeline To Category"
matTooltipPosition="above">
+ <mat-icon>add_circle_outline</mat-icon>
+ </button>
+ </div>
+ <div class="md-list-item-text" flex="33" layout="row"
layout-align="center start">
+ <button mat-button mat-icon-button
+
(click)="deletePipelineCategory(pipelineCategory._id)"
+ color="primary"
+ matTooltip="Delete Category"
matTooltipPosition="above">
+ <mat-icon>delete</mat-icon>
+ </button>
+ </div>
+ </div>
+ </div>
+ <mat-divider></mat-divider>
+ </div>
+ <div *ngIf="addSelected">
+ <div class="md-list-item-text" fxFlex="20" fxLayout="column">
+ <mat-form-field>
+ <mat-label>Name</mat-label>
+ <input matInput type="text" [(ngModel)]="newCategoryName">
+ </mat-form-field>
+ </div>
+ <div class="md-list-item-text" fxFlex="60" fxLayout="column">
+ <mat-form-field>
+ <mat-label>Description</mat-label>
+ <input matInput type="text"
[(ngModel)]="newCategoryDescription">
+ </mat-form-field>
+ </div>
+ <div class="md-list-item-text" fxFlex="20" fxLayout="column">
+ <button mat-button mat-icon-button
(click)="addPipelineCategory()" color="primary"
+ class="md-accent md-icon-button">
+ <mat-icon>save</mat-icon>
+ </button>
+ </div>
+ </div>
+ <div style="margin-top:10px;">
+ <button mat-button mat-raised-button color="primary"
(click)="showAddInput()">Add Category</button>
+ </div>
+ </div>
+ <mat-divider></mat-divider>
+ <div class="sp-dialog-actions actions-align-right">
+ <button mat-button mat-raised-button class="mat-basic"
(click)="close()">
+ Close
+ </button>
+ </div>
+</div>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss
similarity index 68%
copy from
ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
copy to
ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss
index dd37aa0..0a776e5 100644
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
+++
b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss
@@ -16,17 +16,4 @@
*
*/
-import {PipelineDetailsController} from "./pipeline-details.controller";
-
-declare const require: any;
-
-export let PipelineDetailsComponent = {
- template: require('./pipeline-details.tmpl.html'),
- bindings: {
- pipelines: "=",
- refreshPipelines: "&",
- activeCategory: "<"
- },
- controller: PipelineDetailsController,
- controllerAs: 'ctrl'
-};
+@import '../../../../scss/sp/sp-dialog.scss';
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/pipeline-categories-dialog.controller.ts
b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts
similarity index 57%
rename from ui/src/app/pipelines/dialog/pipeline-categories-dialog.controller.ts
rename to
ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts
index da05c8a..14ca150 100644
--- a/ui/src/app/pipelines/dialog/pipeline-categories-dialog.controller.ts
+++
b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts
@@ -17,39 +17,52 @@
*/
import * as angular from 'angular';
-import {RestApi} from "../../services/rest-api.service";
+import {Component, Input, OnInit} from "@angular/core";
+import {Pipeline, PipelineCategory} from
"../../../core-model/gen/streampipes-model";
+import {PipelineService} from
"../../../platform-services/apis/pipeline.service";
+import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
+
+@Component({
+ selector: 'pipeline-categories-dialog',
+ templateUrl: './pipeline-categories-dialog.component.html',
+ styleUrls: ['./pipeline-categories-dialog.component.scss']
+})
+export class PipelineCategoriesDialogComponent implements OnInit {
-export class PipelineCategoriesDialogController {
-
- $mdDialog: any;
- RestApi: RestApi;
- newCategory: any;
addSelected: any;
+
addPipelineToCategorySelected: any;
categoryDetailsVisible: any;
- selectedPipelineId: any;
- pipelineCategories: any;
- pipelines: any;
- refreshPipelines: any;
- getPipelineCategories;
- constructor($mdDialog, RestApi: RestApi, getPipelineCategories,
refreshPipelines)
+ selectedPipelineId: string;
+ pipelineCategories: PipelineCategory[];
+
+ newCategoryName: string;
+ newCategoryDescription: string;
+
+ @Input()
+ pipelines: Pipeline[];
+
+ @Input()
+ systemPipelines: Pipeline[];
+
+ //getPipelineCategories;
+
+ constructor(private pipelineService: PipelineService,
+ private dialogRef:
DialogRef<PipelineCategoriesDialogComponent>)
{
- this.$mdDialog = $mdDialog;
- this.RestApi = RestApi;
- this.newCategory = {};
- this.newCategory.categoryName = "";
- this.newCategory.categoryDescription = "";
this.addSelected = false;
this.addPipelineToCategorySelected = [];
this.categoryDetailsVisible = [];
this.selectedPipelineId = "";
- this.getPipelineCategories = getPipelineCategories;
- this.refreshPipelines = refreshPipelines;
+ //this.getPipelineCategories = getPipelineCategories;
+ //this.refreshPipelines = refreshPipelines;
+ }
+
+ ngOnInit() {
this.fetchPipelineCategories();
this.fetchPipelines();
-
}
toggleCategoryDetailsVisibility(categoryId) {
@@ -58,7 +71,8 @@ export class PipelineCategoriesDialogController {
addPipelineToCategory(pipelineCategory) {
- var pipeline = this.findPipeline(pipelineCategory.selectedPipelineId);
+ console.log(pipelineCategory);
+ var pipeline = this.findPipeline(this.selectedPipelineId);
if (pipeline['pipelineCategories'] == undefined)
pipeline['pipelineCategories'] = [];
pipeline['pipelineCategories'].push(pipelineCategory._id);
this.storeUpdatedPipeline(pipeline);
@@ -71,10 +85,10 @@ export class PipelineCategoriesDialogController {
}
storeUpdatedPipeline(pipeline) {
- this.RestApi.updatePipeline(pipeline)
- .then(msg => {
- this.refreshPipelines();
- this.getPipelineCategories();
+ this.pipelineService.updatePipeline(pipeline)
+ .subscribe(msg => {
+ //this.refreshPipelines();
+ //this.getPipelineCategories();
this.fetchPipelineCategories();
});
}
@@ -90,53 +104,47 @@ export class PipelineCategoriesDialogController {
}
addPipelineCategory() {
- this.RestApi.storePipelineCategory(this.newCategory)
- .then(data => {
+ let newCategory: any = {};
+ newCategory.categoryName = this.newCategoryName;
+ newCategory.categoryDescription = this.newCategoryDescription;
+ this.pipelineService.storePipelineCategory(newCategory)
+ .subscribe(data => {
this.fetchPipelineCategories();
- this.getPipelineCategories();
this.addSelected = false;
});
}
fetchPipelineCategories() {
- this.RestApi.getPipelineCategories()
- .then(pipelineCategories => {
- this.pipelineCategories = pipelineCategories.data;
+ this.pipelineService.getPipelineCategories()
+ .subscribe(pipelineCategories => {
+ this.pipelineCategories = pipelineCategories;
});
};
fetchPipelines() {
- this.RestApi.getOwnPipelines().then(pipelines => {
- this.pipelines = pipelines.data;
- })
+
}
showAddToCategoryInput(categoryId, show) {
this.addPipelineToCategorySelected[categoryId] = show;
this.categoryDetailsVisible[categoryId] = true;
+ console.log(this.categoryDetailsVisible);
}
deletePipelineCategory(pipelineId) {
- this.RestApi.deletePipelineCategory(pipelineId)
- .then(data => {
+ this.pipelineService.deletePipelineCategory(pipelineId)
+ .subscribe(data => {
this.fetchPipelineCategories();
- this.getPipelineCategories();
});
}
showAddInput() {
this.addSelected = true;
- this.newCategory.categoryName = "";
- this.newCategory.categoryDescription = "";
+ this.newCategoryName = "";
+ this.newCategoryDescription = "";
}
- hide() {
- this.$mdDialog.hide();
+ close() {
+ this.dialogRef.close();
}
-
- cancel() {
- this.$mdDialog.cancel();
- }
-}
-
-PipelineCategoriesDialogController.$inject = ['$mdDialog', 'RestApi',
'getPipelineCategories', 'refreshPipelines'];
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/pipeline-status-dialog.tmpl.html
b/ui/src/app/pipelines/dialog/pipeline-status-dialog.tmpl.html
deleted file mode 100644
index 973709d..0000000
--- a/ui/src/app/pipelines/dialog/pipeline-status-dialog.tmpl.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<md-dialog aria-label="Pipeline Status" flex="70" class="colored-frame">
- <form>
- <md-toolbar>
- <div class="md-toolbar-tools">
- <h2>Pipeline Status</h2>
- <span flex></span>
- <md-button class="md-icon-button" ng-click="ctrl.cancel()">
- <md-icon md-svg-icon="navigation:ic_close_24px"
aria-label="Close dialog"></md-icon>
- </md-button>
- </div>
- </md-toolbar>
- <md-dialog-content class="md-dialog-content">
- <div>
- <h4>
- <md-icon md-svg-icon="action:ic_done_24px"
aria-label="Action" class="md-accent"
- ng-show="ctrl.data.success"></md-icon>
- <md-icon md-svg-icon="alert:ic_warning_24px"
aria-label="Action" class="md-accent"
- ng-show="!ctrl.data.success"></md-icon>
- {{ctrl.data.title}}
- </h4>
- <md-button ng-click="ctrl.toggleStatusDetailsVisible()"
type="button" class="md-accent">
- <div ng-if="!ctrl.statusDetailsVisible">Show Details</div>
- <div ng-if="ctrl.statusDetailsVisible">Hide Details</div>
- </md-button>
-
- <div ng-if="ctrl.statusDetailsVisible" ng-repeat="msg in
ctrl.data.elementStatus">
- <div flex="100" class="md-whiteframe-z2">
- <div flex layout="column" class="md-padding">
- <div>
- <b>{{msg.elementName}} </b> at URL <b>
{{msg.elementId}}</b>
- <md-icon md-svg-icon="action:ic_done_24px"
aria-label="Action" class="md-accent"
- ng-show="msg.success"></md-icon>
- <md-icon md-svg-icon="alert:ic_warning_24px"
aria-label="Action" class="md-accent"
- ng-show="!msg.success"></md-icon>
- </div>
- <div>
- <div flex layout="column"
ng-show="msg.optionalMessage">
- <b>More Details:</b>
- <div class="md-padding">
- <pre class="language" nag-prism
source="{{msg.optionalMessage}}"
-
style="margin-top:0px;border-radius:0px;max-width:100%;"></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </md-dialog-content>
- <md-dialog-actions layout="row">
- <sp-button sp-button-gray ng-click="ctrl.hide()">
- Close
- </sp-button>
- </md-dialog-actions>
- </form>
-</md-dialog>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
new file mode 100644
index 0000000..2ef39f5
--- /dev/null
+++
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
@@ -0,0 +1,59 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div class="sp-dialog-container">
+ <div class="sp-dialog-content p-15">
+ <div>
+ <div class="success-text" fxLayout="row" fxLayoutAlign="start
center">
+ <mat-icon color="accent"
*ngIf="pipelineOperationStatus.success">done</mat-icon>
+ <mat-icon color="accent"
*ngIf="!pipelineOperationStatus.success">warning</mat-icon>
+ <span> </span>
+ {{pipelineOperationStatus.title}}
+ </div>
+ <button mat-button mat-raised-button
(click)="toggleStatusDetailsVisible()">
+ <div *ngIf="!statusDetailsVisible">Show Details</div>
+ <div *ngIf="statusDetailsVisible">Hide Details</div>
+ </button>
+
+ <div fxLayout="column" *ngIf="statusDetailsVisible">
+ <div fxFlex="100" fxLayout="column" class="md-whiteframe-z2"
*ngFor="let msg of pipelineOperationStatus.elementStatus">
+ <div fxFlex="100" fxLayout="column" class="md-padding">
+ <div>
+ <b>{{msg.elementName}} </b> at URL <b>
{{msg.elementId}}</b>
+ <mat-icon color="accent"
*ngIf="msg.success">done</mat-icon>
+ <mat-icon color="accent"
*ngIf="!msg.success">warning</mat-icon>
+ </div>
+ <div>
+ <div fxFlex="100" fxLayout="column"
*ngIf="msg.optionalMessage">
+ <div class="error-message">
+ {{msg.optionalMessage}}
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <mat-divider></mat-divider>
+ <div class="sp-dialog-actions actions-align-right">
+ <button mat-button mat-raised-button class="mat-basic"
(click)="close()">
+ Close
+ </button>
+ </div>
+</div>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
similarity index 68%
copy from
ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
copy to
ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
index dd37aa0..e11debc 100644
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
+++
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
@@ -16,17 +16,16 @@
*
*/
-import {PipelineDetailsController} from "./pipeline-details.controller";
+@import '../../../../scss/sp/colors';
+@import '../../../../scss/sp/sp-dialog.scss';
-declare const require: any;
+.success-text {
+ font-size:14pt;
+}
-export let PipelineDetailsComponent = {
- template: require('./pipeline-details.tmpl.html'),
- bindings: {
- pipelines: "=",
- refreshPipelines: "&",
- activeCategory: "<"
- },
- controller: PipelineDetailsController,
- controllerAs: 'ctrl'
-};
+.error-message {
+ background-color: black;
+ color: white;
+ padding: 10px;
+ width: 100%;
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/pipeline-status-dialog.controller.ts
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
similarity index 61%
rename from ui/src/app/pipelines/dialog/pipeline-status-dialog.controller.ts
rename to
ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
index c0e5fee..cd5d103 100644
--- a/ui/src/app/pipelines/dialog/pipeline-status-dialog.controller.ts
+++
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
@@ -16,29 +16,32 @@
*
*/
-export class PipelineStatusDialogController {
+import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
+import {PipelineOperationStatus} from
"../../../core-model/gen/streampipes-model";
+import {Component, Input} from "@angular/core";
+
+
+@Component({
+ selector: 'pipeline-status-dialog',
+ templateUrl: './pipeline-status-dialog.component.html',
+ styleUrls: ['./pipeline-status-dialog.component.scss']
+})
+export class PipelineStatusDialogComponent {
- $mdDialog: any;
statusDetailsVisible: any;
- data: any;
- constructor($mdDialog, data) {
- this.$mdDialog = $mdDialog;
+ @Input()
+ pipelineOperationStatus: PipelineOperationStatus;
+
+ constructor(private DialogRef: DialogRef<PipelineStatusDialogComponent>) {
this.statusDetailsVisible = false;
- this.data = data;
}
- hide() {
- this.$mdDialog.hide();
- };
-
- cancel() {
- this.$mdDialog.cancel();
+ close() {
+ this.DialogRef.close();
};
toggleStatusDetailsVisible() {
this.statusDetailsVisible = !(this.statusDetailsVisible);
}
-}
-
-PipelineStatusDialogController.$inject = ['$mdDialog', 'data'];
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/dialog/start-all-pipelines-dialog.tmpl.html
b/ui/src/app/pipelines/dialog/start-all-pipelines-dialog.tmpl.html
deleted file mode 100644
index d189b3d..0000000
--- a/ui/src/app/pipelines/dialog/start-all-pipelines-dialog.tmpl.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<md-dialog aria-label="{{ctrl.pipelineAction}} pipelines" flex="60"
class="colored-frame">
- <form>
- <md-toolbar>
- <div class="md-toolbar-tools">
- <h2>Installation</h2>
- <span flex></span>
- <md-button class="md-icon-button" ng-click="ctrl.cancel()">
- <md-icon md-svg-icon="navigation:ic_close_24px"
aria-label="Close dialog"></md-icon>
- </md-button>
- </div>
- </md-toolbar>
- <md-dialog-content>
- <div flex="100" class="md-dialog-content" style="padding:20px;"
ng-show="ctrl.page == 'preview'">
- <h4>You are about to {{ctrl.action ? 'start' : 'stop'}} the
following pipelines:</h4>
- <div ng-repeat="pipeline in ctrl.pipelinesToModify">
- <h5>{{pipeline.name}}</h5>
- </div>
- <h5><b>Press 'Next' to start the process.</b></h5>
- </div>
- <div flex="100" class="md-dialog-content" style="padding:20px;"
ng-show="ctrl.page == 'installation'">
- <div ng-repeat="status in ctrl.installationStatus">
- <h4>{{ctrl.action ? 'Starting pipeline ' : 'Stopping
pipeline'}} {{status.id+1}} of
- {{ctrl.pipelinesToModify.length}}
({{status.name}})...{{status.status}}</h4>
- </div>
- <div ng-if="ctrl.pipelinesToModify.length == 0">
- <h4>Sorry, there are no pipelines that are currently
{{action ? "idle." : "running."}}</h4>
- </div>
- </div>
- </md-dialog-content>
- <md-dialog-actions layout="row">
- <sp-button sp-button-gray ng-click="ctrl.cancel()">
- Cancel
- </sp-button>
- <sp-button sp-button-blue ng-disabled="ctrl.installationRunning"
ng-click="ctrl.next()">
- {{ctrl.nextButton}}
- </sp-button>
- </md-dialog-actions>
- </form>
-</md-dialog>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html
b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html
new file mode 100644
index 0000000..dddba60
--- /dev/null
+++
b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.html
@@ -0,0 +1,49 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div class="sp-dialog-container">
+ <div class="sp-dialog-content p-15">
+ <div>
+ <div fxFlex="100" class="md-dialog-content" style="padding:20px;"
*ngIf="page == 'preview'">
+ <h4>You are about to {{action ? 'start' : 'stop'}} the
following pipelines:</h4>
+ <div *ngFor="let pipeline of pipelinesToModify">
+ <h5>{{pipeline.name}}</h5>
+ </div>
+ <h5><b>Press 'Next' to start the process.</b></h5>
+ </div>
+ <div fxFlex="100" class="md-dialog-content" style="padding:20px;"
*ngIf="page == 'installation'">
+ <div *ngFor="let status of installationStatus">
+ <h4>{{action ? 'Starting pipeline ' : 'Stopping
pipeline'}} {{status.id + 1}} of
+ {{pipelinesToModify.length}}
({{status.name}})...{{status.status}}</h4>
+ </div>
+ <div *ngIf="pipelinesToModify.length == 0">
+ <h4>Sorry, there are no pipelines that are currently
{{action ? "idle." : "running."}}</h4>
+ </div>
+ </div>
+ </div>
+ </div>
+ <mat-divider></mat-divider>
+ <div class="sp-dialog-actions actions-align-right">
+ <button mat-button mat-raised-button class="mat-basic"
(click)="close(false)" style="margin-right:10px;">
+ Cancel
+ </button>
+ <button mat-button mat-raised-button color="primary"
[disabled]="installationRunning" (click)="next()">
+ {{nextButton}}
+ </button>
+ </div>
+</div>
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.scss
similarity index 68%
copy from
ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
copy to
ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.scss
index dd37aa0..0a776e5 100644
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
+++
b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.scss
@@ -16,17 +16,4 @@
*
*/
-import {PipelineDetailsController} from "./pipeline-details.controller";
-
-declare const require: any;
-
-export let PipelineDetailsComponent = {
- template: require('./pipeline-details.tmpl.html'),
- bindings: {
- pipelines: "=",
- refreshPipelines: "&",
- activeCategory: "<"
- },
- controller: PipelineDetailsController,
- controllerAs: 'ctrl'
-};
+@import '../../../../scss/sp/sp-dialog.scss';
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/dialog/start-all-pipelines-dialog.controller.ts
b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts
similarity index 72%
rename from ui/src/app/pipelines/dialog/start-all-pipelines-dialog.controller.ts
rename to
ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts
index d3c8a56..9e012e0 100644
--- a/ui/src/app/pipelines/dialog/start-all-pipelines-dialog.controller.ts
+++
b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts
@@ -17,39 +17,46 @@
*/
import * as angular from 'angular';
+import {Component, Input, OnInit} from "@angular/core";
+import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
+import {Pipeline} from "../../../core-model/gen/streampipes-model";
+import {PipelineService} from
"../../../platform-services/apis/pipeline.service";
-export class StartAllPipelinesController {
+@Component({
+ selector: 'start-all-pipelines-dialog',
+ templateUrl: './start-all-pipelines-dialog.component.html',
+ styleUrls: ['./start-all-pipelines-dialog.component.scss']
+})
+export class StartAllPipelinesDialogComponent implements OnInit {
- $mdDialog: any;
- RestApi: any;
- pipelines: any;
- activeCategory: any;
- pipelinesToModify: any;
+ @Input()
+ pipelines: Pipeline[];
+
+ @Input()
+ activeCategory: string;
+
+ pipelinesToModify: Pipeline[];
installationStatus: any;
- installationFinished: any;
- page: any;
- nextButton: any;
- installationRunning: any;
- action: any;
- pipeline: any;
- refreshPipelines: any;
-
- constructor($mdDialog, RestApi, pipelines, action, activeCategory,
refreshPipelines) {
- this.$mdDialog = $mdDialog;
- this.RestApi = RestApi;
- this.pipelines = pipelines;
- this.activeCategory = activeCategory;
+ installationFinished: boolean;
+ page: string;
+ nextButton: string;
+ installationRunning: boolean;
+
+ @Input()
+ action: boolean;
+
+
+ constructor(private DialogRef: DialogRef<StartAllPipelinesDialogComponent>,
+ private PipelineService: PipelineService) {
this.pipelinesToModify = [];
this.installationStatus = [];
this.installationFinished = false;
this.page = "preview";
this.nextButton = "Next";
this.installationRunning = false;
- this.action = action;
- this.refreshPipelines = refreshPipelines;
}
- $onInit() {
+ ngOnInit() {
this.getPipelinesToModify();
if (this.pipelinesToModify.length == 0) {
this.nextButton = "Close";
@@ -57,17 +64,13 @@ export class StartAllPipelinesController {
}
}
- hide() {
- this.$mdDialog.hide();
- };
-
- cancel() {
- this.$mdDialog.cancel();
+ close(refreshPipelines: boolean) {
+ this.DialogRef.close(refreshPipelines);
};
next() {
if (this.page == "installation") {
- this.cancel();
+ this.close(true);
} else {
this.page = "installation";
this.initiateInstallation(this.pipelinesToModify[0], 0);
@@ -82,11 +85,11 @@ export class StartAllPipelinesController {
});
}
- hasCategory(pipeline) {
+ hasCategory(pipeline: Pipeline) {
var categoryPresent = false;
- if (this.activeCategory == "") return true;
+ if (!this.activeCategory) return true;
else {
- angular.forEach(this.pipeline.pipelineCategories, category => {
+ angular.forEach(pipeline.pipelineCategories, category => {
if (category == this.activeCategory) {
categoryPresent = true;
}
@@ -106,9 +109,8 @@ export class StartAllPipelinesController {
}
startPipeline(pipeline, index) {
- this.RestApi.startPipeline(pipeline._id)
- .then(msg => {
- let data = msg.data;
+ this.PipelineService.startPipeline(pipeline._id)
+ .subscribe(data => {
if (data.success) {
this.installationStatus[index].status = "success";
} else {
@@ -117,12 +119,11 @@ export class StartAllPipelinesController {
}, data => {
this.installationStatus[index].status = "error";
})
- .then(() => {
+ .add(() => {
if (index < this.pipelinesToModify.length - 1) {
index++;
this.initiateInstallation(this.pipelinesToModify[index],
index);
} else {
- this.refreshPipelines();
this.nextButton = "Close";
this.installationRunning = false;
}
@@ -131,9 +132,8 @@ export class StartAllPipelinesController {
stopPipeline(pipeline, index) {
- this.RestApi.stopPipeline(pipeline._id)
- .then(msg => {
- let data = msg.data;
+ this.PipelineService.stopPipeline(pipeline._id)
+ .subscribe(data => {
if (data.success) {
this.installationStatus[index].status = "success";
} else {
@@ -142,22 +142,14 @@ export class StartAllPipelinesController {
}, data => {
this.installationStatus[index].status = "error";
})
- .then(() => {
+ .add(() => {
if (index < this.pipelinesToModify.length - 1) {
index++;
this.initiateInstallation(this.pipelinesToModify[index],
index);
} else {
- this.refreshPipelines();
this.nextButton = "Close";
this.installationRunning = false;
}
});
}
-}
-
-StartAllPipelinesController.$inject = ['$mdDialog',
- 'RestApi',
- 'pipelines',
- 'action',
- 'activeCategory',
- 'refreshPipelines'];
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/pipeline-category.filter.ts
b/ui/src/app/pipelines/pipeline-category.filter.ts
index 25ee591..9c5e397 100644
--- a/ui/src/app/pipelines/pipeline-category.filter.ts
+++ b/ui/src/app/pipelines/pipeline-category.filter.ts
@@ -16,21 +16,18 @@
*
*/
-import * as angular from 'angular';
+import {Pipe, PipeTransform} from "@angular/core";
+import {Pipeline} from "../core-model/gen/streampipes-model";
-export function PipelineCategoryFilter() {
- return function(pipelines, categoryId) {
- var result = [];
- var showAll = false;
- if (categoryId == "") showAll = true;
- angular.forEach(pipelines, function(pipeline) {
- if (showAll) result.push(pipeline);
- else {
- angular.forEach(pipeline.pipelineCategories,
function(category) {
- if (category == categoryId)
result.push(pipeline);
- })
- }
- })
- return result;
- };
+@Pipe({
+ name: 'pipelineInCategoryFilter',
+ pure: false
+})
+export class PipelineInCategoryPipe implements PipeTransform {
+
+ transform(pipelines: Pipeline[], categoryId: string): any {
+ return pipelines.filter(pipeline => {
+ return pipeline.pipelineCategories &&
pipeline.pipelineCategories.some(pc => pc === categoryId);
+ });
+ }
};
diff --git a/ui/src/app/pipelines/pipelines.component.html
b/ui/src/app/pipelines/pipelines.component.html
new file mode 100644
index 0000000..9fa7300
--- /dev/null
+++ b/ui/src/app/pipelines/pipelines.component.html
@@ -0,0 +1,76 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div fxLayout="column" class="page-container">
+ <div fxLayout="row" class="border"
style="padding:0px;background-color:#f6f6f6;">
+ <div fxFlex="100" style="line-height:24px;border-bottom:1px solid
#ccc">
+ <div fxFlex="100" fxLayout="row">
+ <button mat-button mat-flat-button color="primary"
(click)="showPipelineCategoriesDialog()">Manage Categories</button>
+ <div fxFlex fxLayoutAlign="start center" [attr.id]="'peType'">
+ <mat-tab-group [selectedIndex]="selectedCategoryIndex"
(selectedIndexChange)="setSelectedTab($event)">
+ <mat-tab label="All pipelines"></mat-tab>
+ <mat-tab *ngFor="let category of pipelineCategories"
label="{{category.categoryName}}"></mat-tab>
+ </mat-tab-group>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="fixed-height page-container-padding-inner" fxLayout="column"
fxFlex="100">
+ <div layout="row">
+ <button class="mr-10" mat-button mat-raised-button color="primary"
(click)="startAllPipelines(true)"
+ [disabled]="checkCurrentSelectionStatus(false)">Start
all pipelines
+ </button>
+ <button mat-button mat-raised-button color="primary"
(click)="startAllPipelines(false)"
+ [disabled]="checkCurrentSelectionStatus(true)">Stop all
pipelines
+ </button>
+ </div>
+ <div class="assemblyOptions sp-blue-bg mt-20" style="padding:5px;">
+ <div fxLayout="row" fxLayoutAlign="start center">
+ <h4>My pipelines</h4>
+ <span fxFlex></span>
+ <button mat-button mat-icon-button matTooltip="Export
pipelines" matTooltipPosition="above"
+ (click)="exportPipelines()">
+ <i class="material-icons">
+ cloud_download
+ </i>
+ </button>
+ <button mat-button mat-icon-button matTooltip="Import
pipelines" matTooltipPosition="above"
+ (click)="openImportPipelinesDialog()">
+ <i class="material-icons">
+ cloud_upload
+ </i>
+ </button>
+ </div>
+ </div>
+ <div class="sp-blue-border">
+ <pipeline-overview [activeCategoryId]="activeCategoryId"
[pipelines]="pipelines"
+ (refreshPipelinesEmitter)="refreshPipelines()"
+ *ngIf="pipelines.length > 0"></pipeline-overview>
+ </div>
+ <div style="margin-top:20px;margin-bottom:20px;"></div>
+ <div class="assemblyOptions sp-blue-bg">
+ <h4>System-generated pipelines</h4>
+ </div>
+ <div class="sp-blue-border">
+ <pipeline-overview [activeCategoryId]="activeCategoryId"
[pipelines]="systemPipelines"
+ (refreshPipelinesEmitter)="refreshPipelines()"
+ *ngIf="pipelines.length > 0"></pipeline-overview>
+ </div>
+ </div>
+</div>
+
diff --git
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
b/ui/src/app/pipelines/pipelines.component.scss
similarity index 68%
rename from
ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
rename to ui/src/app/pipelines/pipelines.component.scss
index dd37aa0..31cb972 100644
---
a/ui/src/app/pipelines/components/pipeline-details/pipeline-details.component.ts
+++ b/ui/src/app/pipelines/pipelines.component.scss
@@ -16,17 +16,14 @@
*
*/
-import {PipelineDetailsController} from "./pipeline-details.controller";
+.page-container-padding-inner {
+ margin: 20px;
+}
-declare const require: any;
+.mr-10 {
+ margin-right: 10px;
+}
-export let PipelineDetailsComponent = {
- template: require('./pipeline-details.tmpl.html'),
- bindings: {
- pipelines: "=",
- refreshPipelines: "&",
- activeCategory: "<"
- },
- controller: PipelineDetailsController,
- controllerAs: 'ctrl'
-};
+.mt-20 {
+ margin-top: 20px;
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/pipelines.component.ts
b/ui/src/app/pipelines/pipelines.component.ts
new file mode 100644
index 0000000..39690d3
--- /dev/null
+++ b/ui/src/app/pipelines/pipelines.component.ts
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import * as angular from 'angular';
+import * as FileSaver from 'file-saver';
+import {Component, OnInit} from "@angular/core";
+import {PipelineService} from "../platform-services/apis/pipeline.service";
+import {Pipeline, PipelineCategory} from '../core-model/gen/streampipes-model';
+import {DialogService} from
"../core-ui/dialog/base-dialog/base-dialog.service";
+import {PanelType} from "../core-ui/dialog/base-dialog/base-dialog.model";
+import {ImportPipelineDialogComponent} from
"./dialog/import-pipeline/import-pipeline-dialog.component";
+import {DialogRef} from "../core-ui/dialog/base-dialog/dialog-ref";
+import {StartAllPipelinesDialogComponent} from
"./dialog/start-all-pipelines/start-all-pipelines-dialog.component";
+import {PipelineCategoriesDialogComponent} from
"./dialog/pipeline-categories/pipeline-categories-dialog.component";
+
+declare const jsPlumb: any;
+declare const require: any;
+
+@Component({
+ selector: 'pipelines',
+ templateUrl: './pipelines.component.html',
+ styleUrls: ['./pipelines.component.scss']
+})
+export class PipelinesComponent implements OnInit {
+
+ RestApi: any;
+ $mdDialog: any;
+ $state: any;
+ $timeout: any;
+ $stateParams: any;
+ ImageChecker: any;
+ ElementIconText: any;
+ pipeline: Pipeline;
+ pipelines: Array<Pipeline> = [];
+ systemPipelines: Array<Pipeline> = [];
+ pipelinShowing: any;
+ pipelinePlumb: any;
+ starting: any;
+ stopping: any;
+ pipelineCategories: Array<PipelineCategory>;
+ activeCategoryId: string;
+ startPipelineDirectly: any;
+
+ selectedCategoryIndex: number = 0;
+
+ constructor(private pipelineService: PipelineService,
+ private DialogService: DialogService) {
+ this.pipelineCategories = [];
+ this.starting = false;
+ this.stopping = false;
+ // this.startPipelineDirectly = $stateParams.pipeline;
+
+ }
+
+ ngOnInit() {
+ this.getPipelineCategories();
+ this.getPipelines();
+ this.getSystemPipelines();
+ }
+
+ setSelectedTab(index) {
+ if (index == 0) {
+ this.activeCategoryId = undefined;
+ } else {
+ this.activeCategoryId = this.pipelineCategories[index - 1]._id;
+ }
+ }
+
+ exportPipelines() {
+ let blob = new Blob([JSON.stringify(this.pipelines)], {type:
"application/json"})
+ FileSaver.saveAs(blob, "pipelines.json");
+ }
+
+
+ getPipelines() {
+ this.pipelines = [];
+ this.pipelineService.getOwnPipelines()
+ .subscribe(pipelines => {
+ this.pipelines = pipelines;
+ if (this.startPipelineDirectly != "") {
+ this.pipelines.forEach(pipeline => {
+ if (pipeline._id == this.startPipelineDirectly) {
+ (pipeline as any).immediateStart = true;
+ }
+ });
+ this.startPipelineDirectly = "";
+ }
+ });
+
+ };
+
+ getSystemPipelines() {
+ this.systemPipelines = [];
+ this.pipelineService.getSystemPipelines()
+ .subscribe(pipelines => {
+ this.systemPipelines = pipelines;
+ });
+ }
+
+ getPipelineCategories() {
+ this.pipelineService.getPipelineCategories()
+ .subscribe(pipelineCategories => {
+ this.pipelineCategories = pipelineCategories;
+ });
+ };
+
+ isTextIconShown(element) {
+ return element.iconUrl == null || element.iconUrl ==
'http://localhost:8080/img' || typeof element.iconUrl === 'undefined';
+
+ };
+
+ activeClass(pipeline) {
+ return 'active-pipeline';
+ }
+
+ checkCurrentSelectionStatus(status) {
+ var active = true;
+ angular.forEach(this.pipelines, pipeline => {
+ if (!this.activeCategoryId || pipeline.pipelineCategories.some(pc
=> pc === this.activeCategoryId)) {
+ if (pipeline.running == status) {
+ active = false;
+ }
+ }
+ });
+
+ return active;
+ }
+
+ openImportPipelinesDialog() {
+ let dialogRef: DialogRef<ImportPipelineDialogComponent> =
this.DialogService.open(ImportPipelineDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: "Import Pipeline",
+ width: "70vw",
+ data: {
+ "pipelines": this.pipelines
+ }
+ });
+ dialogRef.afterClosed().subscribe(data => {
+ if (data) {
+ this.refreshPipelines();
+ }
+ })
+ }
+
+ startAllPipelines(action) {
+ let dialogRef: DialogRef<StartAllPipelinesDialogComponent> =
this.DialogService.open(StartAllPipelinesDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: (action ? "Start" : "Stop") + " all pipelines",
+ width: "70vw",
+ data: {
+ "pipelines": this.pipelines,
+ "action": action,
+ "activeCategoryId": this.activeCategoryId
+ }
+ });
+
+ dialogRef.afterClosed().subscribe(data => {
+ if (data) {
+ this.refreshPipelines();
+ }
+ });
+ }
+
+ showPipelineCategoriesDialog() {
+ let dialogRef: DialogRef<PipelineCategoriesDialogComponent> =
this.DialogService.open(PipelineCategoriesDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: "Pipeline Categories",
+ width: "70vw",
+ data: {
+ "pipelines": this.pipelines,
+ "systemPipelines": this.systemPipelines
+ }
+ });
+
+ dialogRef.afterClosed().subscribe(data => {
+ this.getPipelineCategories();
+ this.refreshPipelines();
+ });
+ };
+
+ refreshPipelines() {
+ this.getPipelines();
+ this.getSystemPipelines();
+ }
+
+
+ showPipeline(pipeline) {
+ pipeline.display = !pipeline.display;
+ }
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/pipelines.controller.ts
b/ui/src/app/pipelines/pipelines.controller.ts
deleted file mode 100644
index e38f8e2..0000000
--- a/ui/src/app/pipelines/pipelines.controller.ts
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import * as angular from 'angular';
-import * as FileSaver from 'file-saver';
-import {StartAllPipelinesController} from
'./dialog/start-all-pipelines-dialog.controller';
-import {PipelineCategoriesDialogController} from
'./dialog/pipeline-categories-dialog.controller';
-import {ElementIconText} from "../services/get-element-icon-text.service";
-import {ImportPipelineDialogController} from
"./dialog/import-pipeline-dialog.controller";
-
-declare const jsPlumb: any;
-declare const require: any;
-
-export class PipelineCtrl {
-
- RestApi: any;
- $mdDialog: any;
- $state: any;
- $timeout: any;
- $stateParams: any;
- ImageChecker: any;
- ElementIconText: any;
- pipeline: any;
- pipelines: any;
- systemPipelines: any;
- pipelinShowing: any;
- pipelinePlumb: any;
- starting: any;
- stopping: any;
- pipelineCategories: any;
- activeCategory: any;
- startPipelineDirectly: any;
-
-
- constructor(RestApi, $mdDialog, $state, $timeout, $stateParams,
ImageChecker, ElementIconText) {
- this.RestApi = RestApi;
- this.$mdDialog = $mdDialog;
- this.$state = $state;
- this.$timeout = $timeout;
- this.$stateParams = $stateParams;
- this.ImageChecker = ImageChecker;
- this.ElementIconText = ElementIconText;
-
- this.pipeline = {};
- this.pipelines = [];
- this.systemPipelines = [];
- this.pipelinShowing = false;
- this.pipelinePlumb = jsPlumb.getInstance({Container:
"pipelineDisplay"});
- this.starting = false;
- this.stopping = false;
-
- this.pipelineCategories = [];
- this.activeCategory = "";
-
- this.startPipelineDirectly = $stateParams.pipeline;
- }
-
- $onInit() {
- this.getPipelineCategories();
- this.getPipelines();
- this.getSystemPipelines();
- }
-
- $onDestroy() {
- this.pipelinePlumb.deleteEveryEndpoint();
- }
-
- setSelectedTab(categoryId) {
- this.activeCategory = categoryId;
- }
-
- exportPipelines() {
- let blob = new Blob([JSON.stringify(this.pipelines)], {type:
"application/json"})
- FileSaver.saveAs(blob, "pipelines.json");
- }
-
-
- getPipelines() {
- this.pipelines = [];
- this.RestApi.getOwnPipelines()
- .then(pipelines => {
- this.pipelines = pipelines.data;
- if (this.startPipelineDirectly != "") {
- angular.forEach(this.pipelines, pipeline => {
- if (pipeline._id == this.startPipelineDirectly) {
- pipeline.immediateStart = true;
- }
- });
- this.startPipelineDirectly = "";
- }
- });
-
- };
-
- getSystemPipelines() {
- this.systemPipelines = [];
- this.RestApi.getSystemPipelines()
- .then(pipelines => {
- this.systemPipelines = pipelines.data;
- });
- }
-
- getPipelineCategories() {
- this.RestApi.getPipelineCategories()
- .then(pipelineCategories => {
- this.pipelineCategories = pipelineCategories.data;
- });
-
- };
-
- isTextIconShown(element) {
- return element.iconUrl == null || element.iconUrl ==
'http://localhost:8080/img' || typeof element.iconUrl === 'undefined';
-
- };
-
- activeClass(pipeline) {
- return 'active-pipeline';
- }
-
- checkCurrentSelectionStatus(status) {
- var active = true;
- angular.forEach(this.pipelines, pipeline => {
- if (this.activeCategory == "" || pipeline.pipelineCategories ==
this.activeCategory) {
- if (pipeline.running == status) {
- active = false;
- }
- }
- });
-
- return active;
- }
-
- openImportPipelinesDialog() {
- this.$mdDialog.show({
- controller: ImportPipelineDialogController,
- controllerAs: 'ctrl',
- template: require('./dialog/import-pipeline-dialog.tmpl.html'),
- parent: angular.element(document.body),
- clickOutsideToClose: false,
- locals: {
- pipelines: this.pipelines,
- refreshPipelines: () => {
- return this.refreshPipelines();
- }
- },
- bindToController: true
- })
- }
-
- startAllPipelines(action) {
- this.$mdDialog.show({
- controller: StartAllPipelinesController,
- controllerAs: 'ctrl',
- template: require('./dialog/start-all-pipelines-dialog.tmpl.html'),
- parent: angular.element(document.body),
- clickOutsideToClose: false,
- locals: {
- pipelines: this.pipelines,
- action: action,
- activeCategory: this.activeCategory,
- refreshPipelines: () => {
- return this.refreshPipelines();
- }
- },
- bindToController: true
- })
- }
-
- showPipelineCategoriesDialog() {
- this.$mdDialog.show({
- controller: PipelineCategoriesDialogController,
- controllerAs: 'ctrl',
- template: require('./dialog/pipeline-categories-dialog.tmpl.html'),
- parent: angular.element(document.body),
- clickOutsideToClose: true,
- locals: {
- pipelines: this.pipelines,
- getPipelineCategories: () => {
- return this.getPipelineCategories();
- },
- refreshPipelines: () => {
- return this.refreshPipelines();
- }
- },
- bindToController: true
- })
- };
-
- refreshPipelines() {
- this.getPipelines();
- this.getSystemPipelines();
- }
-
-
- showPipeline(pipeline) {
- pipeline.display = !pipeline.display;
- }
-
-
- addImageOrTextIcon($element, json) {
- this.ImageChecker.imageExists(json.properties.iconUrl, function
(exists) {
- if (exists) {
- var $img = $('<img>')
- .attr("src", json.properties.iconUrl)
- .addClass('pipeline-display-element-img');
- $element.append($img);
- } else {
- var $span = $("<span>")
-
.text((<any>ElementIconText).getElementIconText(json.properties.name) || "N/A")
- .addClass("element-text-icon")
- $element.append($span);
- }
- });
- }
-
- elementTextIcon(string) {
- var result = "";
- if (string.length <= 4) {
- result = string;
- } else {
- var words = string.split(" ");
- words.forEach(function (word, i) {
- result += word.charAt(0);
- });
- }
- return result.toUpperCase();
- };
-
-
-}
-
-PipelineCtrl.$inject = ['RestApi', '$mdDialog', '$state', '$timeout',
'$stateParams', 'ImageChecker', 'ElementIconText'];
\ No newline at end of file
diff --git a/ui/src/app/pipelines/pipelines.html
b/ui/src/app/pipelines/pipelines.html
deleted file mode 100644
index 8f6d1e9..0000000
--- a/ui/src/app/pipelines/pipelines.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<div flex class="page-container page-container-padding"
ng-controller="PipelineCtrl as ctrl">
- <div flex="100" layout="row" style="padding:0px;background-color:#f6f6f6;">
- <div flex="none" layout-wrap layout="row" layout-align="start center"
-
style="padding-left:10px;font-size:14px;line-height:24px;border-bottom:1px
solid #ccc">
- <sp-button sp-button-flat
ng-click="ctrl.showPipelineCategoriesDialog()">Manage Categories</sp-button>
- </div>
- <div layout-fill style="line-height:24px;border-bottom:1px solid #ccc">
- <md-tabs md-dynamic-height md-border-bottom>
- <md-tab label="All Pipelines"
md-on-select="ctrl.setSelectedTab('')"></md-tab>
- <md-tab label="{{pipelineCategory.categoryName}}"
-
md-on-select="ctrl.setSelectedTab(pipelineCategory._id)"
- ng-repeat="pipelineCategory in
ctrl.pipelineCategories"></md-tab>
- </md-tabs>
- </div>
-
- </div>
-
- <div class="container-fluid">
- <div>
- <md-content layout-padding>
- <div layout="row">
- <sp-button sp-button-blue
ng-click="ctrl.startAllPipelines(true)"
-
ng-disabled="ctrl.checkCurrentSelectionStatus(false)" type="button">Start all
pipelines
- </sp-button>
- <sp-button sp-button-blue
ng-click="ctrl.startAllPipelines(false)"
-
ng-disabled="ctrl.checkCurrentSelectionStatus(true)" type="button">Stop all
pipelines
- </sp-button>
- </div>
- <md-list>
- <div class="assemblyOptions sp-blue-bg"
style="padding:5px;">
- <div layout="row" layout-align="start center">
- <h4>My pipelines</h4>
- <span flex></span>
- <md-button class="md-icon-button"
ng-click="ctrl.exportPipelines()">
- <i class="material-icons">
- cloud_download
- </i>
- <md-tooltip md-direction="top">
- Export pipelines
- </md-tooltip>
- </md-button>
- <md-button class="md-icon-button"
ng-click="ctrl.openImportPipelinesDialog()">
- <i class="material-icons">
- cloud_upload
- </i>
- <md-tooltip md-direction="top">
- Import pipelines
- </md-tooltip>
- </md-button>
- </div>
- </div>
- <div class="sp-blue-border">
- <pipeline-details
active-category="ctrl.activeCategory" pipelines="ctrl.pipelines"
-
refresh-pipelines="ctrl.refreshPipelines()"
- ng-if="ctrl.pipelines.length >
0"></pipeline-details>
- <div layout="row" layout-align="center center"
ng-if="ctrl.pipelines.length == 0">
- <h5>(no pipelines available)</h5>
- </div>
- </div>
- <div flex="100"
style="margin-top:20px;margin-bottom:20px;">
- </div>
- <div class="assemblyOptions sp-blue-bg">
- <h4>System-generated pipelines</h4>
- </div>
- <div class="sp-blue-border">
- <pipeline-details
active-category="ctrl.activeCategory" pipelines="ctrl.systemPipelines"
-
refresh-pipelines="ctrl.refreshPipelines()"
- ng-if="ctrl.pipelines.length >
0"></pipeline-details>
- <div layout="row" layout-align="center center"
ng-if="ctrl.systemPipelines.length == 0">
- <h5>(no system pipelines available)</h5>
- </div>
- </div>
-
- </md-list>
- </md-content>
- </div>
- </div>
-
-
-</div>
diff --git a/ui/src/app/pipelines/pipelines.module.ts
b/ui/src/app/pipelines/pipelines.module.ts
index 1347cb3..9a63ef8 100644
--- a/ui/src/app/pipelines/pipelines.module.ts
+++ b/ui/src/app/pipelines/pipelines.module.ts
@@ -16,25 +16,77 @@
*
*/
-import * as angular from 'angular';
-
import 'npm/angular-datatables';
import 'npm/angular-sanitize';
-import spServices from '../services/services.module';
-
-import {PipelineCtrl} from './pipelines.controller';
-import {PipelineDetailsComponent} from
'./components/pipeline-details/pipeline-details.component';
-import {PipelineCategoryFilter} from './pipeline-category.filter';
-import {CategoryAlreadyInPipelineFilter} from
'./category-already-in-pipeline.filter';
+import {CategoryAlreadyInPipelinePipe} from
'./category-already-in-pipeline.filter';
import {PipelineOperationsService} from
"./services/pipeline-operations.service";
+import {PipelinesComponent} from "./pipelines.component";
+import {NgModule} from "@angular/core";
+import {FlexLayoutModule} from "@angular/flex-layout";
+import {MatTabsModule} from "@angular/material/tabs";
+import {MatButtonModule} from "@angular/material/button";
+import {CustomMaterialModule} from "../CustomMaterial/custom-material.module";
+import {CommonModule} from "@angular/common";
+import {PipelineOverviewComponent} from
"./components/pipeline-overview/pipeline-overview.component";
+import {PipelineStatusDialogComponent} from
"./dialog/pipeline-status/pipeline-status-dialog.component";
+import {DeletePipelineDialogComponent} from
"./dialog/delete-pipeline/delete-pipeline-dialog.component";
+import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
+import {ImportPipelineDialogComponent} from
"./dialog/import-pipeline/import-pipeline-dialog.component";
+import {StartAllPipelinesDialogComponent} from
"./dialog/start-all-pipelines/start-all-pipelines-dialog.component";
+import {PipelineCategoriesDialogComponent} from
"./dialog/pipeline-categories/pipeline-categories-dialog.component";
+import {FormsModule} from "@angular/forms";
+import {PipelineInCategoryPipe} from "./pipeline-category.filter";
+
+// export default angular.module('sp.pipeline', [spServices, ngFileUpload,
'ngSanitize', 'datatables'])
+// .controller('PipelineCtrl', PipelineCtrl)
+// .component('pipelineDetails', PipelineDetailsComponent)
+// .filter('pipelineCategoryFilter', PipelineCategoryFilter)
+// .filter('categoryAlreadyInPipelineFilter',
CategoryAlreadyInPipelineFilter)
+// .service('PipelineOperationsService', PipelineOperationsService)
+// .name;
+
+@NgModule({
+ imports: [
+ FlexLayoutModule,
+ FormsModule,
+ MatTabsModule,
+ MatButtonModule,
+ CustomMaterialModule,
+ CommonModule,
+ MatProgressSpinnerModule
+ ],
+ declarations: [
+ DeletePipelineDialogComponent,
+ ImportPipelineDialogComponent,
+ PipelinesComponent,
+ PipelineCategoriesDialogComponent,
+ PipelineOverviewComponent,
+ PipelineStatusDialogComponent,
+ StartAllPipelinesDialogComponent,
+ PipelineInCategoryPipe,
+ CategoryAlreadyInPipelinePipe,
+ ],
+ providers: [
+ {
+ provide: '$state',
+ useFactory: ($injector: any) => $injector.get('$state'),
+ deps: ['$injector']
+ },
+ PipelineOperationsService,
+ CategoryAlreadyInPipelinePipe,
+ PipelineInCategoryPipe
+ ],
+ exports: [
+ PipelinesComponent
+ ],
+ entryComponents: [
+ PipelinesComponent
+ ]
+})
+export class PipelinesModule {
-import ngFileUpload from 'ng-file-upload';
+ constructor() {
+ }
-export default angular.module('sp.pipeline', [spServices, ngFileUpload,
'ngSanitize', 'datatables'])
- .controller('PipelineCtrl', PipelineCtrl)
- .component('pipelineDetails', PipelineDetailsComponent)
- .filter('pipelineCategoryFilter', PipelineCategoryFilter)
- .filter('categoryAlreadyInPipelineFilter',
CategoryAlreadyInPipelineFilter)
- .service('PipelineOperationsService', PipelineOperationsService)
- .name;
+}
\ No newline at end of file
diff --git a/ui/src/app/pipelines/services/pipeline-operations.service.ts
b/ui/src/app/pipelines/services/pipeline-operations.service.ts
index e01474e..321d16e 100644
--- a/ui/src/app/pipelines/services/pipeline-operations.service.ts
+++ b/ui/src/app/pipelines/services/pipeline-operations.service.ts
@@ -16,12 +16,15 @@
*
*/
-import * as angular from 'angular';
-import {PipelineStatusDialogController} from
"../dialog/pipeline-status-dialog.controller";
-import {DeletePipelineDialogController} from
"../dialog/delete-pipeline-dialog.controller";
-import {RestApi} from "../../services/rest-api.service";
import {ShepherdService} from "../../services/tour/shepherd.service";
-import {Inject, Injectable} from "@angular/core";
+import {EventEmitter, Inject, Injectable} from "@angular/core";
+import {PipelineService} from "../../platform-services/apis/pipeline.service";
+import {PanelType} from "../../core-ui/dialog/base-dialog/base-dialog.model";
+import {DialogService} from
"../../core-ui/dialog/base-dialog/base-dialog.service";
+import {PipelineStatusDialogComponent} from
"../dialog/pipeline-status/pipeline-status-dialog.component";
+import {Pipeline, PipelineOperationStatus} from
"../../core-model/gen/streampipes-model";
+import {DeletePipelineDialogComponent} from
"../dialog/delete-pipeline/delete-pipeline-dialog.component";
+import {DialogRef} from "../../core-ui/dialog/base-dialog/dialog-ref";
declare const require: any;
@@ -31,81 +34,65 @@ export class PipelineOperationsService {
starting: any;
stopping: any;
- constructor(@Inject('$mdDialog') private $mdDialog,
- @Inject('RestApi') private RestApi: RestApi,
- @Inject('$state') private $state,
- @Inject('ShepherdService') private ShepherdService:
ShepherdService) {
+ constructor(
+ //@Inject('RestApi') private RestApi: RestApi,
+ @Inject('$state') private $state,
+ private ShepherdService: ShepherdService,
+ private PipelineService: PipelineService,
+ private DialogService: DialogService) {
}
- startPipeline(pipelineId, toggleRunningOperation, refreshPipelines) {
+ startPipeline(pipelineId: string,
+ toggleRunningOperation,
+ refreshPipelinesEmitter: EventEmitter<boolean>) {
toggleRunningOperation('starting');
- this.RestApi.startPipeline(pipelineId)
- .then(msg => {
- let data = msg.data;
- this.showDialog(data);
- refreshPipelines();
- toggleRunningOperation('starting');
- if (this.ShepherdService.isTourActive()) {
- this.ShepherdService.trigger("pipeline-started");
- }
- }, error => {
- toggleRunningOperation('starting');
- this.showDialog({
- notifications: [{
- title: "Network Error",
- description: "Please check your Network."
- }]
- });
- });
+ this.PipelineService.startPipeline(pipelineId).subscribe(msg => {
+ refreshPipelinesEmitter.emit(true);
+ if (this.ShepherdService.isTourActive()) {
+ this.ShepherdService.trigger("pipeline-started");
+ }
+ this.showDialog(msg);
+ }, error => {
+ this.showDialog({title: "Network Error", success: false, pipelineId:
undefined, pipelineName: undefined, elementStatus: []})
+ });
};
- stopPipeline(pipelineId, toggleRunningOperation, refreshPipelines) {
+ stopPipeline(pipelineId: string, toggleRunningOperation,
refreshPipelinesEmitter: EventEmitter<boolean>) {
toggleRunningOperation('stopping');
- this.RestApi.stopPipeline(pipelineId)
- .then(msg => {
- let data = msg.data;
- toggleRunningOperation('stopping');
- this.showDialog(data);
- refreshPipelines();
- }, error => {
- toggleRunningOperation('stopping');
- this.showDialog({
- notifications: [{
- title: "Network Error",
- description: "Please check your Network."
- }]
- });
-
- });
+ this.PipelineService.stopPipeline(pipelineId).subscribe(msg => {
+ refreshPipelinesEmitter.emit(true);
+ this.showDialog(msg);
+ }, error => {
+ this.showDialog({title: "Network Error", success: false, pipelineId:
undefined, pipelineName: undefined, elementStatus: []})
+ });
};
- showDeleteDialog(pipeline, refreshPipelines) {
- this.$mdDialog.show({
- controller: DeletePipelineDialogController,
- controllerAs: 'ctrl',
- template: require('../dialog/delete-pipeline-dialog.tmpl.html'),
- parent: angular.element(document.body),
- clickOutsideToClose: false,
- locals: {
- pipeline: pipeline,
- refreshPipelines: refreshPipelines
- },
- bindToController: true
+ showDeleteDialog(pipeline: Pipeline, refreshPipelinesEmitter:
EventEmitter<boolean>) {
+ let dialogRef: DialogRef<DeletePipelineDialogComponent> =
this.DialogService.open(DeletePipelineDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: "Delete Pipeline",
+ width: "70vw",
+ data: {
+ "pipeline": pipeline,
+ }
+ });
+
+ dialogRef.afterClosed().subscribe(data => {
+ if (data) {
+ refreshPipelinesEmitter.emit(true);
+ }
})
};
- showDialog(data) {
- this.$mdDialog.show({
- controller: PipelineStatusDialogController,
- controllerAs: 'ctrl',
- template: require('../dialog/pipeline-status-dialog.tmpl.html'),
- parent: angular.element(document.body),
- clickOutsideToClose: false,
- locals: {
- data: data
- },
- bindToController: true
- })
+ showDialog(data: PipelineOperationStatus) {
+ this.DialogService.open(PipelineStatusDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: "Pipeline Status",
+ width: "70vw",
+ data: {
+ "pipelineOperationStatus": data
+ }
+ });
};
showPipelineInEditor(id) {
@@ -121,8 +108,8 @@ export class PipelineOperationsService {
}
showLogs(id) {
- this.$state.go("streampipes.pipelinelogs", {pipeline: id});
+ //this.$state.go("streampipes.pipelinelogs", {pipeline: id});
}
}
-PipelineOperationsService.$inject = ['$mdDialog', 'RestApi', '$state',
'ShepherdService'];
\ No newline at end of file
+//PipelineOperationsService.$inject = ['$mdDialog', 'RestApi', '$state',
'ShepherdService'];
\ No newline at end of file
diff --git a/ui/src/app/platform-services/apis/pipeline.service.ts
b/ui/src/app/platform-services/apis/pipeline.service.ts
index 0b6bc12..39ce559 100644
--- a/ui/src/app/platform-services/apis/pipeline.service.ts
+++ b/ui/src/app/platform-services/apis/pipeline.service.ts
@@ -20,7 +20,12 @@ import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {PlatformServicesCommons} from "./commons.service";
import {Observable} from "rxjs";
-import {Message, Pipeline} from "../../core-model/gen/streampipes-model";
+import {
+ Message,
+ Pipeline,
+ PipelineCategory,
+ PipelineOperationStatus
+} from "../../core-model/gen/streampipes-model";
import {map} from "rxjs/operators";
@Injectable()
@@ -31,24 +36,29 @@ export class PipelineService {
}
- getPipelineCategories() {
- return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelinecategories");
+ getPipelineCategories(): Observable<PipelineCategory[]> {
+ return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelinecategories")
+ .pipe(map(response => {
+ return (response as any[]).map(p => PipelineCategory.fromData(p));
+ }));
};
- storePipelineCategory(pipelineCategory) {
+ storePipelineCategory(pipelineCategory: PipelineCategory) {
return this.http.post(this.platformServicesCommons.authUserBasePath() +
"/pipelinecategories", pipelineCategory);
};
- deletePipelineCategory(categoryId) {
+ deletePipelineCategory(categoryId: string) {
return this.http.delete(this.platformServicesCommons.authUserBasePath() +
"/pipelinecategories/" + categoryId);
}
- startPipeline(pipelineId) {
- return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelines/" + pipelineId + "/start");
+ startPipeline(pipelineId): Observable<PipelineOperationStatus> {
+ return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelines/" + pipelineId + "/start")
+ .pipe(map(result => PipelineOperationStatus.fromData(result as
PipelineOperationStatus)));
}
- stopPipeline(pipelineId) {
- return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelines/" + pipelineId + "/stop");
+ stopPipeline(pipelineId): Observable<PipelineOperationStatus> {
+ return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelines/" + pipelineId + "/stop")
+ .pipe(map(result => PipelineOperationStatus.fromData(result as
PipelineOperationStatus)));
}
getPipelineById(pipelineId): Observable<Pipeline> {
@@ -81,6 +91,10 @@ export class PipelineService {
}));
};
+ deleteOwnPipeline(pipelineId): Observable<any> {
+ return this.http.delete(this.platformServicesCommons.authUserBasePath() +
"/pipelines/" + pipelineId);
+ }
+
getSystemPipelines(): Observable<Pipeline[]> {
return this.http.get(this.platformServicesCommons.authUserBasePath() +
"/pipelines/system").pipe(map(response => {
return (response as any[]).map(p => Pipeline.fromData(p));