From 95d8648beca909eb67d6f36978b05bb4640bc755 Mon Sep 17 00:00:00 2001 From: Dominik Riemer Date: Tue, 7 May 2024 22:31:59 +0200 Subject: [PATCH] chore(#2822): Remove pipeline export (#2823) --- .../existing-adapters.component.html | 1 - .../category-already-in-pipeline.filter.ts | 35 --- .../import-pipeline-dialog.component.html | 106 ------- .../import-pipeline-dialog.component.scss | 19 -- .../import-pipeline-dialog.component.ts | 115 ------- .../pipeline-categories-dialog.component.html | 289 ------------------ .../pipeline-categories-dialog.component.scss | 19 -- .../pipeline-categories-dialog.component.ts | 149 --------- .../app/pipelines/pipeline-category.filter.ts | 35 --- ui/src/app/pipelines/pipelines.component.html | 35 +-- ui/src/app/pipelines/pipelines.component.ts | 55 ---- ui/src/app/pipelines/pipelines.module.ts | 10 +- 12 files changed, 8 insertions(+), 860 deletions(-) delete mode 100644 ui/src/app/pipelines/category-already-in-pipeline.filter.ts delete mode 100644 ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.html delete mode 100644 ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss delete mode 100644 ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts delete mode 100644 ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.html delete mode 100644 ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss delete mode 100644 ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts delete mode 100644 ui/src/app/pipelines/pipeline-category.filter.ts diff --git a/ui/src/app/connect/components/existing-adapters/existing-adapters.component.html b/ui/src/app/connect/components/existing-adapters/existing-adapters.component.html index 24c8cb8934..ee553983b9 100644 --- a/ui/src/app/connect/components/existing-adapters/existing-adapters.component.html +++ b/ui/src/app/connect/components/existing-adapters/existing-adapters.component.html @@ -61,7 +61,6 @@ fxFlex="100" fxLayout="row" fxLayoutAlign="end center" - style="padding-left: 10px; padding-right: 10px; font-size: 14px" class="page-container-nav" > - - - - diff --git a/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss deleted file mode 100644 index fddade7bf6..0000000000 --- a/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.scss +++ /dev/null @@ -1,19 +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 '../../../../scss/sp/sp-dialog.scss'; diff --git a/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts b/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts deleted file mode 100644 index 2dfd2178f6..0000000000 --- a/ui/src/app/pipelines/dialog/import-pipeline/import-pipeline-dialog.component.ts +++ /dev/null @@ -1,115 +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 { Component } from '@angular/core'; -import { Pipeline, PipelineService } from '@streampipes/platform-services'; -import { DialogRef } from '@streampipes/shared-ui'; -import { forkJoin } from 'rxjs'; - -@Component({ - selector: 'sp-import-pipeline-dialog', - templateUrl: './import-pipeline-dialog.component.html', - styleUrls: ['./import-pipeline-dialog.component.scss'], -}) -export class ImportPipelineDialogComponent { - currentStatus: any; - page = 'upload-pipelines'; - - availablePipelines: Pipeline[] = []; - selectedPipelines: Pipeline[] = []; - - importing = false; - - pages = [ - { - type: 'upload-pipelines', - title: 'Upload', - description: - 'Upload a json file containing the pipelines to import', - }, - { - type: 'select-pipelines', - title: 'Select pipelines', - description: 'Select the pipelines to import', - }, - { - type: 'import-pipelines', - title: 'Import', - description: '', - }, - ]; - - constructor( - private pipelineService: PipelineService, - private dialogRef: DialogRef, - ) {} - - handleFileInput(files: any) { - const file = files[0]; - const 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'; - }; - } - - close(refreshPipelines: boolean) { - this.dialogRef.close(refreshPipelines); - } - - back() { - if (this.page === 'select-pipelines') { - this.page = 'upload-pipelines'; - } else if (this.page === 'import-pipelines') { - this.page = 'select-pipelines'; - } - } - - toggleSelectedPipeline(pipeline: 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() { - const 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.importing = true; - this.storePipelines(); - } -} 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 deleted file mode 100644 index 72cee565ff..0000000000 --- a/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.html +++ /dev/null @@ -1,289 +0,0 @@ - - -
-
-
-
-
-
-

- {{ pipelineCategory.categoryName }} -

-
- {{ pipelineCategory.categoryDescription }} -
-
-
-
- - - {{ pipeline.name }}
-
- - {{ systemPipeline.name }}
-
-
-
-
-
- -
-
- -
-
-
-
-
- {{ pipeline.name }} -
-
- -
-
-
-
-
-
-
- - -
-
- -
-
- -
-
-
- -
-
-
- - Name - - -
-
- - Description - - -
-
- -
-
-
- -
-
- -
- -
-
diff --git a/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss deleted file mode 100644 index fddade7bf6..0000000000 --- a/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.scss +++ /dev/null @@ -1,19 +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 '../../../../scss/sp/sp-dialog.scss'; diff --git a/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts b/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts deleted file mode 100644 index e480e4eccf..0000000000 --- a/ui/src/app/pipelines/dialog/pipeline-categories/pipeline-categories-dialog.component.ts +++ /dev/null @@ -1,149 +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 { Component, Input, OnInit } from '@angular/core'; -import { - Pipeline, - PipelineCategory, - PipelineService, -} from '@streampipes/platform-services'; -import { DialogRef } from '@streampipes/shared-ui'; - -@Component({ - selector: 'sp-pipeline-categories-dialog', - templateUrl: './pipeline-categories-dialog.component.html', - styleUrls: ['./pipeline-categories-dialog.component.scss'], -}) -export class PipelineCategoriesDialogComponent implements OnInit { - addSelected: any; - - addPipelineToCategorySelected: any; - categoryDetailsVisible: any; - - selectedPipelineId: string; - pipelineCategories: PipelineCategory[]; - - newCategoryName: string; - newCategoryDescription: string; - - @Input() - pipelines: Pipeline[]; - - @Input() - systemPipelines: Pipeline[]; - - constructor( - private pipelineService: PipelineService, - private dialogRef: DialogRef, - ) { - this.addSelected = false; - this.addPipelineToCategorySelected = []; - this.categoryDetailsVisible = []; - this.selectedPipelineId = ''; - } - - ngOnInit() { - this.fetchPipelineCategories(); - this.fetchPipelines(); - } - - toggleCategoryDetailsVisibility(categoryId) { - this.categoryDetailsVisible[categoryId] = - !this.categoryDetailsVisible[categoryId]; - } - - addPipelineToCategory(pipelineCategory) { - console.log(pipelineCategory); - const pipeline = this.findPipeline(this.selectedPipelineId); - if (pipeline['pipelineCategories'] === undefined) { - pipeline['pipelineCategories'] = []; - } - pipeline['pipelineCategories'].push(pipelineCategory._id); - this.storeUpdatedPipeline(pipeline); - } - - removePipelineFromCategory(pipeline, categoryId) { - const index = pipeline.pipelineCategories.indexOf(categoryId); - pipeline.pipelineCategories.splice(index, 1); - this.storeUpdatedPipeline(pipeline); - } - - storeUpdatedPipeline(pipeline) { - this.pipelineService.updatePipeline(pipeline).subscribe(msg => { - // this.refreshPipelines(); - // this.getPipelineCategories(); - this.fetchPipelineCategories(); - }); - } - - findPipeline(pipelineId) { - let matchedPipeline = {}; - this.pipelines.forEach(pipeline => { - if (pipeline._id === pipelineId) { - matchedPipeline = pipeline; - } - }); - return matchedPipeline; - } - - addPipelineCategory() { - const newCategory: any = {}; - newCategory.categoryName = this.newCategoryName; - newCategory.categoryDescription = this.newCategoryDescription; - this.pipelineService - .storePipelineCategory(newCategory) - .subscribe(data => { - this.fetchPipelineCategories(); - this.addSelected = false; - }); - } - - fetchPipelineCategories() { - this.pipelineService - .getPipelineCategories() - .subscribe(pipelineCategories => { - this.pipelineCategories = pipelineCategories; - }); - } - - fetchPipelines() {} - - showAddToCategoryInput(categoryId, show) { - this.addPipelineToCategorySelected[categoryId] = show; - this.categoryDetailsVisible[categoryId] = true; - console.log(this.categoryDetailsVisible); - } - - deletePipelineCategory(pipelineId) { - this.pipelineService - .deletePipelineCategory(pipelineId) - .subscribe(data => { - this.fetchPipelineCategories(); - }); - } - - showAddInput() { - this.addSelected = true; - this.newCategoryName = ''; - this.newCategoryDescription = ''; - } - - close() { - this.dialogRef.close(); - } -} diff --git a/ui/src/app/pipelines/pipeline-category.filter.ts b/ui/src/app/pipelines/pipeline-category.filter.ts deleted file mode 100644 index 9ba3aa4811..0000000000 --- a/ui/src/app/pipelines/pipeline-category.filter.ts +++ /dev/null @@ -1,35 +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 { Pipe, PipeTransform } from '@angular/core'; -import { Pipeline } from '@streampipes/platform-services'; - -@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 index f8feda3394..62775062e2 100644 --- a/ui/src/app/pipelines/pipelines.component.html +++ b/ui/src/app/pipelines/pipelines.component.html @@ -57,41 +57,20 @@ - -
diff --git a/ui/src/app/pipelines/pipelines.component.ts b/ui/src/app/pipelines/pipelines.component.ts index e87d8f02f3..aa11020969 100644 --- a/ui/src/app/pipelines/pipelines.component.ts +++ b/ui/src/app/pipelines/pipelines.component.ts @@ -16,7 +16,6 @@ * */ -import * as FileSaver from 'file-saver'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { FunctionId, @@ -32,9 +31,7 @@ import { PanelType, SpBreadcrumbService, } from '@streampipes/shared-ui'; -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 { ActivatedRoute, Router } from '@angular/router'; import { AuthService } from '../services/auth.service'; import { UserPrivilege } from '../_enums/user-privilege.enum'; @@ -51,7 +48,6 @@ import { Subscription } from 'rxjs'; export class PipelinesComponent implements OnInit, OnDestroy { pipeline: Pipeline; pipelines: Pipeline[] = []; - systemPipelines: Pipeline[] = []; starting: boolean; stopping: boolean; pipelineCategories: PipelineCategory[]; @@ -122,18 +118,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { }); } - setSelectedTab(index) { - this.activeCategoryId = - index === 0 ? undefined : this.pipelineCategories[index - 1]._id; - } - - exportPipelines() { - const blob = new Blob([JSON.stringify(this.pipelines)], { - type: 'application/json', - }); - FileSaver.saveAs(blob, 'pipelines.json'); - } - getFunctions() { this.functionsService.getActiveFunctions().subscribe(functions => { this.functions = functions.map(f => f.functionId); @@ -168,10 +152,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { }); } - activeClass(pipeline) { - return 'active-pipeline'; - } - checkCurrentSelectionStatus(status) { let active = true; this.pipelines.forEach(pipeline => { @@ -189,23 +169,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { return active; } - openImportPipelinesDialog() { - const dialogRef: DialogRef = - 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) { const dialogRef: DialogRef = this.dialogService.open(StartAllPipelinesDialogComponent, { @@ -226,24 +189,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { }); } - showPipelineCategoriesDialog() { - const dialogRef: DialogRef = - 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(); } diff --git a/ui/src/app/pipelines/pipelines.module.ts b/ui/src/app/pipelines/pipelines.module.ts index 90161270d1..6d969cd1c7 100644 --- a/ui/src/app/pipelines/pipelines.module.ts +++ b/ui/src/app/pipelines/pipelines.module.ts @@ -16,7 +16,6 @@ * */ -import { CategoryAlreadyInPipelinePipe } from './category-already-in-pipeline.filter'; import { PipelinesComponent } from './pipelines.component'; import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@ngbracket/ngx-layout'; @@ -27,11 +26,8 @@ import { PipelineOverviewComponent } from './components/pipeline-overview/pipeli 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'; import { MatSortModule } from '@angular/material/sort'; import { MatTableModule } from '@angular/material/table'; import { PipelineNotificationsComponent } from './dialog/pipeline-notifications/pipeline-notifications.component'; @@ -130,19 +126,15 @@ import { MatIconModule } from '@angular/material/icon'; declarations: [ DeletePipelineDialogComponent, FunctionsOverviewComponent, - ImportPipelineDialogComponent, PipelinesComponent, - PipelineCategoriesDialogComponent, PipelineNotificationsComponent, PipelineOverviewComponent, PipelineStatusDialogComponent, StartAllPipelinesDialogComponent, - PipelineInCategoryPipe, - CategoryAlreadyInPipelinePipe, SpFunctionsMetricsComponent, SpFunctionsLogsComponent, ], - providers: [CategoryAlreadyInPipelinePipe, PipelineInCategoryPipe], + providers: [], exports: [PipelinesComponent], }) export class PipelinesModule {