mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 02:51: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,6 +1,15 @@
|
||||
<template>
|
||||
<div v-if="webhooksNode.length" class="webhooks">
|
||||
<div class="clickable headline" :class="{expanded: !isMinimized}" @click="isMinimized=!isMinimized" :title="isMinimized ? $locale.baseText('nodeWebhooks.clickToDisplayWebhookUrls') : $locale.baseText('nodeWebhooks.clickToHideWebhookUrls')">
|
||||
<div
|
||||
class="clickable headline"
|
||||
:class="{ expanded: !isMinimized }"
|
||||
@click="isMinimized = !isMinimized"
|
||||
:title="
|
||||
isMinimized
|
||||
? $locale.baseText('nodeWebhooks.clickToDisplayWebhookUrls')
|
||||
: $locale.baseText('nodeWebhooks.clickToHideWebhookUrls')
|
||||
"
|
||||
>
|
||||
<font-awesome-icon icon="angle-down" class="minimize-button minimize-icon" />
|
||||
{{ $locale.baseText('nodeWebhooks.webhookUrls') }}
|
||||
</div>
|
||||
@@ -12,39 +21,44 @@
|
||||
<n8n-radio-buttons
|
||||
v-model="showUrlFor"
|
||||
:options="[
|
||||
{ label: this.$locale.baseText('nodeWebhooks.testUrl'), value: 'test'},
|
||||
{ label: this.$locale.baseText('nodeWebhooks.productionUrl'), value: 'production'},
|
||||
{ label: this.$locale.baseText('nodeWebhooks.testUrl'), value: 'test' },
|
||||
{
|
||||
label: this.$locale.baseText('nodeWebhooks.productionUrl'),
|
||||
value: 'production',
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<n8n-tooltip v-for="(webhook, index) in webhooksNode" :key="index" class="item" :content="$locale.baseText('nodeWebhooks.clickToCopyWebhookUrls')" placement="left">
|
||||
<n8n-tooltip
|
||||
v-for="(webhook, index) in webhooksNode"
|
||||
:key="index"
|
||||
class="item"
|
||||
:content="$locale.baseText('nodeWebhooks.clickToCopyWebhookUrls')"
|
||||
placement="left"
|
||||
>
|
||||
<div class="webhook-wrapper">
|
||||
<div class="http-field">
|
||||
<div class="http-method">
|
||||
{{getWebhookExpressionValue(webhook, 'httpMethod')}}<br />
|
||||
</div>
|
||||
<div class="http-field">
|
||||
<div class="http-method">
|
||||
{{ getWebhookExpressionValue(webhook, 'httpMethod') }}<br />
|
||||
</div>
|
||||
<div class="url-field">
|
||||
<div class="webhook-url left-ellipsis clickable" @click="copyWebhookUrl(webhook)">
|
||||
{{getWebhookUrlDisplay(webhook)}}<br />
|
||||
</div>
|
||||
</div>
|
||||
<div class="url-field">
|
||||
<div class="webhook-url left-ellipsis clickable" @click="copyWebhookUrl(webhook)">
|
||||
{{ getWebhookUrlDisplay(webhook) }}<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n8n-tooltip>
|
||||
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {
|
||||
INodeTypeDescription,
|
||||
IWebhookDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeTypeDescription, IWebhookDescription } from 'n8n-workflow';
|
||||
|
||||
import { WEBHOOK_NODE_TYPE } from '@/constants';
|
||||
import { copyPaste } from '@/mixins/copyPaste';
|
||||
@@ -53,63 +67,59 @@ import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||
|
||||
import mixins from 'vue-typed-mixins';
|
||||
|
||||
export default mixins(
|
||||
copyPaste,
|
||||
showMessage,
|
||||
workflowHelpers,
|
||||
)
|
||||
.extend({
|
||||
name: 'NodeWebhooks',
|
||||
props: [
|
||||
'node', // NodeUi
|
||||
'nodeType', // INodeTypeDescription
|
||||
],
|
||||
data () {
|
||||
return {
|
||||
isMinimized: this.nodeType && this.nodeType.name !== WEBHOOK_NODE_TYPE,
|
||||
showUrlFor: 'test',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
webhooksNode (): IWebhookDescription[] {
|
||||
if (this.nodeType === null || this.nodeType.webhooks === undefined) {
|
||||
return [];
|
||||
}
|
||||
export default mixins(copyPaste, showMessage, workflowHelpers).extend({
|
||||
name: 'NodeWebhooks',
|
||||
props: [
|
||||
'node', // NodeUi
|
||||
'nodeType', // INodeTypeDescription
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
isMinimized: this.nodeType && this.nodeType.name !== WEBHOOK_NODE_TYPE,
|
||||
showUrlFor: 'test',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
webhooksNode(): IWebhookDescription[] {
|
||||
if (this.nodeType === null || this.nodeType.webhooks === undefined) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return (this.nodeType as INodeTypeDescription).webhooks!.filter(webhookData => webhookData.restartWebhook !== true);
|
||||
},
|
||||
return (this.nodeType as INodeTypeDescription).webhooks!.filter(
|
||||
(webhookData) => webhookData.restartWebhook !== true,
|
||||
);
|
||||
},
|
||||
methods: {
|
||||
copyWebhookUrl (webhookData: IWebhookDescription): void {
|
||||
const webhookUrl = this.getWebhookUrlDisplay(webhookData);
|
||||
this.copyToClipboard(webhookUrl);
|
||||
},
|
||||
methods: {
|
||||
copyWebhookUrl(webhookData: IWebhookDescription): void {
|
||||
const webhookUrl = this.getWebhookUrlDisplay(webhookData);
|
||||
this.copyToClipboard(webhookUrl);
|
||||
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('nodeWebhooks.showMessage.title'),
|
||||
type: 'success',
|
||||
});
|
||||
this.$telemetry.track('User copied webhook URL', {
|
||||
pane: 'parameters',
|
||||
type: `${this.showUrlFor} url`,
|
||||
});
|
||||
},
|
||||
getWebhookUrlDisplay (webhookData: IWebhookDescription): string {
|
||||
if (this.node) {
|
||||
return this.getWebhookUrl(webhookData, this.node, this.showUrlFor);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('nodeWebhooks.showMessage.title'),
|
||||
type: 'success',
|
||||
});
|
||||
this.$telemetry.track('User copied webhook URL', {
|
||||
pane: 'parameters',
|
||||
type: `${this.showUrlFor} url`,
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
node () {
|
||||
this.isMinimized = this.nodeType.name !== WEBHOOK_NODE_TYPE;
|
||||
},
|
||||
getWebhookUrlDisplay(webhookData: IWebhookDescription): string {
|
||||
if (this.node) {
|
||||
return this.getWebhookUrl(webhookData, this.node, this.showUrlFor);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
node() {
|
||||
this.isMinimized = this.nodeType.name !== WEBHOOK_NODE_TYPE;
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.webhooks {
|
||||
padding-bottom: var(--spacing-xs);
|
||||
margin: var(--spacing-xs) 0;
|
||||
@@ -126,7 +136,7 @@ export default mixins(
|
||||
position: absolute;
|
||||
width: 50px;
|
||||
display: inline-block;
|
||||
top: calc(50% - 8px)
|
||||
top: calc(50% - 8px);
|
||||
}
|
||||
|
||||
.http-method {
|
||||
|
||||
Reference in New Issue
Block a user