2019-06-23 03:35:23 -07:00
|
|
|
<template>
|
|
|
|
<div id="side-menu">
|
2020-01-09 19:53:26 -08:00
|
|
|
<about :dialogVisible="aboutDialogVisible" @closeDialog="closeAboutDialog"></about>
|
2019-06-23 03:35:23 -07:00
|
|
|
<input type="file" ref="importFile" style="display: none" v-on:change="handleFileImport()">
|
|
|
|
|
|
|
|
<div class="side-menu-wrapper" :class="{expanded: !isCollapsed}">
|
2021-05-29 11:31:21 -07:00
|
|
|
<div id="collapse-change-button" class="clickable" @click="toggleCollapse">
|
2019-06-23 03:35:23 -07:00
|
|
|
<font-awesome-icon icon="angle-right" class="icon" />
|
|
|
|
</div>
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu default-active="workflow" @select="handleSelect" :collapse="isCollapsed">
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu-item index="logo" class="logo-item">
|
2020-01-09 19:53:26 -08:00
|
|
|
<a href="https://n8n.io" target="_blank" class="logo">
|
2020-07-12 00:28:08 -07:00
|
|
|
<img :src="basePath + 'n8n-icon-small.png'" class="icon" alt="n8n.io"/>
|
2020-01-09 19:53:26 -08:00
|
|
|
<span class="logo-text" slot="title">n8n.io</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</a>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2021-05-04 08:55:39 -07:00
|
|
|
<MenuItemsIterator :items="sidebarMenuTopItems" :root="true"/>
|
2021-04-09 13:44:53 -07:00
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<el-submenu index="workflow" title="Workflow" popperClass="sidebar-popper">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="network-wired"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title-root">{{ $locale.baseText('mainSidebar.workflows') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu-item index="workflow-new">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="file"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.new') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-open">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="folder-open"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.open') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-save">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="save"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.save') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-duplicate" :disabled="!currentWorkflow">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="copy"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.duplicate') }}</span>
|
2019-12-20 14:58:36 -08:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-delete" :disabled="!currentWorkflow">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="trash"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.delete') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-download">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="file-download"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.download') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-import-url">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="cloud"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.importFromUrl') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-import-file">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="hdd"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.importFromFile') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="workflow-settings" :disabled="!currentWorkflow">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="cog"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.settings') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
2019-06-23 03:35:23 -07:00
|
|
|
</el-submenu>
|
|
|
|
|
2021-12-15 04:16:53 -08:00
|
|
|
<el-submenu index="credentials" :title="$locale.baseText('mainSidebar.credentials')" popperClass="sidebar-popper">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="key"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title-root">{{ $locale.baseText('mainSidebar.credentials') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu-item index="credentials-new">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="file"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.new') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
|
|
|
<n8n-menu-item index="credentials-open">
|
2019-06-23 03:35:23 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="folder-open"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.open') }}</span>
|
2019-06-23 03:35:23 -07:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
2019-06-23 03:35:23 -07:00
|
|
|
</el-submenu>
|
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu-item index="executions">
|
2019-06-23 03:35:23 -07:00
|
|
|
<font-awesome-icon icon="tasks"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title-root">{{ $locale.baseText('mainSidebar.executions') }}</span>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<el-submenu index="help" class="help-menu" title="Help" popperClass="sidebar-popper">
|
2019-09-22 12:59:45 -07:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon icon="question"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title-root">{{ $locale.baseText('mainSidebar.help') }}</span>
|
2019-09-22 12:59:45 -07:00
|
|
|
</template>
|
|
|
|
|
2021-10-18 20:57:49 -07:00
|
|
|
<MenuItemsIterator :items="helpMenuItems" :afterItemClick="trackHelpItemClick" />
|
2021-05-04 08:55:39 -07:00
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu-item index="help-about">
|
2020-01-09 19:53:26 -08:00
|
|
|
<template slot="title">
|
|
|
|
<font-awesome-icon class="about-icon" icon="info"/>
|
2021-12-15 04:16:53 -08:00
|
|
|
<span slot="title" class="item-title">{{ $locale.baseText('mainSidebar.aboutN8n') }}</span>
|
2020-01-09 19:53:26 -08:00
|
|
|
</template>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
2019-09-22 12:59:45 -07:00
|
|
|
</el-submenu>
|
|
|
|
|
2021-05-04 08:55:39 -07:00
|
|
|
<MenuItemsIterator :items="sidebarMenuBottomItems" :root="true"/>
|
2021-04-09 13:44:53 -07:00
|
|
|
|
2021-07-22 01:22:17 -07:00
|
|
|
<div class="footer-menu-items">
|
2021-09-11 01:15:36 -07:00
|
|
|
<n8n-menu-item index="updates" class="updates" v-if="hasVersionUpdates" @click="openUpdatesPanel">
|
2021-07-22 01:22:17 -07:00
|
|
|
<div class="gift-container">
|
|
|
|
<GiftNotificationIcon />
|
|
|
|
</div>
|
|
|
|
<span slot="title" class="item-title-root">{{nextVersions.length > 99 ? '99+' : nextVersions.length}} update{{nextVersions.length > 1 ? 's' : ''}} available</span>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu-item>
|
2021-07-22 01:22:17 -07:00
|
|
|
</div>
|
2021-09-11 01:15:36 -07:00
|
|
|
</n8n-menu>
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-05-04 08:55:39 -07:00
|
|
|
|
2019-12-29 13:02:21 -08:00
|
|
|
import { MessageBoxInputData } from 'element-ui/types/message-box';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
import {
|
|
|
|
IExecutionResponse,
|
|
|
|
IWorkflowDataUpdate,
|
2021-04-09 13:44:53 -07:00
|
|
|
IMenuItem,
|
2019-06-23 03:35:23 -07:00
|
|
|
} from '../Interface';
|
|
|
|
|
2020-01-09 19:53:26 -08:00
|
|
|
import About from '@/components/About.vue';
|
2019-06-23 03:35:23 -07:00
|
|
|
import ExecutionsList from '@/components/ExecutionsList.vue';
|
2021-07-22 01:22:17 -07:00
|
|
|
import GiftNotificationIcon from './GiftNotificationIcon.vue';
|
2019-06-23 03:35:23 -07:00
|
|
|
import WorkflowSettings from '@/components/WorkflowSettings.vue';
|
|
|
|
|
|
|
|
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
|
|
|
import { restApi } from '@/components/mixins/restApi';
|
|
|
|
import { showMessage } from '@/components/mixins/showMessage';
|
2020-08-25 11:38:09 -07:00
|
|
|
import { titleChange } from '@/components/mixins/titleChange';
|
2019-06-23 03:35:23 -07:00
|
|
|
import { workflowHelpers } from '@/components/mixins/workflowHelpers';
|
|
|
|
import { workflowRun } from '@/components/mixins/workflowRun';
|
|
|
|
|
|
|
|
import { saveAs } from 'file-saver';
|
|
|
|
|
|
|
|
import mixins from 'vue-typed-mixins';
|
2021-05-29 11:31:21 -07:00
|
|
|
import { mapGetters } from 'vuex';
|
2021-05-04 08:55:39 -07:00
|
|
|
import MenuItemsIterator from './MainSidebarMenuItemsIterator.vue';
|
2022-01-21 09:00:00 -08:00
|
|
|
import { CREDENTIAL_LIST_MODAL_KEY, CREDENTIAL_SELECT_MODAL_KEY, DUPLICATE_MODAL_KEY, TAGS_MANAGER_MODAL_KEY, VERSIONS_MODAL_KEY, WORKFLOW_SETTINGS_MODAL_KEY, WORKFLOW_OPEN_MODAL_KEY, EXECUTIONS_MODAL_KEY } from '@/constants';
|
2021-05-04 08:55:39 -07:00
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export default mixins(
|
|
|
|
genericHelpers,
|
|
|
|
restApi,
|
|
|
|
showMessage,
|
2020-08-25 11:38:09 -07:00
|
|
|
titleChange,
|
2019-06-23 03:35:23 -07:00
|
|
|
workflowHelpers,
|
|
|
|
workflowRun,
|
|
|
|
)
|
|
|
|
.extend({
|
|
|
|
name: 'MainHeader',
|
|
|
|
components: {
|
2020-01-09 19:53:26 -08:00
|
|
|
About,
|
2019-06-23 03:35:23 -07:00
|
|
|
ExecutionsList,
|
2021-07-22 01:22:17 -07:00
|
|
|
GiftNotificationIcon,
|
2019-06-23 03:35:23 -07:00
|
|
|
WorkflowSettings,
|
2021-05-04 08:55:39 -07:00
|
|
|
MenuItemsIterator,
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
2020-01-09 19:53:26 -08:00
|
|
|
aboutDialogVisible: false,
|
2020-07-12 00:28:08 -07:00
|
|
|
// @ts-ignore
|
2020-07-14 14:36:05 -07:00
|
|
|
basePath: this.$store.getters.getBaseUrl,
|
2019-06-23 03:35:23 -07:00
|
|
|
stopExecutionInProgress: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2021-05-29 11:31:21 -07:00
|
|
|
...mapGetters('ui', {
|
|
|
|
isCollapsed: 'sidebarMenuCollapsed',
|
|
|
|
}),
|
2021-07-22 01:22:17 -07:00
|
|
|
...mapGetters('versions', [
|
|
|
|
'hasVersionUpdates',
|
|
|
|
'nextVersions',
|
|
|
|
]),
|
2021-11-10 10:41:40 -08:00
|
|
|
helpMenuItems (): object[] {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
id: 'docs',
|
|
|
|
type: 'link',
|
|
|
|
properties: {
|
|
|
|
href: 'https://docs.n8n.io',
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.helpMenuItems.documentation'),
|
2021-11-10 10:41:40 -08:00
|
|
|
icon: 'book',
|
|
|
|
newWindow: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'forum',
|
|
|
|
type: 'link',
|
|
|
|
properties: {
|
|
|
|
href: 'https://community.n8n.io',
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.helpMenuItems.forum'),
|
2021-11-10 10:41:40 -08:00
|
|
|
icon: 'users',
|
|
|
|
newWindow: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'examples',
|
|
|
|
type: 'link',
|
|
|
|
properties: {
|
|
|
|
href: 'https://n8n.io/workflows',
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.helpMenuItems.workflows'),
|
2021-11-10 10:41:40 -08:00
|
|
|
icon: 'network-wired',
|
|
|
|
newWindow: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
exeuctionId (): string | undefined {
|
|
|
|
return this.$route.params.id;
|
|
|
|
},
|
|
|
|
executionFinished (): boolean {
|
|
|
|
if (!this.isExecutionPage) {
|
|
|
|
// We are not on an exeuction page so return false
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const fullExecution = this.$store.getters.getWorkflowExecution;
|
|
|
|
|
|
|
|
if (fullExecution === null) {
|
|
|
|
// No exeuction loaded so return also false
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fullExecution.finished === true) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
executionWaitingForWebhook (): boolean {
|
|
|
|
return this.$store.getters.executionWaitingForWebhook;
|
|
|
|
},
|
|
|
|
isExecutionPage (): boolean {
|
|
|
|
if (['ExecutionById'].includes(this.$route.name as string)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
isWorkflowActive (): boolean {
|
|
|
|
return this.$store.getters.isActive;
|
|
|
|
},
|
|
|
|
currentWorkflow (): string {
|
|
|
|
return this.$route.params.name;
|
|
|
|
},
|
|
|
|
workflowExecution (): IExecutionResponse | null {
|
|
|
|
return this.$store.getters.getWorkflowExecution;
|
|
|
|
},
|
|
|
|
workflowName (): string {
|
|
|
|
return this.$store.getters.workflowName;
|
|
|
|
},
|
|
|
|
workflowRunning (): boolean {
|
|
|
|
return this.$store.getters.isActionActive('workflowRunning');
|
|
|
|
},
|
2021-04-09 13:44:53 -07:00
|
|
|
sidebarMenuTopItems(): IMenuItem[] {
|
|
|
|
return this.$store.getters.sidebarMenuItems.filter((item: IMenuItem) => item.position === 'top');
|
|
|
|
},
|
|
|
|
sidebarMenuBottomItems(): IMenuItem[] {
|
|
|
|
return this.$store.getters.sidebarMenuItems.filter((item: IMenuItem) => item.position === 'bottom');
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
methods: {
|
2021-10-18 20:57:49 -07:00
|
|
|
trackHelpItemClick (itemType: string) {
|
|
|
|
this.$telemetry.track('User clicked help resource', { type: itemType, workflow_id: this.$store.getters.workflowId });
|
|
|
|
},
|
2021-05-29 11:31:21 -07:00
|
|
|
toggleCollapse () {
|
|
|
|
this.$store.commit('ui/toggleSidebarMenuCollapse');
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
clearExecutionData () {
|
|
|
|
this.$store.commit('setWorkflowExecutionData', null);
|
|
|
|
this.updateNodesExecutionIssues();
|
|
|
|
},
|
2020-01-09 19:53:26 -08:00
|
|
|
closeAboutDialog () {
|
|
|
|
this.aboutDialogVisible = false;
|
|
|
|
},
|
2021-05-29 11:31:21 -07:00
|
|
|
openTagManager() {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', TAGS_MANAGER_MODAL_KEY);
|
2021-05-29 11:31:21 -07:00
|
|
|
},
|
2021-07-22 01:22:17 -07:00
|
|
|
openUpdatesPanel() {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', VERSIONS_MODAL_KEY);
|
2021-07-22 01:22:17 -07:00
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
async stopExecution () {
|
|
|
|
const executionId = this.$store.getters.activeExecutionId;
|
|
|
|
if (executionId === null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.stopExecutionInProgress = true;
|
2021-07-23 08:50:47 -07:00
|
|
|
await this.restApi().stopCurrentExecution(executionId);
|
2019-06-23 03:35:23 -07:00
|
|
|
this.$showMessage({
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.showMessage.stopExecution.title'),
|
2019-06-23 03:35:23 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
} catch (error) {
|
2021-11-10 10:41:40 -08:00
|
|
|
this.$showError(
|
|
|
|
error,
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.showError.stopExecution.title'),
|
2021-11-10 10:41:40 -08:00
|
|
|
);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
this.stopExecutionInProgress = false;
|
|
|
|
},
|
|
|
|
async openWorkflow (workflowId: string) {
|
|
|
|
// Change to other workflow
|
|
|
|
this.$router.push({
|
|
|
|
name: 'NodeViewExisting',
|
|
|
|
params: { name: workflowId },
|
|
|
|
});
|
|
|
|
|
2022-01-21 09:00:00 -08:00
|
|
|
this.$store.commit('ui/closeAllModals');
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
async handleFileImport () {
|
|
|
|
const reader = new FileReader();
|
|
|
|
|
|
|
|
reader.onload = (event: ProgressEvent) => {
|
|
|
|
const data = (event.target as FileReader).result;
|
|
|
|
|
|
|
|
let worflowData: IWorkflowDataUpdate;
|
|
|
|
try {
|
|
|
|
worflowData = JSON.parse(data as string);
|
|
|
|
} catch (error) {
|
|
|
|
this.$showMessage({
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.showMessage.handleFileImport.title'),
|
|
|
|
message: this.$locale.baseText('mainSidebar.showMessage.handleFileImport.message'),
|
2019-06-23 03:35:23 -07:00
|
|
|
type: 'error',
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$telemetry.track('User imported workflow', { source: 'file', workflow_id: this.$store.getters.workflowId });
|
2019-06-23 03:35:23 -07:00
|
|
|
this.$root.$emit('importWorkflowData', { data: worflowData });
|
|
|
|
};
|
|
|
|
|
|
|
|
const input = this.$refs.importFile as HTMLInputElement;
|
|
|
|
if (input !== null && input.files !== null && input.files.length !== 0) {
|
|
|
|
reader.readAsText(input!.files[0]!);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async handleSelect (key: string, keyPath: string) {
|
|
|
|
if (key === 'workflow-open') {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', WORKFLOW_OPEN_MODAL_KEY);
|
2019-06-23 03:35:23 -07:00
|
|
|
} else if (key === 'workflow-import-file') {
|
|
|
|
(this.$refs.importFile as HTMLInputElement).click();
|
|
|
|
} else if (key === 'workflow-import-url') {
|
|
|
|
try {
|
2021-11-10 10:41:40 -08:00
|
|
|
const promptResponse = await this.$prompt(
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.prompt.workflowUrl') + ':',
|
|
|
|
this.$locale.baseText('mainSidebar.prompt.importWorkflowFromUrl') + ':',
|
2021-11-10 10:41:40 -08:00
|
|
|
{
|
2021-12-15 04:16:53 -08:00
|
|
|
confirmButtonText: this.$locale.baseText('mainSidebar.prompt.import'),
|
|
|
|
cancelButtonText: this.$locale.baseText('mainSidebar.prompt.cancel'),
|
|
|
|
inputErrorMessage: this.$locale.baseText('mainSidebar.prompt.invalidUrl'),
|
2021-11-10 10:41:40 -08:00
|
|
|
inputPattern: /^http[s]?:\/\/.*\.json$/i,
|
|
|
|
},
|
|
|
|
) as MessageBoxInputData;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
this.$root.$emit('importWorkflowUrl', { url: promptResponse.value });
|
|
|
|
} catch (e) {}
|
|
|
|
} else if (key === 'workflow-delete') {
|
2021-11-10 10:41:40 -08:00
|
|
|
const deleteConfirmed = await this.confirmMessage(
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText(
|
2021-11-10 10:41:40 -08:00
|
|
|
'mainSidebar.confirmMessage.workflowDelete.message',
|
|
|
|
{ interpolate: { workflowName: this.workflowName } },
|
|
|
|
),
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowDelete.headline'),
|
2021-11-10 10:41:40 -08:00
|
|
|
'warning',
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowDelete.confirmButtonText'),
|
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowDelete.cancelButtonText'),
|
2021-11-10 10:41:40 -08:00
|
|
|
);
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
if (deleteConfirmed === false) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2021-07-23 08:50:47 -07:00
|
|
|
await this.restApi().deleteWorkflow(this.currentWorkflow);
|
2019-06-23 03:35:23 -07:00
|
|
|
} catch (error) {
|
2021-11-10 10:41:40 -08:00
|
|
|
this.$showError(
|
|
|
|
error,
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.showError.stopExecution.title'),
|
2021-11-10 10:41:40 -08:00
|
|
|
);
|
2019-06-23 03:35:23 -07:00
|
|
|
return;
|
|
|
|
}
|
2021-07-17 00:00:39 -07:00
|
|
|
this.$store.commit('setStateDirty', false);
|
2020-08-25 11:37:24 -07:00
|
|
|
// Reset tab title since workflow is deleted.
|
2020-08-25 11:38:09 -07:00
|
|
|
this.$titleReset();
|
2019-06-23 03:35:23 -07:00
|
|
|
this.$showMessage({
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.showMessage.handleSelect1.title'),
|
2019-06-23 03:35:23 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$router.push({ name: 'NodeViewNew' });
|
|
|
|
} else if (key === 'workflow-download') {
|
|
|
|
const workflowData = await this.getWorkflowDataToSave();
|
2021-05-29 11:31:21 -07:00
|
|
|
|
|
|
|
const {tags, ...data} = workflowData;
|
2021-07-10 14:23:19 -07:00
|
|
|
if (data.id && typeof data.id === 'string') {
|
|
|
|
data.id = parseInt(data.id, 10);
|
|
|
|
}
|
2021-05-29 11:31:21 -07:00
|
|
|
const blob = new Blob([JSON.stringify(data, null, 2)], {
|
2019-06-23 03:35:23 -07:00
|
|
|
type: 'application/json;charset=utf-8',
|
|
|
|
});
|
|
|
|
|
|
|
|
let workflowName = this.$store.getters.workflowName || 'unsaved_workflow';
|
|
|
|
|
|
|
|
workflowName = workflowName.replace(/[^a-z0-9]/gi, '_');
|
|
|
|
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$telemetry.track('User exported workflow', { workflow_id: workflowData.id });
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
saveAs(blob, workflowName + '.json');
|
|
|
|
} else if (key === 'workflow-save') {
|
:zap: Add Value Survey (#2499)
* N8N-2619 Value Survey Front-end
* N8N-2619 Added Contact Prompt Modal and logic
* N8N-2619 Added Link to Toast Message on Successful submitting ValueSurvey
* N8N-2619 Updated TypeForm URL in ValueSurvey Success Toast
* N8N-2619 Fixed Typo placeholder for ValueSurvey and ContactPrompt Modal
* N8N-2619 Fixed Toast not close automatically in ValueSurvey, Make part of the title bold, Changed Font-sizes on Value Survey
* N8N-2619 Fixed Close Button on ValueSurvey, Vertical Allignment for Questions in ValueSurvey Drawer
* N8N-2619 Make Value Survey with static height
* N8N-2619 Fixed Telemetry Events on closing ValueSurvey
* N8N-2619 Updated N8NPrompt Interface, Added Dynamic Title and Description on ContactPrompt Modal
* N8N-2619 Reversed Answers in ValueSurveyModal
* N8N-2619 Added Telemetry Event on user close ValueSurvey on second Question
* N8N-2619 Re-work, Optimized, Simplify the code after technical review
* N8N-2619 Fixed If else statement in openUserPromptsIfPossible
* N8N-2619 Change Text under Email Box - ValueSurvey, ContactPrompt, Added new Telemetary Event on ValueSurvey Open, Fixed Toast to close aftet 15s
* N8N-2619 Change ContactPrompt Modal to use Atoms like N8N-Heading and N8N-Text
* N8N-2619 Change Design & Logic on ValueSurvey - When to open
* N8N-2619 Updated Value Survey with new Telemetry Events (Refactor), Simplified functions, Added Atoms in ValueSurvey + ContactPrompt
* N8N-2619 Refactor in Interfaces, Updated/Refactor Getters and Vuex store props
* N8N-2619 Defined IN8nValueSurveyData interface
* N8N-2619 Disabled Keyboard shortcuts to be activated on typing in ValueSurvey Input field, Fire an event on Saving WF from Menu and with shorcut, Make Drawer keep-alive
* N8N-2619 Added Atoms in Value Survey Modal (buttons), Rework css
* N8N-2619 Added Responses on ValueSurvey Submit
* N8N-2619 Added Response for SubmittingContactInfo
* N8N-2619 Added loading state for buttons / ValueSurvey
* N8N-2619 Changed ValueSurvey and ContactPrompt to support enter key on submit, Simplifed closeDialog Function, Changed css for button in ValueSurvey, Prevent showing the Modals if Saving WF fails, Add Debouncing on showing prompt
* N8N-2619 Added IsTelemetryEnabled Getter in Vuex.store
* N8N-2619 Created/Added N8N-SquareButton to Design-system
* N8N-2619 Change Promise in MainSideBar with Async/Await function, Nitpick simpliefied
* N8N-2619 Update the text under the input fields
* N8N-2619 Update the text in ContactPrompt Modal
* N8N-2619 Allign Send button on ValueSurvey Modal
* N8N-2619 Fixed Input in ValueSurvey Modal
* N8N-2619 Check if the workflow is saving
* N8N-2619 Check if WF is saving to allowed performs fetchPromptsData
* N8N-2619 Hotfix
* N8N-2619 Fixed ValueSurvey, Updated onSaveButtonClick function, Created onSaveKeyboardShortcut function in NodeView
* N8N-2619 Rework css module classes for ValueSurvey, Simplified
* N8N-2619 Simplified N8N-SquareButton Component, removed dead code
* N8N-2619 Added Breakpoints for Mobile/Tablet View
* N8N-2619 Formatting fix
* N8N-2619 Update css for mobile/tablet, change promises to asyn/await functions in ContactPrompt and ValueSurvey, Added isActive prop to ValueSurvey
* N8N-2619 Update TEMPLATE_BASE_URL to production
2021-12-11 08:38:16 -08:00
|
|
|
const saved = await this.saveCurrentWorkflow();
|
|
|
|
if (saved) this.$store.dispatch('settings/fetchPromptsData');
|
2021-05-29 11:31:21 -07:00
|
|
|
} else if (key === 'workflow-duplicate') {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', DUPLICATE_MODAL_KEY);
|
2020-01-09 19:53:26 -08:00
|
|
|
} else if (key === 'help-about') {
|
|
|
|
this.aboutDialogVisible = true;
|
2021-10-18 20:57:49 -07:00
|
|
|
this.trackHelpItemClick('about');
|
2019-06-23 03:35:23 -07:00
|
|
|
} else if (key === 'workflow-settings') {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', WORKFLOW_SETTINGS_MODAL_KEY);
|
2019-06-23 03:35:23 -07:00
|
|
|
} else if (key === 'workflow-new') {
|
2020-09-01 07:06:08 -07:00
|
|
|
const result = this.$store.getters.getStateIsDirty;
|
2020-07-09 13:54:50 -07:00
|
|
|
if(result) {
|
2021-11-10 10:41:40 -08:00
|
|
|
const importConfirm = await this.confirmMessage(
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowNew.message'),
|
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowNew.headline'),
|
2021-11-10 10:41:40 -08:00
|
|
|
'warning',
|
2021-12-15 04:16:53 -08:00
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowNew.confirmButtonText'),
|
|
|
|
this.$locale.baseText('mainSidebar.confirmMessage.workflowNew.cancelButtonText'),
|
2021-11-10 10:41:40 -08:00
|
|
|
);
|
2020-07-09 13:54:50 -07:00
|
|
|
if (importConfirm === true) {
|
2020-10-25 04:47:49 -07:00
|
|
|
this.$store.commit('setStateDirty', false);
|
2021-06-04 14:13:42 -07:00
|
|
|
if (this.$router.currentRoute.name === 'NodeViewNew') {
|
|
|
|
this.$root.$emit('newWorkflow');
|
|
|
|
} else {
|
|
|
|
this.$router.push({ name: 'NodeViewNew' });
|
|
|
|
}
|
2020-07-09 13:54:50 -07:00
|
|
|
|
|
|
|
this.$showMessage({
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.showMessage.handleSelect2.title'),
|
2020-07-09 13:54:50 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
2021-06-04 14:13:42 -07:00
|
|
|
if (this.$router.currentRoute.name !== 'NodeViewNew') {
|
|
|
|
this.$router.push({ name: 'NodeViewNew' });
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2020-07-09 13:54:50 -07:00
|
|
|
this.$showMessage({
|
2021-12-15 04:16:53 -08:00
|
|
|
title: this.$locale.baseText('mainSidebar.showMessage.handleSelect3.title'),
|
2020-07-09 13:54:50 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
}
|
2021-01-17 05:07:07 -08:00
|
|
|
this.$titleReset();
|
2019-06-23 03:35:23 -07:00
|
|
|
} else if (key === 'credentials-open') {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', CREDENTIAL_LIST_MODAL_KEY);
|
2019-06-23 03:35:23 -07:00
|
|
|
} else if (key === 'credentials-new') {
|
2021-10-18 20:57:49 -07:00
|
|
|
this.$store.dispatch('ui/openModal', CREDENTIAL_SELECT_MODAL_KEY);
|
2019-06-23 03:35:23 -07:00
|
|
|
} else if (key === 'execution-open-workflow') {
|
|
|
|
if (this.workflowExecution !== null) {
|
|
|
|
this.openWorkflow(this.workflowExecution.workflowId as string);
|
|
|
|
}
|
|
|
|
} else if (key === 'executions') {
|
2022-01-21 09:00:00 -08:00
|
|
|
this.$store.dispatch('ui/openModal', EXECUTIONS_MODAL_KEY);
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2021-09-11 01:15:36 -07:00
|
|
|
.sidebar-popper{
|
|
|
|
.el-menu-item {
|
|
|
|
font-size: 0.9em;
|
|
|
|
height: 35px;
|
|
|
|
line-height: 35px;
|
|
|
|
color: $--custom-dialog-text-color;
|
|
|
|
--menu-item-hover-fill: #fff0ef;
|
|
|
|
|
|
|
|
.item-title {
|
|
|
|
position: absolute;
|
|
|
|
left: 55px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.svg-inline--fa {
|
|
|
|
position: relative;
|
|
|
|
right: -3px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#side-menu {
|
|
|
|
// Menu
|
|
|
|
.el-menu--vertical,
|
|
|
|
.el-menu {
|
|
|
|
border: none;
|
|
|
|
font-size: 14px;
|
|
|
|
--menu-item-hover-fill: #fff0ef;
|
|
|
|
|
|
|
|
.el-menu--collapse {
|
|
|
|
width: 75px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-menu--popup,
|
|
|
|
.el-menu--inline {
|
|
|
|
font-size: 0.9em;
|
|
|
|
li.el-menu-item {
|
|
|
|
height: 35px;
|
|
|
|
line-height: 35px;
|
|
|
|
color: $--custom-dialog-text-color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-menu-item,
|
|
|
|
.el-submenu__title {
|
|
|
|
color: $--color-primary;
|
|
|
|
font-size: 1.2em;
|
|
|
|
.el-submenu__icon-arrow {
|
|
|
|
color: $--color-primary;
|
|
|
|
font-weight: 800;
|
|
|
|
font-size: 1em;
|
|
|
|
}
|
|
|
|
.svg-inline--fa {
|
|
|
|
position: relative;
|
|
|
|
right: -3px;
|
|
|
|
}
|
|
|
|
.item-title {
|
|
|
|
position: absolute;
|
|
|
|
left: 73px;
|
|
|
|
}
|
|
|
|
.item-title-root {
|
|
|
|
position: absolute;
|
|
|
|
left: 60px;
|
|
|
|
top: 1px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-menu-item {
|
|
|
|
a {
|
|
|
|
color: #666;
|
|
|
|
|
|
|
|
&.primary-item {
|
|
|
|
color: $--color-primary;
|
|
|
|
vertical-align: baseline;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.logo-item {
|
|
|
|
background-color: $--color-primary !important;
|
|
|
|
height: $--header-height;
|
|
|
|
line-height: $--header-height;
|
|
|
|
* {
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
position: relative;
|
|
|
|
height: 23px;
|
|
|
|
left: -10px;
|
|
|
|
top: -2px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-09 19:53:26 -08:00
|
|
|
.about-icon {
|
2021-08-29 04:36:17 -07:00
|
|
|
margin-left: 5px;
|
2020-01-09 19:53:26 -08:00
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
#collapse-change-button {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 10;
|
|
|
|
top: 55px;
|
|
|
|
left: 25px;
|
|
|
|
text-align: right;
|
|
|
|
line-height: 24px;
|
|
|
|
height: 20px;
|
|
|
|
width: 20px;
|
|
|
|
background-color: #fff;
|
|
|
|
border: none;
|
|
|
|
border-radius: 15px;
|
|
|
|
|
|
|
|
-webkit-transition-duration: 0.5s;
|
|
|
|
-moz-transition-duration: 0.5s;
|
|
|
|
-o-transition-duration: 0.5s;
|
|
|
|
transition-duration: 0.5s;
|
|
|
|
|
|
|
|
-webkit-transition-property: -webkit-transform;
|
|
|
|
-moz-transition-property: -moz-transform;
|
|
|
|
-o-transition-property: -o-transform;
|
|
|
|
transition-property: transform;
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
position: relative;
|
|
|
|
left: -5px;
|
|
|
|
top: -2px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#collapse-change-button:hover {
|
|
|
|
transform: scale(1.1);
|
|
|
|
}
|
|
|
|
|
2020-01-09 19:53:26 -08:00
|
|
|
a.logo {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo-text {
|
2019-06-23 03:35:23 -07:00
|
|
|
position: relative;
|
|
|
|
top: -3px;
|
|
|
|
left: 5px;
|
|
|
|
font-weight: bold;
|
|
|
|
color: #fff;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.expanded #collapse-change-button {
|
|
|
|
-webkit-transform: translateX(60px) rotate(180deg);
|
|
|
|
-moz-transform: translateX(60px) rotate(180deg);
|
|
|
|
-o-transform: translateX(60px) rotate(180deg);
|
|
|
|
transform: translateX(60px) rotate(180deg);
|
|
|
|
}
|
|
|
|
|
|
|
|
#side-menu {
|
|
|
|
position: fixed;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
.el-menu {
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.side-menu-wrapper {
|
|
|
|
height: 100%;
|
2021-05-29 11:31:21 -07:00
|
|
|
width: $--sidebar-width;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
&.expanded {
|
2021-05-29 11:31:21 -07:00
|
|
|
width: $--sidebar-expanded-width;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
2021-07-22 01:22:17 -07:00
|
|
|
|
|
|
|
ul {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.footer-menu-items {
|
|
|
|
display: flex;
|
|
|
|
flex-grow: 1;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: flex-end;
|
|
|
|
padding-bottom: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-menu-item.updates {
|
2021-09-11 01:15:36 -07:00
|
|
|
color: $--sidebar-inactive-color !important;
|
2021-07-22 01:22:17 -07:00
|
|
|
.item-title-root {
|
|
|
|
font-size: 13px;
|
|
|
|
top: 0 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: $--sidebar-active-color;
|
|
|
|
}
|
|
|
|
|
|
|
|
.gift-container {
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|