mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +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,52 +1,44 @@
|
||||
<template>
|
||||
<n8n-card
|
||||
:class="$style['card-link']"
|
||||
@click="onClick"
|
||||
>
|
||||
<template #prepend>
|
||||
<credential-icon :credential-type-name="credentialType ? credentialType.name : ''" />
|
||||
</template>
|
||||
<template #header>
|
||||
<n8n-heading tag="h2" bold class="ph-no-capture" :class="$style['card-heading']">
|
||||
{{ data.name }}
|
||||
</n8n-heading>
|
||||
</template>
|
||||
<n8n-text color="text-light" size="small">
|
||||
<span v-if="credentialType">{{ credentialType.displayName }} | </span>
|
||||
<span v-show="data">{{$locale.baseText('credentials.item.updated')}} <time-ago :date="data.updatedAt" /> | </span>
|
||||
<span v-show="data">{{$locale.baseText('credentials.item.created')}} {{ formattedCreatedAtDate }} </span>
|
||||
</n8n-text>
|
||||
<template #append>
|
||||
<div :class="$style['card-actions']">
|
||||
<enterprise-edition :features="[EnterpriseEditionFeature.Sharing]">
|
||||
<n8n-badge
|
||||
v-if="credentialPermissions.isOwner"
|
||||
class="mr-xs"
|
||||
theme="tertiary"
|
||||
bold
|
||||
>
|
||||
{{$locale.baseText('credentials.item.owner')}}
|
||||
</n8n-badge>
|
||||
</enterprise-edition>
|
||||
<n8n-action-toggle
|
||||
:actions="actions"
|
||||
theme="dark"
|
||||
@action="onAction"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<n8n-card :class="$style['card-link']" @click="onClick">
|
||||
<template #prepend>
|
||||
<credential-icon :credential-type-name="credentialType ? credentialType.name : ''" />
|
||||
</template>
|
||||
<template #header>
|
||||
<n8n-heading tag="h2" bold class="ph-no-capture" :class="$style['card-heading']">
|
||||
{{ data.name }}
|
||||
</n8n-heading>
|
||||
</template>
|
||||
<n8n-text color="text-light" size="small">
|
||||
<span v-if="credentialType">{{ credentialType.displayName }} | </span>
|
||||
<span v-show="data"
|
||||
>{{ $locale.baseText('credentials.item.updated') }} <time-ago :date="data.updatedAt" /> |
|
||||
</span>
|
||||
<span v-show="data"
|
||||
>{{ $locale.baseText('credentials.item.created') }} {{ formattedCreatedAtDate }}
|
||||
</span>
|
||||
</n8n-text>
|
||||
<template #append>
|
||||
<div :class="$style['card-actions']">
|
||||
<enterprise-edition :features="[EnterpriseEditionFeature.Sharing]">
|
||||
<n8n-badge v-if="credentialPermissions.isOwner" class="mr-xs" theme="tertiary" bold>
|
||||
{{ $locale.baseText('credentials.item.owner') }}
|
||||
</n8n-badge>
|
||||
</enterprise-edition>
|
||||
<n8n-action-toggle :actions="actions" theme="dark" @action="onAction" />
|
||||
</div>
|
||||
</template>
|
||||
</n8n-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import mixins from 'vue-typed-mixins';
|
||||
import {ICredentialsResponse, IUser} from "@/Interface";
|
||||
import {ICredentialType} from "n8n-workflow";
|
||||
import {EnterpriseEditionFeature} from '@/constants';
|
||||
import {showMessage} from "@/mixins/showMessage";
|
||||
import { ICredentialsResponse, IUser } from '@/Interface';
|
||||
import { ICredentialType } from 'n8n-workflow';
|
||||
import { EnterpriseEditionFeature } from '@/constants';
|
||||
import { showMessage } from '@/mixins/showMessage';
|
||||
import CredentialIcon from '@/components/CredentialIcon.vue';
|
||||
import {getCredentialPermissions, IPermissions} from "@/permissions";
|
||||
import dateformat from "dateformat";
|
||||
import { getCredentialPermissions, IPermissions } from '@/permissions';
|
||||
import dateformat from 'dateformat';
|
||||
import { mapStores } from 'pinia';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
import { useUsersStore } from '@/stores/users';
|
||||
@@ -57,9 +49,7 @@ export const CREDENTIAL_LIST_ITEM_ACTIONS = {
|
||||
DELETE: 'delete',
|
||||
};
|
||||
|
||||
export default mixins(
|
||||
showMessage,
|
||||
).extend({
|
||||
export default mixins(showMessage).extend({
|
||||
data() {
|
||||
return {
|
||||
EnterpriseEditionFeature,
|
||||
@@ -89,12 +79,8 @@ export default mixins(
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapStores(
|
||||
useCredentialsStore,
|
||||
useUIStore,
|
||||
useUsersStore,
|
||||
),
|
||||
currentUser (): IUser | null {
|
||||
...mapStores(useCredentialsStore, useUIStore, useUsersStore),
|
||||
currentUser(): IUser | null {
|
||||
return this.usersStore.currentUser;
|
||||
},
|
||||
credentialType(): ICredentialType {
|
||||
@@ -103,7 +89,7 @@ export default mixins(
|
||||
credentialPermissions(): IPermissions | null {
|
||||
return !this.currentUser ? null : getCredentialPermissions(this.currentUser, this.data);
|
||||
},
|
||||
actions(): Array<{ label: string; value: string; }> {
|
||||
actions(): Array<{ label: string; value: string }> {
|
||||
if (!this.credentialPermissions) {
|
||||
return [];
|
||||
}
|
||||
@@ -113,15 +99,24 @@ export default mixins(
|
||||
label: this.$locale.baseText('credentials.item.open'),
|
||||
value: CREDENTIAL_LIST_ITEM_ACTIONS.OPEN,
|
||||
},
|
||||
].concat(this.credentialPermissions.delete ? [{
|
||||
label: this.$locale.baseText('credentials.item.delete'),
|
||||
value: CREDENTIAL_LIST_ITEM_ACTIONS.DELETE,
|
||||
}]: []);
|
||||
].concat(
|
||||
this.credentialPermissions.delete
|
||||
? [
|
||||
{
|
||||
label: this.$locale.baseText('credentials.item.delete'),
|
||||
value: CREDENTIAL_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: {
|
||||
@@ -133,16 +128,23 @@ export default mixins(
|
||||
this.onClick();
|
||||
} else if (action === CREDENTIAL_LIST_ITEM_ACTIONS.DELETE) {
|
||||
const deleteConfirmed = await this.confirmMessage(
|
||||
this.$locale.baseText('credentialEdit.credentialEdit.confirmMessage.deleteCredential.message', {
|
||||
interpolate: { savedCredentialName: this.data.name },
|
||||
}),
|
||||
this.$locale.baseText('credentialEdit.credentialEdit.confirmMessage.deleteCredential.headline'),
|
||||
this.$locale.baseText(
|
||||
'credentialEdit.credentialEdit.confirmMessage.deleteCredential.message',
|
||||
{
|
||||
interpolate: { savedCredentialName: this.data.name },
|
||||
},
|
||||
),
|
||||
this.$locale.baseText(
|
||||
'credentialEdit.credentialEdit.confirmMessage.deleteCredential.headline',
|
||||
),
|
||||
null,
|
||||
this.$locale.baseText('credentialEdit.credentialEdit.confirmMessage.deleteCredential.confirmButtonText'),
|
||||
this.$locale.baseText(
|
||||
'credentialEdit.credentialEdit.confirmMessage.deleteCredential.confirmButtonText',
|
||||
),
|
||||
);
|
||||
|
||||
if (deleteConfirmed) {
|
||||
this.credentialsStore.deleteCredential({ id: this.data.id });
|
||||
this.credentialsStore.deleteCredential({ id: this.data.id });
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -156,7 +158,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,5 +173,3 @@ export default mixins(
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user