NIFI-13270: (#8877) - Persisting the select tab index

This closes #8877
This commit is contained in:
Matt Gilman 2024-05-28 09:01:37 -04:00 committed by GitHub
parent fa8dc4f1a0
commit e1920dace0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 101 additions and 48 deletions

View File

@ -20,7 +20,7 @@
</h2>
<form class="edit-connection-form" [formGroup]="editConnectionForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Details">
<mat-dialog-content>
@if (breadcrumbs$ | async; as breadcrumbs) {

View File

@ -56,7 +56,7 @@ import { SourceRemoteProcessGroup } from '../source/source-remote-process-group/
import { DestinationRemoteProcessGroup } from '../destination/destination-remote-process-group/destination-remote-process-group.component';
import { BreadcrumbEntity } from '../../../../../state/shared';
import { ErrorBanner } from '../../../../../../../ui/common/error-banner/error-banner.component';
import { CloseOnEscapeDialog } from '../../../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../../../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-connection',
@ -91,7 +91,7 @@ import { CloseOnEscapeDialog } from '../../../../../../../ui/common/close-on-esc
templateUrl: './edit-connection.component.html',
styleUrls: ['./edit-connection.component.scss']
})
export class EditConnectionComponent extends CloseOnEscapeDialog {
export class EditConnectionComponent extends TabbedDialog {
@Input() set getChildOutputPorts(getChildOutputPorts: (groupId: string) => Observable<any>) {
if (this.sourceType == ComponentType.ProcessGroup) {
this.childOutputPorts$ = getChildOutputPorts(this.source.groupId);
@ -233,7 +233,8 @@ export class EditConnectionComponent extends CloseOnEscapeDialog {
private canvasUtils: CanvasUtils,
private client: Client
) {
super();
super('edit-connection-selected-index');
const connection: any = dialogRequest.entity.component;
this.connectionReadonly = !dialogRequest.entity.permissions.canWrite;

View File

@ -18,7 +18,7 @@
<h2 mat-dialog-title>{{ readonly ? 'Process Group Details' : 'Edit Process Group' }}</h2>
<form class="process-group-edit-form" [formGroup]="editProcessGroupForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -35,7 +35,7 @@ import { ControllerServiceTable } from '../../../../../../../ui/common/controlle
import { EditComponentDialogRequest } from '../../../../../state/flow';
import { ClusterConnectionService } from '../../../../../../../service/cluster-connection.service';
import { ErrorBanner } from '../../../../../../../ui/common/error-banner/error-banner.component';
import { CloseOnEscapeDialog } from '../../../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../../../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-process-group',
@ -59,7 +59,7 @@ import { CloseOnEscapeDialog } from '../../../../../../../ui/common/close-on-esc
],
styleUrls: ['./edit-process-group.component.scss']
})
export class EditProcessGroup extends CloseOnEscapeDialog {
export class EditProcessGroup extends TabbedDialog {
@Input() set parameterContexts(parameterContexts: ParameterContextEntity[]) {
parameterContexts.forEach((parameterContext) => {
if (parameterContext.permissions.canRead) {
@ -156,7 +156,8 @@ export class EditProcessGroup extends CloseOnEscapeDialog {
private client: Client,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-process-group-selected-index');
this.readonly = !request.entity.permissions.canWrite;
this.parameterContextsOptions.push({

View File

@ -28,7 +28,7 @@
<form class="processor-edit-form" [formGroup]="editProcessorForm">
<error-banner></error-banner>
<!-- TODO - Stop & Configure -->
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -49,13 +49,13 @@ import { ErrorBanner } from '../../../../../../../ui/common/error-banner/error-b
import { ClusterConnectionService } from '../../../../../../../service/cluster-connection.service';
import { CanvasUtils } from '../../../../../service/canvas-utils.service';
import { ConvertToParameterResponse } from '../../../../../service/parameter-helper.service';
import { CloseOnEscapeDialog } from '../../../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import { PropertyVerification } from '../../../../../../../ui/common/property-verification/property-verification.component';
import {
ConfigVerificationResult,
ModifiedProperties,
VerifyPropertiesRequestContext
} from '../../../../../../../state/property-verification';
import { TabbedDialog } from '../../../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-processor',
@ -81,7 +81,7 @@ import {
],
styleUrls: ['./edit-processor.component.scss']
})
export class EditProcessor extends CloseOnEscapeDialog {
export class EditProcessor extends TabbedDialog {
@Input() createNewProperty!: (existingProperties: string[], allowsSensitive: boolean) => Observable<Property>;
@Input() createNewService!: (request: InlineServiceCreationRequest) => Observable<InlineServiceCreationResponse>;
@Input() parameterContext: ParameterContextEntity | undefined;
@ -169,7 +169,8 @@ export class EditProcessor extends CloseOnEscapeDialog {
private clusterConnectionService: ClusterConnectionService,
private nifiCommon: NiFiCommon
) {
super();
super('edit-processor-selected-index');
this.readonly =
!request.entity.permissions.canWrite || !this.canvasUtils.runnableSupportsModification(request.entity);

View File

@ -82,7 +82,7 @@
</div>
</mat-dialog-content>
} @else {
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -45,7 +45,7 @@ import { ErrorBanner } from '../../../../../ui/common/error-banner/error-banner.
import { ClusterConnectionService } from '../../../../../service/cluster-connection.service';
import { TextTip } from '../../../../../ui/common/tooltips/text-tip/text-tip.component';
import { NifiTooltipDirective } from '../../../../../ui/common/tooltips/nifi-tooltip.directive';
import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-parameter-context',
@ -73,7 +73,7 @@ import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-di
],
styleUrls: ['./edit-parameter-context.component.scss']
})
export class EditParameterContext extends CloseOnEscapeDialog {
export class EditParameterContext extends TabbedDialog {
@Input() createNewParameter!: (existingParameters: string[]) => Observable<Parameter>;
@Input() editParameter!: (parameter: Parameter) => Observable<Parameter>;
@Input() updateRequest!: Observable<ParameterContextUpdateRequestEntity | null>;
@ -97,7 +97,8 @@ export class EditParameterContext extends CloseOnEscapeDialog {
private client: Client,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-parameter-context-selected-index');
if (request.parameterContext) {
this.isNew = false;
this.readonly = !request.parameterContext.permissions.canWrite;

View File

@ -17,7 +17,7 @@
<h2 mat-dialog-title>FlowFile</h2>
<div class="flowfile">
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Details">
<mat-dialog-content>
<div class="dialog-tab-content">

View File

@ -26,7 +26,7 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatTabsModule } from '@angular/material/tabs';
import { FlowFileDialogRequest } from '../../../state/queue-listing';
import { NiFiCommon } from '../../../../../service/nifi-common.service';
import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'flowfile-dialog',
@ -49,7 +49,7 @@ import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-di
KeyValuePipe
]
})
export class FlowFileDialog extends CloseOnEscapeDialog {
export class FlowFileDialog extends TabbedDialog {
@Input() contentViewerAvailable!: boolean;
@Output() downloadContent: EventEmitter<void> = new EventEmitter<void>();
@ -59,7 +59,7 @@ export class FlowFileDialog extends CloseOnEscapeDialog {
@Inject(MAT_DIALOG_DATA) public request: FlowFileDialogRequest,
private nifiCommon: NiFiCommon
) {
super();
super('flowfile-dialog-selected-index');
}
formatDurationValue(duration: number): string {

View File

@ -27,7 +27,7 @@
</h2>
<form class="flow-analysis-rule-edit-form" [formGroup]="editFlowAnalysisRuleForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -46,13 +46,13 @@ import {
import { FlowAnalysisRuleTable } from '../flow-analysis-rule-table/flow-analysis-rule-table.component';
import { ErrorBanner } from '../../../../../ui/common/error-banner/error-banner.component';
import { ClusterConnectionService } from '../../../../../service/cluster-connection.service';
import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import {
ConfigVerificationResult,
ModifiedProperties,
VerifyPropertiesRequestContext
} from '../../../../../state/property-verification';
import { PropertyVerification } from '../../../../../ui/common/property-verification/property-verification.component';
import { TabbedDialog } from '../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-flow-analysis-rule',
@ -77,7 +77,7 @@ import { PropertyVerification } from '../../../../../ui/common/property-verifica
],
styleUrls: ['./edit-flow-analysis-rule.component.scss']
})
export class EditFlowAnalysisRule extends CloseOnEscapeDialog {
export class EditFlowAnalysisRule extends TabbedDialog {
@Input() createNewProperty!: (existingProperties: string[], allowsSensitive: boolean) => Observable<Property>;
@Input() createNewService!: (request: InlineServiceCreationRequest) => Observable<InlineServiceCreationResponse>;
@Input() saving$!: Observable<boolean>;
@ -107,7 +107,8 @@ export class EditFlowAnalysisRule extends CloseOnEscapeDialog {
private nifiCommon: NiFiCommon,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-flow-analysis-rule-selected-index');
this.readonly =
!request.flowAnalysisRule.permissions.canWrite || request.flowAnalysisRule.status.runStatus !== 'DISABLED';

View File

@ -25,7 +25,7 @@
</h2>
<form class="parameter-provider-edit-form" [formGroup]="editParameterProviderForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -46,13 +46,13 @@ import { CommonModule } from '@angular/common';
import { ClusterConnectionService } from '../../../../../service/cluster-connection.service';
import { TextTip } from '../../../../../ui/common/tooltips/text-tip/text-tip.component';
import { NifiTooltipDirective } from '../../../../../ui/common/tooltips/nifi-tooltip.directive';
import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import {
ConfigVerificationResult,
ModifiedProperties,
VerifyPropertiesRequestContext
} from '../../../../../state/property-verification';
import { PropertyVerification } from '../../../../../ui/common/property-verification/property-verification.component';
import { TabbedDialog } from '../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-parameter-provider',
@ -76,7 +76,7 @@ import { PropertyVerification } from '../../../../../ui/common/property-verifica
templateUrl: './edit-parameter-provider.component.html',
styleUrls: ['./edit-parameter-provider.component.scss']
})
export class EditParameterProvider extends CloseOnEscapeDialog {
export class EditParameterProvider extends TabbedDialog {
@Input() createNewProperty!: (existingProperties: string[], allowsSensitive: boolean) => Observable<Property>;
@Input() createNewService!: (request: InlineServiceCreationRequest) => Observable<InlineServiceCreationResponse>;
@Input() goToService!: (serviceId: string) => void;
@ -99,7 +99,8 @@ export class EditParameterProvider extends CloseOnEscapeDialog {
private nifiCommon: NiFiCommon,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-parameter-provider-selected-index');
this.readonly = !request.parameterProvider.permissions.canWrite;
const providerProperties = request.parameterProvider.component.properties;

View File

@ -25,7 +25,7 @@
</h2>
<form class="edit-registry-client-form" [formGroup]="editRegistryClientForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex flex-col">

View File

@ -40,7 +40,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { PropertyTable } from '../../../../../ui/common/property-table/property-table.component';
import { ErrorBanner } from '../../../../../ui/common/error-banner/error-banner.component';
import { ClusterConnectionService } from '../../../../../service/cluster-connection.service';
import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-registry-client',
@ -62,7 +62,7 @@ import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-di
],
styleUrls: ['./edit-registry-client.component.scss']
})
export class EditRegistryClient extends CloseOnEscapeDialog {
export class EditRegistryClient extends TabbedDialog {
@Input() createNewProperty!: (existingProperties: string[], allowsSensitive: boolean) => Observable<Property>;
@Input() createNewService!: (request: InlineServiceCreationRequest) => Observable<InlineServiceCreationResponse>;
@Input() goToService!: (serviceId: string) => void;
@ -81,7 +81,8 @@ export class EditRegistryClient extends CloseOnEscapeDialog {
private client: Client,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-registry-client-selected-index');
const serviceProperties: any = request.registryClient.component.properties;
const properties: Property[] = Object.entries(serviceProperties).map((entry: any) => {
const [property, value] = entry;

View File

@ -27,7 +27,7 @@
</h2>
<form class="reporting-task-edit-form" [formGroup]="editReportingTaskForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -48,13 +48,13 @@ import { NifiTooltipDirective } from '../../../../../ui/common/tooltips/nifi-too
import { TextTip } from '../../../../../ui/common/tooltips/text-tip/text-tip.component';
import { ErrorBanner } from '../../../../../ui/common/error-banner/error-banner.component';
import { ClusterConnectionService } from '../../../../../service/cluster-connection.service';
import { CloseOnEscapeDialog } from '../../../../../ui/common/close-on-escape-dialog/close-on-escape-dialog.component';
import {
ConfigVerificationResult,
ModifiedProperties,
VerifyPropertiesRequestContext
} from '../../../../../state/property-verification';
import { PropertyVerification } from '../../../../../ui/common/property-verification/property-verification.component';
import { TabbedDialog } from '../../../../../ui/common/tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-reporting-task',
@ -80,7 +80,7 @@ import { PropertyVerification } from '../../../../../ui/common/property-verifica
],
styleUrls: ['./edit-reporting-task.component.scss']
})
export class EditReportingTask extends CloseOnEscapeDialog {
export class EditReportingTask extends TabbedDialog {
@Input() createNewProperty!: (existingProperties: string[], allowsSensitive: boolean) => Observable<Property>;
@Input() createNewService!: (request: InlineServiceCreationRequest) => Observable<InlineServiceCreationResponse>;
@Input() goToService!: (serviceId: string) => void;
@ -121,7 +121,8 @@ export class EditReportingTask extends CloseOnEscapeDialog {
private nifiCommon: NiFiCommon,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-reporting-task-selected-index');
this.readonly =
!request.reportingTask.permissions.canWrite ||
(request.reportingTask.status.runStatus !== 'STOPPED' &&

View File

@ -27,7 +27,7 @@
</h2>
<form class="controller-service-edit-form" [formGroup]="editControllerServiceForm">
<error-banner></error-banner>
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Settings">
<mat-dialog-content>
<div class="dialog-tab-content flex gap-x-4">

View File

@ -47,13 +47,13 @@ import { ClusterConnectionService } from '../../../../service/cluster-connection
import { TextTip } from '../../tooltips/text-tip/text-tip.component';
import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
import { ConvertToParameterResponse } from '../../../../pages/flow-designer/service/parameter-helper.service';
import { CloseOnEscapeDialog } from '../../close-on-escape-dialog/close-on-escape-dialog.component';
import { PropertyVerification } from '../../property-verification/property-verification.component';
import {
ConfigVerificationResult,
ModifiedProperties,
VerifyPropertiesRequestContext
} from '../../../../state/property-verification';
import { TabbedDialog } from '../../tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'edit-controller-service',
@ -79,7 +79,7 @@ import {
],
styleUrls: ['./edit-controller-service.component.scss']
})
export class EditControllerService extends CloseOnEscapeDialog {
export class EditControllerService extends TabbedDialog {
@Input() createNewProperty!: (existingProperties: string[], allowsSensitive: boolean) => Observable<Property>;
@Input() createNewService!: (request: InlineServiceCreationRequest) => Observable<InlineServiceCreationResponse>;
@Input() parameterContext: ParameterContextEntity | undefined;
@ -133,7 +133,8 @@ export class EditControllerService extends CloseOnEscapeDialog {
private nifiCommon: NiFiCommon,
private clusterConnectionService: ClusterConnectionService
) {
super();
super('edit-controller-service-selected-index');
this.readonly =
!request.controllerService.permissions.canWrite ||
request.controllerService.status.runStatus !== 'DISABLED';

View File

@ -17,7 +17,7 @@
<h2 mat-dialog-title>Provenance Event</h2>
<div class="provenance-event">
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="Details">
<mat-dialog-content>
<div class="dialog-tab-content">

View File

@ -26,7 +26,7 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
import { NiFiCommon } from '../../../service/nifi-common.service';
import { MatTabsModule } from '@angular/material/tabs';
import { Attribute, ProvenanceEventDialogRequest } from '../../../state/shared';
import { CloseOnEscapeDialog } from '../close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'provenance-event-dialog',
@ -47,7 +47,7 @@ import { CloseOnEscapeDialog } from '../close-on-escape-dialog/close-on-escape-d
FormsModule
]
})
export class ProvenanceEventDialog extends CloseOnEscapeDialog {
export class ProvenanceEventDialog extends TabbedDialog {
@Input() contentViewerAvailable!: boolean;
@Output() downloadContent: EventEmitter<string> = new EventEmitter<string>();
@ -60,7 +60,7 @@ export class ProvenanceEventDialog extends CloseOnEscapeDialog {
@Inject(MAT_DIALOG_DATA) public request: ProvenanceEventDialogRequest,
private nifiCommon: NiFiCommon
) {
super();
super('edit-provenance-event-selected-index');
}
formatDurationValue(duration: number): string {

View File

@ -19,7 +19,7 @@
<h2 mat-dialog-title>System Diagnostics</h2>
<error-banner></error-banner>
<div class="system-diagnostics">
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="selectedIndex" (selectedIndexChange)="tabChanged($event)">
<mat-tab label="JVM">
<mat-dialog-content>
<div class="dialog-tab-content w-full">

View File

@ -35,7 +35,7 @@ import { isDefinedAndNotNull } from '../../../state/shared';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { ErrorBanner } from '../error-banner/error-banner.component';
import { clearBannerErrors } from '../../../state/error/error.actions';
import { CloseOnEscapeDialog } from '../close-on-escape-dialog/close-on-escape-dialog.component';
import { TabbedDialog } from '../tabbed-dialog/tabbed-dialog.component';
@Component({
selector: 'system-diagnostics-dialog',
@ -52,7 +52,7 @@ import { CloseOnEscapeDialog } from '../close-on-escape-dialog/close-on-escape-d
templateUrl: './system-diagnostics-dialog.component.html',
styleUrls: ['./system-diagnostics-dialog.component.scss']
})
export class SystemDiagnosticsDialog extends CloseOnEscapeDialog implements OnInit, OnDestroy {
export class SystemDiagnosticsDialog extends TabbedDialog implements OnInit, OnDestroy {
systemDiagnostics$ = this.store.select(selectSystemDiagnostics);
loadedTimestamp$ = this.store.select(selectSystemDiagnosticsLoadedTimestamp);
status$ = this.store.select(selectSystemDiagnosticsStatus);
@ -62,7 +62,7 @@ export class SystemDiagnosticsDialog extends CloseOnEscapeDialog implements OnIn
private store: Store<SystemDiagnosticsState>,
private nifiCommon: NiFiCommon
) {
super();
super('system-diagnostics-selected-index');
}
ngOnInit(): void {

View File

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, Inject, inject } from '@angular/core';
import { CloseOnEscapeDialog } from '../close-on-escape-dialog/close-on-escape-dialog.component';
import { Storage } from '../../../service/storage.service';
@Component({
selector: 'tabbed-dialog',
standalone: true,
template: ''
})
export abstract class TabbedDialog extends CloseOnEscapeDialog {
private storage: Storage = inject(Storage);
selectedIndex = 0;
protected constructor(@Inject(String) private dialogId: string) {
super();
const previousSelectedIndex = this.storage.getItem<number>(this.dialogId);
if (previousSelectedIndex != null) {
this.selectedIndex = previousSelectedIndex;
}
}
tabChanged(selectedTabIndex: number): void {
this.storage.setItem<number>(this.dialogId, selectedTabIndex);
}
}