Skip to content

Commit

Permalink
disabled edit button if object is encrypted.
Browse files Browse the repository at this point in the history
Signed-off-by: Himanshi Chhabra <hchhabra@progress.com>
  • Loading branch information
himanshi-chhabra committed Sep 20, 2021
1 parent 9e3ef9f commit 7b8a6b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@
<chef-icon class="material-icons">delete</chef-icon>
<span>Delete</span>
</chef-button>
<chef-button tertiary class="action right-button-box" (click)="startUpdateDataBagItem(item, selectedItemDetails)">
<chef-button
tertiary
class="action right-button-box"
(click)="startUpdateDataBagItem(item, selectedItemDetails)"
[disabled]="editDisable">
<chef-icon class="material-icons">mode_edit</chef-icon>
<span>Edit</span>
</chef-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class DataBagsDetailsComponent implements OnInit, OnDestroy {
public dataBagItemToDelete: DataBagItems;
public deleteModalVisible = false;
public deleting = false;
public editDisable = false;
public openDataBagModal = new EventEmitter<void>();
public openEditDataBagItemModal = new EventEmitter<void>();
public openDataBagItemModal = new EventEmitter<void>();
Expand Down Expand Up @@ -117,6 +118,16 @@ export class DataBagsDetailsComponent implements OnInit, OnDestroy {
.subscribe(([_getDataBagItemDetailsSt, dataBagItemDetailsState]) => {
this.selectedItemDetails = JSON.parse(dataBagItemDetailsState.data);
delete this.selectedItemDetails['id'];
this.editDisable = false;
for (const item in this.selectedItemDetails) {
if (this.selectedItemDetails[item]) {
for (const property in this.selectedItemDetails[item]) {
if (property === 'encrypted_data' || property === 'cipher') {
this.editDisable = true;
}
}
}
}
this.dataBagsItemDetailsLoading = false;
});
}
Expand Down

0 comments on commit 7b8a6b0

Please sign in to comment.