This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch remove-pipeline-category-code in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit e47c2176d79ad6d7105efd6f80a629bbefe1941f Author: Dominik Riemer <[email protected]> AuthorDate: Thu Jun 27 13:36:42 2024 +0200 chore: Remove remainings of pipeline category feature --- .../streampipes/model/pipeline/Pipeline.java | 12 ---- .../model/pipeline/PipelineCategory.java | 81 ---------------------- .../streampipes/rest/impl/PipelineCategory.java | 77 -------------------- .../streampipes/rest/impl/PipelineResource.java | 1 - .../streampipes/storage/api/INoSqlStorage.java | 2 - .../storage/api/IPipelineCategoryStorage.java | 33 --------- .../storage/couchdb/CouchDbStorageManager.java | 7 -- .../couchdb/impl/PipelineCategoryStorageImpl.java | 49 ------------- .../src/lib/apis/pipeline.service.ts | 26 +------ .../save-pipeline/save-pipeline.component.ts | 18 +---- .../start-all-pipelines-dialog.component.ts | 22 +----- ui/src/app/pipelines/pipelines.component.ts | 25 +------ 12 files changed, 7 insertions(+), 346 deletions(-) diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java index 7055ca29aa..169ae4174e 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java @@ -42,8 +42,6 @@ public class Pipeline extends ElementComposition { private boolean publicElement; private String createdByUser; - - private List<String> pipelineCategories; private List<String> pipelineNotifications; private PipelineHealthStatus healthStatus; @@ -60,7 +58,6 @@ public class Pipeline extends ElementComposition { super(); this.actions = new ArrayList<>(); this.pipelineNotifications = new ArrayList<>(); - this.pipelineCategories = new ArrayList<>(); } public List<DataSinkInvocation> getActions() { @@ -120,14 +117,6 @@ public class Pipeline extends ElementComposition { this.rev = rev; } - public List<String> getPipelineCategories() { - return pipelineCategories; - } - - public void setPipelineCategories(List<String> pipelineCategories) { - this.pipelineCategories = pipelineCategories; - } - public long getCreatedAt() { return createdAt; } @@ -176,7 +165,6 @@ public class Pipeline extends ElementComposition { pipeline.setStreams(streams); pipeline.setActions(actions); pipeline.setCreatedByUser(createdByUser); - pipeline.setPipelineCategories(pipelineCategories); pipeline.setCreatedAt(createdAt); pipeline.setPipelineId(pipelineId); pipeline.setHealthStatus(healthStatus); 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 deleted file mode 100644 index 95dd7d618a..0000000000 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineCategory.java +++ /dev/null @@ -1,81 +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. - * - */ - -package org.apache.streampipes.model.pipeline; - -import org.apache.streampipes.model.shared.annotation.TsModel; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.gson.annotations.SerializedName; - -@TsModel -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() { - - } - - public PipelineCategory(String categoryName, String categoryDescription) { - super(); - this.categoryName = categoryName; - this.categoryDescription = categoryDescription; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } - - public String getCategoryDescription() { - return categoryDescription; - } - - public void setCategoryDescription(String categoryDescription) { - this.categoryDescription = categoryDescription; - } - - public String getCategoryId() { - return categoryId; - } - - public void setCategoryId(String categoryId) { - this.categoryId = categoryId; - } - - public String getRev() { - return rev; - } - - public void setRev(String rev) { - this.rev = rev; - } - - -} diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java deleted file mode 100644 index 4ef3a6dde8..0000000000 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java +++ /dev/null @@ -1,77 +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. - * - */ - -package org.apache.streampipes.rest.impl; - -import org.apache.streampipes.model.message.Message; -import org.apache.streampipes.model.message.Notifications; -import org.apache.streampipes.rest.core.base.impl.AbstractRestResource; -import org.apache.streampipes.storage.api.IPipelineCategoryStorage; - -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("/api/v2/pipelinecategories") -public class PipelineCategory extends AbstractRestResource { - - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity<List<org.apache.streampipes.model.pipeline.PipelineCategory>> getCategories() { - return ok(getPipelineCategoryStorage() - .getPipelineCategories()); - } - - @PostMapping( - produces = MediaType.APPLICATION_JSON_VALUE, - consumes = MediaType.APPLICATION_JSON_VALUE - ) - public ResponseEntity<? extends Message> addCategory( - @RequestBody org.apache.streampipes.model.pipeline.PipelineCategory pipelineCategory) { - boolean success = getPipelineCategoryStorage() - .addPipelineCategory(pipelineCategory); - if (success) { - return ok(Notifications.success("Category successfully stored. ")); - } else { - return ok(Notifications.error("Could not create category.")); - } - } - - @DeleteMapping(path = "/{categoryId}", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity<? extends Message> removeCategory(@PathVariable("categoryId") String categoryId) { - boolean success = getPipelineCategoryStorage() - .deletePipelineCategory(categoryId); - if (success) { - return ok(Notifications.success("Category successfully deleted. ")); - } else { - return ok(Notifications.error("Could not delete category.")); - } - } - - private IPipelineCategoryStorage getPipelineCategoryStorage() { - return getNoSqlStorage().getPipelineCategoryStorageApi(); - } -} diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java index 4afe07c171..fae5851172 100644 --- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java +++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java @@ -241,7 +241,6 @@ public class PipelineResource extends AbstractAuthGuardedRestResource { storedPipeline.setActions(pipeline.getActions()); } storedPipeline.setCreatedAt(System.currentTimeMillis()); - storedPipeline.setPipelineCategories(pipeline.getPipelineCategories()); storedPipeline.setHealthStatus(pipeline.getHealthStatus()); storedPipeline.setPipelineNotifications(pipeline.getPipelineNotifications()); storedPipeline.setValid(pipeline.isValid()); diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java index 3b704f5eb1..3169a61c69 100644 --- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java +++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java @@ -44,8 +44,6 @@ public interface INoSqlStorage { INotificationStorage getNotificationStorageApi(); - IPipelineCategoryStorage getPipelineCategoryStorageApi(); - IAssetDashboardStorage getAssetDashboardStorage(); CRUDStorage<String, DataLakeMeasure> getDataLakeStorage(); diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineCategoryStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineCategoryStorage.java deleted file mode 100644 index 516de60fbb..0000000000 --- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineCategoryStorage.java +++ /dev/null @@ -1,33 +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. - * - */ - -package org.apache.streampipes.storage.api; - -import org.apache.streampipes.model.pipeline.PipelineCategory; - -import java.util.List; - -public interface IPipelineCategoryStorage { - - List<PipelineCategory> getPipelineCategories(); - - boolean addPipelineCategory(PipelineCategory pipelineCategory); - - boolean deletePipelineCategory(String categoryId); - -} diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java index abdb176262..dca2e03294 100644 --- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java +++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java @@ -37,7 +37,6 @@ import org.apache.streampipes.storage.api.INotificationStorage; import org.apache.streampipes.storage.api.IPasswordRecoveryTokenStorage; import org.apache.streampipes.storage.api.IPermissionStorage; import org.apache.streampipes.storage.api.IPipelineCanvasMetadataStorage; -import org.apache.streampipes.storage.api.IPipelineCategoryStorage; import org.apache.streampipes.storage.api.IPipelineElementConnectionStorage; import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage; import org.apache.streampipes.storage.api.IPipelineElementTemplateStorage; @@ -64,7 +63,6 @@ import org.apache.streampipes.storage.couchdb.impl.NotificationStorageImpl; import org.apache.streampipes.storage.couchdb.impl.PasswordRecoveryTokenImpl; import org.apache.streampipes.storage.couchdb.impl.PermissionStorageImpl; import org.apache.streampipes.storage.couchdb.impl.PipelineCanvasMetadataStorageImpl; -import org.apache.streampipes.storage.couchdb.impl.PipelineCategoryStorageImpl; import org.apache.streampipes.storage.couchdb.impl.PipelineElementDescriptionStorageImpl; import org.apache.streampipes.storage.couchdb.impl.PipelineElementTemplateStorageImpl; import org.apache.streampipes.storage.couchdb.impl.PipelineStorageImpl; @@ -122,11 +120,6 @@ public enum CouchDbStorageManager implements INoSqlStorage { return new NotificationStorageImpl(); } - @Override - public IPipelineCategoryStorage getPipelineCategoryStorageApi() { - return new PipelineCategoryStorageImpl(); - } - @Override public IAssetDashboardStorage getAssetDashboardStorage() { return new AssetDashboardStorageImpl(); diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/PipelineCategoryStorageImpl.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/PipelineCategoryStorageImpl.java deleted file mode 100644 index 30ffc23852..0000000000 --- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/PipelineCategoryStorageImpl.java +++ /dev/null @@ -1,49 +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. - * - */ - -package org.apache.streampipes.storage.couchdb.impl; - -import org.apache.streampipes.model.pipeline.PipelineCategory; -import org.apache.streampipes.storage.api.IPipelineCategoryStorage; -import org.apache.streampipes.storage.couchdb.dao.AbstractDao; -import org.apache.streampipes.storage.couchdb.utils.Utils; - -import java.util.List; - -public class PipelineCategoryStorageImpl extends AbstractDao<PipelineCategory> implements IPipelineCategoryStorage { - - public PipelineCategoryStorageImpl() { - super(Utils::getCouchDbPipelineCategoriesClient, PipelineCategory.class); - } - - @Override - public List<PipelineCategory> getPipelineCategories() { - return findAll(); - } - - @Override - public boolean addPipelineCategory(PipelineCategory pipelineCategory) { - return persist(pipelineCategory).k; - } - - @Override - public boolean deletePipelineCategory(String categoryId) { - return delete(categoryId); - } - -} diff --git a/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts b/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts index 05ff064fb9..d4e084424c 100644 --- a/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts +++ b/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts @@ -23,7 +23,6 @@ import { Observable } from 'rxjs'; import { Message, Pipeline, - PipelineCategory, PipelineElementRecommendationMessage, PipelineModificationMessage, PipelineOperationStatus, @@ -40,30 +39,7 @@ export class PipelineService { private platformServicesCommons: PlatformServicesCommons, ) {} - getPipelineCategories(): Observable<PipelineCategory[]> { - return this.http.get(`${this.apiBasePath}/pipelinecategories`).pipe( - map(response => { - return (response as any[]).map(p => - PipelineCategory.fromData(p), - ); - }), - ); - } - - storePipelineCategory(pipelineCategory: PipelineCategory) { - return this.http.post( - `${this.apiBasePath}/pipelinecategories`, - pipelineCategory, - ); - } - - deletePipelineCategory(categoryId: string) { - return this.http.delete( - `${this.apiBasePath}/pipelinecategories/${categoryId}`, - ); - } - - startPipeline(pipelineId): Observable<PipelineOperationStatus> { + startPipeline(pipelineId: string): Observable<PipelineOperationStatus> { return this.http .get(`${this.apiBasePath}/pipelines/${pipelineId}/start`) .pipe( diff --git a/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts b/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts index 4476366bba..863d9693fc 100644 --- a/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts +++ b/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts @@ -22,8 +22,8 @@ import { Message, Pipeline, PipelineCanvasMetadata, - PipelineService, PipelineCanvasMetadataService, + PipelineService, } from '@streampipes/platform-services'; import { EditorService } from '../../services/editor.service'; import { ShepherdService } from '../../../services/tour/shepherd.service'; @@ -42,8 +42,7 @@ import { IdGeneratorService } from '../../../core-services/id-generator/id-gener styleUrls: ['./save-pipeline.component.scss'], }) export class SavePipelineComponent implements OnInit { - pipelineCategories: any; - startPipelineAfterStorage: any; + startPipelineAfterStorage: boolean; updateMode: any; submitPipelineForm: UntypedFormGroup = new UntypedFormGroup({}); @@ -77,12 +76,10 @@ export class SavePipelineComponent implements OnInit { private shepherdService: ShepherdService, private pipelineCanvasService: PipelineCanvasMetadataService, ) { - this.pipelineCategories = []; this.updateMode = 'update'; } ngOnInit() { - this.getPipelineCategories(); if (this.currentModifiedPipelineId) { this.currentPipelineName = this.pipeline.name; } @@ -129,14 +126,6 @@ export class SavePipelineComponent implements OnInit { this.errorMessage = data; } - getPipelineCategories() { - this.pipelineService - .getPipelineCategories() - .subscribe(pipelineCategories => { - this.pipelineCategories = pipelineCategories; - }); - } - savePipeline(switchTab) { let storageRequest; const updateMode = @@ -174,10 +163,9 @@ export class SavePipelineComponent implements OnInit { updateId(entity: InvocablePipelineElementUnion) { const lastIdIndex = entity.elementId.lastIndexOf(':'); - const newElementId = + entity.elementId = entity.elementId.substring(0, lastIdIndex + 1) + this.idGeneratorService.generate(5); - entity.elementId = newElementId; } storePipelineCanvasMetadata(pipelineId: string, updateMode: boolean) { diff --git a/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts index 229fdee5e5..e92ff7a1d7 100644 --- a/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts +++ b/ui/src/app/pipelines/dialog/start-all-pipelines/start-all-pipelines-dialog.component.ts @@ -29,9 +29,6 @@ export class StartAllPipelinesDialogComponent implements OnInit { @Input() pipelines: Pipeline[]; - @Input() - activeCategory: string; - pipelinesToModify: Pipeline[]; installationStatus: any; installationFinished: boolean; @@ -77,29 +74,12 @@ export class StartAllPipelinesDialogComponent implements OnInit { getPipelinesToModify() { this.pipelines.forEach(pipeline => { - if ( - pipeline.running !== this.action && - this.hasCategory(pipeline) - ) { + if (pipeline.running !== this.action) { this.pipelinesToModify.push(pipeline); } }); } - hasCategory(pipeline: Pipeline) { - let categoryPresent = false; - if (!this.activeCategory) { - return true; - } else { - pipeline.pipelineCategories.forEach(category => { - if (category === this.activeCategory) { - categoryPresent = true; - } - }); - return categoryPresent; - } - } - initiateInstallation(pipeline, index) { this.installationRunning = true; this.installationStatus.push({ diff --git a/ui/src/app/pipelines/pipelines.component.ts b/ui/src/app/pipelines/pipelines.component.ts index aa11020969..77e9710f72 100644 --- a/ui/src/app/pipelines/pipelines.component.ts +++ b/ui/src/app/pipelines/pipelines.component.ts @@ -50,11 +50,8 @@ export class PipelinesComponent implements OnInit, OnDestroy { pipelines: Pipeline[] = []; starting: boolean; stopping: boolean; - pipelineCategories: PipelineCategory[]; - activeCategoryId: string; pipelineIdToStart: string; - pipelineToStart: Pipeline; pipelinesReady = false; @@ -81,7 +78,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { private breadcrumbService: SpBreadcrumbService, private shepherdService: ShepherdService, ) { - this.pipelineCategories = []; this.starting = false; this.stopping = false; } @@ -108,7 +104,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { if (params.startTutorial) { this.startPipelineTour(); } - this.getPipelineCategories(); this.getPipelines(); this.getFunctions(); }); @@ -144,26 +139,11 @@ export class PipelinesComponent implements OnInit, OnDestroy { this.pipelineIdToStart = undefined; } - getPipelineCategories() { - this.pipelineService - .getPipelineCategories() - .subscribe(pipelineCategories => { - this.pipelineCategories = pipelineCategories; - }); - } - checkCurrentSelectionStatus(status) { let active = true; this.pipelines.forEach(pipeline => { - if ( - !this.activeCategoryId || - pipeline.pipelineCategories.some( - pc => pc === this.activeCategoryId, - ) - ) { - if (pipeline.running === status) { - active = false; - } + if (pipeline.running === status) { + active = false; } }); return active; @@ -178,7 +158,6 @@ export class PipelinesComponent implements OnInit, OnDestroy { data: { pipelines: this.pipelines, action: action, - activeCategoryId: this.activeCategoryId, }, });
