This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch 3207-remove-pipeline-element-recommender
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/3207-remove-pipeline-element-recommender by this push:
new 47fad6e803 chore(#3207): Remove pipeline element recommender
47fad6e803 is described below
commit 47fad6e8031f3a734c7e6bbeed31a4874d0d8a50
Author: Dominik Riemer <[email protected]>
AuthorDate: Mon Sep 2 23:22:53 2024 +0200
chore(#3207): Remove pipeline element recommender
---
.../pipeline/PipelineElementRecommendation.java | 17 --
.../PipelineElementRecommendationMessage.java | 13 --
.../manager/matching/ConnectionStorageHandler.java | 70 --------
.../manager/recommender/ElementRecommender.java | 82 +--------
.../manager/setup/CouchDbInstallationStep.java | 28 ---
.../manager/storage/PipelineStorageService.java | 5 +-
.../rest/security/SpPermissionEvaluator.java | 1 -
.../streampipes/storage/api/INoSqlStorage.java | 2 -
.../api/IPipelineElementConnectionStorage.java | 32 ----
.../storage/couchdb/CouchDbStorageManager.java | 7 -
.../couchdb/impl/ConnectionStorageImpl.java | 108 ------------
.../streampipes/storage/couchdb/utils/Utils.java | 4 -
.../src/lib/model/gen/streampipes-model.ts | 10 +-
.../pipeline-element-options.component.html | 27 ---
.../pipeline-element-options.component.ts | 15 --
.../pipeline-element-recommendation.component.html | 51 ------
.../pipeline-element-recommendation.component.scss | 17 --
.../pipeline-element-recommendation.component.ts | 187 ---------------------
ui/src/app/editor/editor.module.ts | 2 -
.../pipeline-element-recommendation.service.ts | 19 ---
ui/src/scss/sp/main.scss | 87 ----------
21 files changed, 6 insertions(+), 778 deletions(-)
diff --git
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendation.java
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendation.java
index ae1d04cfcf..b202ace3e9 100644
---
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendation.java
+++
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendation.java
@@ -23,8 +23,6 @@ public class PipelineElementRecommendation {
private String elementId;
private String name;
private String description;
- private Float weight;
- private Integer count;
public PipelineElementRecommendation() {
@@ -60,19 +58,4 @@ public class PipelineElementRecommendation {
this.description = description;
}
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- this.weight = weight;
- }
-
- public Integer getCount() {
- return count;
- }
-
- public void setCount(Integer count) {
- this.count = count;
- }
}
diff --git
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendationMessage.java
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendationMessage.java
index d57de8b7ca..4823bfe818 100644
---
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendationMessage.java
+++
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementRecommendationMessage.java
@@ -27,13 +27,11 @@ import java.util.List;
public class PipelineElementRecommendationMessage {
private List<PipelineElementRecommendation> possibleElements;
- private List<PipelineElementRecommendation> recommendedElements;
private boolean success;
public PipelineElementRecommendationMessage() {
this.possibleElements = new ArrayList<>();
- this.recommendedElements = new ArrayList<>();
this.success = true;
}
@@ -56,15 +54,4 @@ public class PipelineElementRecommendationMessage {
public void setSuccess(boolean success) {
this.success = success;
}
-
- public List<PipelineElementRecommendation> getRecommendedElements() {
- return recommendedElements;
- }
-
- public void setRecommendedElements(
- List<PipelineElementRecommendation> recommendedElements) {
- this.recommendedElements = recommendedElements;
- }
-
-
}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ConnectionStorageHandler.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ConnectionStorageHandler.java
deleted file mode 100644
index 3eb64c6d5c..0000000000
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ConnectionStorageHandler.java
+++ /dev/null
@@ -1,70 +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.manager.matching;
-
-import org.apache.streampipes.manager.recommender.AllElementsProvider;
-import org.apache.streampipes.model.SpDataStream;
-import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
-import org.apache.streampipes.model.base.NamedStreamPipesEntity;
-import org.apache.streampipes.model.client.connection.Connection;
-import org.apache.streampipes.model.graph.DataProcessorInvocation;
-import org.apache.streampipes.model.graph.DataSinkInvocation;
-import org.apache.streampipes.model.pipeline.Pipeline;
-import org.apache.streampipes.storage.management.StorageDispatcher;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ConnectionStorageHandler {
-
- private AllElementsProvider elementsProvider;
- private Pipeline pipeline;
-
- public ConnectionStorageHandler(Pipeline pipeline) {
- this.pipeline = pipeline;
- this.elementsProvider = new AllElementsProvider(pipeline);
- }
-
- public void storeConnections() {
- List<Connection> connections = new ArrayList<>();
- pipeline.getActions().forEach(sink -> findConnections(sink, connections));
-
- connections.forEach(connection -> StorageDispatcher.INSTANCE
- .getNoSqlStore()
- .getConnectionStorageApi()
- .addConnection(connection));
- }
-
- private void findConnections(NamedStreamPipesEntity target,
- List<Connection> connections) {
- if (target instanceof DataSinkInvocation || target instanceof
DataProcessorInvocation) {
- InvocableStreamPipesEntity pipelineElement =
(InvocableStreamPipesEntity) target;
- pipelineElement.getConnectedTo().forEach(conn -> {
- NamedStreamPipesEntity source =
this.elementsProvider.findElement(conn);
- String sourceId;
- if (source instanceof SpDataStream) {
- sourceId = source.getElementId();
- } else {
- sourceId = ((InvocableStreamPipesEntity) source).getBelongsTo();
- }
- connections.add(new Connection(sourceId, ((InvocableStreamPipesEntity)
target).getBelongsTo()));
- findConnections(source, connections);
- });
- }
- }
-}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
index 6cb0911b27..699f9bddc6 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/recommender/ElementRecommender.java
@@ -23,7 +23,6 @@ import
org.apache.streampipes.manager.matching.PipelineVerificationHandlerV2;
import org.apache.streampipes.manager.matching.v2.StreamMatch;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.base.ConsumableStreamPipesEntity;
-import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
import org.apache.streampipes.model.base.NamedStreamPipesEntity;
import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataSinkDescription;
@@ -33,7 +32,6 @@ import
org.apache.streampipes.model.pipeline.PipelineElementRecommendation;
import
org.apache.streampipes.model.pipeline.PipelineElementRecommendationMessage;
import org.apache.streampipes.model.pipeline.PipelineModification;
import org.apache.streampipes.resource.management.SpResourceManager;
-import org.apache.streampipes.storage.api.INoSqlStorage;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;
@@ -62,81 +60,13 @@ public class ElementRecommender {
public PipelineElementRecommendationMessage findRecommendedElements() throws
NoSuitableSepasAvailableException {
AllElementsProvider elementsProvider = new
AllElementsProvider(this.pipeline);
-
- String rootNodeId;
try {
- rootNodeId = getRootNodeId(elementsProvider);
Optional<SpDataStream> outputStream = getOutputStream(elementsProvider);
outputStream.ifPresent(spDataStream -> validate(spDataStream, getAll()));
} catch (Exception e) {
LOG.warn("Could not find root node or output stream of provided
pipeline");
- return recommendationMessage;
- }
-
- if (recommendationMessage.getPossibleElements().isEmpty()) {
- throw new NoSuitableSepasAvailableException();
- } else {
- recommendationMessage
- .setRecommendedElements(calculateWeights(
- filterOldElements(getNoSqlStorage()
- .getConnectionStorageApi()
- .getRecommendedElements(rootNodeId))));
- return recommendationMessage;
}
- }
-
- private String getRootNodeId(AllElementsProvider elementsProvider) {
- NamedStreamPipesEntity pe =
elementsProvider.findElement(this.baseRecDomId);
- return pe instanceof InvocableStreamPipesEntity ?
((InvocableStreamPipesEntity) pe).getBelongsTo() :
- pe.getElementId();
- }
-
- private List<PipelineElementRecommendation> filterOldElements(
- List<PipelineElementRecommendation> recommendedElements) {
- return recommendedElements
- .stream()
- .filter(r -> getAll()
- .stream()
- .anyMatch(a -> a.getElementId().equals(r.getElementId())))
- .collect(Collectors.toList());
- }
-
- private List<PipelineElementRecommendation> calculateWeights(
- List<PipelineElementRecommendation> recommendedElements) {
- int allConnectionsCount = recommendedElements
- .stream()
- .mapToInt(PipelineElementRecommendation::getCount)
- .sum();
-
- recommendedElements
- .forEach(r -> {
- r.setWeight(getWeight(r.getCount(), allConnectionsCount));
- r.setName(getName(r.getElementId()));
- r.setDescription(getDescription(r.getElementId()));
- });
-
- return recommendedElements;
- }
-
- private String getName(String elementId) {
- return filter(elementId).getName();
- }
-
- private String getDescription(String elementId) {
- return filter(elementId).getDescription();
- }
-
- private NamedStreamPipesEntity filter(String elementId) {
- List<ConsumableStreamPipesEntity> allElements = getAll();
- return allElements
- .stream()
- .filter(a -> a.getElementId().equals(elementId))
- .findFirst()
- .get();
- }
-
- private Float getWeight(Integer count, Integer allConnectionsCount) {
- return ((float) (count)) / allConnectionsCount;
+ return recommendationMessage;
}
private void validate(SpDataStream offer, List<ConsumableStreamPipesEntity>
entities) {
@@ -157,7 +87,7 @@ public class ElementRecommender {
private List<ConsumableStreamPipesEntity> getAllDataProcessors() {
List<String> userObjects = new
SpResourceManager().manageDataProcessors().findAllIdsOnly();
- return getTripleStore()
+ return getNoSqlStore()
.getAllDataProcessors()
.stream()
.filter(e -> userObjects.stream().anyMatch(u ->
u.equals(e.getAppId())))
@@ -168,7 +98,7 @@ public class ElementRecommender {
private List<ConsumableStreamPipesEntity> getAllDataSinks() {
List<String> userObjects = new
SpResourceManager().manageDataSinks().findAllIdsOnly();
- return getTripleStore()
+ return getNoSqlStore()
.getAllDataSinks()
.stream()
.filter(e -> userObjects.stream().anyMatch(u ->
u.equals(e.getAppId())))
@@ -183,14 +113,10 @@ public class ElementRecommender {
return allElements;
}
- private IPipelineElementDescriptionStorage getTripleStore() {
+ private IPipelineElementDescriptionStorage getNoSqlStore() {
return
StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineElementDescriptionStorage();
}
- private INoSqlStorage getNoSqlStorage() {
- return StorageDispatcher.INSTANCE.getNoSqlStore();
- }
-
private Optional<SpDataStream> getOutputStream(AllElementsProvider
elementsProvider) {
NamedStreamPipesEntity entity =
elementsProvider.findElement(this.baseRecDomId);
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java
index 88b03f667c..b010dbae56 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java
@@ -60,7 +60,6 @@ public class CouchDbInstallationStep extends InstallationStep
{
// Set up streampipes internal databases
Utils.getCouchDbUserClient();
Utils.getCouchDbPipelineClient();
- Utils.getCouchDbConnectionClient();
Utils.getCouchDbNotificationClient();
Utils.getCouchDbPipelineCategoriesClient();
@@ -72,7 +71,6 @@ public class CouchDbInstallationStep extends InstallationStep
{
private void createViews() {
addUserView();
- addConnectionView();
addNotificationView();
addPipelineView();
}
@@ -166,30 +164,4 @@ public class CouchDbInstallationStep extends
InstallationStep {
logFailure(PREPARING_USERS_TEXT, e);
}
}
-
- private void addConnectionView() {
- try {
- DesignDocument connectionDocument =
prepareDocument("_design/connection");
- Map<String, MapReduce> views = new HashMap<>();
-
- MapReduce frequentFunction = new MapReduce();
- frequentFunction.setMap("function(doc) { if(doc.from && doc.to) {
emit([doc.from, doc.to] , 1 ); } }");
- frequentFunction.setReduce("function (key, values) { return sum(values);
}");
-
- views.put("frequent", frequentFunction);
-
- connectionDocument.setViews(views);
- Response resp =
Utils.getCouchDbConnectionClient().design().synchronizeWithDb(connectionDocument);
-
- if (resp.getError() != null) {
- logFailure("Preparing database 'connection'...");
- } else {
- logSuccess("Preparing database 'connection'...");
- }
- } catch (Exception e) {
- logFailure("Preparing database 'connection'...", e);
- }
- }
-
-
}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/PipelineStorageService.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/PipelineStorageService.java
index 843164b31a..ebd3d99601 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/PipelineStorageService.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/storage/PipelineStorageService.java
@@ -20,7 +20,6 @@ package org.apache.streampipes.manager.storage;
import org.apache.streampipes.manager.data.PipelineGraph;
import org.apache.streampipes.manager.data.PipelineGraphBuilder;
-import org.apache.streampipes.manager.matching.ConnectionStorageHandler;
import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
import org.apache.streampipes.model.graph.DataProcessorInvocation;
import org.apache.streampipes.model.graph.DataSinkInvocation;
@@ -33,7 +32,7 @@ import java.util.stream.Collectors;
public class PipelineStorageService {
- private Pipeline pipeline;
+ private final Pipeline pipeline;
public PipelineStorageService(Pipeline pipeline) {
this.pipeline = pipeline;
@@ -63,8 +62,6 @@ public class PipelineStorageService {
pipeline.setSepas(sepas);
pipeline.setActions(secs);
-
- new ConnectionStorageHandler(pipeline).storeConnections();
}
private void encryptSecrets(List<InvocableStreamPipesEntity> graphs) {
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
index 62364a9846..1665a9d167 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
@@ -51,7 +51,6 @@ public class SpPermissionEvaluator implements
PermissionEvaluator {
private boolean filterRecommendation(Authentication auth,
PipelineElementRecommendationMessage message) {
Predicate<PipelineElementRecommendation> isForbidden = r ->
!hasPermission(auth, r.getElementId());
- message.getRecommendedElements().removeIf(isForbidden);
message.getPossibleElements().removeIf(isForbidden);
return true;
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 481bdd6871..9e3ab0e444 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
@@ -42,8 +42,6 @@ public interface INoSqlStorage {
IPipelineStorage getPipelineStorageAPI();
- IPipelineElementConnectionStorage getConnectionStorageApi();
-
IUserStorage getUserStorageAPI();
INotificationStorage getNotificationStorageApi();
diff --git
a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementConnectionStorage.java
b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementConnectionStorage.java
deleted file mode 100644
index c3b3c3df51..0000000000
---
a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementConnectionStorage.java
+++ /dev/null
@@ -1,32 +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.client.connection.Connection;
-import org.apache.streampipes.model.pipeline.PipelineElementRecommendation;
-
-import java.util.List;
-
-public interface IPipelineElementConnectionStorage {
-
- void addConnection(Connection connection);
-
- List<PipelineElementRecommendation> getRecommendedElements(String from);
-
-}
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 c368713da7..fde52d165d 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
@@ -38,7 +38,6 @@ import org.apache.streampipes.storage.api.INoSqlStorage;
import org.apache.streampipes.storage.api.INotificationStorage;
import org.apache.streampipes.storage.api.IPermissionStorage;
import org.apache.streampipes.storage.api.IPipelineCanvasMetadataStorage;
-import org.apache.streampipes.storage.api.IPipelineElementConnectionStorage;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
import org.apache.streampipes.storage.api.IPipelineElementTemplateStorage;
import org.apache.streampipes.storage.api.IPipelineStorage;
@@ -46,7 +45,6 @@ import
org.apache.streampipes.storage.api.ISpCoreConfigurationStorage;
import org.apache.streampipes.storage.api.IUserStorage;
import
org.apache.streampipes.storage.couchdb.impl.AdapterDescriptionStorageImpl;
import org.apache.streampipes.storage.couchdb.impl.AdapterInstanceStorageImpl;
-import org.apache.streampipes.storage.couchdb.impl.ConnectionStorageImpl;
import
org.apache.streampipes.storage.couchdb.impl.CoreConfigurationStorageImpl;
import org.apache.streampipes.storage.couchdb.impl.DataProcessorStorageImpl;
import org.apache.streampipes.storage.couchdb.impl.DataSinkStorageImpl;
@@ -102,11 +100,6 @@ public enum CouchDbStorageManager implements INoSqlStorage
{
return new PipelineStorageImpl();
}
- @Override
- public IPipelineElementConnectionStorage getConnectionStorageApi() {
- return new ConnectionStorageImpl();
- }
-
@Override
public IUserStorage getUserStorageAPI() {
return new UserStorage();
diff --git
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
deleted file mode 100644
index 7f98b3746d..0000000000
---
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/ConnectionStorageImpl.java
+++ /dev/null
@@ -1,108 +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.client.connection.Connection;
-import org.apache.streampipes.model.pipeline.PipelineElementRecommendation;
-import org.apache.streampipes.storage.api.IPipelineElementConnectionStorage;
-import org.apache.streampipes.storage.couchdb.dao.AbstractDao;
-import org.apache.streampipes.storage.couchdb.utils.Utils;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import org.apache.http.client.fluent.Request;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-public class ConnectionStorageImpl extends AbstractDao<Connection> implements
- IPipelineElementConnectionStorage {
-
-
- public ConnectionStorageImpl() {
- super(Utils::getCouchDbConnectionClient, Connection.class);
- }
-
- @Override
- public void addConnection(Connection connection) {
- persist(connection);
- }
-
- @Override
- public List<PipelineElementRecommendation> getRecommendedElements(String
from) {
- // doesn't work as required object array is not created by lightcouch
- //List<JsonObject> obj =
dbClient.view("connection/frequent").startKey(from).endKey(from, new Object())
- // .group(true).query(JsonObject.class);
- String query;
- query = buildQuery(from);
- Optional<JsonObject> jsonObjectOpt = getFrequentConnections(query);
- if (jsonObjectOpt.isPresent()) {
- return handleResponse(jsonObjectOpt.get());
- } else {
- return Collections.emptyList();
- }
-
- }
-
- private String buildQuery(String from) {
- String escapedPath = Utils
- .escapePathSegment("startkey=[\"" + from + "\"]&endkey=[\"" + from +
"\", {}]&group=true");
- return couchDbClientSupplier.get().getDBUri() +
"_design/connection/_view/frequent?" + escapedPath;
- }
-
- private List<PipelineElementRecommendation> handleResponse(JsonObject
jsonObject) {
- List<PipelineElementRecommendation> recommendations = new ArrayList<>();
- JsonArray jsonArray = jsonObject.get("rows").getAsJsonArray();
- jsonArray.forEach(resultObj ->
- recommendations.add(makeRecommendation(resultObj)));
- return recommendations;
- }
-
- private PipelineElementRecommendation makeRecommendation(JsonElement
resultObj) {
- PipelineElementRecommendation recommendation = new
PipelineElementRecommendation();
- recommendation.setElementId(resultObj
- .getAsJsonObject()
- .get("key")
- .getAsJsonArray()
- .get(1).getAsString());
-
- recommendation.setCount(resultObj
- .getAsJsonObject()
- .get("value")
- .getAsInt());
-
- return recommendation;
- }
-
- private Optional<JsonObject> getFrequentConnections(String query) {
- try {
- var request = Utils.append(Request.Get(query));
- return Optional.of((JsonObject) new
JsonParser().parse(request.execute().returnContent().asString()));
- } catch (IOException e) {
- e.printStackTrace();
- return Optional.empty();
- }
- }
-
-}
diff --git
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
index 1801df15d8..0e4ece90c5 100644
---
a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
+++
b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Utils.java
@@ -86,10 +86,6 @@ public class Utils {
return getCouchDbGsonClient("pipeline");
}
- public static CouchDbClient getCouchDbConnectionClient() {
- return getCouchDbStandardSerializerClient("connection");
- }
-
public static CouchDbClient getCouchDbUserClient() {
return getCouchDbPrincipalClient(USER_DB_NAME);
}
diff --git
a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
index 6edbaea91e..584a090708 100644
---
a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
+++
b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
@@ -20,7 +20,7 @@
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
-// Generated using typescript-generator version 3.2.1263 on 2024-08-28
16:22:24.
+// Generated using typescript-generator version 3.2.1263 on 2024-09-02
23:09:40.
export class NamedStreamPipesEntity implements Storable {
'@class':
@@ -2614,11 +2614,9 @@ export class PipelineElementMonitoringInfo {
}
export class PipelineElementRecommendation {
- count: number;
description: string;
elementId: string;
name: string;
- weight: number;
static fromData(
data: PipelineElementRecommendation,
@@ -2628,18 +2626,15 @@ export class PipelineElementRecommendation {
return data;
}
const instance = target || new PipelineElementRecommendation();
- instance.count = data.count;
instance.description = data.description;
instance.elementId = data.elementId;
instance.name = data.name;
- instance.weight = data.weight;
return instance;
}
}
export class PipelineElementRecommendationMessage {
possibleElements: PipelineElementRecommendation[];
- recommendedElements: PipelineElementRecommendation[];
success: boolean;
static fromData(
@@ -2653,9 +2648,6 @@ export class PipelineElementRecommendationMessage {
instance.possibleElements = __getCopyArrayFn(
PipelineElementRecommendation.fromData,
)(data.possibleElements);
- instance.recommendedElements = __getCopyArrayFn(
- PipelineElementRecommendation.fromData,
- )(data.recommendedElements);
instance.success = data.success;
return instance;
}
diff --git
a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
index 2951de354d..5f01b2a65f 100644
---
a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
+++
b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
@@ -92,26 +92,6 @@
<i class="material-icons
options-icon-size">account_tree</i>
</button>
</span>
- <span
- class="options-button recommended-button"
- *ngIf="
- pipelineElement.type !== 'action' &&
- recommendationsAvailable &&
- recommendedElements.length > 0
- "
- style="z-index: 10"
- >
- <button
- class="options-icon-button"
- mat-icon-button
- matTooltip="Recommended Elements"
- [matTooltipPosition]="'below'"
- (click)="showRecommendations($event)"
- [disabled]="!recommendationsAvailable"
- >
- <i class="material-icons options-icon-size">add</i>
- </button>
- </span>
<span class="options-button help-button" style="z-index: 10">
<button
class="options-icon-button"
@@ -125,11 +105,4 @@
</span>
</div>
</div>
- <sp-pipeline-element-recommendation
- [rawPipelineModel]="rawPipelineModel"
- [pipelineElementDomId]="pipelineElement.payload.dom"
- [recommendedElements]="recommendedElements"
- [recommendationsShown]="recommendationsShown"
- *ngIf="recommendationsAvailable"
- ></sp-pipeline-element-recommendation>
</div>
diff --git
a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
index 1b77d8958a..2a5e26c2ae 100644
---
a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
+++
b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
@@ -54,8 +54,6 @@ import { JsplumbFactoryService } from
'../../services/jsplumb-factory.service';
export class PipelineElementOptionsComponent implements OnInit, OnDestroy {
recommendationsAvailable: any = false;
possibleElements: PipelineElementUnion[];
- recommendedElements: PipelineElementUnion[];
- recommendationsShown: any = false;
isDataSource: boolean;
@Input()
@@ -101,8 +99,6 @@ export class PipelineElementOptionsComponent implements
OnInit, OnDestroy {
) {
this.recommendationsAvailable = false;
this.possibleElements = [];
- this.recommendedElements = [];
- this.recommendationsShown = false;
this.jsplumbBridge =
this.jsplumbFactoryService.getJsplumbBridge(false);
}
@@ -167,12 +163,6 @@ export class PipelineElementOptionsComponent implements
OnInit, OnDestroy {
result.possibleElements,
),
);
- this.recommendedElements = cloneDeep(
-
this.pipelineElementRecommendationService.populateRecommendedList(
- this.allElements,
- result.recommendedElements,
- ),
- );
this.recommendationsAvailable = true;
}
});
@@ -192,11 +182,6 @@ export class PipelineElementOptionsComponent implements
OnInit, OnDestroy {
dialogRef.afterClosed().subscribe(() => {});
}
- showRecommendations(e) {
- this.recommendationsShown = !this.recommendationsShown;
- e.stopPropagation();
- }
-
isWildcardTopic() {
return (
(this.pipelineElement.payload as SpDataStream).eventGrounding
diff --git
a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.html
b/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.html
deleted file mode 100644
index aab5cdff7c..0000000000
---
a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.html
+++ /dev/null
@@ -1,51 +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
- *ngIf="recommendationsPrepared && recommendedElements.length > 0"
- class="cv-wrapper"
- [ngClass]="recommendationsShown ? 'opened-nav' : ''"
->
- <ul>
- <li
- *ngFor="let recommendedElement of recommendedElements"
- style="z-index: -1"
- [style]="recommendedElement.layoutSettings.skewStyle"
- >
- <a
- [style]="recommendedElement.layoutSettings.unskewStyle"
- [ngClass]="recommendedElement.layoutSettings.type"
- (click)="create(recommendedElement)"
- *ngIf="recommendedElement.name"
- >
- </a>
- <div
- (click)="create(recommendedElement)"
- [style]="recommendedElement.layoutSettings.unskewStyleLabel"
- [ngClass]="recommendedElement.layoutSettings.type"
- >
- <sp-pipeline-element
- [iconSize]="'small'"
- [pipelineElement]="recommendedElement"
- *ngIf="recommendedElement.name"
- >
- </sp-pipeline-element>
- </div>
- </li>
- </ul>
-</div>
diff --git
a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.scss
b/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.scss
deleted file mode 100644
index 13cbc4aacb..0000000000
---
a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.scss
+++ /dev/null
@@ -1,17 +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.
- *
- */
diff --git
a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts
b/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts
deleted file mode 100644
index 92a2752ad7..0000000000
---
a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts
+++ /dev/null
@@ -1,187 +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 { JsplumbService } from '../../services/jsplumb.service';
-import { Component, Input } from '@angular/core';
-import {
- InvocablePipelineElementUnion,
- PipelineElementConfig,
-} from '../../model/editor.model';
-import { DataProcessorInvocation } from '@streampipes/platform-services';
-import { SafeCss } from '../../utils/style-sanitizer';
-
-@Component({
- selector: 'sp-pipeline-element-recommendation',
- templateUrl: './pipeline-element-recommendation.component.html',
- styleUrls: ['./pipeline-element-recommendation.component.scss'],
-})
-export class PipelineElementRecommendationComponent {
- @Input()
- recommendationsShown: boolean;
-
- @Input()
- rawPipelineModel: PipelineElementConfig[];
-
- @Input()
- pipelineElementDomId: string;
-
- _recommendedElements: any;
-
- recommendationsPrepared = false;
-
- constructor(
- private jsplumbService: JsplumbService,
- public safeCss: SafeCss,
- ) {}
-
- prepareStyles(recommendedElements) {
- recommendedElements.forEach((element, index) => {
- this.setLayoutSettings(element, index, recommendedElements);
- });
- }
-
- setLayoutSettings(element, index, recommendedElements) {
- element.layoutSettings = {
- skewStyle: element.name
- ? this.getSkewStyle(index, recommendedElements)
- : { opacity: 0 },
- unskewStyle: this.getUnskewStyle(
- element,
- index,
- recommendedElements,
- ),
- unskewStyleLabel: this.getUnskewStyleLabel(
- index,
- recommendedElements,
- ),
- type:
- element instanceof DataProcessorInvocation ? 'sepa' : 'action',
- };
- }
-
- create(recommendedElement: InvocablePipelineElementUnion) {
- this.recommendationsShown = false;
- this.jsplumbService.createElement(
- this.rawPipelineModel,
- recommendedElement,
- this.pipelineElementDomId,
- );
- }
-
- getUnskewStyle(recommendedElement, index, recommendedElements) {
- const unskew = -this.getSkew(recommendedElements);
- const rotate = -(90 - this.getSkew(recommendedElements) / 2);
-
- return (
- 'transform: skew(' +
- unskew +
- 'deg)' +
- ' rotate(' +
- rotate +
- 'deg)' +
- ' scale(1);' +
- 'background-color: ' +
- this.getBackgroundColor(recommendedElement, index)
- );
- }
-
- getBackgroundColor(recommendedElement, index) {
- let alpha =
- recommendedElement.weight < 0.2
- ? 0.2
- : recommendedElement.weight - 0.2;
- alpha = Math.round(alpha * 10) / 10;
- const rgb =
- recommendedElement instanceof DataProcessorInvocation
- ? this.getSepaColor(index)
- : this.getActionColor(index);
- return 'rgba(' + rgb + ',' + alpha + ')';
- }
-
- getSepaColor(index) {
- return index % 2 === 0 ? '0, 150, 136' : '0, 164, 150';
- }
-
- getActionColor(index) {
- return index % 2 === 0 ? '63, 81, 181' : '79, 101, 230';
- }
-
- getSkewStyle(index, recommendedElements) {
- // transform: rotate(72deg) skew(18deg);
- const skew = this.getSkew(recommendedElements);
- const rotate = (index + 1) * this.getAngle(recommendedElements);
-
- return 'transform: rotate(' + rotate + 'deg) skew(' + skew + 'deg);';
- }
-
- getUnskewStyleLabel(index, recommendedElements) {
- const unskew = -this.getSkew(recommendedElements);
- const rotate = (index + 1) * this.getAngle(recommendedElements);
- const unrotate = -360 + rotate * -1;
-
- return (
- 'transform: skew(' +
- unskew +
- 'deg)' +
- ' rotate(' +
- unrotate +
- 'deg)' +
- ' scale(1);' +
- 'z-index: -1;' +
- 'margin-left: 50%;' +
- 'margin-top: 50%;' +
- 'position: absolute;' +
- 'background: white;' +
- 'height: 50px;' +
- 'width: 50px;' +
- 'font-size: 16px;' +
- 'text-align: center;' +
- 'line-height: 50px;' +
- 'top: 0px;'
- );
- }
-
- getSkew(recommendedElements) {
- return 90 - this.getAngle(recommendedElements);
- }
-
- getAngle(recommendedElements) {
- return 360 / recommendedElements.length;
- }
-
- fillRemainingItems(recommendedElements) {
- if (recommendedElements.length < 6) {
- for (let i = recommendedElements.length; i < 6; i++) {
- const element = { fakeElement: true, weight: 0 };
- recommendedElements.push(element);
- }
- }
- }
-
- get recommendedElements() {
- return this._recommendedElements;
- }
-
- @Input()
- set recommendedElements(recommendedElements: any) {
- this.fillRemainingItems(recommendedElements);
- this.prepareStyles(recommendedElements);
- this._recommendedElements = recommendedElements;
- this.recommendationsPrepared = true;
- }
-}
diff --git a/ui/src/app/editor/editor.module.ts
b/ui/src/app/editor/editor.module.ts
index 8922b4ff6d..85bb98932a 100644
--- a/ui/src/app/editor/editor.module.ts
+++ b/ui/src/app/editor/editor.module.ts
@@ -32,7 +32,6 @@ import { CustomizeComponent } from
'./dialog/customize/customize.component';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { CoreUiModule } from '../core-ui/core-ui.module';
import { SavePipelineComponent } from
'./dialog/save-pipeline/save-pipeline.component';
-import { PipelineElementRecommendationComponent } from
'./components/pipeline-element-recommendation/pipeline-element-recommendation.component';
import { CompatibleElementsComponent } from
'./dialog/compatible-elements/compatible-elements.component';
import { MatListModule } from '@angular/material/list';
import { SafeCss } from './utils/style-sanitizer';
@@ -146,7 +145,6 @@ import { DroppedPipelineElementComponent } from
'./components/pipeline/dropped-p
PipelineElementNameFilterPipe,
PipelineElementOptionsComponent,
PipelineElementPreviewComponent,
- PipelineElementRecommendationComponent,
PipelineElementStatisticsComponent,
PipelineElementStatisticsBadgeComponent,
PipelineElementTypeFilterPipe,
diff --git
a/ui/src/app/editor/services/pipeline-element-recommendation.service.ts
b/ui/src/app/editor/services/pipeline-element-recommendation.service.ts
index 1f9322063c..7246ed5355 100644
--- a/ui/src/app/editor/services/pipeline-element-recommendation.service.ts
+++ b/ui/src/app/editor/services/pipeline-element-recommendation.service.ts
@@ -41,25 +41,6 @@ export class PipelineElementRecommendationService {
return possibleElementConfigs;
}
- populateRecommendedList(allElements, recs) {
- const elementRecommendations: any = [];
- recs.sort((a, b) => {
- return a.count > b.count ? -1 : b.count > a.count ? 1 : 0;
- });
- const maxRecs = recs.length > 7 ? 7 : recs.length;
- for (let i = 0; i < maxRecs; i++) {
- const el = recs[i];
- const elements = this.getPipelineElementContents(
- allElements,
- el.elementId,
- );
- const element = elements[0];
- (element as any).weight = el.weight;
- elementRecommendations.push(element);
- }
- return elementRecommendations;
- }
-
getPipelineElementContents(
allElements: PipelineElementUnion[],
belongsTo: string,
diff --git a/ui/src/scss/sp/main.scss b/ui/src/scss/sp/main.scss
index 338900a90a..767d1d568e 100644
--- a/ui/src/scss/sp/main.scss
+++ b/ui/src/scss/sp/main.scss
@@ -89,99 +89,12 @@ pre[class*='language-'] {
background-color: $sp-color-accent;
}
-.cv-wrapper {
- font-size: 1em;
- width: 320px;
- height: 320px;
- overflow: hidden;
- position: absolute;
- left: -100px;
- top: -100px;
- border-radius: 50%;
- pointer-events: none;
- -webkit-transition: all 0.3s ease;
- -moz-transition: all 0.3s ease;
- transition: all 0.3s ease;
- transform: scale(0.1);
- visibility: hidden;
-}
-
.opened-nav {
/*border-radius: 50%;*/
transform: scale(1);
visibility: visible;
}
-.cv-wrapper li {
- pointer-events: all;
- position: absolute;
- width: 160px;
- height: 160px;
- -webkit-transform-origin: 100% 100%;
- -moz-transform-origin: 100% 100%;
- -ms-transform-origin: 100% 100%;
- transform-origin: 100% 100%;
- overflow: hidden;
- left: 0%;
- top: 0%;
- -webkit-transition: border 0.3s ease;
- -moz-transition: border 0.3s ease;
- transition: border 0.3s ease;
- background: lightgray;
-}
-
-.cv-wrapper li a {
- cursor: pointer;
- pointer-events: all;
- display: block;
- height: 300px;
- width: 300px;
- position: absolute;
- right: -150px;
- bottom: -150px;
- border-radius: 50%;
- text-decoration: none;
- text-align: center;
- -webkit-backface-visibility: hidden;
- -webkit-transition:
- opacity 0.3s,
- color 0.3s;
- -moz-transition:
- opacity 0.3s,
- color 0.3s;
- transition:
- opacity 0.3s,
- color 0.3s;
-}
-
-.cv-wrapper li:nth-child(odd) a.sepa {
- background-color: #009688;
-}
-
-.cv-wrapper li:nth-child(even) a.sepa {
- background-color: #00a496;
-}
-
-.cv-wrapper li:nth-child(odd) a.action {
- background-color: #3f51b5;
-}
-
-.cv-wrapper li:nth-child(even) a.action {
- background-color: #4f65e6;
-}
-
-/* hover style */
-.cv-wrapper li a:hover,
-.cv-wrapper li a:active,
-.cv-wrapper li a:focus {
- background: rgba(255, 255, 255, 0.5) !important;
- border: 2px solid #919191;
-}
-
-.cv-wrapper a:focus {
- position: fixed; /* fix the "displacement" bug in webkit browsers when
using tab key */
-}
-
md-toolbar:not(.md-menu-toolbar) {
background: var(--color-primary);
}