3
0

Fix automation dummy button throwing errors when editing it

This commit is contained in:
Jože Fortun 2022-12-22 15:01:12 +01:00
parent 7c91d33df3
commit 2823c9a36c
3 changed files with 24 additions and 20 deletions

View File

@ -1,10 +1,10 @@
<template>
<b-card
:header="workflow ? $t('automation.editTitle.workflow') : $t('automation.editTitle.script')"
:header="workflow ? $t('editTitle.workflow') : $t('editTitle.script')"
footer-class="text-right"
>
<b-form-group
:label="$t('automation.buttonLabel')"
:label="$t('buttonLabel')"
>
<b-input-group>
<b-form-input
@ -14,7 +14,7 @@
</b-form-group>
<b-form-group
:label="$t('automation.buttonVariant')"
:label="$t('buttonVariant')"
>
<b-select
v-model="button.variant"
@ -35,7 +35,7 @@
v-if="workflow"
>
<h5>
{{ workflow.meta.name || $t('automation.noLabel') }}
{{ workflow.meta.name || $t('noLabel') }}
</h5>
</div>
@ -50,27 +50,29 @@
show
variant="warning"
>
{{ $t('automation.noScript' ) }}
{{ $t('noScript' ) }}
</b-alert>
<p
v-if="workflow && workflow.meta"
class="my-2"
>
{{ workflow.meta.description || $t('automation.noDescription') }}
{{ workflow.meta.description || $t('noDescription') }}
<var
v-if="trigger"
>
{{ $t('stepID', { stepID: trigger.stepID }) }}
</var>
</p>
<p
v-else-if="script"
class="my-2"
>
{{ script.description || $t('automation.noDescription') }}
{{ script.description || $t('noDescription') }}
</p>
<var>
{{ $t('automation.stepID', { stepID: trigger.stepID }) }}
</var>
<template #footer>
<c-input-confirm
variant="link-light"
@ -85,6 +87,7 @@ import { compose, NoID } from '@cortezaproject/corteza-js'
export default {
i18nOptions: {
namespaces: 'block',
keyPrefix: 'automation',
},
props: {
@ -126,7 +129,7 @@ export default {
'success',
'danger',
'warning',
].map(variant => ({ variant, label: this.$t(`${variant}Button`) }))
].map(variant => ({ variant, label: this.$t(`variants.${variant}`) }))
},
workflow () {

View File

@ -17,7 +17,7 @@ export class Button {
public label?: string = undefined;
// can override hook's variant
public variant?: string = undefined;
public variant?: string = 'primary';
public enabled = true;

View File

@ -7,26 +7,27 @@ automation:
buttonLabel: Label
buttonVariant: Variant
configuredButtons: Configured buttons
dangerButton: Danger
darkButton: Dark
dummyButtonLabel: Dummy
editButton: Edit
editTitle:
script: Edit automation script button
workflow: Edit workflow button
label: Automation
lightButton: Light
noDescription: No description
noLabel: Unlabeled
noScript: There is no script or workflow configured for this button
noScripts: There are no manual scripts compatible with this page block
primaryButton: Primary
removeAll: Remove all
searchPlaceholder: Filter available scripts by label, script name and description
secondaryButton: Secondary
stepID: 'Starting step ID: {{stepID}}'
successButton: Success
warningButton: Warning
variants:
primary: Primary
secondary: Secondary
light: Light
dark: Dark
success: Success
danger: Danger
warning: Warning
calendar:
addEventsSource: Add events source
calendarHeader: Calendar header