3
0

Fix permissions buttons when resource name or handle were not defined

This commit is contained in:
Jože Fortun 2022-12-20 12:54:24 +01:00
parent a578a0c242
commit ef04afeeb6
17 changed files with 47 additions and 56 deletions

View File

@ -17,9 +17,9 @@
</b-button>
<c-permissions-button
v-if="workflowID && canGrant"
:title="workflow.handle"
:target="workflow.handle"
:resource="'corteza::automation:workflow/'+workflowID"
:title="workflow.meta.name || workflow.handle || workflowID"
:target="workflow.meta.name || workflow.handle || workflowID"
:resource="`corteza::automation:workflow/${workflowID}`"
button-variant="light"
class="ml-2"
>

View File

@ -12,9 +12,9 @@
</b-button>
<c-permissions-button
v-if="routeID && canGrant"
:title="route.endpoint"
:target="route.endpoint"
:resource="'corteza::system:apigw-route/'+routeID"
:title="route.endpoint || routeID"
:target="route.endpoint || routeID"
:resource="`corteza::system:apigw-route/${routeID}`"
button-variant="light"
class="ml-2"
>

View File

@ -19,9 +19,9 @@
</b-button>
<c-permissions-button
v-if="applicationID && canGrant"
:title="application.name"
:target="application.name"
:resource="'corteza::system:application/'+applicationID"
:title="application.name || applicationID"
:target="application.name || applicationID"
:resource="`corteza::system:application/${applicationID}`"
button-variant="light"
class="ml-2"
>

View File

@ -19,9 +19,9 @@
</b-button>
<c-permissions-button
v-if="authClientID && canGrant"
:title="rbacEditorTitle"
:target="rbacEditorTitle"
:resource="'corteza::system:auth-client/'+authClientID"
:title="authclient.meta.name || authclient.handle || authClientID"
:target="authclient.meta.name || authclient.handle || authClientID"
:resource="`corteza::system:auth-client/${authClientID}`"
button-variant="light"
>
<font-awesome-icon :icon="['fas', 'lock']" />
@ -108,15 +108,6 @@ export default {
title () {
return this.authClientID ? this.$t('title.edit') : this.$t('title.create')
},
rbacEditorTitle () {
if (this.authclient) {
const { meta: { name } = {}, handle } = this.authclient || {}
return name || handle
}
return ''
},
},
watch: {

View File

@ -21,9 +21,9 @@
<c-permissions-button
v-if="roleID && canGrant"
:title="role.name"
:target="role.name"
:resource="'corteza::system:role/'+roleID"
:title="role.name || role.handle || role.roleID"
:target="role.name || role.handle || role.roleID"
:resource="`corteza::system:role/${roleID}`"
button-variant="light"
class="mr-2"
>

View File

@ -20,9 +20,9 @@
</b-button>
<c-permissions-button
v-if="templateID && canGrant"
:title="template.handle"
:target="template.handle"
:resource="'corteza::system:template/'+templateID"
:title="template.meta.short || template.handle || template.templateID"
:target="template.meta.short || template.handle || template.templateID"
:resource="`corteza::system:template/${templateID}`"
button-variant="light"
>
<font-awesome-icon :icon="['fas', 'lock']" />

View File

@ -21,9 +21,9 @@
</b-button>
<c-permissions-button
v-if="canGrant"
:title="user.name || user.handle || user.email"
:target="user.name || user.handle || user.email"
:resource="'corteza::system:user/'+userID"
:title="user.name || user.handle || user.email || userID"
:target="user.name || user.handle || user.email || userID"
:resource="`corteza::system:user/${userID}`"
button-variant="light"
>
<font-awesome-icon :icon="['fas', 'lock']" />

View File

@ -92,8 +92,8 @@
v-if="canGrant && exists"
class="text-dark px-0"
button-variant="link"
:title="value.name"
:target="value.name"
:title="value.label || value.name || value.fieldID"
:target="value.label || value.name || value.fieldID"
:tooltip="$t('permissions:resources.compose.module-field.tooltip')"
:resource="`corteza::compose:module-field/${module.namespaceID}/${module.moduleID}/${value.fieldID}`"
/>

View File

@ -90,8 +90,8 @@
</span>
<c-permissions-button
v-if="namespace.canGrant"
:title="item.title"
:target="item.title"
:title="item.title || item.handle || item.pageID"
:target="item.title || item.handle || item.pageID"
:resource="`corteza::compose:page/${namespace.namespaceID}/${item.pageID}`"
:tooltip="$t('permissions:resources.compose.page.tooltip')"
link

View File

@ -85,8 +85,8 @@
<template #actions="{ item: c }">
<c-permissions-button
v-if="c.canGrant"
:title="c.name"
:target="c.name"
:title="c.name || c.handle || c.chartID"
:target="c.name || c.handle || c.chartID"
:resource="`corteza::compose:chart/${namespace.namespaceID}/${c.chartID}`"
link
class="btn px-2"

View File

@ -110,8 +110,8 @@
<b-dropdown-item>
<c-permissions-button
:title="module.name"
:target="module.name"
:title="module.name || module.handle || module.moduleID"
:target="module.name || module.handle || module.moduleID"
:resource="`corteza::compose:module/${namespace.namespaceID}/${module.moduleID}`"
:button-label="$t('general:label.module')"
:show-button-icon="false"
@ -121,8 +121,8 @@
<b-dropdown-item>
<c-permissions-button
:title="module.name"
:target="module.name"
:title="module.name || module.handle || module.moduleID"
:target="module.name || module.handle || module.moduleID"
:resource="`corteza::compose:module-field/${namespace.namespaceID}/${module.moduleID}/*`"
:button-label="$t('general:label.field')"
:show-button-icon="false"
@ -133,8 +133,8 @@
<b-dropdown-item>
<c-permissions-button
:title="module.name"
:target="module.name"
:title="module.name || module.handle || module.moduleID"
:target="module.name || module.handle || module.moduleID"
:resource="`corteza::compose:record/${namespace.namespaceID}/${module.moduleID}/*`"
:button-label="$t('general:label.record')"
:show-button-icon="false"

View File

@ -118,8 +118,8 @@
</b-button>
<c-permissions-button
v-if="m.canGrant"
:title="m.name"
:target="m.name"
:title="m.name || m.handle || m.moduleID"
:target="m.name || m.handle || m.moduleID"
:resource="`corteza::compose:module/${m.namespaceID}/${m.moduleID}`"
:tooltip="$t('permissions:resources.compose.module.tooltip')"
class="btn px-2"

View File

@ -66,9 +66,9 @@
<c-permissions-button
v-if="namespace.canGrant"
data-test-id="button-permissions"
:title="namespace.name"
:target="namespace.name"
:resource="'corteza::compose:namespace/'+namespace.namespaceID"
:title="namespace.name || namespace.slug || namespace.namespaceID"
:target="namespace.name || namespace.slug || namespace.namespaceID"
:resource="`corteza::compose:namespace/${namespace.namespaceID}`"
button-variant="light"
:button-label="$t('label.permissions')"
class="ml-1 btn-lg"

View File

@ -72,8 +72,8 @@
<c-permissions-button
v-if="canGrant"
:title="report.handle"
:target="report.handle"
:title="report.meta.name || report.handle || report.reportID"
:target="report.meta.name || report.handle || report.reportID"
:resource="`corteza::system:report/${report.reportID}`"
:button-label="$t('permissions')"
button-variant="light"

View File

@ -78,9 +78,9 @@
<c-permissions-button
v-if="r.canGrant"
:tooltip="$t('permissions:resources.system.report.tooltip')"
:title="r.handle"
:target="r.handle"
resource="corteza::system:report/*"
:title="r.meta.name || r.handle || r.reportID"
:target="r.meta.name || r.handle || r.reportID"
:resource="`corteza::system:report/${r.reportID}`"
class="btn px-2"
link
/>

View File

@ -335,8 +335,8 @@
<c-permissions-button
v-if="workflow.canGrant"
:title="workflow.meta.name || workflow.handle"
:target="workflow.meta.name || workflow.handle"
:title="workflow.meta.name || workflow.handle || workflow.workflowID"
:target="workflow.meta.name || workflow.handle || workflow.workflowID"
:resource="`corteza::automation:workflow/${workflow.workflowID}`"
:button-label="$t('general:permissions')"
button-variant="light"

View File

@ -138,8 +138,8 @@
<c-permissions-button
v-if="w.canGrant"
:tooltip="$t('permissions:resources.automation.workflow.tooltip')"
:title="w.meta.name || w.handle"
:target="w.meta.name || w.handle"
:title="w.meta.name || w.handle || w.workflowID"
:target="w.meta.name || w.handle || w.workflowID"
:resource="`corteza::automation:workflow/${w.workflowID}`"
link
class="btn px-2"