web: show related edit button for bound stages and policies

This commit is contained in:
Jens Langhammer 2021-03-11 10:12:22 +01:00
parent 0775296003
commit 9a524dd671
2 changed files with 38 additions and 10 deletions

View File

@ -49,6 +49,33 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
}
}
getObjectEditButton(item: PolicyBinding): TemplateResult {
if (item.policy) {
return html`<ak-modal-button href="${AdminURLManager.policies(`${item.policy?.policyUuid}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit Policy")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>`;
} else if (item.group) {
return html`<ak-modal-button href="${AdminURLManager.groups(`${item.group?.groupUuid}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit Group")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>`;
} else if (item.user) {
return html`<ak-modal-button href="${AdminURLManager.policies(`${item.user?.id}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit User")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>`;
} else {
return html``;
}
}
row(item: PolicyBinding): TemplateResult[] {
return [
html`${this.getPolicyUserGroupRow(item)}`,
@ -56,15 +83,16 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
html`${item.order}`,
html`${item.timeout}`,
html`
${this.getObjectEditButton(item)}
<ak-modal-button href="${AdminURLManager.policyBindings(`${item.pk}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit")}
${gettext("Edit Binding")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>
<ak-modal-button href="${AdminURLManager.policyBindings(`${item.pk}/delete/`)}">
<ak-spinner-button slot="trigger" class="pf-m-danger">
${gettext("Delete")}
${gettext("Delete Binding")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>

View File

@ -45,21 +45,21 @@ export class BoundStagesList extends Table<FlowStageBinding> {
html`${item.stageObj?.name}`,
html`${item.stageObj?.verboseName}`,
html`
<ak-modal-button href="${AdminURLManager.stageBindings(`${item.pk}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit Binding")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>
<ak-modal-button href="${AdminURLManager.stages(`${item.stage}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit Stage")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>
<ak-modal-button href="${AdminURLManager.stages(`${item.pk}/delete/`)}">
<ak-modal-button href="${AdminURLManager.stageBindings(`${item.pk}/update/`)}">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
${gettext("Edit Binding")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>
<ak-modal-button href="${AdminURLManager.stageBindings(`${item.pk}/delete/`)}">
<ak-spinner-button slot="trigger" class="pf-m-danger">
${gettext("Delete")}
${gettext("Delete Binding")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>