Skip to content

Commit

Permalink
fix: Update permission for showing workflow caller policy (#4916)
Browse files Browse the repository at this point in the history
* fix: Update permission for showing workflow caller polic

* fix: remove unused store setting
  • Loading branch information
alexgrozav authored Dec 14, 2022
1 parent 990d13d commit f73267f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 58 deletions.
1 change: 0 additions & 1 deletion packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,6 @@ export interface IN8nUISettings {
deployment?: {
type: string;
};
isWorkflowSharingEnabled: boolean;
}

export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
Expand Down
104 changes: 52 additions & 52 deletions packages/editor-ui/src/components/WorkflowSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,56 @@
</n8n-select>
</el-col>
</el-row>
<div v-if="isWorkflowSharingEnabled">
<el-row>
<el-col :span="10" class="setting-name">
{{ $locale.baseText('workflowSettings.callerPolicy') + ':' }}
<n8n-tooltip class="setting-info" placement="top">
<template #content>
<div v-text="helpTexts.workflowCallerPolicy"></div>
</template>
<font-awesome-icon icon="question-circle" />
</n8n-tooltip>
</el-col>

<el-col :span="14" class="ignore-key-press">
<n8n-select
v-model="workflowSettings.callerPolicy"
:placeholder="$locale.baseText('workflowSettings.selectOption')"
size="medium"
filterable
:limit-popper-width="true"
>
<n8n-option
v-for="option of workflowCallerPolicyOptions"
:key="option.key"
:label="option.value"
:value="option.key"
>
</n8n-option>
</n8n-select>
</el-col>
</el-row>
<el-row v-if="workflowSettings.callerPolicy === 'workflowsFromAList'">
<el-col :span="10" class="setting-name">
{{ $locale.baseText('workflowSettings.callerIds') + ':' }}
<n8n-tooltip class="setting-info" placement="top">
<template #content>
<div v-text="helpTexts.workflowCallerIds"></div>
</template>
<font-awesome-icon icon="question-circle" />
</n8n-tooltip>
</el-col>
<el-col :span="14">
<n8n-input
type="text"
size="medium"
v-model="workflowSettings.callerIds"
@input="onCallerIdsInput"
/>
</el-col>
</el-row>
</div>
<el-row>
<el-col :span="10" class="setting-name">
{{ $locale.baseText('workflowSettings.timezone') + ':' }}
Expand Down Expand Up @@ -181,56 +231,6 @@
</n8n-select>
</el-col>
</el-row>
<div v-if="isWorkflowSharingEnabled">
<el-row>
<el-col :span="10" class="setting-name">
{{ $locale.baseText('workflowSettings.callerPolicy') + ':' }}
<n8n-tooltip class="setting-info" placement="top">
<template #content>
<div v-text="helpTexts.workflowCallerPolicy"></div>
</template>
<font-awesome-icon icon="question-circle" />
</n8n-tooltip>
</el-col>

<el-col :span="14" class="ignore-key-press">
<n8n-select
v-model="workflowSettings.callerPolicy"
:placeholder="$locale.baseText('workflowSettings.selectOption')"
size="medium"
filterable
:limit-popper-width="true"
>
<n8n-option
v-for="option of workflowCallerPolicyOptions"
:key="option.key"
:label="option.value"
:value="option.key"
>
</n8n-option>
</n8n-select>
</el-col>
</el-row>
<el-row v-if="workflowSettings.callerPolicy === 'workflowsFromAList'">
<el-col :span="10" class="setting-name">
{{ $locale.baseText('workflowSettings.callerIds') + ':' }}
<n8n-tooltip class="setting-info" placement="top">
<template #content>
<div v-text="helpTexts.workflowCallerIds"></div>
</template>
<font-awesome-icon icon="question-circle" />
</n8n-tooltip>
</el-col>
<el-col :span="14">
<n8n-input
type="text"
size="medium"
v-model="workflowSettings.callerIds"
@input="onCallerIdsInput"
/>
</el-col>
</el-row>
</div>
<el-row>
<el-col :span="10" class="setting-name">
{{ $locale.baseText('workflowSettings.timeoutWorkflow') + ':' }}
Expand Down Expand Up @@ -327,7 +327,7 @@ import {
WorkflowCallerPolicyDefaultOption,
} from '@/Interface';
import Modal from './Modal.vue';
import { PLACEHOLDER_EMPTY_WORKFLOW_ID, WORKFLOW_SETTINGS_MODAL_KEY } from '../constants';
import {EnterpriseEditionFeature, PLACEHOLDER_EMPTY_WORKFLOW_ID, WORKFLOW_SETTINGS_MODAL_KEY} from '../constants';
import mixins from 'vue-typed-mixins';
Expand Down Expand Up @@ -402,7 +402,7 @@ export default mixins(externalHooks, genericHelpers, restApi, showMessage).exten
return this.workflowsStore.workflowId;
},
isWorkflowSharingEnabled(): boolean {
return this.settingsStore.isWorkflowSharingEnabled;
return this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.WorkflowSharing);
},
},
async mounted() {
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,8 @@
"workflowSettings.callerIds": "Caller IDs",
"workflowSettings.callerPolicy": "This workflow can be called by",
"workflowSettings.callerPolicy.options.any": "Any workflow",
"workflowSettings.callerPolicy.options.workflowsFromAList": "List of specific workflow IDs",
"workflowSettings.callerPolicy.options.none": "No workflows can call one",
"workflowSettings.callerPolicy.options.workflowsFromAList": "Selected workflows",
"workflowSettings.callerPolicy.options.none": "No other workflows",
"workflowSettings.defaultTimezone": "Default - {defaultTimezoneValue}",
"workflowSettings.defaultTimezoneNotValid": "Default Timezone not valid",
"workflowSettings.errorWorkflow": "Error Workflow",
Expand Down
3 changes: 0 additions & 3 deletions packages/editor-ui/src/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
isQueueModeEnabled(): boolean {
return this.settings.executionMode === 'queue';
},
isWorkflowSharingEnabled(): boolean {
return this.settings.isWorkflowSharingEnabled;
},
workflowCallerPolicyDefaultOption(): WorkflowCallerPolicyDefaultOption {
return this.settings.workflowCallerPolicyDefaultOption;
},
Expand Down

0 comments on commit f73267f

Please sign in to comment.