Skip to content

Commit

Permalink
refactor(#3388): Pipelines are now removed from the asset links when …
Browse files Browse the repository at this point in the history
…they are deleted
  • Loading branch information
tenthe committed Jan 2, 2025
1 parent 1a8d6a9 commit a1d7eeb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@
<module>archetypes/streampipes-archetype-extensions-jvm</module>
<module>archetypes/streampipes-archetype-pe-sinks-flink</module>
<module>archetypes/streampipes-archetype-pe-processors-flink</module>
<module>streampipes-asset-model-management</module>
<module>streampipes-client</module>
<module>streampipes-client-api</module>
<module>streampipes-commons</module>
Expand Down Expand Up @@ -872,7 +873,6 @@
<module>streampipes-wrapper-kafka-streams</module>
<module>streampipes-wrapper-siddhi</module>
<module>streampipes-wrapper-standalone</module>
<module>streampipes-asset-model-management</module>
</modules>

<profiles>
Expand Down
5 changes: 5 additions & 0 deletions streampipes-pipeline-management/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<artifactId>streampipes-pipeline-management</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-asset-model-management</artifactId>
<version>0.98.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-commons</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.streampipes.manager.pipeline;

import org.apache.streampipes.assetmodel.management.AssetModelHelper;
import org.apache.streampipes.commons.random.UUIDGenerator;
import org.apache.streampipes.manager.execution.PipelineExecutor;
import org.apache.streampipes.manager.permission.PermissionManager;
Expand All @@ -31,6 +32,10 @@
import org.apache.streampipes.storage.api.IPipelineStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand All @@ -40,6 +45,8 @@

public class PipelineManager {

private static final Logger LOG = LoggerFactory.getLogger(PipelineManager.class);

/**
* Returns all pipelines
*
Expand Down Expand Up @@ -119,6 +126,16 @@ public static void deletePipeline(String pipelineId) {
getPipelineStorage().deleteElementById(pipelineId);
new NotificationsResourceManager().deleteNotificationsForPipeline(pipeline);
}

removePipelineFromAllAssetLinks(pipelineId);
}

private static void removePipelineFromAllAssetLinks(String pipelineId) {
try {
getAssetModelHelper().removeAssetLinkFromAllAssets(pipelineId);
} catch (IOException e) {
LOG.error("Could not remove asset link from pipeline:{} from all assets", pipelineId, e);
}
}

public static List<PipelineOperationStatus> stopAllPipelines(boolean forceStop) {
Expand Down Expand Up @@ -177,4 +194,9 @@ private static IPipelineStorage getPipelineStorage() {
private static IPermissionStorage getPermissionStorage() {
return StorageDispatcher.INSTANCE.getNoSqlStore().getPermissionStorage();
}

private static AssetModelHelper getAssetModelHelper() {
return new AssetModelHelper();
}

}
6 changes: 6 additions & 0 deletions ui/cypress/support/utils/asset/AssetBtns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export class AssetBtns {
});
}

public static pipelineCheckbox(pipelineName: string) {
return cy.dataCy('select-pipeline-checkbox-' + pipelineName, {
timeout: 10000,
});
}

public static updateAssetLinksBtn() {
return cy.dataCy('assets-update-links-button', { timeout: 10000 });
}
Expand Down
4 changes: 4 additions & 0 deletions ui/cypress/support/utils/asset/AssetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export class AssetUtils {
AssetBtns.dataStreamCheckbox(adapterName).click();
}

public static selectPipelineAssetLink(pipelineName: string) {
AssetBtns.pipelineCheckbox(pipelineName).click();
}

public static checkAmountOfAssets(amount: number) {
cy.dataCy('assets-table').should('have.length', amount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@
<mat-checkbox
color="accent"
[checked]="linkSelected(pipeline.elementId)"
[attr.data-cy]="
'select-pipeline-checkbox-' +
pipeline.name.toLowerCase().replaceAll(' ', '_')
"
(change)="
selectLink(
$event.checked,
Expand Down

0 comments on commit a1d7eeb

Please sign in to comment.