* ⚡ Generalize unique entity name generation * ⚡ Standardize variable names * redo credentials * revert some changes, replace got with was * fix v-if order * fix v-if order * update linting * update gulpfile * update ssh display name * update height * update params * update info tip sizes * address design comments * update google button disabled * update icon size to 28px * update design issues * update info tab design * address design comments * update tab size * update run data spacing * address comments, update logo design * fix spacing issues * clean up store * fix create new bug * add loading state * rename prop * remove unused prop * fix select bug * remove label tag * update word break * build * address design comments * update font family of button * update menu opacity * update text * update title * address more comments * update oauth messages * add oauth validation * hide disabled state * update warning modal * show button on text input * clean up cred details * add validation errors * fix bug when deleting cred * Frontend hack to display test button * Created interfaces for testing and endpoint * Testing slack node credentials working * Adding test with node to endpoint for credential testing * Fixed linting and test detectability * Adding required for slack token * Added google sheets credential testing * update message * Adding suggestions by Ivan and Mutasem * Address comments * keep blurred when focused * update font weight of errors * add oauth banner * remove toast * Fixed code bug and added telegram credential testing * scroll to top on success * clean up duplication * Fixed telegram trigger node and added tests to typeform * refactor modal * add more validation support * refactor info tab * scroll to bottom on save, handle cred saving * refactor save button * save cred on valid * save cred on valid * scroll to top if has error * add targets on input labels * delete credentails input * revert fe changes * update validation logic * clean interface * test credentials * update banner design * show testing state * update x position * fix issues * fix focus issues * clean up validation behavior * make error relative * update banner component * update error spacing * don't close dialog * rename button * update how banners behave * if has unsaved changes first * move confirm message * add success banner * update time state * disable transitions * test on open * clean up banner behavior * update banner styling * capitalize * update error banner styling to handle long texts * avoid unnessary content jostling * add loading label * show validation warnings when opening modal * retest cred if not all props req * update scroll to auto * add error warning * update color saturation * set overflow to auto * fix bug to get credentials when connected * round down to minutes * change tab name * update casing oauth * disable credential testing if it has expressions * label same as title * add more space between close and save * remove check on making any changes * hide close on confirm modals * don't accept clicks outside dialog * fix build issues * undo test changes * fix table scrollbar logs * rename modals * fix bug with same name * refactor modal * fix tslint issue * refactor name * update name behavior * update monospace font * remove comment * refactor inputs * refactor error handling * reduce spacing changes * fix doc url oauth1 oauth2 * build * add toast for waiting executions * hide infotip if no inputs * address most comments * rename file * fix menu alignment * gst * update types * update language * refactor toast behavior, add support for links clicking * allow closing workflow modal from notification * refactor how modals work * fix data display * update toast behavior * fix type issues * rename prop * update overflow behavior for settings * only expand used properties * fix edge bug * make scrollable prop, add margin to tags footer * remove max height from tag manager * rewrite message * fix notice word break * update property names * clear sticky notifications on run * build * refactor function out * use destruction Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Omar Ajoue <krynble@gmail.com>
243 lines
6.6 KiB
Vue
243 lines
6.6 KiB
Vue
<template>
|
|
<Modal
|
|
:name="modalName"
|
|
width="80%"
|
|
minWidth="620px"
|
|
:classic="true"
|
|
>
|
|
<template v-slot:header>
|
|
<div class="workflows-header">
|
|
<div class="title">
|
|
<h1>Open Workflow</h1>
|
|
</div>
|
|
<div class="tags-filter">
|
|
<TagsDropdown
|
|
placeholder="Filter by tags..."
|
|
:currentTagIds="filterTagIds"
|
|
:createEnabled="false"
|
|
@update="updateTagsFilter"
|
|
@esc="onTagsFilterEsc"
|
|
@blur="onTagsFilterBlur"
|
|
/>
|
|
</div>
|
|
<div class="search-filter">
|
|
<n8n-input placeholder="Search workflows..." ref="inputFieldFilter" v-model="filterText">
|
|
<font-awesome-icon slot="prefix" icon="search"></font-awesome-icon>
|
|
</n8n-input>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<template v-slot:content>
|
|
<el-table class="search-table" :data="filteredWorkflows" stripe @cell-click="openWorkflow" :default-sort = "{prop: 'updatedAt', order: 'descending'}" v-loading="isDataLoading">
|
|
<el-table-column property="name" label="Name" class-name="clickable" sortable>
|
|
<template slot-scope="scope">
|
|
<div :key="scope.row.id">
|
|
<span class="name">{{scope.row.name}}</span>
|
|
<TagsContainer class="hidden-sm-and-down" :tagIds="getIds(scope.row.tags)" :limit="3" @click="onTagClick" :clickable="true" :hoverable="true" />
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column property="createdAt" label="Created" class-name="clickable" width="155" sortable></el-table-column>
|
|
<el-table-column property="updatedAt" label="Updated" class-name="clickable" width="155" sortable></el-table-column>
|
|
<el-table-column label="Active" width="75">
|
|
<template slot-scope="scope">
|
|
<workflow-activator :workflow-active="scope.row.active" :workflow-id="scope.row.id" @workflowActiveChanged="workflowActiveChanged" />
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</template>
|
|
</Modal>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue from 'vue';
|
|
import mixins from 'vue-typed-mixins';
|
|
|
|
import { ITag, IWorkflowShortResponse } from '@/Interface';
|
|
|
|
import { restApi } from '@/components/mixins/restApi';
|
|
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
|
import { workflowHelpers } from '@/components/mixins/workflowHelpers';
|
|
import { showMessage } from '@/components/mixins/showMessage';
|
|
|
|
import Modal from '@/components/Modal.vue';
|
|
import TagsContainer from '@/components/TagsContainer.vue';
|
|
import TagsDropdown from '@/components/TagsDropdown.vue';
|
|
import WorkflowActivator from '@/components/WorkflowActivator.vue';
|
|
import { convertToDisplayDate } from './helpers';
|
|
|
|
export default mixins(
|
|
genericHelpers,
|
|
restApi,
|
|
showMessage,
|
|
workflowHelpers,
|
|
).extend({
|
|
name: 'WorkflowOpen',
|
|
components: {
|
|
WorkflowActivator,
|
|
TagsContainer,
|
|
TagsDropdown,
|
|
Modal,
|
|
},
|
|
props: ['modalName'],
|
|
data () {
|
|
return {
|
|
filterText: '',
|
|
isDataLoading: false,
|
|
workflows: [] as IWorkflowShortResponse[],
|
|
filterTagIds: [] as string[],
|
|
prevFilterTagIds: [] as string[],
|
|
};
|
|
},
|
|
computed: {
|
|
filteredWorkflows (): IWorkflowShortResponse[] {
|
|
return this.workflows
|
|
.filter((workflow: IWorkflowShortResponse) => {
|
|
if (this.filterText && !workflow.name.toLowerCase().includes(this.filterText.toLowerCase())) {
|
|
return false;
|
|
}
|
|
|
|
if (this.filterTagIds.length === 0) {
|
|
return true;
|
|
}
|
|
|
|
if (!workflow.tags || workflow.tags.length === 0) {
|
|
return false;
|
|
}
|
|
|
|
return this.filterTagIds.reduce((accu: boolean, id: string) => accu && !!workflow.tags.find(tag => tag.id === id), true);
|
|
});
|
|
},
|
|
},
|
|
mounted() {
|
|
this.filterText = '';
|
|
this.filterTagIds = [];
|
|
this.openDialog();
|
|
|
|
Vue.nextTick(() => {
|
|
// Make sure that users can directly type in the filter
|
|
(this.$refs.inputFieldFilter as HTMLInputElement).focus();
|
|
});
|
|
},
|
|
methods: {
|
|
getIds(tags: ITag[] | undefined) {
|
|
return (tags || []).map((tag) => tag.id);
|
|
},
|
|
updateTagsFilter(tags: string[]) {
|
|
this.filterTagIds = tags;
|
|
},
|
|
onTagClick(tagId: string) {
|
|
if (tagId !== 'count' && !this.filterTagIds.includes(tagId)) {
|
|
this.filterTagIds.push(tagId);
|
|
}
|
|
},
|
|
async openWorkflow (data: IWorkflowShortResponse, column: any) { // tslint:disable-line:no-any
|
|
if (column.label !== 'Active') {
|
|
|
|
const currentWorkflowId = this.$store.getters.workflowId;
|
|
|
|
if (data.id === currentWorkflowId) {
|
|
this.$showMessage({
|
|
title: 'Already open',
|
|
message: 'This is the current workflow',
|
|
type: 'error',
|
|
duration: 1500,
|
|
});
|
|
// Do nothing if current workflow is the one user chose to open
|
|
return;
|
|
}
|
|
|
|
const result = this.$store.getters.getStateIsDirty;
|
|
if(result) {
|
|
const importConfirm = await this.confirmMessage(`When you switch workflows your current workflow changes will be lost.`, 'Save your Changes?', 'warning', 'Yes, switch workflows and forget changes');
|
|
if (importConfirm === false) {
|
|
return;
|
|
} else {
|
|
// This is used to avoid duplicating the message
|
|
this.$store.commit('setStateDirty', false);
|
|
|
|
this.$router.push({
|
|
name: 'NodeViewExisting',
|
|
params: { name: data.id },
|
|
});
|
|
}
|
|
} else {
|
|
this.$router.push({
|
|
name: 'NodeViewExisting',
|
|
params: { name: data.id },
|
|
});
|
|
}
|
|
this.$store.commit('ui/closeTopModal');
|
|
}
|
|
},
|
|
openDialog () {
|
|
this.isDataLoading = true;
|
|
this.restApi().getWorkflows()
|
|
.then(
|
|
(data) => {
|
|
this.workflows = data;
|
|
|
|
this.workflows.forEach((workflowData: IWorkflowShortResponse) => {
|
|
workflowData.createdAt = convertToDisplayDate(workflowData.createdAt as number);
|
|
workflowData.updatedAt = convertToDisplayDate(workflowData.updatedAt as number);
|
|
});
|
|
this.isDataLoading = false;
|
|
},
|
|
)
|
|
.catch(
|
|
(error: Error) => {
|
|
this.$showError(error, 'Problem loading workflows', 'There was a problem loading the workflows:');
|
|
this.isDataLoading = false;
|
|
},
|
|
);
|
|
},
|
|
workflowActiveChanged (data: { id: string, active: boolean }) {
|
|
for (const workflow of this.workflows) {
|
|
if (workflow.id === data.id) {
|
|
workflow.active = data.active;
|
|
}
|
|
}
|
|
},
|
|
onTagsFilterBlur() {
|
|
this.prevFilterTagIds = this.filterTagIds;
|
|
},
|
|
onTagsFilterEsc() {
|
|
// revert last applied tags
|
|
this.filterTagIds = this.prevFilterTagIds;
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.workflows-header {
|
|
display: flex;
|
|
|
|
.title {
|
|
flex-grow: 1;
|
|
|
|
h1 {
|
|
line-height: 24px;
|
|
font-size: 18px;
|
|
}
|
|
}
|
|
|
|
.search-filter {
|
|
margin-left: 10px;
|
|
min-width: 160px;
|
|
}
|
|
|
|
.tags-filter {
|
|
flex-grow: 1;
|
|
max-width: 270px;
|
|
min-width: 220px;
|
|
}
|
|
}
|
|
|
|
.search-table .name {
|
|
font-weight: 400;
|
|
margin-right: 10px;
|
|
}
|
|
</style>
|