mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
refactor(editor): Apply Prettier (no-changelog) (#4920)
* ⚡ Adjust `format` script * 🔥 Remove exemption for `editor-ui` * 🎨 Prettify * 👕 Fix lint
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="workflow-activator">
|
||||
<div :class="$style.activeStatusText" data-test-id="workflow-activator-status">
|
||||
<n8n-text v-if="workflowActive" :color="couldNotBeStarted ? 'danger' : 'success'" size="small" bold>
|
||||
<n8n-text
|
||||
v-if="workflowActive"
|
||||
:color="couldNotBeStarted ? 'danger' : 'success'"
|
||||
size="small"
|
||||
bold
|
||||
>
|
||||
{{ $locale.baseText('workflowActivator.active') }}
|
||||
</n8n-text>
|
||||
<n8n-text v-else color="text-base" size="small" bold>
|
||||
@@ -16,7 +21,11 @@
|
||||
v-loading="updatingWorkflowActivation"
|
||||
:value="workflowActive"
|
||||
@change="activeChanged"
|
||||
:title="workflowActive ? $locale.baseText('workflowActivator.deactivateWorkflow') : $locale.baseText('workflowActivator.activateWorkflow')"
|
||||
:title="
|
||||
workflowActive
|
||||
? $locale.baseText('workflowActivator.deactivateWorkflow')
|
||||
: $locale.baseText('workflowActivator.activateWorkflow')
|
||||
"
|
||||
:disabled="disabled || updatingWorkflowActivation"
|
||||
:active-color="getActiveColor"
|
||||
inactive-color="#8899AA"
|
||||
@@ -29,7 +38,10 @@
|
||||
<div class="could-not-be-started" v-if="couldNotBeStarted">
|
||||
<n8n-tooltip placement="top">
|
||||
<template #content>
|
||||
<div @click="displayActivationError" v-html="$locale.baseText('workflowActivator.theWorkflowIsSetToBeActiveBut')"></div>
|
||||
<div
|
||||
@click="displayActivationError"
|
||||
v-html="$locale.baseText('workflowActivator.theWorkflowIsSetToBeActiveBut')"
|
||||
></div>
|
||||
</template>
|
||||
<font-awesome-icon @click="displayActivationError" icon="exclamation-triangle" />
|
||||
</n8n-tooltip>
|
||||
@@ -38,7 +50,6 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import { showMessage } from '@/mixins/showMessage';
|
||||
import { workflowActivate } from '@/mixins/workflowActivate';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
@@ -47,88 +58,80 @@ import { mapStores } from 'pinia';
|
||||
import mixins from 'vue-typed-mixins';
|
||||
import { getActivatableTriggerNodes } from '@/utils';
|
||||
|
||||
export default mixins(
|
||||
showMessage,
|
||||
workflowActivate,
|
||||
)
|
||||
.extend(
|
||||
{
|
||||
name: 'WorkflowActivator',
|
||||
props: [
|
||||
'workflowActive',
|
||||
'workflowId',
|
||||
],
|
||||
computed: {
|
||||
...mapStores(
|
||||
useUIStore,
|
||||
useWorkflowsStore,
|
||||
),
|
||||
getStateIsDirty (): boolean {
|
||||
return this.uiStore.stateIsDirty;
|
||||
},
|
||||
nodesIssuesExist (): boolean {
|
||||
return this.workflowsStore.nodesIssuesExist;
|
||||
},
|
||||
isWorkflowActive (): boolean {
|
||||
const activeWorkflows = this.workflowsStore.activeWorkflows;
|
||||
return activeWorkflows.includes(this.workflowId);
|
||||
},
|
||||
couldNotBeStarted (): boolean {
|
||||
return this.workflowActive === true && this.isWorkflowActive !== this.workflowActive;
|
||||
},
|
||||
getActiveColor (): string {
|
||||
if (this.couldNotBeStarted === true) {
|
||||
return '#ff4949';
|
||||
}
|
||||
return '#13ce66';
|
||||
},
|
||||
isCurrentWorkflow(): boolean {
|
||||
return this.workflowsStore.workflowId === this.workflowId;
|
||||
},
|
||||
disabled(): boolean {
|
||||
const isNewWorkflow = !this.workflowId;
|
||||
if (isNewWorkflow || this.isCurrentWorkflow) {
|
||||
return !this.workflowActive && !this.containsTrigger;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
containsTrigger(): boolean {
|
||||
const foundTriggers = getActivatableTriggerNodes(this.workflowsStore.workflowTriggerNodes);
|
||||
return foundTriggers.length > 0;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async activeChanged (newActiveState: boolean) {
|
||||
return await this.updateWorkflowActivation(this.workflowId, newActiveState);
|
||||
},
|
||||
async displayActivationError () {
|
||||
let errorMessage: string;
|
||||
try {
|
||||
const errorData = await this.restApi().getActivationError(this.workflowId);
|
||||
|
||||
if (errorData === undefined) {
|
||||
errorMessage = this.$locale.baseText('workflowActivator.showMessage.displayActivationError.message.errorDataUndefined');
|
||||
} else {
|
||||
errorMessage = this.$locale.baseText(
|
||||
'workflowActivator.showMessage.displayActivationError.message.errorDataNotUndefined',
|
||||
{ interpolate: { message: errorData.error.message } },
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
errorMessage = this.$locale.baseText('workflowActivator.showMessage.displayActivationError.message.catchBlock');
|
||||
}
|
||||
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('workflowActivator.showMessage.displayActivationError.title'),
|
||||
message: errorMessage,
|
||||
type: 'warning',
|
||||
duration: 0,
|
||||
});
|
||||
},
|
||||
},
|
||||
export default mixins(showMessage, workflowActivate).extend({
|
||||
name: 'WorkflowActivator',
|
||||
props: ['workflowActive', 'workflowId'],
|
||||
computed: {
|
||||
...mapStores(useUIStore, useWorkflowsStore),
|
||||
getStateIsDirty(): boolean {
|
||||
return this.uiStore.stateIsDirty;
|
||||
},
|
||||
);
|
||||
nodesIssuesExist(): boolean {
|
||||
return this.workflowsStore.nodesIssuesExist;
|
||||
},
|
||||
isWorkflowActive(): boolean {
|
||||
const activeWorkflows = this.workflowsStore.activeWorkflows;
|
||||
return activeWorkflows.includes(this.workflowId);
|
||||
},
|
||||
couldNotBeStarted(): boolean {
|
||||
return this.workflowActive === true && this.isWorkflowActive !== this.workflowActive;
|
||||
},
|
||||
getActiveColor(): string {
|
||||
if (this.couldNotBeStarted === true) {
|
||||
return '#ff4949';
|
||||
}
|
||||
return '#13ce66';
|
||||
},
|
||||
isCurrentWorkflow(): boolean {
|
||||
return this.workflowsStore.workflowId === this.workflowId;
|
||||
},
|
||||
disabled(): boolean {
|
||||
const isNewWorkflow = !this.workflowId;
|
||||
if (isNewWorkflow || this.isCurrentWorkflow) {
|
||||
return !this.workflowActive && !this.containsTrigger;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
containsTrigger(): boolean {
|
||||
const foundTriggers = getActivatableTriggerNodes(this.workflowsStore.workflowTriggerNodes);
|
||||
return foundTriggers.length > 0;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async activeChanged(newActiveState: boolean) {
|
||||
return await this.updateWorkflowActivation(this.workflowId, newActiveState);
|
||||
},
|
||||
async displayActivationError() {
|
||||
let errorMessage: string;
|
||||
try {
|
||||
const errorData = await this.restApi().getActivationError(this.workflowId);
|
||||
|
||||
if (errorData === undefined) {
|
||||
errorMessage = this.$locale.baseText(
|
||||
'workflowActivator.showMessage.displayActivationError.message.errorDataUndefined',
|
||||
);
|
||||
} else {
|
||||
errorMessage = this.$locale.baseText(
|
||||
'workflowActivator.showMessage.displayActivationError.message.errorDataNotUndefined',
|
||||
{ interpolate: { message: errorData.error.message } },
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
errorMessage = this.$locale.baseText(
|
||||
'workflowActivator.showMessage.displayActivationError.message.catchBlock',
|
||||
);
|
||||
}
|
||||
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('workflowActivator.showMessage.displayActivationError.title'),
|
||||
message: errorMessage,
|
||||
type: 'warning',
|
||||
duration: 0,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
||||
Reference in New Issue
Block a user