mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +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,18 +1,28 @@
|
||||
<template>
|
||||
<n8n-card
|
||||
:class="$style.cardLink"
|
||||
@click="onClick"
|
||||
>
|
||||
<template #header>
|
||||
<n8n-heading tag="h2" bold class="ph-no-capture" :class="$style.cardHeading" data-test-id="workflow-card-name">
|
||||
{{ data.name }}
|
||||
</n8n-heading>
|
||||
</template>
|
||||
<div :class="$style.cardDescription">
|
||||
<n8n-text color="text-light" size="small">
|
||||
<span v-show="data">{{$locale.baseText('workflows.item.updated')}} <time-ago :date="data.updatedAt" /> | </span>
|
||||
<span v-show="data" class="mr-2xs">{{$locale.baseText('workflows.item.created')}} {{ formattedCreatedAtDate }} </span>
|
||||
<span v-if="settingsStore.areTagsEnabled && data.tags && data.tags.length > 0" v-show="data">
|
||||
<n8n-card :class="$style.cardLink" @click="onClick">
|
||||
<template #header>
|
||||
<n8n-heading
|
||||
tag="h2"
|
||||
bold
|
||||
class="ph-no-capture"
|
||||
:class="$style.cardHeading"
|
||||
data-test-id="workflow-card-name"
|
||||
>
|
||||
{{ data.name }}
|
||||
</n8n-heading>
|
||||
</template>
|
||||
<div :class="$style.cardDescription">
|
||||
<n8n-text color="text-light" size="small">
|
||||
<span v-show="data"
|
||||
>{{ $locale.baseText('workflows.item.updated') }} <time-ago :date="data.updatedAt" /> |
|
||||
</span>
|
||||
<span v-show="data" class="mr-2xs"
|
||||
>{{ $locale.baseText('workflows.item.created') }} {{ formattedCreatedAtDate }}
|
||||
</span>
|
||||
<span
|
||||
v-if="settingsStore.areTagsEnabled && data.tags && data.tags.length > 0"
|
||||
v-show="data"
|
||||
>
|
||||
<n8n-tags
|
||||
:tags="data.tags"
|
||||
:truncateAt="3"
|
||||
@@ -21,50 +31,50 @@
|
||||
data-test-id="workflow-card-tags"
|
||||
/>
|
||||
</span>
|
||||
</n8n-text>
|
||||
</n8n-text>
|
||||
</div>
|
||||
<template #append>
|
||||
<div :class="$style.cardActions">
|
||||
<enterprise-edition :features="[EnterpriseEditionFeature.WorkflowSharing]">
|
||||
<n8n-badge v-if="workflowPermissions.isOwner" class="mr-xs" theme="tertiary" bold>
|
||||
{{ $locale.baseText('workflows.item.owner') }}
|
||||
</n8n-badge>
|
||||
</enterprise-edition>
|
||||
|
||||
<workflow-activator
|
||||
class="mr-s"
|
||||
:workflow-active="data.active"
|
||||
:workflow-id="data.id"
|
||||
ref="activator"
|
||||
data-test-id="workflow-card-activator"
|
||||
/>
|
||||
|
||||
<n8n-action-toggle
|
||||
:actions="actions"
|
||||
theme="dark"
|
||||
@action="onAction"
|
||||
data-test-id="workflow-card-actions"
|
||||
/>
|
||||
</div>
|
||||
<template #append>
|
||||
<div :class="$style.cardActions">
|
||||
<enterprise-edition :features="[EnterpriseEditionFeature.WorkflowSharing]">
|
||||
<n8n-badge
|
||||
v-if="workflowPermissions.isOwner"
|
||||
class="mr-xs"
|
||||
theme="tertiary"
|
||||
bold
|
||||
>
|
||||
{{$locale.baseText('workflows.item.owner')}}
|
||||
</n8n-badge>
|
||||
</enterprise-edition>
|
||||
|
||||
<workflow-activator
|
||||
class="mr-s"
|
||||
:workflow-active="data.active"
|
||||
:workflow-id="data.id"
|
||||
ref="activator"
|
||||
data-test-id="workflow-card-activator"
|
||||
/>
|
||||
|
||||
<n8n-action-toggle
|
||||
:actions="actions"
|
||||
theme="dark"
|
||||
@action="onAction"
|
||||
data-test-id="workflow-card-actions"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</n8n-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import mixins from 'vue-typed-mixins';
|
||||
import {IWorkflowDb, IUser, ITag} from "@/Interface";
|
||||
import {DUPLICATE_MODAL_KEY, EnterpriseEditionFeature, VIEWS, WORKFLOW_SHARE_MODAL_KEY} from '@/constants';
|
||||
import {showMessage} from "@/mixins/showMessage";
|
||||
import {getWorkflowPermissions, IPermissions} from "@/permissions";
|
||||
import dateformat from "dateformat";
|
||||
import { IWorkflowDb, IUser, ITag } from '@/Interface';
|
||||
import {
|
||||
DUPLICATE_MODAL_KEY,
|
||||
EnterpriseEditionFeature,
|
||||
VIEWS,
|
||||
WORKFLOW_SHARE_MODAL_KEY,
|
||||
} from '@/constants';
|
||||
import { showMessage } from '@/mixins/showMessage';
|
||||
import { getWorkflowPermissions, IPermissions } from '@/permissions';
|
||||
import dateformat from 'dateformat';
|
||||
import { restApi } from '@/mixins/restApi';
|
||||
import WorkflowActivator from '@/components/WorkflowActivator.vue';
|
||||
import Vue from "vue";
|
||||
import Vue from 'vue';
|
||||
import { mapStores } from 'pinia';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
@@ -78,10 +88,7 @@ export const WORKFLOW_LIST_ITEM_ACTIONS = {
|
||||
DELETE: 'delete',
|
||||
};
|
||||
|
||||
export default mixins(
|
||||
showMessage,
|
||||
restApi,
|
||||
).extend({
|
||||
export default mixins(showMessage, restApi).extend({
|
||||
data() {
|
||||
return {
|
||||
EnterpriseEditionFeature,
|
||||
@@ -113,19 +120,14 @@ export default mixins(
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapStores(
|
||||
useSettingsStore,
|
||||
useUIStore,
|
||||
useUsersStore,
|
||||
useWorkflowsStore,
|
||||
),
|
||||
currentUser (): IUser {
|
||||
return this.usersStore.currentUser || {} as IUser;
|
||||
...mapStores(useSettingsStore, useUIStore, useUsersStore, useWorkflowsStore),
|
||||
currentUser(): IUser {
|
||||
return this.usersStore.currentUser || ({} as IUser);
|
||||
},
|
||||
workflowPermissions(): IPermissions {
|
||||
return getWorkflowPermissions(this.currentUser, this.data);
|
||||
},
|
||||
actions(): Array<{ label: string; value: string; }> {
|
||||
actions(): Array<{ label: string; value: string }> {
|
||||
return [
|
||||
{
|
||||
label: this.$locale.baseText('workflows.item.open'),
|
||||
@@ -139,15 +141,24 @@ export default mixins(
|
||||
label: this.$locale.baseText('workflows.item.duplicate'),
|
||||
value: WORKFLOW_LIST_ITEM_ACTIONS.DUPLICATE,
|
||||
},
|
||||
].concat(this.workflowPermissions.delete ? [{
|
||||
label: this.$locale.baseText('workflows.item.delete'),
|
||||
value: WORKFLOW_LIST_ITEM_ACTIONS.DELETE,
|
||||
}]: []);
|
||||
].concat(
|
||||
this.workflowPermissions.delete
|
||||
? [
|
||||
{
|
||||
label: this.$locale.baseText('workflows.item.delete'),
|
||||
value: WORKFLOW_LIST_ITEM_ACTIONS.DELETE,
|
||||
},
|
||||
]
|
||||
: [],
|
||||
);
|
||||
},
|
||||
formattedCreatedAtDate(): string {
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
return dateformat(this.data.createdAt, `d mmmm${this.data.createdAt.startsWith(currentYear) ? '' : ', yyyy'}`);
|
||||
return dateformat(
|
||||
this.data.createdAt,
|
||||
`d mmmm${this.data.createdAt.startsWith(currentYear) ? '' : ', yyyy'}`,
|
||||
);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -158,7 +169,10 @@ export default mixins(
|
||||
}
|
||||
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
const route = this.$router.resolve({name: VIEWS.WORKFLOW, params: { name: this.data.id }});
|
||||
const route = this.$router.resolve({
|
||||
name: VIEWS.WORKFLOW,
|
||||
params: { name: this.data.id },
|
||||
});
|
||||
window.open(route.href, '_blank');
|
||||
|
||||
return;
|
||||
@@ -188,13 +202,15 @@ export default mixins(
|
||||
},
|
||||
});
|
||||
} else if (action === WORKFLOW_LIST_ITEM_ACTIONS.SHARE) {
|
||||
this.uiStore.openModalWithData({ name: WORKFLOW_SHARE_MODAL_KEY, data: { id: this.data.id } });
|
||||
this.uiStore.openModalWithData({
|
||||
name: WORKFLOW_SHARE_MODAL_KEY,
|
||||
data: { id: this.data.id },
|
||||
});
|
||||
} else if (action === WORKFLOW_LIST_ITEM_ACTIONS.DELETE) {
|
||||
const deleteConfirmed = await this.confirmMessage(
|
||||
this.$locale.baseText(
|
||||
'mainSidebar.confirmMessage.workflowDelete.message',
|
||||
{ interpolate: { workflowName: this.data.name } },
|
||||
),
|
||||
this.$locale.baseText('mainSidebar.confirmMessage.workflowDelete.message', {
|
||||
interpolate: { workflowName: this.data.name },
|
||||
}),
|
||||
this.$locale.baseText('mainSidebar.confirmMessage.workflowDelete.headline'),
|
||||
'warning',
|
||||
this.$locale.baseText('mainSidebar.confirmMessage.workflowDelete.confirmButtonText'),
|
||||
@@ -233,7 +249,7 @@ export default mixins(
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 2px 8px rgba(#441C17, 0.1);
|
||||
box-shadow: 0 2px 8px rgba(#441c17, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,5 +271,3 @@ export default mixins(
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user