You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2025/12/08 20:06:21 UTC
(streampipes) branch 4036-improve-asset-view updated: feat(#4036): Improve asset view, add custom fields
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch 4036-improve-asset-view
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/4036-improve-asset-view by this push:
new 51f4c7e9e4 feat(#4036): Improve asset view, add custom fields
51f4c7e9e4 is described below
commit 51f4c7e9e43b64d98846d38e07abc755237cb71c
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Mon Dec 8 21:04:17 2025 +0100
feat(#4036): Improve asset view, add custom fields
---
.../basic-view/basic-view.component.html | 3 +-
.../form-field/form-field.component.html | 19 +-
.../split-section/split-section.component.scss | 18 +-
ui/src/app/assets/assets.module.ts | 20 +-
.../asset-details/base-asset-details.directive.ts | 22 -
.../asset-details-basics.component.html | 214 ++++-----
.../asset-details-basics.component.scss | 27 --
.../asset-details-basics.component.ts | 5 +-
.../asset-details-custom-fields.component.html | 89 ++++
.../asset-details-custom-fields.component.ts} | 45 +-
.../asset-details-labels.component.html | 145 +++---
.../asset-details-site.component.html | 85 ++--
.../asset-details-links.component.html | 89 ++--
.../asset-details-links.component.ts | 56 +--
.../asset-link-item/asset-link-item.component.html | 52 ---
.../asset-link-item/asset-link-item.component.scss | 36 --
.../asset-link-item/asset-link-item.component.ts | 63 ---
.../asset-link-section.component.html | 43 --
.../asset-link-section.component.scss | 35 --
.../edit-asset/asset-details.component.html | 49 +-
.../edit-asset/asset-details.component.ts | 13 +-
.../asset-selection-menu.component.html} | 27 +-
.../asset-selection-menu.component.scss} | 30 +-
.../asset-selection-menu.component.ts | 104 +++++
.../asset-selection-panel.component.html | 135 ++++--
.../asset-selection-panel.component.scss | 98 +++-
.../asset-selection-panel.component.ts | 48 +-
.../asset-top-banner.component.html | 68 +++
.../asset-top-banner.component.scss} | 36 +-
.../asset-top-banner.component.ts} | 36 +-
.../view-asset-basics.component.html | 65 +--
.../view-asset-basics.component.scss | 35 +-
.../view-assset-basics.component.ts | 29 +-
.../asset-link-card/asset-link-card.component.scss | 38 --
.../asset-link-table-type.component.html} | 17 +-
.../asset-link-table-type.component.scss} | 17 +-
.../asset-link-table-type.component.ts} | 32 +-
.../asset-link-table.component.html | 105 +++++
.../asset-link-table/asset-link-table.component.ts | 144 ++++++
.../view-asset-links.component.html | 50 +-
.../view-asset-links.component.scss | 45 +-
.../view-asset/view-asset.component.html | 103 +++--
.../view-asset/view-asset.component.ts | 12 +-
.../create-asset-dialog.component.html | 31 +-
.../edit-asset-link-dialog.component.html | 57 ++-
.../edit-asset-link-dialog.component.scss | 21 -
.../edit-asset-link-dialog.component.ts | 1 -
.../manage-asset-links-dialog.component.html | 504 ++++++++++-----------
.../manage-asset-links-dialog.component.ts | 1 -
.../single-marker-map.component.ts | 6 +-
.../datalake-configuration.component.ts | 1 -
ui/src/app/editor/editor.component.scss | 2 +
ui/src/scss/sp/main.scss | 4 +-
53 files changed, 1666 insertions(+), 1364 deletions(-)
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.html
index 01633a2204..9371fec2b9 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.html
@@ -31,8 +31,7 @@
color="accent"
[matTooltip]="'Back' | translate"
(click)="navigateBack()"
- class="edit-menu-btn"
- class="mr-5"
+ class="edit-menu-btn mr-5"
data-cy="save-data-explorer-go-back-to-overview"
>
<mat-icon>arrow_back</mat-icon>
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/form-field/form-field.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/form-field/form-field.component.html
index 721363491b..c09bc05949 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/form-field/form-field.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/form-field/form-field.component.html
@@ -23,12 +23,17 @@
[class.mb-lg]="level === 2"
[class.mb-sm]="level === 3"
>
- <sp-form-label
- [level]="level"
- [label]="label"
- [description]="description"
- [tooltip]="tooltip"
- >
- </sp-form-label>
+ <div fxLayout="row" fxFlex="100" fxLayoutAlign="start center">
+ <sp-form-label
+ [level]="level"
+ [label]="label"
+ [description]="description"
+ [tooltip]="tooltip"
+ >
+ </sp-form-label>
+ <span fxFlex></span>
+ <ng-content select="[form-field-actions]"></ng-content>
+ </div>
+
<ng-content></ng-content>
</div>
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/split-section/split-section.component.scss b/ui/projects/streampipes/shared-ui/src/lib/components/split-section/split-section.component.scss
index 1c50eaafbf..cd1dfe2109 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/split-section/split-section.component.scss
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/split-section/split-section.component.scss
@@ -29,14 +29,6 @@
grid-template-rows: auto auto;
column-gap: 0.75rem;
align-items: start;
- //padding-left: 12px;
- //border-left: 4px solid transparent;
- //border-image: linear-gradient(
- // to bottom,
- // var(--color-primary),
- // var(--color-primary-dark)
- // )
- // 1;
}
.section-outline {
@@ -46,7 +38,7 @@
}
.section-outline-compact {
- border-radius: 0px;
+ border-radius: 5px;
}
.section-outer-compact {
@@ -54,7 +46,7 @@
}
.section-outer {
- margin-bottom: 10px;
+ margin-bottom: 1rem;
}
.title {
@@ -80,9 +72,9 @@
}
.section-body {
- margin-top: 1.25rem;
- margin-bottom: 1.25rem;
- margin-left: 16px;
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+ margin-left: 0;
display: block;
}
diff --git a/ui/src/app/assets/assets.module.ts b/ui/src/app/assets/assets.module.ts
index 73d1abf298..d0ac72f1b6 100644
--- a/ui/src/app/assets/assets.module.ts
+++ b/ui/src/app/assets/assets.module.ts
@@ -37,7 +37,6 @@ import { SpAssetOverviewComponent } from './components/asset-overview/asset-over
import { SpAssetDetailsComponent } from './components/asset-details/edit-asset/asset-details.component';
import { SpAssetSelectionPanelComponent } from './components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component';
import { MatTreeModule } from '@angular/material/tree';
-import { SpAssetLinkItemComponent } from './components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component';
import { EditAssetLinkDialogComponent } from './dialog/edit-asset-link/edit-asset-link-dialog.component';
import { SpCreateAssetDialogComponent } from './dialog/create-asset/create-asset-dialog.component';
import { SpManageAssetLinksDialogComponent } from './dialog/manage-asset-links/manage-asset-links-dialog.component';
@@ -49,7 +48,6 @@ import { MatSortModule } from '@angular/material/sort';
import { AssetDetailsLinksComponent } from './components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component';
import { AssetDetailsBasicsComponent } from './components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component';
import { MatTabsModule } from '@angular/material/tabs';
-import { AssetLinkSectionComponent } from './components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component';
import { AssetTypeFilterPipe } from './pipes/asset-type-filter.pipe';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { AssetDetailsLabelsComponent } from './components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component';
@@ -61,11 +59,15 @@ import { SpViewAssetComponent } from './components/asset-details/view-asset/view
import { ViewAssetLabelsComponent } from './components/asset-details/view-asset/view-asset-labels/view-asset-labels.component';
import { ViewAssetBasicsComponent } from './components/asset-details/view-asset/view-asset-basics/view-assset-basics.component';
import { ViewAssetLinksComponent } from './components/asset-details/view-asset/view-asset-links/view-asset-links.component';
-import { AssetLinkCardComponent } from './components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component';
-import { MatMenuItem } from '@angular/material/menu';
+import { MatMenuModule } from '@angular/material/menu';
import { TranslatePipe } from '@ngx-translate/core';
import { UserPrivilege } from '../_enums/user-privilege.enum';
import { PageAuthGuard } from '../_guards/page-auth.can-active.guard';
+import { SpAssetTopBannerComponent } from './components/asset-details/view-asset/asset-top-banner/asset-top-banner.component';
+import { SpAssetSelectionMenuComponent } from './components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component';
+import { AssetLinkTableComponent } from './components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component';
+import { AssetLinkTableTypeComponent } from './components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component';
+import { AssetDetailsCustomFieldsComponent } from './components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component';
@NgModule({
imports: [
@@ -124,19 +126,17 @@ import { PageAuthGuard } from '../_guards/page-auth.can-active.guard';
SharedUiModule,
MatTreeModule,
MatSortModule,
- MatMenuItem,
TranslatePipe,
+ MatMenuModule,
],
declarations: [
AssetDetailsBasicsComponent,
AssetDetailsLabelsComponent,
AssetDetailsLinksComponent,
AssetDetailsSiteComponent,
- AssetLinkSectionComponent,
AssetLocationComponent,
EditAssetLinkDialogComponent,
SpAssetDetailsComponent,
- SpAssetLinkItemComponent,
SpAssetOverviewComponent,
SpAssetSelectionPanelComponent,
SpCreateAssetDialogComponent,
@@ -146,7 +146,11 @@ import { PageAuthGuard } from '../_guards/page-auth.can-active.guard';
ViewAssetLabelsComponent,
ViewAssetBasicsComponent,
ViewAssetLinksComponent,
- AssetLinkCardComponent,
+ SpAssetTopBannerComponent,
+ SpAssetSelectionMenuComponent,
+ AssetLinkTableComponent,
+ AssetLinkTableTypeComponent,
+ AssetDetailsCustomFieldsComponent,
],
providers: [],
})
diff --git a/ui/src/app/assets/components/asset-details/base-asset-details.directive.ts b/ui/src/app/assets/components/asset-details/base-asset-details.directive.ts
index d1163c3755..98794e4720 100644
--- a/ui/src/app/assets/components/asset-details/base-asset-details.directive.ts
+++ b/ui/src/app/assets/components/asset-details/base-asset-details.directive.ts
@@ -84,27 +84,5 @@ export abstract class BaseAssetDetailsDirective implements OnInit {
this.rootNode = event.rootNode;
}
- updateSelected() {
- if (this.asset.assetId === this.selectedAsset.assetId) {
- this.asset = this.selectedAsset as SpAssetModel;
- } else {
- this.asset.assets.forEach(a => {
- this.walk(a, this.selectedAsset);
- });
- }
- }
-
- walk(asset: SpAsset, selectedAsset: SpAsset) {
- if (asset.assetId === selectedAsset.assetId) {
- asset = selectedAsset;
- } else {
- if (asset.assets) {
- asset.assets.forEach(a => {
- this.walk(a, selectedAsset);
- });
- }
- }
- }
-
abstract onAssetAvailable(): void;
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.html
index 4d2c60d817..e1e14935e5 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.html
@@ -16,127 +16,101 @@
~
-->
-<div class="page-container-padding-inner">
- <sp-basic-header-title-component
+<div class="page-container-padding-inner" fxLayout="column">
+ <sp-split-section
+ [level]="2"
[title]="('Basics' | translate) + ': ' + asset.assetName"
- ></sp-basic-header-title-component>
- <div class="p-10">
- <div fxLayout="column" fxFlex="100">
- <sp-basic-field-description
- fxFlex="100"
- descriptionPanelWidth="30"
- [label]="'Name' | translate"
- [description]="'A short name of the asset' | translate"
- >
- <mat-form-field
- color="accent"
- class="w-100"
- subscriptSizing="dynamic"
- >
- <input
- data-cy="asset-name"
- matInput
- [(ngModel)]="asset.assetName"
- [disabled]="!editMode"
- />
- </mat-form-field>
- </sp-basic-field-description>
- <sp-basic-field-description
- fxFlex="100"
- descriptionPanelWidth="30"
- [label]="'Description' | translate"
- [description]="'A longer description of this asset' | translate"
- >
- <mat-form-field
- color="accent"
- class="w-100"
- subscriptSizing="dynamic"
- >
- <input
- matInput
- [(ngModel)]="asset.assetDescription"
- [disabled]="!editMode"
- />
- </mat-form-field>
- </sp-basic-field-description>
- <sp-basic-field-description
- fxFlex="100"
- descriptionPanelWidth="30"
- label="Asset ID"
- [description]="
- 'A unique id for this asset in one word' | translate
- "
- >
- <mat-form-field
- color="accent"
- class="w-100"
- subscriptSizing="dynamic"
+ >
+ <sp-form-field
+ [level]="2"
+ [label]="'Name' | translate"
+ [description]="'A short name of the asset' | translate"
+ >
+ <mat-form-field>
+ <input
+ data-cy="asset-name"
+ matInput
+ [(ngModel)]="asset.assetName"
+ [disabled]="!editMode"
+ />
+ </mat-form-field>
+ </sp-form-field>
+ <sp-form-field
+ fxFlex="100"
+ [level]="2"
+ [label]="'Description' | translate"
+ [description]="'A longer description of this asset' | translate"
+ >
+ <mat-form-field>
+ <input
+ matInput
+ [(ngModel)]="asset.assetDescription"
+ [disabled]="!editMode"
+ />
+ </mat-form-field>
+ </sp-form-field>
+ <sp-form-field
+ fxFlex="100"
+ [level]="2"
+ label="Asset ID"
+ [description]="'A unique id for this asset in one word' | translate"
+ >
+ <mat-form-field>
+ <input
+ matInput
+ [(ngModel)]="asset.assetId"
+ [disabled]="!editMode"
+ />
+ </mat-form-field>
+ </sp-form-field>
+ <sp-form-field
+ fxFlex="100"
+ [level]="2"
+ [label]="'Asset Type' | translate"
+ [description]="'The ISA95 type of this asset' | translate"
+ >
+ <mat-form-field class="w-100">
+ <mat-select
+ data-cy="asset-type-select"
+ [disabled]="!editMode"
+ [(ngModel)]="asset.assetType.isa95AssetType"
+ [aria-label]="'Asset Type' | translate"
>
- <input
- matInput
- [(ngModel)]="asset.assetId"
- [disabled]="!editMode"
- />
- </mat-form-field>
- </sp-basic-field-description>
- <sp-basic-field-description
- fxFlex="100"
- descriptionPanelWidth="30"
- [label]="'Asset Type' | translate"
- [description]="'The ISA95 type of this asset' | translate"
+ @for (isaType of isa95Types; track isaType) {
+ <mat-option
+ [value]="isaType.type"
+ [attr.data-cy]="'option-' + isaType.type"
+ >{{ isaType.label }}
+ </mat-option>
+ }
+ </mat-select>
+ </mat-form-field>
+ </sp-form-field>
+ </sp-split-section>
+ <sp-split-section
+ [level]="2"
+ [title]="'Labels & custom fields' | translate"
+ >
+ <sp-asset-details-labels [asset]="asset" [editMode]="editMode">
+ </sp-asset-details-labels>
+ <sp-asset-details-custom-fields [asset]="asset" [editMode]="editMode">
+ </sp-asset-details-custom-fields>
+ </sp-split-section>
+ @if (rootNode) {
+ <sp-split-section [level]="2" [title]="'Sites' | translate">
+ <sp-asset-details-site
+ [asset]="asset"
+ [sites]="sites"
+ [editMode]="editMode"
>
- <mat-form-field class="w-100">
- <mat-select
- data-cy="asset-type-select"
- [disabled]="!editMode"
- [(ngModel)]="asset.assetType.isa95AssetType"
- [aria-label]="'Asset Type' | translate"
- >
- @for (isaType of isa95Types; track isaType) {
- <mat-option
- [value]="isaType.type"
- [attr.data-cy]="'option-' + isaType.type"
- >{{ isaType.label }}
- </mat-option>
- }
- </mat-select>
- </mat-form-field>
- </sp-basic-field-description>
- <sp-basic-field-description
- fxFlex="100"
- descriptionPanelWidth="30"
- [label]="'Labels' | translate"
- [description]="
- 'Assign additional labels to better discover your assets'
- | translate
- "
- >
- <sp-asset-details-labels
- [asset]="asset"
- [editMode]="editMode"
- class="w-100"
- >
- </sp-asset-details-labels>
- </sp-basic-field-description>
- @if (rootNode) {
- <sp-basic-field-description
- fxFlex="100"
- descriptionPanelWidth="30"
- [label]="'Sites' | translate"
- [description]="
- 'Assign a location (site and area) to this asset'
- | translate
- "
- >
- <sp-asset-details-site
- class="w-100"
- [asset]="asset"
- [sites]="sites"
- [editMode]="editMode"
- >
- </sp-asset-details-site>
- </sp-basic-field-description>
- }
- </div>
- </div>
+ </sp-asset-details-site>
+ </sp-split-section>
+ }
+
+ <sp-asset-details-links
+ [asset]="asset"
+ [assetModel]="assetModel"
+ [editMode]="true"
+ >
+ </sp-asset-details-links>
</div>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.scss b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.scss
deleted file mode 100644
index 4492f86b7c..0000000000
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.scss
+++ /dev/null
@@ -1,27 +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.
- *
- */
-
-.mat-button-toggle-group {
- flex-wrap: wrap;
- border: none;
-}
-
-.mat-button-toggle {
- border: 1px solid var(--mat-standard-button-toggle-divider-color);
- margin-bottom: 5px;
-}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts
index 6b9ae72b80..094a4f6ead 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts
@@ -28,18 +28,21 @@ import {
Isa95TypeDesc,
Isa95TypeService,
SpAsset,
+ SpAssetModel,
} from '@streampipes/platform-services';
@Component({
selector: 'sp-asset-details-basics',
templateUrl: './asset-details-basics.component.html',
- styleUrls: ['./asset-details-basics.component.scss'],
standalone: false,
})
export class AssetDetailsBasicsComponent implements OnInit, OnChanges {
@Input()
asset: SpAsset;
+ @Input()
+ assetModel: SpAssetModel;
+
@Input()
editMode: boolean;
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component.html
new file mode 100644
index 0000000000..6628734ec2
--- /dev/null
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component.html
@@ -0,0 +1,89 @@
+@if (editMode) {
+ <sp-form-field
+ [level]="2"
+ [label]="'Custom fields' | translate"
+ [description]="
+ 'Add additional fields to the asset, e.g., to manage responsibilities'
+ | translate
+ "
+ >
+ @for (
+ customField of asset.additionalData.customFields;
+ let i = $index;
+ track $index
+ ) {
+ <div
+ fxLayout="row"
+ fxLayoutGap="15px"
+ fxLayoutAlign="start center"
+ fxFlex="100"
+ >
+ <sp-form-field
+ [level]="3"
+ [label]="'Field name' | translate"
+ fxFlex="40"
+ >
+ <mat-form-field>
+ <input
+ matInput
+ placeholder="Field name"
+ [(ngModel)]="customField.key"
+ />
+ </mat-form-field>
+ </sp-form-field>
+
+ <sp-form-field
+ [level]="3"
+ [label]="'Value' | translate"
+ fxFlex="40"
+ >
+ <mat-form-field>
+ <input
+ matInput
+ placeholder="Value"
+ [(ngModel)]="customField.value"
+ />
+ </mat-form-field>
+ </sp-form-field>
+
+ <sp-form-field [level]="3" label="">
+ <button
+ mat-icon-button
+ type="button"
+ (click)="removeCustomField(i)"
+ aria-label="Remove custom field"
+ >
+ <mat-icon>delete</mat-icon>
+ </button>
+ </sp-form-field>
+ </div>
+ }
+ <div>
+ <button
+ mat-flat-button
+ class="mat-basic"
+ type="button"
+ (click)="addCustomField()"
+ >
+ Add custom field
+ </button>
+ </div>
+ </sp-form-field>
+} @else {
+ <div fxLayout="column" fxLayoutGap="6px">
+ @if (customFields?.length) {
+ @for (field of customFields; track field.key ?? $index) {
+ <div
+ fxLayout="row"
+ fxLayoutGap="8px"
+ fxLayoutAlign="start start"
+ >
+ <span class="text-md font-emphasized">{{ field.key }}</span>
+ <span class="text-md">{{ field.value }}</span>
+ </div>
+ }
+ } @else {
+ <span>No custom fields set</span>
+ }
+ </div>
+}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component.ts
similarity index 54%
copy from ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.ts
copy to ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component.ts
index c9247cbe78..9bf6ae5700 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-custom-fields/asset-details-custom-fields.component.ts
@@ -16,36 +16,39 @@
*
*/
-import { Component, EventEmitter, Input, Output } from '@angular/core';
-import {
- AssetLink,
- AssetLinkType,
- SpAsset,
-} from '@streampipes/platform-services';
+import { Component, Input, OnInit } from '@angular/core';
+import { SpAsset } from '@streampipes/platform-services';
+
+export interface CustomField {
+ key: string;
+ value: string;
+}
@Component({
- selector: 'sp-asset-link-section',
- templateUrl: './asset-link-section.component.html',
- styleUrls: ['./asset-link-section.component.scss'],
+ selector: 'sp-asset-details-custom-fields',
+ templateUrl: './asset-details-custom-fields.component.html',
standalone: false,
})
-export class AssetLinkSectionComponent {
- @Input()
- assetLinkType: AssetLinkType;
-
+export class AssetDetailsCustomFieldsComponent implements OnInit {
@Input()
asset: SpAsset;
@Input()
- editMode: boolean;
+ editMode = false;
- @Output()
- openEditAssetLinkEmitter: EventEmitter<AssetLink> =
- new EventEmitter<AssetLink>();
+ ngOnInit() {
+ this.asset.additionalData.customFields ??= [];
+ }
+
+ get customFields(): CustomField[] {
+ return this.asset.additionalData!.customFields!;
+ }
+
+ addCustomField(): void {
+ this.customFields.push({ key: '', value: '' });
+ }
- deleteAssetLink(assetLink: AssetLink): void {
- const index = this.asset.assetLinks.indexOf(assetLink);
- this.asset.assetLinks.splice(index, 1);
- this.asset.assetLinks = [...this.asset.assetLinks];
+ removeCustomField(index: number): void {
+ this.customFields.splice(index, 1);
}
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.html
index 952e0fd46d..cb824679a0 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.html
@@ -21,78 +21,89 @@
<div fxLayout="row" fxLayoutGap="15px" fxLayoutAlign="start center">
<div fxFlex fxLayoutAlign="start center">
@if (labelsAvailable) {
- <mat-form-field
- class="w-100"
- color="accent"
- subscriptSizing="dynamic"
- [disabled]="allLabels.length === 0"
+ <sp-form-field
+ fxFlex="100"
+ [level]="2"
+ [label]="'Labels' | translate"
+ [description]="
+ 'Assign additional labels to better discover your assets'
+ | translate
+ "
>
- <mat-chip-grid #chipGrid aria-label="Labels">
- @for (label of labels; track label) {
- <mat-chip-row
- (removed)="remove(label)"
- [ngStyle]="{ background: label.color }"
- >
- <span
- [ngStyle]="{
- color: labelTextColors[label._id]
- }"
- >{{ label.label }}</span
+ <div form-field-actions>
+ <button
+ mat-flat-button
+ class="mat-basic"
+ [routerLink]="['/configuration/labels']"
+ >
+ {{ 'Manage Labels' | translate }}
+ </button>
+ </div>
+ <mat-form-field [disabled]="allLabels.length === 0">
+ <mat-chip-grid #chipGrid aria-label="Labels">
+ @for (label of labels; track label) {
+ <mat-chip-row
+ (removed)="remove(label)"
+ [ngStyle]="{ background: label.color }"
>
- <button
- matChipRemove
- [ngStyle]="{
- color: labelTextColors[label._id]
- }"
+ <span
+ [ngStyle]="{
+ color: labelTextColors[
+ label._id
+ ]
+ }"
+ >{{ label.label }}</span
+ >
+ <button
+ matChipRemove
+ [ngStyle]="{
+ color: labelTextColors[
+ label._id
+ ]
+ }"
+ >
+ <mat-icon>cancel</mat-icon>
+ </button>
+ </mat-chip-row>
+ }
+ </mat-chip-grid>
+ <input
+ [placeholder]="
+ allLabels.length === 0
+ ? ('No labels available - Click \'Manage Labels\''
+ | translate)
+ : ('Click to add label' | translate)
+ "
+ data-cy="asset-label-input"
+ #labelInput
+ [formControl]="labelCtrl"
+ [matChipInputFor]="chipGrid"
+ [matAutocomplete]="auto"
+ [matChipInputSeparatorKeyCodes]="
+ separatorKeysCodes
+ "
+ (matChipInputTokenEnd)="add($event)"
+ [disabled]="allLabels.length === 0"
+ />
+ <mat-autocomplete
+ #auto="matAutocomplete"
+ (optionSelected)="selected($event)"
+ >
+ @for (
+ label of filteredLabels | async;
+ track label
+ ) {
+ <mat-option
+ [value]="label._id"
+ [attr.data-cy]="'option-' + label.label"
+ >{{ label.label }}</mat-option
>
- <mat-icon>cancel</mat-icon>
- </button>
- </mat-chip-row>
- }
- </mat-chip-grid>
- <input
- [placeholder]="
- allLabels.length === 0
- ? ('No labels available - Click \'Manage Labels\''
- | translate)
- : ('Click to add label' | translate)
- "
- data-cy="asset-label-input"
- #labelInput
- [formControl]="labelCtrl"
- [matChipInputFor]="chipGrid"
- [matAutocomplete]="auto"
- [matChipInputSeparatorKeyCodes]="separatorKeysCodes"
- (matChipInputTokenEnd)="add($event)"
- [disabled]="allLabels.length === 0"
- />
- <mat-autocomplete
- #auto="matAutocomplete"
- (optionSelected)="selected($event)"
- >
- @for (
- label of filteredLabels | async;
- track label
- ) {
- <mat-option
- [value]="label._id"
- [attr.data-cy]="'option-' + label.label"
- >{{ label.label }}</mat-option
- >
- }
- </mat-autocomplete>
- </mat-form-field>
+ }
+ </mat-autocomplete>
+ </mat-form-field>
+ </sp-form-field>
}
</div>
- <div fxLayoutAlign="start center">
- <button
- mat-flat-button
- color="accent"
- [routerLink]="['/configuration/labels']"
- >
- {{ 'Manage Labels' | translate }}
- </button>
- </div>
</div>
</div>
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-details-site.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-details-site.component.html
index cbc811a93f..e87733e6fd 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-details-site.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-details-site.component.html
@@ -19,53 +19,60 @@
<div fxLayout="column">
<div fxLayout="row" fxLayoutGap="15px" fxLayoutAlign="start center">
<div fxFlex fxLayoutAlign="start center">
- <mat-form-field
- color="accent"
- class="w-100"
- subscriptSizing="dynamic"
+ <sp-form-field
+ [level]="2"
+ fxFlex="100"
+ [label]="'Site' | translate"
+ [description]="
+ 'Assign a location (site and area) to this asset'
+ | translate
+ "
>
+ <div form-field-actions>
+ <button
+ mat-flat-button
+ class="mat-basic"
+ [routerLink]="['/configuration/sites']"
+ >
+ {{ 'Manage Sites' | translate }}
+ </button>
+ </div>
+ <mat-form-field>
+ <mat-select
+ data-cy="asset-site-select"
+ [disabled]="!editMode"
+ [(ngModel)]="asset.assetSite.siteId"
+ (selectionChange)="handleLocationChange($event)"
+ >
+ @for (site of sites; track site) {
+ <mat-option
+ [attr.data-cy]="'option-' + site.label"
+ [value]="site._id"
+ >
+ {{ site.label }}
+ </mat-option>
+ }
+ </mat-select>
+ </mat-form-field>
+ </sp-form-field>
+ </div>
+ </div>
+
+ @if (currentSite) {
+ <sp-form-field [level]="2" [label]="'Area' | translate">
+ <mat-form-field>
<mat-select
- data-cy="asset-site-select"
[disabled]="!editMode"
- [(ngModel)]="asset.assetSite.siteId"
- (selectionChange)="handleLocationChange($event)"
+ [(ngModel)]="asset.assetSite.area"
>
- @for (site of sites; track site) {
- <mat-option
- [attr.data-cy]="'option-' + site.label"
- [value]="site._id"
- >
- {{ site.label }}
+ @for (area of currentSite.areas; track area) {
+ <mat-option [value]="area">
+ {{ area }}
</mat-option>
}
</mat-select>
</mat-form-field>
- </div>
- <div fxLayoutAlign="start center">
- <button
- mat-flat-button
- color="accent"
- [routerLink]="['/configuration/sites']"
- >
- {{ 'Manage Sites' | translate }}
- </button>
- </div>
- </div>
-
- @if (currentSite) {
- <mat-form-field color="accent" class="mt-10 w-100">
- <mat-label>Area</mat-label>
- <mat-select
- [disabled]="!editMode"
- [(ngModel)]="asset.assetSite.area"
- >
- @for (area of currentSite.areas; track area) {
- <mat-option [value]="area">
- {{ area }}
- </mat-option>
- }
- </mat-select>
- </mat-form-field>
+ </sp-form-field>
}
@if (asset.assetSite?.siteId) {
<sp-asset-location [asset]="asset" [editMode]="editMode">
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.html
index 3e958e20e3..608ce0aaaa 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.html
@@ -16,58 +16,41 @@
~
-->
-<div class="page-container-padding-inner">
- <sp-basic-header-title-component
- title="{{ 'Asset Links: ' + asset.assetName }}"
- ></sp-basic-header-title-component>
-
- <div class="p-10" fxLayout="column">
- <div
- fxLayoutAlign="end center"
- fxLayout="row"
- fxFlex="100"
- fxLayoutGap="10px"
- >
- @if (editMode) {
- <button
- [disabled]="!assetLinksLoaded"
- mat-flat-button
- color="accent"
- (click)="openManageAssetLinksDialog()"
- data-cy="assets-manage-links-button"
- >
- <i class="material-icons">add</i
- ><span> {{ 'Manage links' | translate }}</span>
- </button>
- }
- @if (editMode) {
- <button
- [disabled]="!assetLinksLoaded"
- mat-flat-button
- color="accent"
- (click)="openCreateAssetLinkDialog()"
- >
- <i class="material-icons">add</i
- ><span> {{ 'Add link' | translate }}</span>
- </button>
- }
- </div>
- @if (assetLinkTypes) {
- <div fxLayout="column" fxFlex="100" class="mt-10">
- @for (assetLinkType of assetLinkTypes; track assetLinkType) {
- <div>
- <sp-asset-link-section
- [assetLinkType]="assetLinkType"
- [asset]="asset"
- [editMode]="editMode"
- (openEditAssetLinkEmitter)="
- openEditAssetLinkDialog($event, false)
- "
- >
- </sp-asset-link-section>
- </div>
- }
- </div>
+<sp-split-section [title]="'Asset links' | translate">
+ <div section-actions fxLayoutGap="10px">
+ @if (editMode) {
+ <button
+ [disabled]="!assetLinksLoaded"
+ mat-flat-button
+ class="mat-basic"
+ (click)="openManageAssetLinksDialog()"
+ data-cy="assets-manage-links-button"
+ >
+ <i class="material-icons">add</i
+ ><span> {{ 'Manage links' | translate }}</span>
+ </button>
+ }
+ @if (editMode) {
+ <button
+ [disabled]="!assetLinksLoaded"
+ mat-flat-button
+ class="mat-basic"
+ (click)="openCreateAssetLinkDialog()"
+ >
+ <i class="material-icons">add</i
+ ><span> {{ 'Add link' | translate }}</span>
+ </button>
}
</div>
-</div>
+ @if (assetLinkTypes) {
+ <div fxLayout="column" fxFlex="100" class="mt-10">
+ <sp-asset-link-table
+ #assetLinkTable
+ [assetLinkTypes]="assetLinkTypes"
+ [asset]="asset"
+ [assetModel]="assetModel"
+ [editMode]="true"
+ ></sp-asset-link-table>
+ </div>
+ }
+</sp-split-section>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
index 4add1d72bd..c8c400fdc3 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
@@ -16,18 +16,27 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ ViewChild,
+} from '@angular/core';
import {
AssetConstants,
AssetLink,
AssetLinkType,
GenericStorageService,
SpAsset,
+ SpAssetModel,
} from '@streampipes/platform-services';
import { SpManageAssetLinksDialogComponent } from '../../../../../dialog/manage-asset-links/manage-asset-links-dialog.component';
import { DialogService, PanelType } from '@streampipes/shared-ui';
import { EditAssetLinkDialogComponent } from '../../../../../dialog/edit-asset-link/edit-asset-link-dialog.component';
import { TranslateService } from '@ngx-translate/core';
+import { AssetLinkTableComponent } from '../../../view-asset/view-asset-links/asset-link-table/asset-link-table.component';
@Component({
selector: 'sp-asset-details-links',
@@ -38,6 +47,9 @@ export class AssetDetailsLinksComponent implements OnInit {
@Input()
asset: SpAsset;
+ @Input()
+ assetModel: SpAssetModel;
+
@Input()
editMode: boolean;
@@ -47,6 +59,9 @@ export class AssetDetailsLinksComponent implements OnInit {
assetLinkTypes: AssetLinkType[] = [];
assetLinksLoaded = false;
+ @ViewChild('assetLinkTable', { static: false })
+ assetLinkTable: AssetLinkTableComponent;
+
constructor(
private genericStorageService: GenericStorageService,
private dialogService: DialogService,
@@ -81,51 +96,40 @@ export class AssetDetailsLinksComponent implements OnInit {
dialogRef.afterClosed().subscribe(assetLinks => {
if (assetLinks) {
this.asset.assetLinks = assetLinks;
+ this.assetLinkTable?.refreshData();
}
});
}
- openEditAssetLinkDialog(assetLink: AssetLink, createMode: boolean): void {
- const index = !createMode
- ? this.asset.assetLinks.indexOf(assetLink)
- : -1;
+ openCreateAssetLinkDialog(): void {
+ const assetLink: AssetLink = {
+ linkLabel: '',
+ linkType: 'chart',
+ editingDisabled: false,
+ resourceId: '',
+ navigationActive: true,
+ queryHint: 'chart',
+ };
const dialogRef = this.dialogService.open(
EditAssetLinkDialogComponent,
{
panelType: PanelType.SLIDE_IN_PANEL,
- title: createMode
- ? this.translateService.instant('Create asset links')
- : this.translateService.instant('Update asset links'),
+ title: this.translateService.instant('Create asset links'),
width: '50vw',
data: {
assetLink: assetLink,
assetLinkTypes: this.assetLinkTypes,
- createMode: createMode,
+ createMode: true,
},
},
);
dialogRef.afterClosed().subscribe(storedLink => {
if (storedLink) {
- if (index > -1) {
- this.asset.assetLinks[index] = storedLink;
- } else {
- this.asset.assetLinks.push(storedLink);
- }
+ this.asset.assetLinks.push(storedLink);
this.asset.assetLinks = [...this.asset.assetLinks];
+ this.assetLinkTable?.refreshData();
}
});
}
-
- openCreateAssetLinkDialog(): void {
- const assetLink: AssetLink = {
- linkLabel: '',
- linkType: 'chart',
- editingDisabled: false,
- resourceId: '',
- navigationActive: true,
- queryHint: 'chart',
- };
- this.openEditAssetLinkDialog(assetLink, true);
- }
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.html
deleted file mode 100644
index b6e257c5ab..0000000000
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.html
+++ /dev/null
@@ -1,52 +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 fxFlex="100" fxLayout="column">
- <div fxLayout="row" fxLayoutGap="10px">
- <div fxLayoutAlign="center center">
- <div
- fxLayoutAlign="center center"
- class="link-icon"
- [ngStyle]="{ background: assetLinkType.linkColor }"
- >
- <i class="material-icons">{{ assetLinkType.linkIcon }}</i>
- </div>
- </div>
- <div fxLayoutAlign="start center">
- <span class="link-label">{{ assetLink.linkLabel }}</span>
- </div>
- <div fxFlex></div>
- <div fxLayoutAlign="end center">
- @if (assetLink.navigationActive) {
- <button mat-icon-button color="accent" (click)="openLink()">
- <i class="material-icons">link</i>
- </button>
- }
- @if (editMode) {
- <button mat-icon-button color="accent" (click)="editLink()">
- <i class="material-icons">edit</i>
- </button>
- }
- @if (editMode) {
- <button mat-icon-button color="accent" (click)="deleteLink()">
- <i class="material-icons">delete</i>
- </button>
- }
- </div>
- </div>
-</div>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.scss b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.scss
deleted file mode 100644
index 35b0494923..0000000000
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.scss
+++ /dev/null
@@ -1,36 +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.
- *
- */
-
-.link-type {
- background: var(--color-secondary);
- padding: 5px;
- border-radius: 5px;
-}
-
-.link-label {
- margin-right: 15px;
-}
-
-.link-icon {
- border-radius: 50%;
- width: 40px;
- height: 40px;
- padding: 5px;
- color: var(--color-bg-1);
- background: var(--color-bg-3);
-}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.ts
deleted file mode 100644
index 38865d745f..0000000000
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-item/asset-link-item.component.ts
+++ /dev/null
@@ -1,63 +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, EventEmitter, Input, Output } from '@angular/core';
-import { AssetLink, AssetLinkType } from '@streampipes/platform-services';
-import { Router } from '@angular/router';
-
-@Component({
- selector: 'sp-asset-link-item',
- templateUrl: './asset-link-item.component.html',
- styleUrls: ['./asset-link-item.component.scss'],
- standalone: false,
-})
-export class SpAssetLinkItemComponent {
- @Input()
- assetLink: AssetLink;
-
- @Input()
- assetLinkType: AssetLinkType;
-
- @Input()
- editMode: boolean;
-
- @Output()
- openEditAssetLinkEmitter: EventEmitter<AssetLink> =
- new EventEmitter<AssetLink>();
-
- @Output()
- deleteAssetLinkEmitter: EventEmitter<AssetLink> =
- new EventEmitter<AssetLink>();
-
- constructor(private router: Router) {}
-
- openLink(): void {
- this.router.navigate([
- ...this.assetLinkType.navPaths,
- this.assetLink.resourceId,
- ]);
- }
-
- editLink(): void {
- this.openEditAssetLinkEmitter.emit(this.assetLink);
- }
-
- deleteLink(): void {
- this.deleteAssetLinkEmitter.emit(this.assetLink);
- }
-}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.html
deleted file mode 100644
index 0c9715cb86..0000000000
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.html
+++ /dev/null
@@ -1,43 +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 class="asset-section">
- <div class="section-header">{{ assetLinkType.linkLabel }}</div>
- @for (
- link of asset.assetLinks | assetTypeFilter: assetLinkType.linkType;
- track link
- ) {
- <div
- fxLayout="column"
- class="asset-section-entry"
- data-cy="linked-resources-list"
- >
- <sp-asset-link-item
- [assetLink]="link"
- [assetLinkType]="assetLinkType"
- [editMode]="editMode"
- (openEditAssetLinkEmitter)="
- openEditAssetLinkEmitter.emit($event)
- "
- (deleteAssetLinkEmitter)="deleteAssetLink($event)"
- class="asset-link-item"
- >
- </sp-asset-link-item>
- </div>
- }
-</div>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.scss b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.scss
deleted file mode 100644
index 6c7baa919a..0000000000
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.scss
+++ /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.
- *
- */
-
-.section-header {
- font-weight: bold;
- margin-bottom: 10px;
- color: var(--color-default-text);
-}
-
-.asset-section {
- margin-bottom: 10px;
- margin-top: 10px;
- padding: 10px;
- border: 1px solid var(--color-bg-2);
-}
-
-.asset-section-entry {
- margin-top: 5px;
- margin-bottom: 5px;
-}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.html
index 31fd5f8a93..679bfb6b87 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.html
@@ -48,50 +48,19 @@
><span> {{ 'Save' | translate }}</span>
</button>
</div>
- <div
- fxLayout="row"
- class="navbar-margin"
- fxLayoutAlign="end center"
- >
- <nav mat-tab-nav-bar color="accent">
- <a
- mat-tab-link
- data-cy="basic-tab"
- [active]="activeTab === 'basic'"
- (click)="activeTab = 'basic'"
- >{{ 'Basics' | translate }}</a
- >
- <a
- mat-tab-link
- data-cy="asset-links-tab"
- [active]="activeTab === 'asset-links'"
- (click)="activeTab = 'asset-links'"
- >Asset Links</a
- >
- </nav>
- </div>
</div>
<div fxFlex fxLayout="row" fxLayoutAlign="end center"></div>
</div>
@if (asset) {
- <div fxFlex="100" fxLayout="column">
- @if (activeTab === 'basic') {
- <sp-asset-details-basics
- [asset]="selectedAsset"
- [sites]="sites"
- [rootNode]="rootNode"
- [editMode]="true"
- >
- </sp-asset-details-basics>
- }
- @if (activeTab === 'asset-links') {
- <sp-asset-details-links
- [asset]="selectedAsset"
- [editMode]="true"
- (updateAssetEmitter)="updateSelected()"
- >
- </sp-asset-details-links>
- }
+ <div fxFlex="100" fxLayout="column" class="p-10">
+ <sp-asset-details-basics
+ [asset]="selectedAsset"
+ [assetModel]="asset"
+ [sites]="sites"
+ [rootNode]="rootNode"
+ [editMode]="true"
+ >
+ </sp-asset-details-basics>
</div>
}
</sp-basic-view>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.ts
index 401a2f272a..6c71d33b1b 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.ts
@@ -24,21 +24,28 @@ import { BaseAssetDetailsDirective } from '../base-asset-details.directive';
@Component({
selector: 'sp-asset-details',
templateUrl: './asset-details.component.html',
- styleUrls: ['./asset-details.component.scss'],
standalone: false,
})
export class SpAssetDetailsComponent extends BaseAssetDetailsDirective {
- activeTab = 'basic';
-
private router = inject(Router);
private assetBrowserService = inject(SpAssetBrowserService);
saveAsset() {
+ this.cleanupEmpty();
this.assetService.updateAsset(this.asset).subscribe(res => {
this.assetBrowserService.loadAssetData();
this.router.navigate(['assets']);
});
}
+ cleanupEmpty(): void {
+ if (this.asset.additionalData?.customFields) {
+ this.asset.additionalData!.customFields =
+ this.asset.additionalData.customFields.filter(
+ f => f.key?.trim() || f.value?.trim(),
+ );
+ }
+ }
+
onAssetAvailable() {}
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.html
similarity index 57%
copy from ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.html
copy to ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.html
index 0a90a9427d..37639c5a8e 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.html
@@ -16,16 +16,21 @@
~
-->
-<div fxLayout="column" class="box" [ngStyle]="boxStyle">
- <div fxLayout="column" fxFlex class="box-content" fxLayoutGap="10px">
- <i class="material-icons icon-size" [ngStyle]="linkStyle">{{
- linkType.linkIcon
- }}</i>
- <span class="link-label">{{ assetLink.linkLabel }}</span>
- </div>
- <div fxLayout="row" fxLayoutAlign="end end">
- <button mat-icon-button color="accent" (click)="navigate()">
- <mat-icon>visibility</mat-icon>
- </button>
+<div fxLayout="column" class="asset-selection-outer">
+ <div fxLayout="column" class="m-md">
+ @for (option of flatAssets; track option.asset.assetId) {
+ <div
+ class="option-content p-md"
+ [style.padding-left.px]="option.depth * 12"
+ (click)="selectAsset(option.asset)"
+ >
+ <mat-icon class="option-icon">
+ {{ option.depth === 0 ? 'home' : 'account_tree' }}
+ </mat-icon>
+ <span class="option-label">
+ {{ option.label }}
+ </span>
+ </div>
+ }
</div>
</div>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.scss b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.scss
similarity index 71%
rename from ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.scss
rename to ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.scss
index 68f6a06c18..8893563c6f 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details.component.scss
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.scss
@@ -1,4 +1,4 @@
-/*
+/*!
* 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.
@@ -16,22 +16,28 @@
*
*/
-.asset-details-panel {
+.option-content {
display: flex;
- flex-direction: column;
- flex: 1 1 100%;
+ align-items: center;
+ gap: 8px;
}
-.asset-details-container {
- width: 100%;
- height: 100%;
- background: var(--color-bg-0);
+.option-content:hover {
+ background: var(--color-bg-2);
+ cursor: pointer;
}
-.asset-tree-panel {
- width: 400px;
+.asset-selection-outer {
+ max-height: 400px;
+ overflow-y: auto;
}
-.navbar-margin {
- margin-left: 25px;
+.option-icon {
+ font-size: 18px;
+ width: 18px;
+ height: 18px;
+}
+
+.option-label {
+ font-size: var(--font-size-md);
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.ts
new file mode 100644
index 0000000000..23963a6594
--- /dev/null
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-menu/asset-selection-menu.component.ts
@@ -0,0 +1,104 @@
+/*
+ * 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, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { SpAsset, SpAssetModel } from '@streampipes/platform-services';
+
+@Component({
+ selector: 'sp-asset-selection-menu',
+ templateUrl: './asset-selection-menu.component.html',
+ styleUrls: ['./asset-selection-menu.component.scss'],
+ standalone: false,
+})
+export class SpAssetSelectionMenuComponent implements OnInit {
+ @Input()
+ assetModel: SpAssetModel;
+
+ @Input()
+ selectedAsset: SpAsset;
+
+ @Output()
+ closeMenu = new EventEmitter<void>();
+
+ @Output()
+ assetSelected = new EventEmitter<{ asset: SpAsset; rootNode: boolean }>();
+
+ flatAssets: { asset: SpAsset; depth: number; label: string }[] = [];
+
+ ngOnInit() {
+ this.rebuildFlatAssets();
+ }
+
+ private rebuildFlatAssets() {
+ if (!this.assetModel) {
+ this.flatAssets = [];
+ return;
+ }
+ this.flatAssets = this.flattenAssets(this.assetModel);
+ }
+
+ private flattenAssets(
+ asset: SpAsset,
+ depth = 0,
+ ): { asset: SpAsset; depth: number; label: string }[] {
+ const current = [
+ {
+ asset,
+ depth,
+ label: asset.assetName,
+ },
+ ];
+
+ const children =
+ asset.assets?.flatMap(child =>
+ this.flattenAssets(child, depth + 1),
+ ) || [];
+
+ return [...current, ...children];
+ }
+
+ selectNodeById(assetId: string) {
+ const target = this.findAssetById(this.assetModel, assetId);
+ if (target) {
+ const isRoot = target.assetId === this.assetModel.assetId;
+ //this.selectNode(target, isRoot);
+ //this.expandToAsset(assetId);
+ }
+ }
+
+ selectAsset(asset: SpAsset) {
+ this.assetSelected.emit({
+ asset,
+ rootNode: asset.assetId === this.assetModel.assetId,
+ });
+ }
+
+ private findAssetById(
+ asset: SpAsset,
+ assetId: string,
+ ): SpAsset | undefined {
+ if (asset.assetId === assetId) {
+ return asset;
+ }
+ for (const child of asset.assets || []) {
+ const found = this.findAssetById(child, assetId);
+ if (found) return found;
+ }
+ return undefined;
+ }
+}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.html b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.html
index 4d6058e7ca..04e6ce96d4 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.html
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.html
@@ -16,15 +16,27 @@
~
-->
-<div fxLayout="row">
+<div fxLayout="row" fxFlex="100">
@if (assetModel) {
- <div fxFlex="20" fxLayout="column" class="designer-panel-content">
- <sp-basic-view [showBackLink]="false">
- <div nav fxLayout="row">
- <h4 class="ml-5">Asset Hierarchy</h4>
+ <div fxFlex="30" fxLayout="column" class="designer-panel-content">
+ <sp-basic-view
+ class="w-100"
+ [showBackLink]="false"
+ [padding]="false"
+ >
+ <div nav fxLayout="row" fxLayoutAlign="space-between center">
+ <span class="txt-lg ml-md">{{
+ 'Select asset to view details' | translate
+ }}</span>
</div>
- <div fxFlex="100" fxLayout="column">
- <div fxFlex fxLayout="column" class="designer-panel-config">
+
+ <div
+ fxFlex="100"
+ class="w-100"
+ fxLayout="column"
+ fxLayoutGap="12px"
+ >
+ <div fxFlex="100" class="tree-wrapper">
<mat-tree
[dataSource]="dataSource"
[treeControl]="treeControl"
@@ -34,27 +46,46 @@
<mat-tree-node
*matTreeNodeDef="let node"
matTreeNodeToggle
+ class="tree-leaf"
>
<div
- [ngClass]="
+ class="asset-node"
+ [class.selected-node]="
node.assetId === selectedAsset.assetId
- ? 'asset-node selected-node'
- : 'asset-node'
"
- fxLayout="row"
- fxFlex="100"
[attr.data-cy]="
'select-asset-' + node.assetName
"
(click)="selectNode(node, false)"
>
- <span
- fxLayoutAlign="end center"
- class="ml-5"
- >{{ node.assetName }}</span
- >
+ <div class="node-main">
+ <mat-icon
+ class="node-icon"
+ [class.node-icon-selected]="
+ node.assetId ===
+ selectedAsset.assetId
+ "
+ color="primary"
+ >
+ device_hub
+ </mat-icon>
+ <div class="node-text">
+ <div
+ class="node-title"
+ [class.font-emphasized]="
+ node.assetId ===
+ selectedAsset.assetId
+ "
+ >
+ {{ node.assetName }}
+ </div>
+ <div class="node-meta">
+ {{ node.assetDescription }}
+ </div>
+ </div>
+ </div>
@if (editMode) {
- <div fxLayoutAlign="end center" fxFlex>
+ <div class="node-actions">
<button
mat-icon-button
[attr.data-cy]="
@@ -64,23 +95,20 @@
(click)="addAsset(node)"
color="accent"
>
- <i class="material-icons"
- >add</i
- >
+ <mat-icon>add</mat-icon>
</button>
<button
mat-icon-button
(click)="deleteAsset(node)"
color="accent"
>
- <i class="material-icons"
- >delete</i
- >
+ <mat-icon>delete</mat-icon>
</button>
</div>
}
</div>
</mat-tree-node>
+
<mat-nested-tree-node
*matTreeNodeDef="let node; when: hasChild"
>
@@ -88,8 +116,9 @@
<button
mat-icon-button
matTreeNodeToggle
+ class="node-toggle"
[attr.data-cy]="
- 'button-' + node.nodeName
+ 'button-' + node.assetName
"
[attr.aria-label]="
'Toggle ' + node.nodeName
@@ -104,24 +133,42 @@
</mat-icon>
</button>
<div
- [ngClass]="
- node.assetId ===
- selectedAsset.assetId
- ? 'asset-node selected-node'
- : 'asset-node'
+ class="asset-node"
+ [class.root-node]="
+ node.assetId === assetModel.assetId
"
- fxLayout="row"
- fxFlex="100"
(click)="selectNode(node, true)"
>
- <span fxLayoutAlign="start center">{{
- node.assetName
- }}</span>
- @if (editMode) {
- <div
- fxLayoutAlign="end center"
- fxFlex
+ <div class="node-main">
+ <mat-icon
+ class="node-icon"
+ [class.node-icon-selected]="
+ node.assetId ===
+ selectedAsset.assetId
+ "
>
+ account_tree
+ </mat-icon>
+ <div class="node-text">
+ <div
+ class="node-title"
+ [class.font-emphasized]="
+ node.assetId ===
+ selectedAsset.assetId
+ "
+ >
+ {{ node.assetName }}
+ </div>
+ </div>
+ @if (
+ node.assetId ===
+ assetModel.assetId
+ ) {
+ <span class="badge">Root</span>
+ }
+ </div>
+ @if (editMode) {
+ <div class="node-actions">
<button
mat-icon-button
(click)="addAsset(node)"
@@ -131,9 +178,7 @@
"
color="accent"
>
- <i class="material-icons"
- >add</i
- >
+ <mat-icon>add</mat-icon>
</button>
</div>
}
@@ -155,8 +200,8 @@
</div>
</sp-basic-view>
</div>
+ <div fxFlex="70">
+ <ng-content></ng-content>
+ </div>
}
- <div fxFlex>
- <ng-content></ng-content>
- </div>
</div>
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.scss b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.scss
index e0c8a4d063..1db8f2adc0 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.scss
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.scss
@@ -16,21 +16,20 @@
*
*/
-.designer-panel-content {
- padding: 0;
- overflow-y: auto;
+:host {
+ display: block;
+ height: 100%;
}
-.designer-panel-config {
+.designer-panel-content {
padding: 0;
+ overflow: hidden;
}
-.designer-panel-title {
- margin-left: 5px;
-}
-
-.designer-panel-header {
- border-bottom: 1px solid var(--color-tab-border);
+.tree-wrapper {
+ padding: 5px 5px 10px 2px;
+ overflow-y: auto;
+ flex: 1 1 auto;
}
.sp-tree-invisible {
@@ -45,18 +44,21 @@
}
.sp-tree .mat-nested-tree-node div[role='group'] {
- padding-left: 20px;
+ padding-left: 10px;
+ border-left: 1px solid var(--color-bg-2);
+ margin-left: 12px;
}
.sp-tree div[role='group'] > .mat-tree-node {
- padding-left: 20px;
+ padding-left: 6px;
}
.mat-tree-node {
- min-height: 35px;
+ min-height: 48px;
+ font-family: inherit;
}
-.mat-tree-node:hover {
+.mat-tree-node:hover .asset-node {
background: var(--color-bg-1);
}
@@ -64,6 +66,20 @@
font-weight: normal;
cursor: pointer;
width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ //border: 1px solid var(--color-bg-2);
+ border-radius: 10px;
+ padding: 8px 10px;
+ transition:
+ border-color 100ms ease,
+ box-shadow 100ms ease;
+ background: var(--color-bg-0);
+}
+
+.asset-node:hover {
+ border-color: var(--color-primary);
}
.asset-node-disabled {
@@ -71,7 +87,55 @@
cursor: default;
}
-.selected-node {
- font-family: 'Roboto-Bold', serif;
- font-weight: bolder;
+.root-node {
+ margin-left: -8px;
+}
+
+.badge {
+ background: var(--color-primary);
+ color: #fff;
+ border-radius: 10px;
+ padding: 2px 8px;
+ font-size: var(--font-size-xs);
+}
+
+.node-main {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+
+.node-icon {
+ background: var(--color-bg-2);
+ color: var(--color-primary);
+ border-radius: 8px;
+ padding: 4px;
+}
+
+.node-icon-selected {
+ background: color-mix(in srgb, var(--color-primary) 30%, white);
+ color: var(--color-primary);
+}
+
+.node-text {
+ display: flex;
+ flex-direction: column;
+}
+
+.node-title {
+ font-size: var(--font-size-md);
+}
+
+.node-meta {
+ font-size: var(--font-size-xs);
+ color: var(--fg-muted, #666);
+}
+
+.node-actions {
+ display: flex;
+ gap: 6px;
+}
+
+.node-toggle {
+ margin-right: 6px;
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.ts
index c4eac60536..2eee5cea20 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-selection-panel/asset-selection-panel.component.ts
@@ -59,13 +59,12 @@ export class SpAssetSelectionPanelComponent implements OnInit {
ngOnInit(): void {
this.treeControl = new NestedTreeControl<SpAsset>(node => node.assets);
this.dataSource = new MatTreeNestedDataSource<SpAsset>();
- this.dataSource.data = [this.assetModel];
- this.treeControl.dataNodes = [this.assetModel];
- this.treeControl.expandAll();
+ this.resetTree();
}
selectNode(asset: SpAsset, rootNode: boolean) {
this.selectedAssetEmitter.emit({ asset, rootNode });
+ this.expandToAsset(asset.assetId);
}
addAsset(node: SpAsset) {
@@ -78,6 +77,12 @@ export class SpAssetSelectionPanelComponent implements OnInit {
this.rerenderTree();
}
+ rerenderTree(): void {
+ this.dataSource.data = [];
+ this.dataSource.data = [this.assetModel];
+ this.treeControl.expandAll();
+ }
+
deleteAsset(node: SpAsset) {
this.removeAssetWithId(this.assetModel.assets, node.assetId);
this.rerenderTree();
@@ -95,12 +100,6 @@ export class SpAssetSelectionPanelComponent implements OnInit {
}
}
- rerenderTree(): void {
- this.dataSource.data = [];
- this.dataSource.data = [this.assetModel];
- this.treeControl.expandAll();
- }
-
makeNewAsset(): SpAsset {
return {
assetId: this.makeAssetId(),
@@ -118,4 +117,35 @@ export class SpAssetSelectionPanelComponent implements OnInit {
makeAssetId(): string {
return 'a' + Math.random().toString(36).substring(2, 9);
}
+
+ private resetTree() {
+ this.dataSource.data = [this.assetModel];
+ this.treeControl.dataNodes = [this.assetModel];
+ this.treeControl.expandAll();
+ }
+
+ private expandToAsset(assetId: string) {
+ const path = this.findPath(this.assetModel, assetId);
+ if (path) {
+ path.forEach(node => this.treeControl.expand(node));
+ }
+ }
+
+ private findPath(
+ node: SpAsset,
+ targetId: string,
+ path: SpAsset[] = [],
+ ): SpAsset[] | undefined {
+ const currentPath = [...path, node];
+ if (node.assetId === targetId) {
+ return currentPath;
+ }
+ for (const child of node.assets || []) {
+ const res = this.findPath(child, targetId, currentPath);
+ if (res) {
+ return res;
+ }
+ }
+ return undefined;
+ }
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.html b/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.html
new file mode 100644
index 0000000000..80103c9cc6
--- /dev/null
+++ b/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.html
@@ -0,0 +1,68 @@
+<!--
+ ~ 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 class="asset-root-banner" fxLayout="row" fxLayoutAlign="start center">
+ <div fxLayout="row" fxLayoutAlign="start stretch" fxFlex="100">
+ <div fxLayout="column" fxFlex="60">
+ <sp-basic-header-title-component
+ [level]="1"
+ [title]="assetModel.assetName"
+ [description]="assetModel.assetDescription"
+ >
+ </sp-basic-header-title-component>
+ <div class="banner-meta" fxLayout="row" fxLayoutGap="10px">
+ <sp-label
+ [labelText]="assetType"
+ icon="precision_manufacturing"
+ size="small"
+ >
+ </sp-label>
+ @if (assetModel.assetSite?.siteId) {
+ <sp-label
+ [labelText]="assetModel.assetSite?.area"
+ icon="location_on"
+ size="small"
+ >
+ </sp-label>
+ }
+ @if (assetModel.labelIds?.length > 0) {
+ <sp-view-asset-labels
+ [asset]="assetModel"
+ size="small"
+ ></sp-view-asset-labels>
+ }
+ </div>
+ </div>
+ <span fxFlex></span>
+ <div class="map-wrapper" fxFlex="40">
+ @if (locationConfig && assetModel.assetSite?.location) {
+ <sp-single-marker-map
+ class="h-100"
+ [mapHeight]="'100%'"
+ [locationConfig]="locationConfig"
+ [readonly]="true"
+ [assetLocation]="assetModel.assetSite.location"
+ ></sp-single-marker-map>
+ } @else {
+ <div class="map-empty text-md">
+ {{ 'No location defined for this asset yet.' | translate }}
+ </div>
+ }
+ </div>
+ </div>
+</div>
diff --git a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.scss b/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.scss
similarity index 66%
rename from ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.scss
rename to ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.scss
index ec7cdcc4b0..a25d1f0e66 100644
--- a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.scss
+++ b/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.scss
@@ -1,4 +1,4 @@
-/*
+/*!
* 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.
@@ -16,14 +16,34 @@
*
*/
-.link-configuration {
- padding: 10px;
- width: 100%;
- margin: 5px;
- background: var(--color-bg-1);
+.asset-root-banner {
+ display: flex;
+ align-items: stretch !important;
+ gap: 10px;
+ padding: 10px 12px;
+ margin: 4px 8px 0;
+}
+
+.banner-text {
+ min-width: 0;
+}
+
+.banner-meta {
+ margin-top: 4px;
+}
+
+.map-wrapper {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ min-width: 400px;
border: 1px solid var(--color-bg-3);
+ border-radius: 12px;
+ background: var(--color-bg-1);
+ overflow: hidden;
}
-.mb-0 {
- margin-bottom: 0;
+.map-empty {
+ padding: 24px;
+ color: var(--fg-muted, #666);
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.ts b/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.ts
similarity index 56%
rename from ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.ts
rename to ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.ts
index c9247cbe78..37e24d714b 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-link-section/asset-link-section.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/asset-top-banner/asset-top-banner.component.ts
@@ -16,36 +16,34 @@
*
*/
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, inject, Input, OnInit } from '@angular/core';
import {
- AssetLink,
- AssetLinkType,
- SpAsset,
+ Isa95TypeService,
+ LocationConfig,
+ SpAssetModel,
} from '@streampipes/platform-services';
@Component({
- selector: 'sp-asset-link-section',
- templateUrl: './asset-link-section.component.html',
- styleUrls: ['./asset-link-section.component.scss'],
+ selector: 'sp-asset-top-banner',
+ templateUrl: './asset-top-banner.component.html',
+ styleUrls: ['./asset-top-banner.component.scss'],
standalone: false,
})
-export class AssetLinkSectionComponent {
+export class SpAssetTopBannerComponent implements OnInit {
@Input()
- assetLinkType: AssetLinkType;
+ assetModel: SpAssetModel;
@Input()
- asset: SpAsset;
+ locationConfig: LocationConfig;
- @Input()
- editMode: boolean;
+ assetType = undefined;
- @Output()
- openEditAssetLinkEmitter: EventEmitter<AssetLink> =
- new EventEmitter<AssetLink>();
+ private isa95TypeService = inject(Isa95TypeService);
- deleteAssetLink(assetLink: AssetLink): void {
- const index = this.asset.assetLinks.indexOf(assetLink);
- this.asset.assetLinks.splice(index, 1);
- this.asset.assetLinks = [...this.asset.assetLinks];
+ ngOnInit() {
+ this.assetType =
+ this.isa95TypeService.toLabel(
+ this.assetModel.assetType.isa95AssetType,
+ ) || '';
}
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.html b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.html
index 916c7139bc..b7598282bd 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.html
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.html
@@ -16,58 +16,21 @@
~
-->
-<div fxLayout="column">
- <div class="asset-title">{{ rootAsset.assetName }}</div>
- <div class="asset-description">{{ rootAsset.assetDescription }}</div>
-
- <div fxLayout="column" class="asset-metadata mt-20">
- <div fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="start center">
- <mat-icon color="primary">precision_manufacturing</mat-icon>
- <div class="asset-description">{{ assetType }}</div>
- </div>
- <div fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="start center">
- <mat-icon color="primary">location_on</mat-icon>
- <div class="asset-description">{{ assetSite?.label || '-' }}</div>
+<div class="asset-hero" fxLayout="row" fxLayoutGap="20px">
+ <div fxFlex class="hero-text">
+ <div class="asset-title text-2xl">{{ selectedAsset.assetName }}</div>
+ <div class="asset-subtitle text-md">
+ {{ getDescription(selectedAsset) }}
</div>
- <div fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="start center">
- <mat-icon color="primary">factory</mat-icon>
- <div class="asset-description">
- {{ rootAsset.assetSite?.area || '-' }}
- </div>
+ <div class="meta-row" fxLayout="row" fxLayoutGap="10px" fxLayoutWrap>
+ <sp-label
+ [labelText]="selectedAssetType"
+ icon="precision_manufacturing"
+ >
+ </sp-label>
+ <sp-view-asset-labels
+ [asset]="selectedAsset"
+ ></sp-view-asset-labels>
</div>
</div>
-
- @if (selectedAsset.assetId !== rootAsset.assetId) {
- <div fxLayout="column" class="selected-asset-metadata mt-20">
- <div class="selected-asset-title">
- {{ selectedAsset.assetName }}
- </div>
- <div class="selected-asset-description">
- {{ selectedAsset.assetDescription }}
- </div>
- <div fxLayout="column" class="asset-metadata mt-20">
- <div
- fxLayout="row"
- fxLayoutGap="10px"
- fxLayoutAlign="start center"
- >
- <mat-icon color="primary">precision_manufacturing</mat-icon>
- <div class="asset-description">{{ selectedAssetType }}</div>
- </div>
- @if (selectedAsset.labelIds?.length > 0) {
- <div
- fxLayout="row"
- fxLayoutGap="10px"
- fxLayoutAlign="start center"
- >
- <mat-icon color="primary">sell</mat-icon>
- <sp-view-asset-labels
- [asset]="selectedAsset"
- size="small"
- ></sp-view-asset-labels>
- </div>
- }
- </div>
- </div>
- }
</div>
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.scss b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.scss
index 2a2c4c1a8f..cbc1a45108 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.scss
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-asset-basics.component.scss
@@ -16,33 +16,26 @@
*
*/
-.asset-title {
- font-size: 16pt;
- font-weight: bold;
- font-family: 'Roboto-Bold', sans-serif;
-}
-
-.asset-description {
- font-size: 12pt;
+.asset-hero {
+ border-radius: 12px;
+ padding: 16px 18px;
}
-.asset-metadata {
+.hero-text {
+ min-width: 0;
}
-.mt-20 {
- margin-top: 20px;
-}
-
-.selected-asset-title {
- font-size: 14pt;
- font-weight: bold;
- font-family: 'Roboto-Bold', sans-serif;
+.asset-title {
+ font-family: var(--font-emphasized), sans-serif;
+ font-weight: 700;
+ margin: 0;
}
-.selected-asset-description {
- font-size: 11pt;
+.asset-subtitle {
+ color: var(--fg-muted, #555);
+ margin: 6px 0 12px;
}
-.selected-asset-metadata {
- margin-top: 30px;
+.meta-row {
+ margin-top: 4px;
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts
index 0d1fc478a3..89fe0da194 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts
@@ -36,29 +36,23 @@ import {
standalone: false,
})
export class ViewAssetBasicsComponent implements OnInit, OnChanges {
- @Input()
- rootAsset: SpAsset;
-
@Input()
selectedAsset: SpAsset;
@Input()
sites: AssetSiteDesc[] = [];
- assetType: string;
selectedAssetType: string;
- assetSite: AssetSiteDesc;
constructor(private isa95TypeService: Isa95TypeService) {}
ngOnInit() {
- this.assetType =
- this.isa95TypeService.toLabel(
- this.rootAsset.assetType.isa95AssetType,
- ) || '';
- this.assetSite = this.sites.find(
- site => this.rootAsset.assetSite.siteId === site._id,
- );
+ // this.assetType =
+ // this.isa95TypeService.toLabel(
+ // this.rootAsset.assetType.isa95AssetType,
+ // ) || '';
+ //this.assetSite = this.getSite(this.rootAsset);
+ //this.selectedSite = this.getSite(this.selectedAsset);
}
ngOnChanges(changes: SimpleChanges) {
@@ -67,4 +61,15 @@ export class ViewAssetBasicsComponent implements OnInit, OnChanges {
this.selectedAsset.assetType.isa95AssetType,
) || '';
}
+
+ getDescription(asset: SpAsset): string {
+ return asset?.assetDescription || 'No description available.';
+ }
+
+ private getSite(asset: SpAsset): AssetSiteDesc | undefined {
+ if (!asset?.assetSite?.siteId) {
+ return undefined;
+ }
+ return this.sites.find(site => asset.assetSite.siteId === site._id);
+ }
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.scss b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.scss
deleted file mode 100644
index e598cfa608..0000000000
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.scss
+++ /dev/null
@@ -1,38 +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.
- *
- */
-
-.box {
- width: 340px;
- height: 140px;
- margin-bottom: 20px;
-}
-
-.box-content {
- padding: 10px;
-}
-
-.box-action {
-}
-
-.link-label {
- font-weight: normal;
-}
-
-.icon-size {
- font-size: 22pt;
-}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.html b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.html
similarity index 61%
rename from ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.html
rename to ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.html
index 0a90a9427d..9c6daf7b16 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.html
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.html
@@ -16,16 +16,9 @@
~
-->
-<div fxLayout="column" class="box" [ngStyle]="boxStyle">
- <div fxLayout="column" fxFlex class="box-content" fxLayoutGap="10px">
- <i class="material-icons icon-size" [ngStyle]="linkStyle">{{
- linkType.linkIcon
- }}</i>
- <span class="link-label">{{ assetLink.linkLabel }}</span>
- </div>
- <div fxLayout="row" fxLayoutAlign="end end">
- <button mat-icon-button color="accent" (click)="navigate()">
- <mat-icon>visibility</mat-icon>
- </button>
- </div>
+<div class="chip" [ngStyle]="{ color: accentColor }">
+ <mat-icon class="link-type-icon">{{
+ linkType?.linkIcon || 'link'
+ }}</mat-icon>
+ <span class="text-sm">{{ linkType?.linkLabel || 'Resource' }}</span>
</div>
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.scss b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.scss
similarity index 75%
rename from ui/src/app/assets/components/asset-details/view-asset/view-asset.component.scss
rename to ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.scss
index 2ecaf37498..b631b64ce6 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.scss
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.scss
@@ -16,12 +16,17 @@
*
*/
-.asset-info {
- margin: 10px;
- overflow-y: auto;
- max-height: 100%;
+.chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 3px 10px;
+ border-radius: 10px;
+ font-weight: 600;
}
-.ml-20 {
- margin-left: 20px;
+.link-type-icon {
+ font-size: var(--font-size-md);
+ height: var(--font-size-md);
+ width: var(--font-size-md);
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.ts
similarity index 61%
rename from ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.ts
rename to ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.ts
index b00b420cdd..6cc72ae344 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-card/asset-link-card.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table-link-type/asset-link-table-type.component.ts
@@ -16,42 +16,36 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnChanges } from '@angular/core';
import { AssetLink, AssetLinkType } from '@streampipes/platform-services';
-import { Router } from '@angular/router';
@Component({
- selector: 'sp-asset-link-card',
- templateUrl: './asset-link-card.component.html',
- styleUrls: ['./asset-link-card.component.scss'],
+ selector: 'sp-asset-link-table-type',
+ templateUrl: './asset-link-table-type.component.html',
+ styleUrls: ['./asset-link-table-type.component.scss'],
standalone: false,
})
-export class AssetLinkCardComponent implements OnInit {
+export class AssetLinkTableTypeComponent implements OnChanges {
@Input()
assetLink: AssetLink;
@Input()
- assetLinkTypes: AssetLinkType[] = [];
+ assetLinkTypes: AssetLinkType[];
linkType: AssetLinkType;
boxStyle: any;
linkStyle: any;
+ accentColor = 'var(--color-primary)';
+ backgroundColor = 'color-mix(in srgb, var(--color-primary) 20%, white);';
- constructor(private router: Router) {}
-
- ngOnInit() {
+ ngOnChanges() {
this.linkType = this.assetLinkTypes.find(
l => l.linkType === this.assetLink.linkType,
);
- this.boxStyle = { border: `1px solid ${this.linkType.linkColor}` };
- this.linkStyle = { color: this.linkType.linkColor };
- }
-
- navigate() {
- this.router.navigate([
- ...this.linkType.navPaths,
- this.assetLink.resourceId,
- ]);
+ this.accentColor = this.linkType?.linkColor || this.accentColor;
+ this.backgroundColor = `color-mix(in srgb, ${this.accentColor} 20%, white);`;
+ this.boxStyle = { border: `1px solid ${this.accentColor}` };
+ this.linkStyle = { color: this.accentColor };
}
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.html b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.html
new file mode 100644
index 0000000000..f8d2a79922
--- /dev/null
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.html
@@ -0,0 +1,105 @@
+<!--
+ ~ 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 fxFlex="100" fxLayout="row" fxLayoutAlign="center start">
+ <sp-table
+ fxFlex="100"
+ [columns]="displayedColumns"
+ [dataSource]="dataSource"
+ [showActionsMenu]="true"
+ [rowsClickable]="true"
+ (rowClicked)="openDetails($event)"
+ data-cy="all-adapters-table"
+ matSort
+ >
+ <ng-container matColumnDef="type">
+ <th mat-header-cell mat-sort-header *matHeaderCellDef>
+ {{ 'Type' | translate }}
+ </th>
+ <td mat-cell *matCellDef="let assetLink">
+ <div
+ fxLayout="column"
+ fxLayoutAlign="start start"
+ class="truncate"
+ >
+ <sp-asset-link-table-type
+ [assetLink]="assetLink"
+ [assetLinkTypes]="assetLinkTypes"
+ class="mt-sm mb-sm"
+ >
+ </sp-asset-link-table-type>
+ </div>
+ </td>
+ </ng-container>
+ <ng-container matColumnDef="linkLabel">
+ <th mat-header-cell mat-sort-header *matHeaderCellDef>
+ {{ 'Name' | translate }}
+ </th>
+ <td mat-cell *matCellDef="let assetLink">
+ <div
+ fxLayout="column"
+ fxLayoutAlign="start start"
+ class="truncate"
+ >
+ <span>{{ assetLink.linkLabel }}</span>
+ </div>
+ </td>
+ </ng-container>
+ <ng-container matColumnDef="additionalInfo">
+ <th mat-header-cell *matHeaderCellDef>Info</th>
+ <td mat-cell *matCellDef="let assetLink"></td>
+ </ng-container>
+
+ <ng-template spTableActions let-element>
+ <button
+ mat-menu-item
+ data-cy="details-asset-link"
+ (click)="openDetails(element)"
+ >
+ <mat-icon>visibility</mat-icon>
+ <span>{{ 'Details' | translate }}</span>
+ </button>
+ <button
+ mat-menu-item
+ data-cy="navigate-asset-link"
+ (click)="navigate(element)"
+ >
+ <mat-icon>open_in_new</mat-icon>
+ <span>{{ 'Navigate' | translate }}</span>
+ </button>
+ @if (editMode) {
+ <button
+ mat-menu-item
+ data-cy="edit-asset-link"
+ (click)="openEditAssetLinkDialog(element)"
+ >
+ <mat-icon>edit</mat-icon>
+ <span>{{ 'Edit' | translate }}</span>
+ </button>
+ <button
+ mat-menu-item
+ data-cy="delete-asset-link"
+ (click)="deleteAssetLink(element)"
+ >
+ <mat-icon>delete</mat-icon>
+ <span>{{ 'Delete' | translate }}</span>
+ </button>
+ }
+ </ng-template>
+ </sp-table>
+</div>
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts
new file mode 100644
index 0000000000..07e455c6f5
--- /dev/null
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts
@@ -0,0 +1,144 @@
+/*
+ * 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 {
+ AfterViewInit,
+ Component,
+ inject,
+ Input,
+ OnChanges,
+ OnInit,
+ SimpleChanges,
+ ViewChild,
+} from '@angular/core';
+import {
+ AssetLink,
+ AssetLinkType,
+ SpAsset,
+ SpAssetModel,
+} from '@streampipes/platform-services';
+import { MatSort } from '@angular/material/sort';
+import { MatTableDataSource } from '@angular/material/table';
+import { EditAssetLinkDialogComponent } from '../../../../../dialog/edit-asset-link/edit-asset-link-dialog.component';
+import { DialogService, PanelType } from '@streampipes/shared-ui';
+import { TranslateService } from '@ngx-translate/core';
+import { Router } from '@angular/router';
+
+@Component({
+ selector: 'sp-asset-link-table',
+ templateUrl: './asset-link-table.component.html',
+ standalone: false,
+})
+export class AssetLinkTableComponent
+ implements OnInit, AfterViewInit, OnChanges
+{
+ @Input()
+ assetModel: SpAssetModel;
+
+ @Input()
+ asset: SpAsset;
+
+ @Input()
+ assetLinkTypes: AssetLinkType[];
+
+ @Input()
+ editMode = false;
+
+ @ViewChild(MatSort)
+ sort: MatSort;
+
+ displayedColumns: string[] = [
+ 'type',
+ 'linkLabel',
+ 'additionalInfo',
+ 'actions',
+ ];
+
+ dataSource: MatTableDataSource<AssetLink> = new MatTableDataSource();
+
+ private dialogService = inject(DialogService);
+ private translateService = inject(TranslateService);
+ private router = inject(Router);
+
+ ngOnInit() {
+ this.dataSource.sortingDataAccessor = (link, column) => {
+ if (column === 'type') {
+ return link.linkType;
+ }
+ return link[column];
+ };
+ }
+
+ ngOnChanges(changes: SimpleChanges) {
+ this.refreshData();
+ }
+
+ ngAfterViewInit() {
+ setTimeout(() => {
+ this.dataSource.sort = this.sort;
+ });
+ }
+
+ refreshData(): void {
+ this.dataSource.data = this.asset.assetLinks;
+ }
+
+ openDetails(assetLink: AssetLink) {}
+
+ navigate(assetLink: AssetLink) {
+ const linkType = this.assetLinkTypes.find(
+ l => l.linkType === assetLink.linkType,
+ );
+ if (!linkType?.navPaths?.length) {
+ return;
+ }
+ this.router.navigate([...linkType.navPaths, assetLink.resourceId]);
+ }
+
+ openEditAssetLinkDialog(assetLink: AssetLink): void {
+ const index = this.asset.assetLinks.indexOf(assetLink);
+ const dialogRef = this.dialogService.open(
+ EditAssetLinkDialogComponent,
+ {
+ panelType: PanelType.SLIDE_IN_PANEL,
+ title: this.translateService.instant('Update asset links'),
+ width: '50vw',
+ data: {
+ assetLink: assetLink,
+ assetLinkTypes: this.assetLinkTypes,
+ createMode: false,
+ },
+ },
+ );
+
+ dialogRef.afterClosed().subscribe(storedLink => {
+ if (storedLink) {
+ this.asset.assetLinks[index] = storedLink;
+ this.asset.assetLinks = [...this.asset.assetLinks];
+ this.refreshData();
+ }
+ });
+ }
+
+ deleteAssetLink(assetLink: AssetLink): void {
+ const index = this.asset.assetLinks.indexOf(assetLink);
+ this.asset.assetLinks.splice(index, 1);
+ this.asset.assetLinks = [...this.asset.assetLinks];
+ this.refreshData();
+ }
+}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.html b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.html
index bc8e0b9377..48eceaf516 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.html
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.html
@@ -16,19 +16,43 @@
~
-->
-<div fxLayout="column">
- <div class="link-title">Resources</div>
- @if (assetLinkTypes.length > 0) {
- <div fxLayout="row wrap" class="mt-20" fxLayoutGap="20px">
- @for (link of selectedAsset.assetLinks; track link) {
- @if (link.navigationActive) {
- <sp-asset-link-card
- [assetLink]="link"
- [assetLinkTypes]="assetLinkTypes"
- >
- </sp-asset-link-card>
+<div fxLayout="column" class="links-wrapper">
+ <div class="link-header" fxLayout="row" fxLayoutAlign="space-between">
+ <sp-split-section
+ [level]="2"
+ [title]="'Linked Resources' | translate"
+ [subtitle]="
+ 'Adapters, dashboards, and other entries connected to this asset.'
+ | translate
+ "
+ >
+ <div section-actions>
+ @if (selectedAsset.assetLinks?.length > 0) {
+ <div class="link-pill">
+ {{ selectedAsset.assetLinks.length }} linked
+ </div>
}
+ </div>
+ @if (
+ assetLinkTypes.length > 0 &&
+ selectedAsset.assetLinks?.length > 0
+ ) {
+ <sp-asset-link-table
+ [asset]="selectedAsset"
+ [assetLinkTypes]="assetLinkTypes"
+ >
+ </sp-asset-link-table>
+ } @else {
+ <sp-alert-banner
+ type="info"
+ [title]="'No linked resources found.' | translate"
+ [description]="
+ 'Attach adapters, dashboards, or pipelines in the asset editor to surface them here.'
+ | translate
+ "
+ >
+ </sp-alert-banner>
}
- </div>
- }
+ </sp-split-section>
+ </div>
</div>
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.scss b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.scss
index 0c234fe26c..62746e62f7 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.scss
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/view-asset-links.component.scss
@@ -16,8 +16,47 @@
*
*/
+.links-wrapper {
+ gap: 12px;
+}
+
+.link-header {
+ margin-bottom: 6px;
+}
+
.link-title {
- font-size: 14pt;
- font-weight: bold;
- font-family: 'Roboto-Bold', sans-serif;
+ font-family: var(--font-emphasized), sans-serif;
+ font-weight: 700;
+ font-size: var(--font-size-xl);
+ margin: 0;
+}
+
+.link-subtitle {
+ color: var(--fg-muted, #555);
+ font-size: var(--font-size-sm);
+}
+
+.link-pill {
+ background: var(--color-bg-2);
+ border-radius: 999px;
+ padding: 6px 12px;
+ font-size: var(--font-size-sm);
+ align-self: center;
+}
+
+.link-empty {
+ padding: 14px;
+ border: 1px dashed var(--color-bg-3);
+ border-radius: 10px;
+ color: var(--fg-muted, #666);
+ background: var(--color-bg-1);
+ align-items: center;
+}
+
+.empty-title {
+ font-weight: 600;
+}
+
+.empty-subtitle {
+ font-size: var(--font-size-sm);
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.html b/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.html
index 35474eca7f..0fe7d4edd7 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.html
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.html
@@ -17,59 +17,74 @@
-->
@if (asset) {
- <sp-asset-selection-panel
- [editMode]="false"
- [assetModel]="asset"
- [selectedAsset]="selectedAsset"
- (selectedAssetEmitter)="applySelectedAsset($event)"
- >
+ <div fxLayout="column">
+ <sp-asset-top-banner
+ [assetModel]="asset"
+ [locationConfig]="locationConfig"
+ ></sp-asset-top-banner>
+
<sp-basic-view
[showBackLink]="true"
[backLinkTarget]="['assets']"
[padding]="false"
fxFlex="100"
>
+ <div nav fxLayoutAlign="start center" fxFlex="100">
+ @if (asset) {
+ <span fxFlex></span>
+ <button
+ mat-flat-button
+ class="mat-basic ml-md"
+ color="secondary"
+ data-cy="filter-button"
+ [matMenuTriggerFor]="menu"
+ #menuTrigger="matMenuTrigger"
+ [matTooltip]="'Show subassets' | translate"
+ (menuClosed)="menuTrigger.closeMenu()"
+ >
+ <span>{{ selectedAsset.assetName }}</span>
+ <mat-icon>expand_circle_down</mat-icon>
+ </button>
+ <mat-menu #menu="matMenu" fxFlex="100" class="large-menu">
+ <sp-asset-selection-menu
+ (assetSelected)="applySelectedAsset($event)"
+ [assetModel]="asset"
+ [selectedAsset]="selectedAsset"
+ >
+ </sp-asset-selection-menu>
+ </mat-menu>
+ }
+ </div>
@if (selectedAsset) {
- <div fxLayout="row" fxFlex="100">
- <div
- fxFlex="66"
- fxLayoutAlign="start start"
- class="asset-info"
+ <div
+ fxLayout="column"
+ class="page-container-padding-inner p-10"
+ >
+ @if (selectedAsset.assetId !== asset.assetId) {
+ <sp-view-asset-basics
+ [sites]="sites"
+ [selectedAsset]="selectedAsset"
+ fxFlex="100"
+ ></sp-view-asset-basics>
+ }
+ @if (asset.additionalData.customFields) {
+ <sp-split-section
+ [level]="2"
+ [title]="'Custom fields' | translate"
+ >
+ <sp-asset-details-custom-fields
+ [asset]="selectedAsset"
+ [editMode]="false"
+ ></sp-asset-details-custom-fields>
+ </sp-split-section>
+ }
+ <sp-view-asset-links
+ [selectedAsset]="selectedAsset"
+ class="w-100"
>
- <div fxLayout="column" class="w-100 ml-20">
- <div fxLayout="row" fxFlex="100">
- <sp-view-asset-basics
- [rootAsset]="asset"
- [sites]="sites"
- [selectedAsset]="selectedAsset"
- fxFlex="100"
- ></sp-view-asset-basics>
- @if (asset.labelIds?.length > 0) {
- <sp-view-asset-labels
- [asset]="asset"
- fxFlex
- ></sp-view-asset-labels>
- }
- </div>
- <sp-view-asset-links
- [selectedAsset]="selectedAsset"
- class="mt-20"
- >
- </sp-view-asset-links>
- </div>
- </div>
- <div fxFlex="33">
- @if (locationConfig && asset.assetSite?.location) {
- <sp-single-marker-map
- [mapHeight]="'100%'"
- [locationConfig]="locationConfig"
- [readonly]="true"
- [assetLocation]="asset.assetSite.location"
- ></sp-single-marker-map>
- }
- </div>
+ </sp-view-asset-links>
</div>
}
</sp-basic-view>
- </sp-asset-selection-panel>
+ </div>
}
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.ts
index bd2555907c..345fcba9f2 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset.component.ts
@@ -21,12 +21,12 @@ import { BaseAssetDetailsDirective } from '../base-asset-details.directive';
import {
LocationConfig,
LocationConfigService,
+ SpAsset,
} from '@streampipes/platform-services';
@Component({
selector: 'sp-view-asset',
templateUrl: './view-asset.component.html',
- styleUrls: ['./view-asset.component.scss'],
standalone: false,
})
export class SpViewAssetComponent extends BaseAssetDetailsDirective {
@@ -39,4 +39,14 @@ export class SpViewAssetComponent extends BaseAssetDetailsDirective {
.getLocationConfig()
.subscribe(config => (this.locationConfig = config));
}
+
+ getSubassetCount(asset: SpAsset): number {
+ if (!asset?.assets || asset.assets.length === 0) {
+ return 0;
+ }
+ return asset.assets.reduce(
+ (sum, child) => sum + 1 + this.getSubassetCount(child),
+ 0,
+ );
+ }
}
diff --git a/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.html b/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.html
index 4fcb4101c6..67c2d43431 100644
--- a/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.html
+++ b/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.html
@@ -24,23 +24,28 @@
fxLayout="column"
style="margin: 5px; width: 100%"
>
- <mat-form-field class="full-width" color="accent">
- <mat-label>{{ 'Asset Name' | translate }}</mat-label>
- <input
- matInput
- data-cy="asset-name"
- [(ngModel)]="assetModel.assetName"
- />
- </mat-form-field>
- <mat-form-field class="full-width" color="accent">
- <mat-label>{{ 'Description' | translate }}</mat-label>
- <input matInput [(ngModel)]="assetModel.assetDescription" />
- </mat-form-field>
+ <sp-form-field [level]="2" [label]="'Asset Name' | translate">
+ <mat-form-field>
+ <input
+ matInput
+ data-cy="asset-name"
+ [(ngModel)]="assetModel.assetName"
+ />
+ </mat-form-field>
+ </sp-form-field>
+ <sp-form-field [level]="2" [label]="'Description' | translate">
+ <mat-form-field>
+ <input
+ matInput
+ [(ngModel)]="assetModel.assetDescription"
+ />
+ </mat-form-field>
+ </sp-form-field>
</div>
</div>
</div>
<mat-divider></mat-divider>
- <div class="sp-dialog-actions actions-align-left">
+ <div class="sp-dialog-actions actions-align-left" fxLayoutGap="10px">
<button
mat-button
mat-flat-button
diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html
index 4ac80a0474..5e56960d0a 100644
--- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html
+++ b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.html
@@ -20,9 +20,8 @@
<div class="sp-dialog-content p-15 mt-10">
@if (clonedAssetLink) {
<div fxFlex="100" fxLayout="column">
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" [label]="'Link Type' | translate">
<mat-form-field color="accent">
- <mat-label>Link Type</mat-label>
<mat-select
fxFlex
[(value)]="selectedLinkType"
@@ -39,11 +38,10 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
@if (selectedLinkType.linkQueryHint === 'pipeline') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" label="Pipelines">
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Pipelines</mat-label>
<mat-select
[(ngModel)]="currentResource"
fxFlex
@@ -63,12 +61,14 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
@if (selectedLinkType.linkQueryHint === 'data-source') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field
+ [level]="3"
+ [label]="'Data Stream' | translate"
+ >
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Data Stream</mat-label>
<mat-select
(selectionChange)="
changeLabel(
@@ -88,12 +88,14 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
@if (selectedLinkType.linkQueryHint === 'dashboard') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field
+ [level]="3"
+ [label]="'Dashboard' | translate"
+ >
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Dashboards</mat-label>
<mat-select
(selectionChange)="
changeLabel(
@@ -116,12 +118,11 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
@if (selectedLinkType.linkQueryHint === 'chart') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" [label]="'Chart' | translate">
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Chart</mat-label>
<mat-select
(selectionChange)="
changeLabel(
@@ -141,12 +142,11 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
@if (selectedLinkType.linkQueryHint === 'adapter') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" [label]="'Adapter' | translate">
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Adapter</mat-label>
<mat-select
(selectionChange)="
changeLabel(
@@ -166,12 +166,11 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
@if (selectedLinkType.linkQueryHint === 'measurement') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" [label]="'Dataset' | translate">
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Data Lake Storage</mat-label>
<mat-select
(selectionChange)="
changeLabel(
@@ -194,12 +193,11 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
@if (selectedLinkType.linkQueryHint === 'file') {
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" [label]="'Files' | translate">
<mat-form-field color="accent" fxFlex="100">
- <mat-label>Files</mat-label>
<mat-select
(selectionChange)="
changeLabel(
@@ -219,11 +217,10 @@
}
</mat-select>
</mat-form-field>
- </div>
+ </sp-form-field>
}
- <div fxLayout="column" class="link-configuration">
+ <sp-form-field [level]="3" [label]="'Label' | translate">
<mat-form-field color="accent">
- <mat-label>Label</mat-label>
<input
matInput
[(ngModel)]="clonedAssetLink.linkLabel"
@@ -231,10 +228,9 @@
required
/>
</mat-form-field>
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-form-field>
+ <sp-form-field [level]="3" [label]="'Resource ID' | translate">
<mat-form-field color="accent">
- <mat-label>Resource ID</mat-label>
<input
matInput
[(ngModel)]="clonedAssetLink.resourceId"
@@ -242,8 +238,7 @@
[disabled]="true"
/>
</mat-form-field>
- </div>
- <div fxFlex="100"></div>
+ </sp-form-field>
</div>
}
</div>
diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.scss b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.scss
deleted file mode 100644
index dea25dfb80..0000000000
--- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.scss
+++ /dev/null
@@ -1,21 +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.
- *
- */
-s .link-configuration {
- width: 100%;
- margin: 5px;
-}
diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
index 0ab53edb97..c1d66b6979 100644
--- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
+++ b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
@@ -37,7 +37,6 @@ import { BaseAssetLinksDirective } from '../base-asset-links.directive';
@Component({
selector: 'sp-edit-asset-link-dialog-component',
templateUrl: './edit-asset-link-dialog.component.html',
- styleUrls: ['./edit-asset-link-dialog.component.scss'],
standalone: false,
})
export class EditAssetLinkDialogComponent
diff --git a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.html b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.html
index 93fd905c43..44353b24ac 100644
--- a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.html
+++ b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.html
@@ -20,48 +20,39 @@
<div class="sp-dialog-content p-15">
@if (clonedAssetLinks) {
<div fxFlex="100" fxLayout="column">
- <div fxLayout="column" class="link-configuration">
+ <sp-split-section [level]="3" [title]="'Adapters' | translate">
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
- fxFlex="100"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Adapters</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- adapters,
- elementIdFunction,
- nameFunction,
- 'adapter'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="
- deselectAll(adapters, elementIdFunction)
- "
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ adapters,
+ elementIdFunction,
+ nameFunction,
+ 'adapter'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="deselectAll(adapters, elementIdFunction)"
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
@for (element of adapters; track element) {
<div fxLayout="row">
@@ -84,46 +75,40 @@
</mat-checkbox>
</div>
}
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-split-section>
+ <sp-split-section [level]="3" [title]="'Charts' | translate">
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Charts</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- charts,
- elementIdFunction,
- widgetNameFunction,
- 'chart'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="deselectAll(charts, elementIdFunction)"
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ charts,
+ elementIdFunction,
+ widgetNameFunction,
+ 'chart'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="deselectAll(charts, elementIdFunction)"
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
@for (element of charts; track element) {
<div fxLayout="row">
@@ -144,49 +129,45 @@
</mat-checkbox>
</div>
}
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-split-section>
+ <sp-split-section
+ [level]="3"
+ [title]="'Dashboards' | translate"
+ >
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Dashboards</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- dashboards,
- elementIdFunction,
- nameFunction,
- 'dashboard'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="
- deselectAll(dashboards, elementIdFunction)
- "
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ dashboards,
+ elementIdFunction,
+ nameFunction,
+ 'dashboard'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="deselectAll(dashboards, elementIdFunction)"
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
+
@for (element of dashboards; track element) {
<div fxLayout="row">
<mat-checkbox
@@ -205,51 +186,45 @@
</mat-checkbox>
</div>
}
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-split-section>
+ <sp-split-section
+ [level]="3"
+ [title]="'Data Lake Storage' | translate"
+ >
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Data Lake Storage</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- dataLakeMeasures,
- elementIdFunction,
- measureNameFunction,
- 'measurement'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="
- deselectAll(
- dataLakeMeasures,
- elementIdFunction
- )
- "
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ dataLakeMeasures,
+ elementIdFunction,
+ measureNameFunction,
+ 'measurement'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="
+ deselectAll(dataLakeMeasures, elementIdFunction)
+ "
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
@for (element of dataLakeMeasures; track element) {
<div fxLayout="row">
@@ -269,48 +244,45 @@
</mat-checkbox>
</div>
}
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-split-section>
+ <sp-split-section
+ [level]="3"
+ [title]="'Data Streams' | translate"
+ >
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Data Streams</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- dataSources,
- elementIdFunction,
- nameFunction,
- 'data-source'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="
- deselectAll(dataSources, elementIdFunction)
- "
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ dataSources,
+ elementIdFunction,
+ nameFunction,
+ 'data-source'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="
+ deselectAll(dataSources, elementIdFunction)
+ "
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
@for (source of dataSources; track source) {
<div fxLayout="row">
@@ -333,46 +305,40 @@
</mat-checkbox>
</div>
}
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-split-section>
+ <sp-split-section [level]="3" [title]="'Files' | translate">
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Files</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- files,
- fileIdFunction,
- filenameFunction,
- 'file'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="deselectAll(files, fileIdFunction)"
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ files,
+ fileIdFunction,
+ filenameFunction,
+ 'file'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="deselectAll(files, fileIdFunction)"
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
@for (element of files; track element) {
<div fxLayout="row">
@@ -392,48 +358,40 @@
</mat-checkbox>
</div>
}
- </div>
- <div fxLayout="column" class="link-configuration">
+ </sp-split-section>
+ <sp-split-section [level]="3" [title]="'Pipelines' | translate">
<div
+ section-actions
fxLayout="row"
- fxLayoutAlign="start center"
- class="mb-10"
+ fxLayoutAlign="end center"
+ fxFlex
>
- <div fxLayout="row" fxLayoutAlign="start center">
- <span class="general-options-header mb-0"
- >Pipelines</span
- >
- </div>
- <div fxLayout="row" fxLayoutAlign="end center" fxFlex>
- <button
- mat-button
- mat-flat-button
- color="accent"
- class="small-button"
- (click)="
- selectAll(
- pipelines,
- elementIdFunction,
- nameFunction,
- 'pipeline'
- )
- "
- style="margin-right: 5px; margin-left: 15px"
- >
- <span>{{ 'Select All' | translate }}</span>
- </button>
- <button
- mat-button
- mat-flat-button
- class="mat-basic small-button"
- (click)="
- deselectAll(pipelines, elementIdFunction)
- "
- style="margin-right: 10px; margin-left: 5px"
- >
- <span>{{ 'Deselect All' | translate }}</span>
- </button>
- </div>
+ <button
+ mat-button
+ mat-flat-button
+ color="accent"
+ class="small-button"
+ (click)="
+ selectAll(
+ pipelines,
+ elementIdFunction,
+ nameFunction,
+ 'pipeline'
+ )
+ "
+ style="margin-right: 5px; margin-left: 15px"
+ >
+ <span>{{ 'Select All' | translate }}</span>
+ </button>
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic small-button"
+ (click)="deselectAll(pipelines, elementIdFunction)"
+ style="margin-right: 10px; margin-left: 5px"
+ >
+ <span>{{ 'Deselect All' | translate }}</span>
+ </button>
</div>
@for (pipeline of pipelines; track pipeline) {
<div fxLayout="row">
@@ -452,7 +410,7 @@
</mat-checkbox>
</div>
}
- </div>
+ </sp-split-section>
</div>
}
</div>
diff --git a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts
index 48d8afa94f..698ae5ad75 100644
--- a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts
+++ b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts
@@ -35,7 +35,6 @@ import { BaseAssetLinksDirective } from '../base-asset-links.directive';
@Component({
selector: 'sp-manage-asset-links-dialog-component',
templateUrl: './manage-asset-links-dialog.component.html',
- styleUrls: ['./manage-asset-links-dialog.component.scss'],
standalone: false,
})
export class SpManageAssetLinksDialogComponent
diff --git a/ui/src/app/core-ui/single-marker-map/single-marker-map.component.ts b/ui/src/app/core-ui/single-marker-map/single-marker-map.component.ts
index 561a690471..374a429715 100644
--- a/ui/src/app/core-ui/single-marker-map/single-marker-map.component.ts
+++ b/ui/src/app/core-ui/single-marker-map/single-marker-map.component.ts
@@ -25,7 +25,6 @@ import {
MapOptions,
marker,
Marker,
- tileLayer,
} from 'leaflet';
import {
AssetLocation,
@@ -80,6 +79,7 @@ export class SingleMarkerMapComponent implements OnInit, ControlValueAccessor {
this.locationConfig,
),
zoom: this.assetLocation.zoom || 1,
+ zoomControl: !this.readonly,
center: {
lat: this.assetLocation.coordinates.latitude,
lng: this.assetLocation.coordinates.longitude,
@@ -104,8 +104,10 @@ export class SingleMarkerMapComponent implements OnInit, ControlValueAccessor {
onMapReady(map: Map) {
this.map = map;
this.map.attributionControl.setPrefix('');
- this.map.invalidateSize();
this.addMarker(this.assetLocation.coordinates);
+ setTimeout(() => {
+ this.map.invalidateSize();
+ }, 0);
}
onZoomChange(zoom: number): void {
diff --git a/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.ts b/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.ts
index 4bcc8c1071..accc6d5ee3 100644
--- a/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.ts
+++ b/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.ts
@@ -136,7 +136,6 @@ export class DatalakeConfigurationComponent implements OnInit {
if (measurement?.retentionTime != null) {
entry.retention = measurement.retentionTime;
}
- console.log(entry.retention);
inUseMeasurements.forEach(inUseMeasurement => {
if (
inUseMeasurement.measureName ===
diff --git a/ui/src/app/editor/editor.component.scss b/ui/src/app/editor/editor.component.scss
index 09c9490270..23cf249c67 100644
--- a/ui/src/app/editor/editor.component.scss
+++ b/ui/src/app/editor/editor.component.scss
@@ -22,6 +22,8 @@
.page-container {
border: 0;
+ min-height: calc(100% - 20px);
+ margin: 10px;
}
.border {
diff --git a/ui/src/scss/sp/main.scss b/ui/src/scss/sp/main.scss
index 1f5391fa08..165a199a3e 100644
--- a/ui/src/scss/sp/main.scss
+++ b/ui/src/scss/sp/main.scss
@@ -145,8 +145,8 @@ md-content {
.page-container {
margin: 10px;
- min-height: calc(100% - 40px);
- background: var(--color-bg-page-container);
+ min-height: calc(100% - 20px);
+ background: var(--color-bg-main-panel-content);
}
.page-container-padding-inner {