Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled edit button if databag item is encrypted. #5754

Merged
merged 1 commit into from
Sep 21, 2021
Merged
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 @@ -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