Skip to content
Closed
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 @@ -77,7 +77,7 @@
</div>
<button
mat-flat-button
[disabled]="selectedProfile === null"
[disabled]="selectedProfile === null || isCopyProfile"
(click)="onDeleteClick()"
class="delete-button">
Delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import {
ChangeDetectorRef,
ElementRef,
} from '@angular/core';
import { RiskAssessmentStore } from './risk-assessment.store';
import {
COPY_ACTION,
DElETE_ACTION,
RiskAssessmentStore,
} from './risk-assessment.store';
import { SimpleDialogComponent } from '../../components/simple-dialog/simple-dialog.component';
import { Subject, takeUntil, timer } from 'rxjs';
import { MatDialog } from '@angular/material/dialog';
Expand Down Expand Up @@ -264,7 +268,10 @@ export class RiskAssessmentComponent
actions(actions: EntityAction[]) {
return (profile: Profile) => {
if (profile.status === ProfileStatus.EXPIRED) {
return [{ action: ProfileAction.Delete, icon: 'delete' }];
return [DElETE_ACTION];
}
if (!profile.created) {
return [COPY_ACTION];
}
return actions;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { selectRiskProfiles } from '../../store/selectors';
import { setRiskProfiles } from '../../store/actions';
import { EntityAction } from '../../model/entity-action';

export const COPY_ACTION = { action: ProfileAction.Copy, icon: 'content_copy' };
export const DElETE_ACTION = { action: ProfileAction.Delete, icon: 'delete' };
export interface AppComponentState {
selectedProfile: Profile | null;
profiles: Profile[];
Expand Down Expand Up @@ -190,10 +192,7 @@ export class RiskAssessmentStore extends ComponentStore<AppComponentState> {
profiles: [],
profileFormat: [],
selectedProfile: null,
actions: [
{ action: ProfileAction.Copy, icon: 'content_copy' },
{ action: ProfileAction.Delete, icon: 'delete' },
],
actions: [COPY_ACTION, DElETE_ACTION],
});
}
}
Loading