Skip to content

Commit

Permalink
Feature/error on details refresh undefined permissions (#1327)
Browse files Browse the repository at this point in the history
* fix remove unneccessary permissions use and check correct enum for disabled state

* linting update

* remove unused import

* permissions should still be a part of the condition in html
  • Loading branch information
danoswaltCL authored Feb 29, 2024
1 parent 5e4fb0b commit 80ac904
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 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) || segmentUsed }"
[disabled]="(permissions && !permissions.segments.delete) || segmentUsed"
[ngClass]="{ 'button--disabled': segment.type === SegmentType.GLOBAL_EXCLUDE || segmentUsed || !permissions?.segments.delete }"
[disabled]="segment.type === SegmentStatus.GLOBAL_EXCLUDE || segmentUsed || !permissions?.segments.delete"
>
{{ 'global.delete.text' | translate }}
</button>
Expand All @@ -40,8 +40,8 @@
mat-flat-button
class="ft-14-600 button-long"
(click)="duplicateSegmentDialog()"
[ngClass]="{ 'button-long--disabled': segment?.type == 'global_exclude' }"
[disabled]="segment?.type == 'global_exclude'"
[ngClass]="{ 'button-long--disabled': segment.type == SegmentType.GLOBAL_EXCLUDE }"
[disabled]="segment.type == SegmentType.GLOBAL_EXCLUDE"
>
{{ 'global.duplicate.text' | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export class ViewSegmentComponent implements OnInit, OnDestroy {
return SEGMENT_STATUS;
}

get SegmentType() {
return SEGMENT_TYPE;
}

get SegmentStatusPipeTypes() {
return SegmentStatusPipeType;
}
Expand All @@ -62,7 +66,6 @@ export class ViewSegmentComponent implements OnInit, OnDestroy {
.subscribe((segment) => {
this.segment = { ...segment, status: segment.status || SEGMENT_STATUS.UNUSED };

this.permissions.segments.delete = this.segment.type !== SEGMENT_TYPE.GLOBAL_EXCLUDE;
this.members = [];
this.segment.individualForSegment.forEach((user) => {
this.members.push({ type: MemberTypes.INDIVIDUAL, id: user.userId });
Expand Down

0 comments on commit 80ac904

Please sign in to comment.