Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Update caller policy select #9404

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/editor-ui/src/components/WorkflowSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ export default defineComponent({
return this.workflowsStore.workflowId;
},
workflow(): IWorkflowDb {
return this.workflowsStore.workflow;
return this.workflowsStore.getWorkflowById(this.workflowId);
},
currentUser(): IUser | null {
return this.usersStore.currentUser;
Expand All @@ -483,7 +483,7 @@ export default defineComponent({
},
workflowOwnerName(): string {
const fallback = this.$locale.baseText(
'workflowSettings.callerPolicy.options.workflowsFromSameOwner.fallback',
'workflowSettings.callerPolicy.options.workflowsFromSameProject',
);

return this.workflowsEEStore.getWorkflowOwnerName(`${this.workflowId}`, fallback);
Expand Down Expand Up @@ -604,14 +604,12 @@ export default defineComponent({
{
key: 'workflowsFromSameOwner',
value: this.$locale.baseText(
'workflowSettings.callerPolicy.options.workflowsFromSameOwner',
this.workflow.homeProject?.type === 'personal'
? 'workflowSettings.callerPolicy.options.workflowsFromPersonalProject'
: 'workflowSettings.callerPolicy.options.workflowsFromTeamProject',
{
interpolate: {
owner: this.workflowPermissions.isOwner
? this.$locale.baseText(
'workflowSettings.callerPolicy.options.workflowsFromSameOwner.owner',
)
: this.workflowOwnerName,
projectName: this.workflowOwnerName,
},
},
),
Expand Down Expand Up @@ -763,7 +761,9 @@ export default defineComponent({
}
},
async loadWorkflows() {
const workflows = (await this.workflowsStore.fetchAllWorkflows()) as IWorkflowShortResponse[];
const workflows = (await this.workflowsStore.fetchAllWorkflows(
this.workflow.homeProject?.id,
)) as IWorkflowShortResponse[];
workflows.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) {
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('WorkflowSettingsVue', () => {

vi.spyOn(workflowsStore, 'workflowName', 'get').mockReturnValue('Test Workflow');
vi.spyOn(workflowsStore, 'workflowId', 'get').mockReturnValue('1');
vi.spyOn(workflowsStore, 'workflow', 'get').mockReturnValue({
vi.spyOn(workflowsStore, 'getWorkflowById').mockReturnValue({
id: '1',
name: 'Test Workflow',
active: true,
Expand Down
6 changes: 3 additions & 3 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2005,9 +2005,9 @@
"workflowSettings.callerIds.placeholder": "e.g. 14, 18",
"workflowSettings.callerPolicy": "This workflow can be called by",
"workflowSettings.callerPolicy.options.any": "Any workflow",
"workflowSettings.callerPolicy.options.workflowsFromSameOwner": "Workflows created by {owner}",
"workflowSettings.callerPolicy.options.workflowsFromSameOwner.owner": "me",
"workflowSettings.callerPolicy.options.workflowsFromSameOwner.fallback": "same owner",
"workflowSettings.callerPolicy.options.workflowsFromPersonalProject": "Workflows created by {projectName}",
"workflowSettings.callerPolicy.options.workflowsFromTeamProject": "Only workflows in {projectName}",
"workflowSettings.callerPolicy.options.workflowsFromSameProject": "Only workflows in the same project",
"workflowSettings.callerPolicy.options.workflowsFromAList": "Selected workflows",
"workflowSettings.callerPolicy.options.none": "No other workflows",
"workflowSettings.defaultTimezone": "Default - {defaultTimezoneValue}",
Expand Down
4 changes: 3 additions & 1 deletion packages/editor-ui/src/stores/workflows.ee.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export const useWorkflowsEEStore = defineStore(STORES.WORKFLOWS_EE, {
const workflow = useWorkflowsStore().getWorkflowById(workflowId);
const { firstName, lastName, email } = splitName(workflow?.homeProject?.name ?? '');

return workflow?.homeProject?.name ? `${firstName} ${lastName} (${email})` : fallback;
return workflow?.homeProject?.name
? `${firstName} ${lastName ?? ''} ${email ? `(${email})` : ''}`
: fallback;
};
},
},
Expand Down
Loading