Skip to content

Commit

Permalink
Merge pull request #1059 from CarnegieLearningWeb/bugfix/disable-dele…
Browse files Browse the repository at this point in the history
…tion-of-segments-in-use

bug fix to not allow deleting segments which are in use
  • Loading branch information
Yagnik56 authored Oct 12, 2023
2 parents e22f85f + 28ebae2 commit 832d4b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
mat-flat-button
class="ft-14-600 button"
(click)="deleteSegment()"
[ngClass]="{ 'button--disabled': permissions && !permissions.segments.delete }"
[disabled]="permissions && !permissions.segments.delete"
[ngClass]="{ 'button--disabled': permissions && !permissions.segments.delete || segmentUsed }"
[disabled]="permissions && !permissions.segments.delete || segmentUsed"
>
{{ 'global.delete.text' | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class ViewSegmentComponent implements OnInit, OnDestroy {
segment: Segment;
segmentSub: Subscription;
members: { type: string; id: string }[] = [];
segmentUsed: boolean;

displayedVariationColumns: string[] = ['value', 'name'];

Expand Down Expand Up @@ -60,6 +61,8 @@ export class ViewSegmentComponent implements OnInit, OnDestroy {
this.members.push({ type: MemberTypes.SEGMENT, id: subSegment.name });
});
});

this.segmentUsed = this.segment?.status === SEGMENT_STATUS.USED;
}

openEditSegmentDialog() {
Expand Down

0 comments on commit 832d4b7

Please sign in to comment.