You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2026/04/02 13:49:27 UTC
(streampipes) branch dev updated: Feat: added shortcuts to existing component, and added edit and delet button in pipeline panel (just like dashboard) (#4271)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new caa5e2024d Feat: added shortcuts to existing component, and added edit and delet button in pipeline panel (just like dashboard) (#4271)
caa5e2024d is described below
commit caa5e2024d44846a07ae7be787dc2c6eafce375e
Author: Nguyen-Bang Vu <74...@users.noreply.github.com>
AuthorDate: Thu Apr 2 15:49:21 2026 +0200
Feat: added shortcuts to existing component, and added edit and delet button in pipeline panel (just like dashboard) (#4271)
Co-authored-by: Philipp Zehnder <te...@users.noreply.github.com>
---
.../chart/advancedFilterExpressions.smoke.spec.ts | 13 +++
.../lib/dialog/base-dialog/base-dialog.service.ts | 34 ++++++-
.../confirm-dialog/confirm-dialog.component.ts | 7 +-
.../src/lib/services/keyboard-shortcut.service.ts | 105 +++++++++++++++++++++
.../streampipes/shared-ui/src/public-api.ts | 1 +
.../charts/table/table-widget.component.ts | 26 +++++
.../components/chart-view/chart-view.component.ts | 20 ++++
.../components/panel/dashboard-panel.component.ts | 27 ++++++
.../pipeline-assembly.component.ts | 23 ++++-
.../components/pipeline/pipeline.component.ts | 27 ++++++
.../pipeline-details-toolbar.component.html | 32 +++++++
.../pipeline-details-toolbar.component.ts | 15 ++-
.../pipeline-details.component.html | 2 +
.../pipeline-details/pipeline-details.component.ts | 32 ++++++-
14 files changed, 354 insertions(+), 10 deletions(-)
diff --git a/ui/cypress/tests/chart/advancedFilterExpressions.smoke.spec.ts b/ui/cypress/tests/chart/advancedFilterExpressions.smoke.spec.ts
index 70f4a3c00b..6e0419da41 100644
--- a/ui/cypress/tests/chart/advancedFilterExpressions.smoke.spec.ts
+++ b/ui/cypress/tests/chart/advancedFilterExpressions.smoke.spec.ts
@@ -78,6 +78,19 @@ describe('Advanced Filter Expressions in Charts', () => {
cy.contains('randomtext = a');
});
});
+
+ it('Closes table filter dropdown with ESC', () => {
+ ChartUtils.addDataViewAndTableWidget(
+ 'EscFilterWidget',
+ ChartUtils.ADAPTER_NAME,
+ );
+
+ cy.dataCy('column-filter-trigger-randomtext').click({ force: true });
+ cy.get('.column-filter-dropdown').should('be.visible');
+
+ cy.get('body').type('{esc}');
+ cy.get('.column-filter-dropdown').should('not.exist');
+ });
});
function setAdvancedCondition(
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts
index 8f3243feaf..805f24de4d 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts
@@ -32,11 +32,15 @@ import { PanelDialogConfig } from '../panel-dialog/panel-dialog.config';
import { StandardDialogConfig } from '../standard-dialog/standard-dialog.config';
import { CardDialogComponent } from '../card-dialog/card-dialog.component';
import { CardDialogConfig } from '../card-dialog/card-dialog-config';
+import { MatDialog } from '@angular/material/dialog';
@Injectable({
providedIn: 'root',
})
export class DialogService {
+ private openDialogs: DialogRef<any>[] = [];
+ private matDialog = inject(MatDialog);
+
private overlay = inject(Overlay);
private injector = inject(Injector);
@@ -51,7 +55,7 @@ export class DialogService {
};
const positionStrategy = this.getPositionStrategy(config.panelType);
- const panelConfig: BaseDialogConfig = this.getConfig(config.panelType);
+ const panelConfig = this.getConfig(config.panelType);
const overlay = this.overlay.create(
panelConfig.getOverlayConfig(config, positionStrategy),
);
@@ -73,16 +77,32 @@ export class DialogService {
dialogRef.componentInstance = panelDialogContainerRef.instance.attach();
if (config.data) {
- Object.keys(config.data).forEach(key => {
- dialogRef.componentInstance[key] = config.data[key];
- });
+ Object.keys(config.data).forEach(
+ key => (dialogRef.componentInstance[key] = config.data[key]),
+ );
}
this.applyDialogProperties(panelDialogContainerRef, overlay, config);
+ this.openDialogs.push(dialogRef);
+ dialogRef
+ .afterClosed()
+ .subscribe(
+ () =>
+ (this.openDialogs = this.openDialogs.filter(
+ d => d !== dialogRef,
+ )),
+ );
+
return dialogRef;
}
+ get hasOpenDialogs() {
+ return (
+ this.openDialogs.length > 0 || this.matDialog.openDialogs.length > 0
+ );
+ }
+
private createInjector<T>(dialogRef: DialogRef<T>): Injector {
return Injector.create({
parent: this.injector,
@@ -101,6 +121,12 @@ export class DialogService {
}
});
+ overlayRef.keydownEvents().subscribe(e => {
+ if (e.key === 'Escape' && !config.disableClose) {
+ panelDialogComponentRef.instance.close();
+ }
+ });
+
if (!config.disableClose) {
overlayRef.backdropClick().subscribe(() => {
panelDialogComponentRef.instance.close();
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/confirm-dialog/confirm-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/confirm-dialog/confirm-dialog.component.ts
index c8d4c1d174..d511905135 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/confirm-dialog/confirm-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/confirm-dialog/confirm-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, inject } from '@angular/core';
+import { Component, HostListener, Inject } from '@angular/core';
import {
MAT_DIALOG_DATA,
MatDialogActions,
@@ -51,6 +51,11 @@ export class ConfirmDialogComponent {
);
public data = inject<ConfirmDialogData>(MAT_DIALOG_DATA);
+ @HostListener('keydown.enter')
+ onEnter(): void {
+ this.onOk();
+ }
+
onCancel(): void {
this.dialogRef.close('cancel');
}
diff --git a/ui/projects/streampipes/shared-ui/src/lib/services/keyboard-shortcut.service.ts b/ui/projects/streampipes/shared-ui/src/lib/services/keyboard-shortcut.service.ts
new file mode 100644
index 0000000000..c891ba6db7
--- /dev/null
+++ b/ui/projects/streampipes/shared-ui/src/lib/services/keyboard-shortcut.service.ts
@@ -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.
+ *
+ */
+
+import { Injectable, NgZone, OnDestroy, inject } from '@angular/core';
+import { Subject } from 'rxjs';
+import { DialogService } from '../dialog/base-dialog/base-dialog.service';
+
+export interface ShortcutAction {
+ key: string;
+ ctrl?: boolean;
+ shift?: boolean;
+ action: (event: KeyboardEvent) => void;
+ preventDefault?: boolean;
+ allowInDialog?: boolean;
+}
+
+export type ShortcutRegistration = { unregister: () => void };
+
+@Injectable({ providedIn: 'root' })
+export class KeyboardShortcutService implements OnDestroy {
+ private keydown$ = new Subject<KeyboardEvent>();
+ private registrations: Map<string, ShortcutAction[]> = new Map();
+ private listener = (e: KeyboardEvent) => {
+ const isInput = this.isInputFocused(e);
+ const ctrl = e.ctrlKey || e.metaKey;
+
+ if (!isInput || ctrl || e.key === 'Escape') {
+ this.keydown$.next(e);
+ }
+ };
+
+ private dialogService = inject(DialogService);
+
+ constructor(private ngZone: NgZone) {
+ this.ngZone.runOutsideAngular(() =>
+ document.addEventListener('keydown', this.listener, true),
+ );
+ this.keydown$.subscribe(e =>
+ this.ngZone.run(() => this.handleEvent(e)),
+ );
+ }
+
+ ngOnDestroy(): void {
+ document.removeEventListener('keydown', this.listener, true);
+ this.keydown$.complete();
+ }
+
+ register(id: string, actions: ShortcutAction[]): ShortcutRegistration {
+ this.registrations.set(id, actions);
+ return { unregister: () => this.registrations.delete(id) };
+ }
+
+ unregister(id: string): void {
+ this.registrations.delete(id);
+ }
+
+ private handleEvent(event: KeyboardEvent): void {
+ const key = event.key.toLowerCase();
+ const ctrl = event.ctrlKey || event.metaKey;
+ const shift = event.shiftKey;
+
+ const match = Array.from(this.registrations.values())
+ .flat()
+ .find(
+ a =>
+ a.key.toLowerCase() === key &&
+ !!a.ctrl === ctrl &&
+ !!a.shift === shift,
+ );
+
+ if (match) {
+ if (match.preventDefault !== false) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ if (!this.dialogService.hasOpenDialogs || match.allowInDialog) {
+ match.action(event);
+ }
+ }
+ }
+
+ private isInputFocused = (event: KeyboardEvent): boolean => {
+ const tag = (event.target as HTMLElement)?.tagName;
+ return (
+ ['INPUT', 'TEXTAREA', 'SELECT'].includes(tag) ||
+ (event.target as HTMLElement)?.isContentEditable
+ );
+ };
+}
diff --git a/ui/projects/streampipes/shared-ui/src/public-api.ts b/ui/projects/streampipes/shared-ui/src/public-api.ts
index f72bf82338..8301499bf6 100644
--- a/ui/projects/streampipes/shared-ui/src/public-api.ts
+++ b/ui/projects/streampipes/shared-ui/src/public-api.ts
@@ -83,6 +83,7 @@ export * from './lib/services/date-format.service';
export * from './lib/services/pipeline-element-schema.service';
export * from './lib/services/asset-configuration.service';
export * from './lib/services/local-storage-settings.service';
+export * from './lib/services/keyboard-shortcut.service';
export * from './lib/components/sp-table/sp-paginator/sp-paginator.service';
export * from './lib/components/feature-card-host/feature-card.service';
diff --git a/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts b/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts
index 614047f4d1..037733a333 100644
--- a/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts
+++ b/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts
@@ -515,6 +515,32 @@ export class TableWidgetComponent extends BaseDataExplorerWidgetDirective<TableW
onFilterDropdownClick = (event: MouseEvent): void =>
event.stopPropagation();
+ @HostListener('document:keydown', ['$event'])
+ handleGlobalKeydown(event: KeyboardEvent): void {
+ if (!this.openFilterColumn) {
+ return;
+ }
+
+ const key = event.key.toLowerCase();
+ const ctrl = event.ctrlKey || event.metaKey;
+
+ if (key === 'escape') {
+ this.closeFilter();
+ event.preventDefault();
+ event.stopPropagation();
+ } else if (ctrl && key === 'f') {
+ const input = this.elRef.nativeElement.querySelector(
+ '.column-filter-search',
+ );
+ if (input) {
+ input.focus();
+ input.select();
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+
onTimestampInput(field: 'value' | 'value2', event: Event): void {
const input = event.target as HTMLInputElement;
const digits = input.value.replace(/\D/g, '').slice(0, 17);
diff --git a/ui/src/app/chart/components/chart-view/chart-view.component.ts b/ui/src/app/chart/components/chart-view/chart-view.component.ts
index 7941a5686b..ffb1f4bc62 100644
--- a/ui/src/app/chart/components/chart-view/chart-view.component.ts
+++ b/ui/src/app/chart/components/chart-view/chart-view.component.ts
@@ -47,7 +47,9 @@ import {
ConfirmDialogComponent,
CurrentUserService,
DialogService,
+ KeyboardShortcutService,
PanelType,
+ ShortcutRegistration,
SidebarResizeComponent,
SpAlertBannerComponent,
SpBasicViewComponent,
@@ -124,8 +126,10 @@ export class ChartViewComponent
originalAssets = [];
resizeEchartsService = inject(ResizeEchartsService);
+ private shortcutReg: ShortcutRegistration;
resizeService = inject(ResizeService);
+ private shortcutService = inject(KeyboardShortcutService);
private dataExplorerSharedService = inject(ChartSharedService);
private detectChangesService = inject(ChartDetectChangesService);
private route = inject(ActivatedRoute);
@@ -154,6 +158,15 @@ export class ChartViewComponent
@ViewChild('panel', { static: false }) outerPanel: ElementRef;
ngOnInit() {
+ this.shortcutReg = this.shortcutService.register('chart-view', [
+ {
+ key: 's',
+ ctrl: true,
+ action: () => this.onShortcutSave(),
+ allowInDialog: true,
+ },
+ ]);
+
const dataViewId = this.route.snapshot.params.id;
this.currentUser$ = this.currentUserService.user$.subscribe(() => {
@@ -572,7 +585,14 @@ export class ChartViewComponent
];
}
+ private onShortcutSave(): void {
+ if (this.editMode) {
+ this.saveDataView();
+ }
+ }
+
ngOnDestroy() {
+ this.shortcutReg?.unregister();
this.currentUser$?.unsubscribe();
this.queryParams$?.unsubscribe();
}
diff --git a/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts b/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts
index 66798f2543..1c7fa97363 100644
--- a/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts
+++ b/ui/src/app/dashboard/components/panel/dashboard-panel.component.ts
@@ -41,6 +41,8 @@ import {
ConfirmDialogAction,
ConfirmDialogComponent,
CurrentUserService,
+ KeyboardShortcutService,
+ ShortcutRegistration,
SpBasicViewComponent,
SpBreadcrumbService,
TimeSelectionService,
@@ -114,7 +116,9 @@ export class DashboardPanelComponent
dataLakeMeasure: DataLakeMeasure;
auth$: Subscription;
refresh$: Subscription;
+ private shortcutReg: ShortcutRegistration;
+ private shortcutService = inject(KeyboardShortcutService);
private detectChangesService = inject(ChartDetectChangesService);
private dialog = inject(MatDialog);
private timeSelectionService = inject(TimeSelectionService);
@@ -132,6 +136,16 @@ export class DashboardPanelComponent
this.dataExplorerSharedService.defaultObservableGenerator();
public ngOnInit() {
+ this.shortcutReg = this.shortcutService.register('dashboard-panel', [
+ { key: 'e', action: () => this.onShortcutEdit() },
+ {
+ key: 's',
+ ctrl: true,
+ action: () => this.onShortcutSave(),
+ allowInDialog: true,
+ },
+ ]);
+
const params = this.route.snapshot.params;
const queryParams = this.route.snapshot.queryParams;
@@ -151,10 +165,23 @@ export class DashboardPanelComponent
}
ngOnDestroy() {
+ this.shortcutReg?.unregister();
this.auth$?.unsubscribe();
this.refresh$?.unsubscribe();
}
+ private onShortcutEdit(): void {
+ if (!this.editMode && this.hasDashboardWritePrivileges) {
+ this.triggerEditMode();
+ }
+ }
+
+ private onShortcutSave(): void {
+ if (this.editMode) {
+ this.persistDashboardChanges();
+ }
+ }
+
addChartToDashboard(dataViewElementId: string) {
const dashboardItem = {} as ClientDashboardItem;
dashboardItem.id =
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
index bfae6c4e65..c7f1f7f99e 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
@@ -20,6 +20,7 @@ import {
AfterViewInit,
Component,
Input,
+ OnDestroy,
ViewChild,
inject,
} from '@angular/core';
@@ -33,7 +34,9 @@ import {
import { ObjectProvider } from '../../services/object-provider.service';
import {
DialogService,
+ KeyboardShortcutService,
PanelType,
+ ShortcutRegistration,
SpBasicViewComponent,
} from '@streampipes/shared-ui';
import { SavePipelineComponent } from '../../dialog/save-pipeline/save-pipeline.component';
@@ -62,7 +65,7 @@ import { FlexDirective } from '@ngbracket/ngx-layout/flex';
PipelineAssemblyDrawingAreaComponent,
],
})
-export class PipelineAssemblyComponent implements AfterViewInit {
+export class PipelineAssemblyComponent implements AfterViewInit, OnDestroy {
private jsPlumbFactoryService = inject(JsplumbFactoryService);
private pipelinePositioningService = inject(PipelinePositioningService);
private objectProvider = inject(ObjectProvider);
@@ -72,7 +75,8 @@ export class PipelineAssemblyComponent implements AfterViewInit {
private router = inject(Router);
private jsplumbService = inject(JsplumbService);
private translateService = inject(TranslateService);
-
+ private shortcutService = inject(KeyboardShortcutService);
+
@Input()
rawPipelineModel: PipelineElementConfig[];
@@ -92,6 +96,7 @@ export class PipelineAssemblyComponent implements AfterViewInit {
readonly: boolean;
jsplumbBridge: JsplumbBridge;
+ private shortcutReg: ShortcutRegistration;
@ViewChild('assemblyOptionsComponent')
assemblyOptionsComponent: PipelineAssemblyOptionsComponent;
@@ -99,11 +104,24 @@ export class PipelineAssemblyComponent implements AfterViewInit {
drawingAreaComponent: PipelineAssemblyDrawingAreaComponent;
ngAfterViewInit() {
+ this.shortcutReg = this.shortcutService.register('pipeline-assembly', [
+ { key: 's', ctrl: true, action: () => this.onShortcutSave() },
+ ]);
this.jsplumbBridge = this.jsPlumbFactoryService.getJsplumbBridge(
this.readonly,
);
}
+ ngOnDestroy(): void {
+ this.shortcutReg?.unregister();
+ }
+
+ private onShortcutSave(): void {
+ if (!this.readonly && this.rawPipelineModel?.length) {
+ this.submit();
+ }
+ }
+
/**
* clears the Assembly of all elements
*/
@@ -141,7 +159,6 @@ export class PipelineAssemblyComponent implements AfterViewInit {
);
const dialogRef = this.dialogService.open(SavePipelineComponent, {
panelType: PanelType.SLIDE_IN_PANEL,
- disableClose: true,
title: this.translateService.instant('Save pipeline'),
width: '40vw',
data: {
diff --git a/ui/src/app/editor/components/pipeline/pipeline.component.ts b/ui/src/app/editor/components/pipeline/pipeline.component.ts
index 4ae6f00109..f82edf4a14 100644
--- a/ui/src/app/editor/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor/components/pipeline/pipeline.component.ts
@@ -55,7 +55,9 @@ import { CustomizeComponent } from '../../dialog/customize/customize.component';
import {
ConfirmDialogComponent,
DialogService,
+ KeyboardShortcutService,
PanelType,
+ ShortcutRegistration,
} from '@streampipes/shared-ui';
import { EditorService } from '../../services/editor.service';
import { MatchingErrorComponent } from '../../dialog/matching-error/matching-error.component';
@@ -107,6 +109,7 @@ export class PipelineComponent implements OnInit, OnDestroy {
private dialogService = inject(DialogService);
private dialog = inject(MatDialog);
private ngZone = inject(NgZone);
+ private shortcutService = inject(KeyboardShortcutService);
@Input()
pipelineValid: boolean;
@@ -146,6 +149,7 @@ export class PipelineComponent implements OnInit, OnDestroy {
pipelinePreview: PipelinePreviewModel;
shouldOpenCustomizeSettings = false;
+ private shortcutReg: ShortcutRegistration;
constructor() {
this.currentPipelineModel = new Pipeline();
@@ -159,6 +163,16 @@ export class PipelineComponent implements OnInit, OnDestroy {
this.readonly,
);
if (!this.readonly) {
+ this.shortcutReg = this.shortcutService.register('pipeline', [
+ {
+ key: 'Delete',
+ action: () => this.deleteSelectedElement(),
+ },
+ {
+ key: 'Backspace',
+ action: () => this.deleteSelectedElement(),
+ },
+ ]);
this.initAssembly();
this.initPlumb();
}
@@ -192,10 +206,23 @@ export class PipelineComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
+ this.shortcutReg?.unregister();
this.deletePreviewEmitter.emit(false);
this.jsplumbFactoryService.destroy();
}
+ private deleteSelectedElement(): void {
+ if (!this.currentMouseOverElement) {
+ return;
+ }
+ const el = this.rawPipelineModel.find(
+ pe => pe.payload.dom === this.currentMouseOverElement,
+ );
+ if (el) {
+ this.handleDeleteOption(el);
+ }
+ }
+
@HostListener('window:beforeunload')
onWindowClose() {
this.ngOnDestroy();
diff --git a/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.html b/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.html
index 7e10ef1226..d3a8667ce1 100644
--- a/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.html
+++ b/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.html
@@ -66,5 +66,37 @@
color="accent"
>{{ 'Auto refresh' | translate }}
</mat-slide-toggle>
+ @if (hasPipelineWritePrivileges) {
+ <button
+ mat-icon-button
+ [matMenuTriggerFor]="optMenu"
+ [attr.aria-label]="'Options' | translate"
+ data-cy="pipeline-details-options"
+ >
+ <mat-icon>more_vert</mat-icon>
+ </button>
+ }
+ <mat-menu #optMenu="matMenu">
+ @if (hasPipelineWritePrivileges) {
+ <button
+ mat-menu-item
+ (click)="editPipelineEmitter.emit()"
+ data-cy="options-edit-pipeline"
+ >
+ <mat-icon>edit</mat-icon>
+ <span>{{ 'Edit pipeline' | translate }}</span>
+ </button>
+ }
+ @if (hasPipelineWritePrivileges) {
+ <button
+ mat-menu-item
+ (click)="deletePipelineEmitter.emit()"
+ data-cy="options-delete-pipeline"
+ >
+ <mat-icon>clear</mat-icon>
+ <span>{{ 'Delete pipeline' | translate }}</span>
+ </button>
+ }
+ </mat-menu>
</div>
</div>
diff --git a/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.ts b/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.ts
index 1724c6ad76..b083b3b1d5 100644
--- a/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.ts
+++ b/ui/src/app/pipeline-details/components/pipeline-details-toolbar/pipeline-details-toolbar.component.ts
@@ -22,11 +22,13 @@ import {
LayoutAlignDirective,
LayoutDirective,
} from '@ngbracket/ngx-layout/flex';
-import { MatButton } from '@angular/material/button';
+import { MatButton, MatIconButton } from '@angular/material/button';
import { MatTooltip } from '@angular/material/tooltip';
import { MatSlideToggle } from '@angular/material/slide-toggle';
import { FormsModule } from '@angular/forms';
import { TranslatePipe } from '@ngx-translate/core';
+import { MatIcon } from '@angular/material/icon';
+import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
@Component({
selector: 'sp-pipeline-details-toolbar',
@@ -36,10 +38,15 @@ import { TranslatePipe } from '@ngx-translate/core';
LayoutDirective,
LayoutAlignDirective,
MatButton,
+ MatIconButton,
MatTooltip,
MatSlideToggle,
FormsModule,
TranslatePipe,
+ MatIcon,
+ MatMenuTrigger,
+ MatMenu,
+ MatMenuItem,
],
})
export class PipelineDetailsToolbarComponent {
@@ -63,4 +70,10 @@ export class PipelineDetailsToolbarComponent {
@Output()
openCodeDialogEmitter: EventEmitter<void> = new EventEmitter();
+
+ @Output()
+ editPipelineEmitter: EventEmitter<void> = new EventEmitter();
+
+ @Output()
+ deletePipelineEmitter: EventEmitter<void> = new EventEmitter();
}
diff --git a/ui/src/app/pipeline-details/pipeline-details.component.html b/ui/src/app/pipeline-details/pipeline-details.component.html
index 22e1c7ec5c..442ca7f809 100644
--- a/ui/src/app/pipeline-details/pipeline-details.component.html
+++ b/ui/src/app/pipeline-details/pipeline-details.component.html
@@ -31,6 +31,8 @@
(autoRefreshChange)="autoRefresh = $event"
(reloadMetricsEmitter)="triggerReload()"
(openCodeDialogEmitter)="openPipelineAsCodeDialog()"
+ (editPipelineEmitter)="editPipeline()"
+ (deletePipelineEmitter)="deletePipeline()"
>
</sp-pipeline-details-toolbar>
</div>
diff --git a/ui/src/app/pipeline-details/pipeline-details.component.ts b/ui/src/app/pipeline-details/pipeline-details.component.ts
index 8a0e573f2f..7a2448ede8 100644
--- a/ui/src/app/pipeline-details/pipeline-details.component.ts
+++ b/ui/src/app/pipeline-details/pipeline-details.component.ts
@@ -17,7 +17,7 @@
*/
import { Component, OnDestroy, OnInit, ViewChild, inject } from '@angular/core';
-import { ActivatedRoute } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
import { AuthService } from '../services/auth.service';
import {
Pipeline,
@@ -32,7 +32,9 @@ import { PipelineElementUnion } from '../editor/model/editor.model';
import {
CurrentUserService,
DialogService,
+ KeyboardShortcutService,
PanelType,
+ ShortcutRegistration,
SpBreadcrumbService,
} from '@streampipes/shared-ui';
import { SpPipelineRoutes } from '../pipelines/pipelines.breadcrumb';
@@ -52,6 +54,7 @@ import {
import { PipelineDetailsToolbarComponent } from './components/pipeline-details-toolbar/pipeline-details-toolbar.component';
import { PipelineDetailsExpansionPanelComponent } from './components/pipeline-details-expansion-panel/pipeline-details-expansion-panel.component';
import { TranslatePipe } from '@ngx-translate/core';
+import { PipelineOperationsService } from '../pipelines/services/pipeline-operations.service';
@Component({
selector: 'sp-pipeline-details-overview-component',
@@ -77,6 +80,9 @@ export class SpPipelineDetailsComponent implements OnInit, OnDestroy {
private breadcrumbService = inject(SpBreadcrumbService);
private pipelineMonitoringService = inject(PipelineMonitoringService);
private dialogService = inject(DialogService);
+ private router = inject(Router);
+ private pipelineOperationsService = inject(PipelineOperationsService);
+ private shortcutService = inject(KeyboardShortcutService);
hasPipelineWritePrivileges = false;
@@ -95,11 +101,16 @@ export class SpPipelineDetailsComponent implements OnInit, OnDestroy {
currentUser$: Subscription;
autoRefresh$: Subscription;
+ private shortcutReg: ShortcutRegistration;
@ViewChild('pipelinePreviewComponent')
pipelinePreviewComponent: PipelinePreviewComponent;
ngOnInit(): void {
+ this.shortcutReg = this.shortcutService.register('pipeline-details', [
+ { key: 'e', action: () => this.onShortcutEdit() },
+ ]);
+
this.currentUser$ = this.currentUserService.user$.subscribe(user => {
this.hasPipelineWritePrivileges = this.authService.hasRole(
UserPrivilege.PRIVILEGE_WRITE_PIPELINE,
@@ -227,7 +238,26 @@ export class SpPipelineDetailsComponent implements OnInit, OnDestroy {
});
}
+ editPipeline(): void {
+ this.pipelineOperationsService.showPipelineInEditor(this.pipeline._id);
+ }
+
+ deletePipeline(): void {
+ this.pipelineOperationsService.showDeleteDialog(
+ this.pipeline,
+ null,
+ () => this.router.navigate(['pipelines']),
+ );
+ }
+
+ private onShortcutEdit(): void {
+ if (this.hasPipelineWritePrivileges) {
+ this.editPipeline();
+ }
+ }
+
ngOnDestroy() {
+ this.shortcutReg?.unregister();
this.currentUser$?.unsubscribe();
this.autoRefresh$?.unsubscribe();
}