-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(#3156): Add asset browser to adapters and pipelines * Move asset browser to shared-ui module * Improve rendering of asset browser * Fix imports * Add header * Improve asset viewer, add migrations * Add headers * Fix checkstyle * Fix creation of asset link types * Fix bugs * feat(#3176): Move adapter preview to details view (#3177) * feat(#3176): Move adapter preview to details view * Modify tests
- Loading branch information
1 parent
22ac222
commit 54b3f3a
Showing
110 changed files
with
3,615 additions
and
872 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...ava/org/apache/streampipes/service/core/migrations/v970/ModifyAssetLinkTypeMigration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* 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.service.core.migrations.v970; | ||
|
||
import org.apache.streampipes.commons.constants.GenericDocTypes; | ||
import org.apache.streampipes.model.assets.AssetLinkType; | ||
import org.apache.streampipes.service.core.migrations.Migration; | ||
import org.apache.streampipes.storage.api.IGenericStorage; | ||
import org.apache.streampipes.storage.management.StorageDispatcher; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.type.CollectionType; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class ModifyAssetLinkTypeMigration implements Migration { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(ModifyAssetLinkTypeMigration.class); | ||
|
||
private final IGenericStorage genericStorage = StorageDispatcher.INSTANCE.getNoSqlStore().getGenericStorage(); | ||
private final ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
public ModifyAssetLinkTypeMigration() { | ||
|
||
} | ||
|
||
@Override | ||
public boolean shouldExecute() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void executeMigration() throws IOException { | ||
getAssetLinkTypes().stream() | ||
.filter(assetLinkType -> switch (assetLinkType.getLinkType()) { | ||
case "data-view", "adapter", "pipeline" -> true; | ||
default -> false; | ||
}) | ||
.forEach(assetLinkType -> { | ||
assetLinkType.setNavPaths(switch (assetLinkType.getLinkType()) { | ||
case "data-view" -> List.of("dataexplorer", "dashboard"); | ||
case "adapter" -> List.of("connect", "details"); | ||
case "pipeline" -> List.of("pipelines", "details"); | ||
default -> throw new IllegalStateException("Unexpected value: " + assetLinkType.getLinkType()); | ||
}); | ||
updateLinkType(assetLinkType); | ||
}); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Modifying navigation targets of asset link types"; | ||
} | ||
|
||
private void updateLinkType(AssetLinkType assetLinkType) { | ||
try { | ||
this.genericStorage.update(assetLinkType.getId(), objectMapper.writeValueAsString(assetLinkType)); | ||
} catch (IOException e) { | ||
LOG.warn("Could not update asset link type {}", assetLinkType, e); | ||
} | ||
} | ||
|
||
private List<AssetLinkType> getAssetLinkTypes() { | ||
try { | ||
return deserialize(genericStorage.findAll(GenericDocTypes.DOC_ASSET_LINK_TYPE)); | ||
} catch (IOException e) { | ||
return List.of(); | ||
} | ||
} | ||
|
||
private List<AssetLinkType> deserialize(List<Map<String, Object>> list) { | ||
CollectionType listType = objectMapper.getTypeFactory() | ||
.constructCollectionType(List.class, AssetLinkType.class); | ||
|
||
return objectMapper.convertValue(list, listType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...b/components/asset-browser/asset-browser-hierarchy/asset-browser-hierarchy.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
~ (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~ | ||
--> | ||
|
||
<div fxLayout="column" *ngIf="selectedAsset"> | ||
<mat-tree | ||
[dataSource]="dataSource" | ||
[treeControl]="treeControl" | ||
class="sp-tree" | ||
#tree | ||
> | ||
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle> | ||
<sp-asset-browser-node | ||
class="w-100" | ||
[node]="node" | ||
[assetBrowserData]="assetBrowserData" | ||
[assetSelectionMode]="assetSelectionMode" | ||
[filteredAssetLinkType]="filteredAssetLinkType" | ||
[resourceCount]="resourceCount" | ||
[selectedAsset]="selectedAsset" | ||
(selectedNodeEmitter)="selectNode($event)" | ||
> | ||
</sp-asset-browser-node> | ||
</mat-tree-node> | ||
|
||
<mat-nested-tree-node *matTreeNodeDef="let node; when: hasChild"> | ||
<div class="mat-tree-node"> | ||
<button | ||
mat-icon-button | ||
matTreeNodeToggle | ||
[attr.data-cy]="'button-' + node.nodeName" | ||
[attr.aria-label]="'Toggle ' + node.nodeName" | ||
> | ||
<mat-icon class="mat-icon-rtl-mirror"> | ||
{{ | ||
treeControl.isExpanded(node) | ||
? 'expand_more' | ||
: 'chevron_right' | ||
}} | ||
</mat-icon> | ||
</button> | ||
<sp-asset-browser-node | ||
fxFlex="100" | ||
[node]="node" | ||
[assetBrowserData]="assetBrowserData" | ||
[assetSelectionMode]="assetSelectionMode" | ||
[filteredAssetLinkType]="filteredAssetLinkType" | ||
[resourceCount]="resourceCount" | ||
[selectedAsset]="selectedAsset" | ||
(selectedNodeEmitter)="selectNode($event)" | ||
> | ||
</sp-asset-browser-node> | ||
</div> | ||
<div *ngIf="treeControl.isExpanded(node)" role="group"> | ||
<ng-container matTreeNodeOutlet></ng-container> | ||
</div> | ||
</mat-nested-tree-node> | ||
</mat-tree> | ||
</div> |
44 changes: 44 additions & 0 deletions
44
...b/components/asset-browser/asset-browser-hierarchy/asset-browser-hierarchy.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*! | ||
* 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. | ||
* | ||
*/ | ||
|
||
.sp-tree-invisible { | ||
display: none; | ||
} | ||
|
||
.sp-tree ul, | ||
.sp-tree li { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
list-style-type: none; | ||
} | ||
|
||
.sp-tree .mat-nested-tree-node div[role='group'] { | ||
padding-left: 20px; | ||
} | ||
|
||
.sp-tree div[role='group'] > .mat-tree-node { | ||
padding-left: 20px; | ||
} | ||
|
||
.mat-tree-node { | ||
min-height: 35px; | ||
} | ||
|
||
.mat-tree-node:hover { | ||
background: var(--color-bg-1); | ||
} |
Oops, something went wrong.