🧹 clean up editor based on #1418 (#2010)

* clean up editor based on #1418

* remove unused ref

* address comment on guard style
This commit is contained in:
Mutasem Aldmour 2021-07-23 17:50:47 +02:00 committed by GitHub
parent 5602929210
commit a9550202df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 8 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -38,8 +38,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { genericHelpers } from '@/components/mixins/genericHelpers'; import { genericHelpers } from '@/components/mixins/genericHelpers';
import { showMessage } from '@/components/mixins/showMessage'; import { showMessage } from '@/components/mixins/showMessage';

View file

@ -37,11 +37,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { import {
IRunData,
INodeTypeDescription, INodeTypeDescription,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {

View file

@ -28,8 +28,6 @@ export default mixins(genericHelpers).extend({
return this.$store.getters.activeNode; return this.$store.getters.activeNode;
}, },
currentValue (): string { currentValue (): string {
const parameterNameParts = this.keyName.split('.');
const getDescendantProp = (obj: object, path: string): string => { const getDescendantProp = (obj: object, path: string): string => {
// @ts-ignore // @ts-ignore
return path.split('.').reduce((acc, part) => acc && acc[part], obj); return path.split('.').reduce((acc, part) => acc && acc[part], obj);

View file

@ -6,8 +6,6 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { genericHelpers } from '@/components/mixins/genericHelpers'; import { genericHelpers } from '@/components/mixins/genericHelpers';
import mixins from 'vue-typed-mixins'; import mixins from 'vue-typed-mixins';

View file

@ -167,7 +167,6 @@ import {
IExecutionDeleteFilter, IExecutionDeleteFilter,
IExecutionsListResponse, IExecutionsListResponse,
IExecutionShortResponse, IExecutionShortResponse,
IExecutionsStopData,
IExecutionsSummary, IExecutionsSummary,
IWorkflowShortResponse, IWorkflowShortResponse,
} from '@/Interface'; } from '@/Interface';
@ -632,7 +631,7 @@ export default mixins(
// can show the user in the UI that it is in progress // can show the user in the UI that it is in progress
this.stoppingExecutions.push(activeExecutionId); this.stoppingExecutions.push(activeExecutionId);
const stopData: IExecutionsStopData = await this.restApi().stopCurrentExecution(activeExecutionId); await this.restApi().stopCurrentExecution(activeExecutionId);
// Remove it from the list of currently stopping executions // Remove it from the list of currently stopping executions
const index = this.stoppingExecutions.indexOf(activeExecutionId); const index = this.stoppingExecutions.indexOf(activeExecutionId);

View file

@ -262,9 +262,7 @@ export default mixins(
// Convert the expression string into a Quill Operations // Convert the expression string into a Quill Operations
const editorOperations: DeltaOperation[] = []; const editorOperations: DeltaOperation[] = [];
currentValue.replace(/\{\{(.*?)\}\}/ig, '*%%#_@^$1*%%#_@').split('*%%#_@').forEach((value: string) => { currentValue.replace(/\{\{(.*?)\}\}/ig, '*%%#_@^$1*%%#_@').split('*%%#_@').forEach((value: string) => {
if (!value) { if (value && value.charAt(0) === '^') {
} else if (value.charAt(0) === '^') {
// Is variable // Is variable
let displayValue = `{{${value.slice(1)}}}` as string | number | boolean | null | undefined; let displayValue = `{{${value.slice(1)}}}` as string | number | boolean | null | undefined;
if (this.resolvedValue) { if (this.resolvedValue) {

View file

@ -47,8 +47,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { import {
IUpdateInformation, IUpdateInformation,
} from '@/Interface'; } from '@/Interface';

View file

@ -148,7 +148,6 @@ import { MessageBoxInputData } from 'element-ui/types/message-box';
import { import {
IExecutionResponse, IExecutionResponse,
IExecutionsStopData,
IWorkflowDataUpdate, IWorkflowDataUpdate,
IMenuItem, IMenuItem,
} from '../Interface'; } from '../Interface';
@ -336,7 +335,7 @@ export default mixins(
try { try {
this.stopExecutionInProgress = true; this.stopExecutionInProgress = true;
const stopData: IExecutionsStopData = await this.restApi().stopCurrentExecution(executionId); await this.restApi().stopCurrentExecution(executionId);
this.$showMessage({ this.$showMessage({
title: 'Execution stopped', title: 'Execution stopped',
message: `The execution with the id "${executionId}" got stopped!`, message: `The execution with the id "${executionId}" got stopped!`,
@ -405,9 +404,8 @@ export default mixins(
return; return;
} }
let result;
try { try {
result = await this.restApi().deleteWorkflow(this.currentWorkflow); await this.restApi().deleteWorkflow(this.currentWorkflow);
} catch (error) { } catch (error) {
this.$showError(error, 'Problem deleting the workflow', 'There was a problem deleting the workflow:'); this.$showError(error, 'Problem deleting the workflow', 'There was a problem deleting the workflow:');
return; return;

View file

@ -36,8 +36,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { import {
IUpdateInformation, IUpdateInformation,
} from '@/Interface'; } from '@/Interface';

View file

@ -49,7 +49,6 @@ import {
ICredentialsResponse, ICredentialsResponse,
INodeUi, INodeUi,
INodeUpdatePropertiesInformation, INodeUpdatePropertiesInformation,
IUpdateInformation,
} from '@/Interface'; } from '@/Interface';
import { import {
ICredentialType, ICredentialType,
@ -212,8 +211,6 @@ export default mixins(
return node.issues.credentials[credentialTypeName]; return node.issues.credentials[credentialTypeName];
}, },
updateCredentials (credentialType: string): void { updateCredentials (credentialType: string): void {
const credentials = this.credentials[credentialType];
const name = this.credentials[credentialType]; const name = this.credentials[credentialType];
const credentialData = this.credentialOptions[credentialType].find((optionData: ICredentialsResponse) => optionData.name === name); const credentialData = this.credentialOptions[credentialType].find((optionData: ICredentialsResponse) => optionData.name === name);
if (credentialData === undefined) { if (credentialData === undefined) {

View file

@ -79,8 +79,6 @@ export default mixins(
}, },
computed: { computed: {
nodeType (): INodeTypeDescription | null { nodeType (): INodeTypeDescription | null {
const activeNode = this.node;
if (this.node) { if (this.node) {
return this.$store.getters.nodeType(this.node.type); return this.$store.getters.nodeType(this.node.type);
} }

View file

@ -38,12 +38,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { import {
IWebhookDescription, IWebhookDescription,
NodeHelpers, NodeHelpers,
Workflow,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { copyPaste } from '@/components/mixins/copyPaste'; import { copyPaste } from '@/components/mixins/copyPaste';

View file

@ -115,13 +115,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { get } from 'lodash'; import { get } from 'lodash';
import { import {
INodeUi, INodeUi,
IVariableItemSelected,
IVariableSelectorOption,
} from '@/Interface'; } from '@/Interface';
import { import {
NodeHelpers, NodeHelpers,

View file

@ -196,20 +196,16 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
//@ts-ignore //@ts-ignore
import VueJsonPretty from 'vue-json-pretty'; import VueJsonPretty from 'vue-json-pretty';
import { import {
GenericValue, GenericValue,
IBinaryData,
IBinaryKeyData, IBinaryKeyData,
IDataObject, IDataObject,
INodeExecutionData, INodeExecutionData,
IRun,
IRunData, IRunData,
IRunExecutionData, IRunExecutionData,
ITaskData, ITaskData,
ITaskDataConnections,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {

View file

@ -18,10 +18,6 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import {
Workflow,
} from 'n8n-workflow';
export default Vue.extend({ export default Vue.extend({
name: 'TextEdit', name: 'TextEdit',

View file

@ -12,13 +12,10 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue';
import { import {
GenericValue, GenericValue,
IContextObject, IContextObject,
IDataObject, IDataObject,
IRun,
IRunData, IRunData,
IRunExecutionData, IRunExecutionData,
Workflow, Workflow,

View file

@ -355,7 +355,6 @@ export default mixins(
Vue.set(this, 'workflows', workflows); Vue.set(this, 'workflows', workflows);
}, },
async openDialog () { async openDialog () {
const workflowId = this.$route.params.name;
if (this.$route.params.name === undefined) { if (this.$route.params.name === undefined) {
this.$showMessage({ this.$showMessage({
title: 'No workflow active', title: 'No workflow active',

View file

@ -149,7 +149,6 @@ import {
INodeConnections, INodeConnections,
INodeIssues, INodeIssues,
INodeTypeDescription, INodeTypeDescription,
NodeInputConnections,
NodeHelpers, NodeHelpers,
Workflow, Workflow,
IRun, IRun,
@ -157,7 +156,6 @@ import {
import { import {
IConnectionsUi, IConnectionsUi,
IExecutionResponse, IExecutionResponse,
IExecutionsStopData,
IN8nUISettings, IN8nUISettings,
IWorkflowDb, IWorkflowDb,
IWorkflowData, IWorkflowData,
@ -910,7 +908,7 @@ export default mixins(
try { try {
this.stopExecutionInProgress = true; this.stopExecutionInProgress = true;
const stopData: IExecutionsStopData = await this.restApi().stopCurrentExecution(executionId); await this.restApi().stopCurrentExecution(executionId);
this.$showMessage({ this.$showMessage({
title: 'Execution stopped', title: 'Execution stopped',
message: `The execution with the id "${executionId}" got stopped!`, message: `The execution with the id "${executionId}" got stopped!`,
@ -950,9 +948,8 @@ export default mixins(
}, },
async stopWaitingForWebhook () { async stopWaitingForWebhook () {
let result;
try { try {
result = await this.restApi().removeTestWebhook(this.$store.getters.workflowId); await this.restApi().removeTestWebhook(this.$store.getters.workflowId);
} catch (error) { } catch (error) {
this.$showError(error, 'Problem deleting the test-webhook', 'There was a problem deleting webhook:'); this.$showError(error, 'Problem deleting the test-webhook', 'There was a problem deleting webhook:');
return; return;
@ -2037,7 +2034,6 @@ export default mixins(
const nodeSourceConnections = []; const nodeSourceConnections = [];
if (currentConnections[sourceNode][type][sourceIndex]) { if (currentConnections[sourceNode][type][sourceIndex]) {
for (connectionIndex = 0; connectionIndex < currentConnections[sourceNode][type][sourceIndex].length; connectionIndex++) { for (connectionIndex = 0; connectionIndex < currentConnections[sourceNode][type][sourceIndex].length; connectionIndex++) {
const nodeConnection: NodeInputConnections = [];
connectionData = currentConnections[sourceNode][type][sourceIndex][connectionIndex]; connectionData = currentConnections[sourceNode][type][sourceIndex][connectionIndex];
if (!createNodeNames.includes(connectionData.node)) { if (!createNodeNames.includes(connectionData.node)) {
// Node does not get created so skip input connection // Node does not get created so skip input connection
@ -2235,7 +2231,7 @@ export default mixins(
async mounted () { async mounted () {
this.$root.$on('importWorkflowData', async (data: IDataObject) => { this.$root.$on('importWorkflowData', async (data: IDataObject) => {
const resData = await this.importWorkflowData(data.data as IWorkflowDataUpdate); await this.importWorkflowData(data.data as IWorkflowDataUpdate);
}); });
this.$root.$on('newWorkflow', this.newWorkflow); this.$root.$on('newWorkflow', this.newWorkflow);
@ -2243,7 +2239,7 @@ export default mixins(
this.$root.$on('importWorkflowUrl', async (data: IDataObject) => { this.$root.$on('importWorkflowUrl', async (data: IDataObject) => {
const workflowData = await this.getWorkflowDataFromUrl(data.url as string); const workflowData = await this.getWorkflowDataFromUrl(data.url as string);
if (workflowData !== undefined) { if (workflowData !== undefined) {
const resData = await this.importWorkflowData(workflowData); await this.importWorkflowData(workflowData);
} }
}); });