Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add user hint to data view selection panel if no data view is p… #3406

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@
<div class="scroll-tab-content">
<sp-data-explorer-data-view-selection
(addDataViewEmitter)="addDataViewEmitter.emit($event)"
fxFlex="100"
>
</sp-data-explorer-data-view-selection>
</div>
</mat-tab>
<mat-tab data-cy="designer-panel-data-config" label="Layout">
<div class="scroll-tab-content">Layout</div>
</mat-tab>
</mat-tab-group>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,28 @@
-->

<div fxFlex="100" class="m-10" fxLayoutGap="10px" fxLayout="column">
<div *ngFor="let dataView of dataViews">
<sp-data-explorer-data-view-preview
[dataView]="dataView"
(addDataViewEmitter)="addDataViewEmitter.emit($event)"
>
</sp-data-explorer-data-view-preview>
</div>
@if (dataViews.length > 0) {
<div *ngFor="let dataView of dataViews">
<sp-data-explorer-data-view-preview
[dataView]="dataView"
(addDataViewEmitter)="addDataViewEmitter.emit($event)"
>
</sp-data-explorer-data-view-preview>
</div>
} @else {
<div fxLayoutAlign="center center" fxLayout="column" fxFlex="100">
<span class="no-widget-hint"
>No data views found - create a new data view first to add it to
this dashboard.</span
>
<button
mat-button
color="accent"
class="mt-10"
(click)="navigateToDataViewCreation()"
>
Create Data View
</button>
</div>
}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
.m-10 {
margin: 10px;
}

.no-widget-hint {
font-size: 10pt;
text-align: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
DataExplorerWidgetModel,
DataViewDataExplorerService,
} from '@streampipes/platform-services';
import { Router } from '@angular/router';

@Component({
selector: 'sp-data-explorer-data-view-selection',
Expand All @@ -33,7 +34,10 @@ export class DataExplorerDataViewSelectionComponent implements OnInit {

dataViews: DataExplorerWidgetModel[] = [];

constructor(private dataViewService: DataViewDataExplorerService) {}
constructor(
private dataViewService: DataViewDataExplorerService,
private router: Router,
) {}

ngOnInit() {
this.dataViewService.getAllWidgets().subscribe(dataViews => {
Expand All @@ -44,4 +48,11 @@ export class DataExplorerDataViewSelectionComponent implements OnInit {
);
});
}

navigateToDataViewCreation(): void {
this.router.navigate(['dataexplorer', 'data-view'], {
queryParams: { editMode: true },
state: { omitConfirm: true },
});
}
}
Loading