feat: Add dynamic translations. Change how sharing unavailable is handled (no-changelog) (#4758)

* feat: Add dynamic translations. Change how sharing unavailable is handled (no-changelog)

* fix: Add not-allowed cursor for disabled share button

* fix: Remove fakedoor features from workflow details

* fix: Remove fakedoor code from workflow share modal

* fix: change dynamic translation to match shareModal title

* chore: Removed unused import
This commit is contained in:
Alex Grozav
2022-11-29 15:13:10 +02:00
committed by GitHub
parent 86a4965e9a
commit b1287ba8cb
6 changed files with 73 additions and 16 deletions

View File

@@ -75,6 +75,25 @@
>
{{ $locale.baseText('workflowDetails.share') }}
</n8n-button>
<template #fallback>
<n8n-tooltip>
<n8n-button
type="secondary"
:class="['mr-2xs', $style.disabledShareButton]"
>
{{ $locale.baseText('workflowDetails.share') }}
</n8n-button>
<template #content>
<i18n :path="dynamicTranslations.workflows.sharing.unavailable.description" tag="span">
<template #action>
<a :href="dynamicTranslations.workflows.sharing.unavailable.linkURL" target="_blank">
{{ $locale.baseText(dynamicTranslations.workflows.sharing.unavailable.action) }}
</a>
</template>
</i18n>
</template>
</n8n-tooltip>
</template>
</enterprise-edition>
<SaveButton
type="primary"
@@ -114,7 +133,7 @@ import SaveButton from "@/components/SaveButton.vue";
import TagsDropdown from "@/components/TagsDropdown.vue";
import InlineTextEdit from "@/components/InlineTextEdit.vue";
import BreakpointsObserver from "@/components/BreakpointsObserver.vue";
import {IWorkflowDataUpdate, IWorkflowDb, IWorkflowToShare} from "@/Interface";
import {IWorkflowDataUpdate, IWorkflowDb, IWorkflowToShare, NestedRecord} from "@/Interface";
import { saveAs } from 'file-saver';
import { titleChange } from "@/mixins/titleChange";
@@ -169,6 +188,9 @@ export default mixins(workflowHelpers, titleChange).extend({
useWorkflowsStore,
useUsersStore,
),
dynamicTranslations(): NestedRecord<string> {
return this.uiStore.dynamicTranslations;
},
isWorkflowActive(): boolean {
return this.workflowsStore.isWorkflowActive;
},
@@ -548,4 +570,8 @@ $--header-spacing: 20px;
.deleteItem {
color: var(--color-danger);
}
.disabledShareButton {
cursor: not-allowed;
}
</style>

View File

@@ -1,7 +1,7 @@
<template>
<Modal
width="460px"
:title="$locale.baseText(fakeDoor.actionBoxTitle, { interpolate: { name: workflow.name } })"
:title="$locale.baseText(dynamicTranslations.workflows.shareModal.title, { interpolate: { name: workflow.name } })"
:eventBus="modalBus"
:name="WORKFLOW_SHARE_MODAL_KEY"
:center="true"
@@ -52,7 +52,9 @@
</n8n-users-list>
<template #fallback>
<n8n-text>
{{ $locale.baseText(fakeDoor.actionBoxDescription) }}
<i18n :path="dynamicTranslations.workflows.sharing.unavailable.description" tag="span">
<template #action />
</i18n>
</n8n-text>
</template>
</enterprise-edition>
@@ -80,12 +82,12 @@
</n8n-button>
<template #fallback>
<n8n-link :to="fakeDoor.linkURL">
<n8n-link :to="dynamicTranslations.workflows.sharing.unavailable.linkURL">
<n8n-button
:loading="loading"
size="medium"
>
{{ $locale.baseText(fakeDoor.actionBoxButtonLabel) }}
{{ $locale.baseText(dynamicTranslations.workflows.sharing.unavailable.button) }}
</n8n-button>
</n8n-link>
</template>
@@ -99,11 +101,10 @@ import Vue from 'vue';
import Modal from './Modal.vue';
import {
EnterpriseEditionFeature,
FAKE_DOOR_FEATURES,
PLACEHOLDER_EMPTY_WORKFLOW_ID,
WORKFLOW_SHARE_MODAL_KEY,
} from '../constants';
import {IFakeDoor, IUser, IWorkflowDb} from "@/Interface";
import {IUser, IWorkflowDb, NestedRecord} from "@/Interface";
import { getWorkflowPermissions, IPermissions } from "@/permissions";
import mixins from "vue-typed-mixins";
import {showMessage} from "@/mixins/showMessage";
@@ -174,8 +175,8 @@ export default mixins(
isSharingAvailable(): boolean {
return this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.WorkflowSharing) === true;
},
fakeDoor(): IFakeDoor | undefined {
return this.uiStore.getFakeDoorById(FAKE_DOOR_FEATURES.WORKFLOWS_SHARING);
dynamicTranslations(): NestedRecord<string> {
return this.uiStore.dynamicTranslations;
},
isDirty(): boolean {
const previousSharedWith = this.workflow.sharedWith || [];