n8n-editor-ui 1.75.1 → 1.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-BhRv3Xk0.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-Bk0ZjgAz.js} +1 -1
- package/dist/assets/{AuthView-vL9vjCvD.js → AuthView-CQW1x21E.js} +2 -2
- package/dist/assets/{CanvasChat-B69VJDcA.js → CanvasChat-DuJwpZew.js} +19 -18
- package/dist/assets/{CanvasControls-DhhKk7yf.js → CanvasControls-Br7x0c2w.js} +1 -1
- package/dist/assets/{ChangePasswordView-D8y2rYLl.js → ChangePasswordView-Ck-5oU_m.js} +3 -3
- package/dist/assets/CollectionParameter-DRNykodC.js +4 -0
- package/dist/assets/{ConcurrentExecutionsHeader-Dv0s5rxY.js → ConcurrentExecutionsHeader-Dfi130Qe.js} +2 -2
- package/dist/assets/{CredentialsView-Dp0fVbpZ.js → CredentialsView-D44diL3J.js} +4 -4
- package/dist/assets/{ErrorView-a6qq4rkt.js → ErrorView-ub9nQRXV.js} +1 -1
- package/dist/assets/{ExecutionsView-CpILe_1o.js → ExecutionsView-DsAXYzOp.js} +17 -5
- package/dist/assets/{FileSaver.min-C1QTiJmy.js → FileSaver.min-nbqT44De.js} +1 -1
- package/dist/assets/{FixedCollectionParameter-kphzKyyy.js → FixedCollectionParameter-DwiBHQQW.js} +1 -1
- package/dist/assets/{ForgotMyPasswordView-DzUekqel.js → ForgotMyPasswordView-CH0wwots.js} +3 -3
- package/dist/assets/{Logo-B-pFOUGc.js → Logo-CIYEwVrA.js} +1 -1
- package/dist/assets/{MainHeader-C6S60KwG.js → MainHeader-CN6RTCuC.js} +15 -105
- package/dist/assets/{MainHeader-BIKp2Ncp.css → MainHeader-DC-g9NGP.css} +12 -11
- package/dist/assets/{MainSidebar-CJ-OKhK-.js → MainSidebar-ih4BlE0n.js} +4 -81
- package/dist/assets/{NodeCreation-CNcty5fl.js → NodeCreation-DQUKwvhM.js} +4 -4
- package/dist/assets/{NodeCreator-DAW2sX8p.js → NodeCreator-B1R35yuN.js} +5 -5
- package/dist/assets/{NodeViewSwitcher-mtWBt9cw.js → NodeViewSwitcher-TsFkW80s.js} +89 -48
- package/dist/assets/{NodeViewSwitcher-CB1zkjni.css → NodeViewSwitcher-aJwrKS8o.css} +23 -23
- package/dist/assets/{ProjectCardBadge-DcWhzEr6.js → ProjectCardBadge-BcCHZFJ2.js} +2 -15
- package/dist/assets/{ProjectHeader-D2FCquSr.js → ProjectHeader-CSOMgkVs.js} +1 -1
- package/dist/assets/{ProjectSettings-CDg4IQw7.js → ProjectSettings-DtqNq5WU.js} +2 -2
- package/dist/assets/{PushConnectionTracker.vue_vue_type_script_setup_true_lang-BPBen7Li.js → PushConnectionTracker.vue_vue_type_script_setup_true_lang-CZIKiOsY.js} +1 -1
- package/dist/assets/{ResourcesListLayout-DWASP6Vp.js → ResourcesListLayout-CvkkebAN.js} +21 -11
- package/dist/assets/{ResourcesListLayout-CJC-YvjD.css → ResourcesListLayout-d7mMNhOL.css} +6 -6
- package/dist/assets/{RunDataJson-CFNeORgR.js → RunDataJson-DA1LNZGU.js} +15 -15
- package/dist/assets/{RunDataJson-BXTLuo7i.css → RunDataJson-Txw0lqay.css} +1 -0
- package/dist/assets/{RunDataJsonActions-COFXneND.js → RunDataJsonActions-DZzYHsR7.js} +2 -2
- package/dist/assets/{RunDataSearch-D9UDSGjR.js → RunDataSearch-D6-6kSmI.js} +1 -1
- package/dist/assets/{RunDataTable-C3flt0dy.js → RunDataTable-bDBgkWN3.js} +2 -2
- package/dist/assets/{SamlOnboarding-CWM-8qu7.js → SamlOnboarding-ULq0l8s6.js} +3 -3
- package/dist/assets/{SettingsApiView-Bl6jvpWQ.js → SettingsApiView-CVRk9yEi.js} +1 -1
- package/dist/assets/{SettingsCommunityNodesView-5Dl4EOzd.js → SettingsCommunityNodesView-B6We65ta.js} +4 -4
- package/dist/assets/{SettingsExternalSecrets-DljwCjwW.js → SettingsExternalSecrets-wrWe6ob7.js} +1 -1
- package/dist/assets/{SettingsLdapView-5kgLPxB7.js → SettingsLdapView-CeKm7XML.js} +1 -1
- package/dist/assets/{SettingsLogStreamingView-CsB-E4Kv.js → SettingsLogStreamingView-DxAoQ7dF.js} +1 -1
- package/dist/assets/{SettingsPersonalView-B0vJNuPt.js → SettingsPersonalView-DFcUFc08.js} +1 -1
- package/dist/assets/{SettingsSourceControl-B7SGpzBu.js → SettingsSourceControl-D9u9tDhF.js} +1 -1
- package/dist/assets/{SettingsSso-pDsu2lsS.js → SettingsSso-gUSJtFP0.js} +1 -1
- package/dist/assets/{SettingsUsageAndPlan-B83lunzH.js → SettingsUsageAndPlan-C4rSaxsT.js} +1 -1
- package/dist/assets/{SettingsUsersView-DPM5R_9p.js → SettingsUsersView-DSaFQg1K.js} +1 -1
- package/dist/assets/{SettingsView-NF_8zzqr.js → SettingsView-BcBZpdTs.js} +1 -1
- package/dist/assets/{SetupView-Dzehb2sC.js → SetupView-BnZ-D6Jy.js} +3 -3
- package/dist/assets/{SetupWorkflowCredentialsButton-Bhx7c9Lu.js → SetupWorkflowCredentialsButton-B3DfAGgF.js} +1 -1
- package/dist/assets/{SetupWorkflowFromTemplateView-DaP6_l4S.js → SetupWorkflowFromTemplateView-DVLoF-kN.js} +3 -3
- package/dist/assets/{SigninView-BLyXzN0c.js → SigninView-BI4UTqFm.js} +3 -3
- package/dist/assets/{SignoutView-BsaJctbQ.js → SignoutView-4KEfr3ze.js} +1 -1
- package/dist/assets/{SignupView-m53hHk3y.js → SignupView-BdxSQxbe.js} +3 -3
- package/dist/assets/{TemplateDetails-CWR4kXyf.js → TemplateDetails-BU5E9lAh.js} +1 -1
- package/dist/assets/{TemplateList-DLQxEmgt.js → TemplateList-CSyTesvr.js} +1 -1
- package/dist/assets/{TemplatesCollectionView-CobxDh9v.js → TemplatesCollectionView-aqqEP8td.js} +5 -5
- package/dist/assets/{TemplatesSearchView-CDW7EH1p.js → TemplatesSearchView-BXQw_aAZ.js} +3 -3
- package/dist/assets/{TemplatesView-DJCodjB-.js → TemplatesView-BbVjMkgy.js} +1 -1
- package/dist/assets/{TemplatesWorkflowView-DOlLEzEa.js → TemplatesWorkflowView-Cao3RpEd.js} +5 -5
- package/dist/assets/{TestDefinitionEditView-Cuphh86f.js → TestDefinitionEditView-CgW-4tTx.js} +785 -547
- package/dist/assets/{TestDefinitionEditView-FI1GVbhl.css → TestDefinitionEditView-d7yfvp9P.css} +601 -238
- package/dist/assets/{TestDefinitionListView-Dgq9dXJL.js → TestDefinitionListView-D3eg62pM.js} +93 -68
- package/dist/assets/{TestDefinitionRootView-DU-JMBSH.js → TestDefinitionRootView-DJdsaL4M.js} +1 -1
- package/dist/assets/VariablesView-2TmNYpas.js +509 -0
- package/dist/assets/{VariablesView-D4pRzSuY.css → VariablesView-CIfrpJdg.css} +21 -54
- package/dist/assets/{WorkerView-CbqToUTB.js → WorkerView-C3LhhFeZ.js} +5 -5
- package/dist/assets/{WorkflowActivator-BaM6Tydw.js → WorkflowActivator-DiOQiQK2.js} +2 -2
- package/dist/assets/{WorkflowExecutionsInfoAccordion-6kKOPXK7.js → WorkflowExecutionsInfoAccordion-BmMiVSHQ.js} +1 -1
- package/dist/assets/{WorkflowExecutionsLandingPage-Cqq5FeZE.js → WorkflowExecutionsLandingPage-CxbfP9Kf.js} +2 -2
- package/dist/assets/{WorkflowExecutionsPreview-D1cSllVi.js → WorkflowExecutionsPreview-Cku-ZBQ3.js} +5 -5
- package/dist/assets/{WorkflowExecutionsView-BUHtKz5M.css → WorkflowExecutionsView-BjdRnQOE.css} +32 -32
- package/dist/assets/{WorkflowExecutionsView-qTFEWbeC.js → WorkflowExecutionsView-C0CnXLDW.js} +43 -29
- package/dist/assets/{WorkflowHistory-De54-QkN.js → WorkflowHistory-Bg6AIKXX.js} +3 -3
- package/dist/assets/{WorkflowOnboardingView-p6cAElRZ.js → WorkflowOnboardingView-LXWyp2is.js} +1 -1
- package/dist/assets/{WorkflowPreview-CKK96lnJ.js → WorkflowPreview-CsR9t5iY.js} +1 -1
- package/dist/assets/{WorkflowsView-D5G530AX.js → WorkflowsView-DQJAEKqk.js} +7 -7
- package/dist/assets/{easyAiWorkflowUtils-eykvtlKm.js → easyAiWorkflowUtils-D3El0FyE.js} +1 -1
- package/dist/assets/{index-DXFsvbJ_.css → index-DsHZ4yOE.css} +250 -31
- package/dist/assets/{index-CWcTt6jd.js → index-DvkbRfZN.js} +2542 -1943
- package/dist/assets/{polyfills-BN5TIqPj.js → polyfills-DNwgos9f.js} +650 -0
- package/dist/assets/{pushConnection.store-CTrZ_kO6.js → pushConnection.store-5KniMGTZ.js} +1 -1
- package/dist/assets/{templateActions-B712CNo3.js → templateActions-UGDN8R7F.js} +1 -1
- package/dist/assets/useBeforeUnload-BwgAu_Gm.js +43 -0
- package/dist/assets/{useBugReporting-BxDqzvRW.js → useBugReporting-Bqv4ngy7.js} +2 -1
- package/dist/assets/{useCanvasOperations-BSKKylIT.css → useCanvasOperations-Bjf582lB.css} +12 -12
- package/dist/assets/{useCanvasOperations-DTx4vbp_.js → useCanvasOperations-Cw1yjntX.js} +56 -25
- package/dist/assets/{useExecutionDebugging-DjYGtT4w.js → useExecutionDebugging-CTzUvS-m.js} +1 -1
- package/dist/assets/{useExecutionHelpers-DcyS3__o.js → useExecutionHelpers-ts_ANr0X.js} +1 -1
- package/dist/assets/{usePinnedData-C5NRkSpx.js → usePinnedData-CAHmwr13.js} +1 -1
- package/dist/assets/{usePushConnection-CGv57TM5.js → usePushConnection-BcVRW8VB.js} +3 -3
- package/dist/assets/{useRunWorkflow-C_vazd74.js → useRunWorkflow-DZq8rmMi.js} +7 -4
- package/dist/assets/{useWorkflowActivate-Dxi5zSSs.js → useWorkflowActivate-y3uHMZeh.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/CollectionParameter-djLQ8MUO.js +0 -4
- package/dist/assets/VariablesView-CaGkZXjl.js +0 -599
- package/dist/assets/useNodeViewVersionSwitcher-CXU1PYlK.js +0 -93
|
@@ -1,599 +0,0 @@
|
|
|
1
|
-
import { d as defineComponent, b7 as useClipboard, a as useToast, p as useSettingsStore, u as useUsersStore, q as computed, r as ref, o as onMounted, H as watch, c as openBlock, h as createElementBlock, j as createBaseVNode, t as toDisplayString, e as createBlock, l as unref, i as createVNode, w as withCtx, k as createTextVNode, n as normalizeClass, f as createCommentVNode, g as useI18n, y as nextTick, m as resolveComponent, am as getResourcePermissions, a8 as EnterpriseEditionFeature, _ as _export_sfc, dK as useEnvironmentsStore, K as useUIStore, a0 as useSourceControlStore, a3 as useDocumentTitle, a5 as usePageRedirectionHelper, ax as onBeforeMount, x as onBeforeUnmount, aT as createSlots, fN as uid, ae as MODAL_CONFIRM, ak as useTelemetry, al as useMessage } from "./index-CWcTt6jd.js";
|
|
2
|
-
import { R as ResourcesListLayout } from "./ResourcesListLayout-DWASP6Vp.js";
|
|
3
|
-
const _hoisted_1$1 = { class: "variables-key-column" };
|
|
4
|
-
const _hoisted_2$1 = { key: 0 };
|
|
5
|
-
const _hoisted_3 = { class: "variables-value-column" };
|
|
6
|
-
const _hoisted_4 = { key: 0 };
|
|
7
|
-
const _hoisted_5 = { class: "variables-usage-column" };
|
|
8
|
-
const _hoisted_6 = { key: 0 };
|
|
9
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
10
|
-
__name: "VariablesRow",
|
|
11
|
-
props: {
|
|
12
|
-
data: {},
|
|
13
|
-
editing: { type: Boolean, default: false }
|
|
14
|
-
},
|
|
15
|
-
emits: ["save", "cancel", "edit", "delete"],
|
|
16
|
-
setup(__props, { emit: __emit }) {
|
|
17
|
-
const i18n = useI18n();
|
|
18
|
-
const clipboard = useClipboard();
|
|
19
|
-
const { showMessage } = useToast();
|
|
20
|
-
const settingsStore = useSettingsStore();
|
|
21
|
-
const usersStore = useUsersStore();
|
|
22
|
-
const emit = __emit;
|
|
23
|
-
const props = __props;
|
|
24
|
-
const permissions = computed(
|
|
25
|
-
() => getResourcePermissions(usersStore.currentUser?.globalScopes).variable
|
|
26
|
-
);
|
|
27
|
-
const modelValue = ref({ ...props.data });
|
|
28
|
-
const formValidationStatus = ref({
|
|
29
|
-
key: false,
|
|
30
|
-
value: false
|
|
31
|
-
});
|
|
32
|
-
const formValid = computed(() => {
|
|
33
|
-
return formValidationStatus.value.name && formValidationStatus.value.value;
|
|
34
|
-
});
|
|
35
|
-
const keyInputRef = ref();
|
|
36
|
-
const valueInputRef = ref();
|
|
37
|
-
const usage = ref(`$vars.${props.data.name}`);
|
|
38
|
-
const isFeatureEnabled = computed(
|
|
39
|
-
() => settingsStore.isEnterpriseFeatureEnabled[EnterpriseEditionFeature.Variables]
|
|
40
|
-
);
|
|
41
|
-
onMounted(() => {
|
|
42
|
-
focusFirstInput();
|
|
43
|
-
});
|
|
44
|
-
const keyValidationRules = [
|
|
45
|
-
{ name: "REQUIRED" },
|
|
46
|
-
{ name: "MAX_LENGTH", config: { maximum: 50 } },
|
|
47
|
-
{
|
|
48
|
-
name: "MATCH_REGEX",
|
|
49
|
-
config: {
|
|
50
|
-
regex: /^[a-zA-Z]/,
|
|
51
|
-
message: i18n.baseText("variables.editing.key.error.startsWithLetter")
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "MATCH_REGEX",
|
|
56
|
-
config: {
|
|
57
|
-
regex: /^[a-zA-Z][a-zA-Z0-9_]*$/,
|
|
58
|
-
message: i18n.baseText("variables.editing.key.error.jsonKey")
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
const valueValidationRules = [
|
|
63
|
-
{ name: "MAX_LENGTH", config: { maximum: 220 } }
|
|
64
|
-
];
|
|
65
|
-
watch(
|
|
66
|
-
() => modelValue.value.name,
|
|
67
|
-
async () => {
|
|
68
|
-
await nextTick();
|
|
69
|
-
if (formValidationStatus.value.name) {
|
|
70
|
-
updateUsageSyntax();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
function updateUsageSyntax() {
|
|
75
|
-
usage.value = `$vars.${modelValue.value.name || props.data.name}`;
|
|
76
|
-
}
|
|
77
|
-
async function onCancel() {
|
|
78
|
-
modelValue.value = { ...props.data };
|
|
79
|
-
emit("cancel", modelValue.value);
|
|
80
|
-
}
|
|
81
|
-
async function onSave() {
|
|
82
|
-
emit("save", modelValue.value);
|
|
83
|
-
}
|
|
84
|
-
async function onEdit() {
|
|
85
|
-
emit("edit", modelValue.value);
|
|
86
|
-
await nextTick();
|
|
87
|
-
focusFirstInput();
|
|
88
|
-
}
|
|
89
|
-
async function onDelete() {
|
|
90
|
-
emit("delete", modelValue.value);
|
|
91
|
-
}
|
|
92
|
-
function onValidate(name, value) {
|
|
93
|
-
formValidationStatus.value[name] = value;
|
|
94
|
-
}
|
|
95
|
-
function onUsageClick() {
|
|
96
|
-
void clipboard.copy(usage.value);
|
|
97
|
-
showMessage({
|
|
98
|
-
title: i18n.baseText("variables.row.usage.copiedToClipboard"),
|
|
99
|
-
type: "success"
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
function focusFirstInput() {
|
|
103
|
-
keyInputRef.value?.inputRef?.focus?.();
|
|
104
|
-
}
|
|
105
|
-
return (_ctx, _cache) => {
|
|
106
|
-
const _component_n8n_form_input = resolveComponent("n8n-form-input");
|
|
107
|
-
const _component_n8n_tooltip = resolveComponent("n8n-tooltip");
|
|
108
|
-
const _component_n8n_button = resolveComponent("n8n-button");
|
|
109
|
-
return openBlock(), createElementBlock("tr", {
|
|
110
|
-
class: normalizeClass(_ctx.$style.variablesRow),
|
|
111
|
-
"data-test-id": "variables-row"
|
|
112
|
-
}, [
|
|
113
|
-
createBaseVNode("td", _hoisted_1$1, [
|
|
114
|
-
createBaseVNode("div", null, [
|
|
115
|
-
!_ctx.editing ? (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(_ctx.data.name), 1)) : (openBlock(), createBlock(_component_n8n_form_input, {
|
|
116
|
-
key: 1,
|
|
117
|
-
ref_key: "keyInputRef",
|
|
118
|
-
ref: keyInputRef,
|
|
119
|
-
modelValue: modelValue.value.name,
|
|
120
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value.name = $event),
|
|
121
|
-
label: "",
|
|
122
|
-
name: "name",
|
|
123
|
-
"data-test-id": "variable-row-key-input",
|
|
124
|
-
placeholder: unref(i18n).baseText("variables.editing.key.placeholder"),
|
|
125
|
-
required: "",
|
|
126
|
-
"validate-on-blur": "",
|
|
127
|
-
"validation-rules": keyValidationRules,
|
|
128
|
-
onValidate: _cache[1] || (_cache[1] = (value) => onValidate("name", value))
|
|
129
|
-
}, null, 8, ["modelValue", "placeholder"]))
|
|
130
|
-
])
|
|
131
|
-
]),
|
|
132
|
-
createBaseVNode("td", _hoisted_3, [
|
|
133
|
-
createBaseVNode("div", null, [
|
|
134
|
-
!_ctx.editing ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(_ctx.data.value), 1)) : (openBlock(), createBlock(_component_n8n_form_input, {
|
|
135
|
-
key: 1,
|
|
136
|
-
ref_key: "valueInputRef",
|
|
137
|
-
ref: valueInputRef,
|
|
138
|
-
modelValue: modelValue.value.value,
|
|
139
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => modelValue.value.value = $event),
|
|
140
|
-
label: "",
|
|
141
|
-
name: "value",
|
|
142
|
-
"data-test-id": "variable-row-value-input",
|
|
143
|
-
placeholder: unref(i18n).baseText("variables.editing.value.placeholder"),
|
|
144
|
-
"validate-on-blur": "",
|
|
145
|
-
"validation-rules": valueValidationRules,
|
|
146
|
-
onValidate: _cache[3] || (_cache[3] = (value) => onValidate("value", value))
|
|
147
|
-
}, null, 8, ["modelValue", "placeholder"]))
|
|
148
|
-
])
|
|
149
|
-
]),
|
|
150
|
-
createBaseVNode("td", _hoisted_5, [
|
|
151
|
-
createBaseVNode("div", null, [
|
|
152
|
-
createVNode(_component_n8n_tooltip, { placement: "top" }, {
|
|
153
|
-
content: withCtx(() => [
|
|
154
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.usage.copyToClipboard")), 1)
|
|
155
|
-
]),
|
|
156
|
-
default: withCtx(() => [
|
|
157
|
-
modelValue.value.name && usage.value ? (openBlock(), createElementBlock("span", {
|
|
158
|
-
key: 0,
|
|
159
|
-
class: normalizeClass(_ctx.$style.usageSyntax),
|
|
160
|
-
onClick: onUsageClick
|
|
161
|
-
}, toDisplayString(usage.value), 3)) : createCommentVNode("", true)
|
|
162
|
-
]),
|
|
163
|
-
_: 1
|
|
164
|
-
})
|
|
165
|
-
])
|
|
166
|
-
]),
|
|
167
|
-
isFeatureEnabled.value ? (openBlock(), createElementBlock("td", _hoisted_6, [
|
|
168
|
-
_ctx.editing ? (openBlock(), createElementBlock("div", {
|
|
169
|
-
key: 0,
|
|
170
|
-
class: normalizeClass(_ctx.$style.buttons)
|
|
171
|
-
}, [
|
|
172
|
-
createVNode(_component_n8n_button, {
|
|
173
|
-
"data-test-id": "variable-row-cancel-button",
|
|
174
|
-
type: "tertiary",
|
|
175
|
-
class: "mr-xs",
|
|
176
|
-
onClick: onCancel
|
|
177
|
-
}, {
|
|
178
|
-
default: withCtx(() => [
|
|
179
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.button.cancel")), 1)
|
|
180
|
-
]),
|
|
181
|
-
_: 1
|
|
182
|
-
}),
|
|
183
|
-
createVNode(_component_n8n_button, {
|
|
184
|
-
"data-test-id": "variable-row-save-button",
|
|
185
|
-
disabled: !formValid.value,
|
|
186
|
-
type: "primary",
|
|
187
|
-
onClick: onSave
|
|
188
|
-
}, {
|
|
189
|
-
default: withCtx(() => [
|
|
190
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.button.save")), 1)
|
|
191
|
-
]),
|
|
192
|
-
_: 1
|
|
193
|
-
}, 8, ["disabled"])
|
|
194
|
-
], 2)) : (openBlock(), createElementBlock("div", {
|
|
195
|
-
key: 1,
|
|
196
|
-
class: normalizeClass([_ctx.$style.buttons, _ctx.$style.hoverButtons])
|
|
197
|
-
}, [
|
|
198
|
-
createVNode(_component_n8n_tooltip, {
|
|
199
|
-
disabled: permissions.value.update,
|
|
200
|
-
placement: "top"
|
|
201
|
-
}, {
|
|
202
|
-
content: withCtx(() => [
|
|
203
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.button.edit.onlyRoleCanEdit")), 1)
|
|
204
|
-
]),
|
|
205
|
-
default: withCtx(() => [
|
|
206
|
-
createBaseVNode("div", null, [
|
|
207
|
-
createVNode(_component_n8n_button, {
|
|
208
|
-
"data-test-id": "variable-row-edit-button",
|
|
209
|
-
type: "tertiary",
|
|
210
|
-
class: "mr-xs",
|
|
211
|
-
disabled: !permissions.value.update,
|
|
212
|
-
onClick: onEdit
|
|
213
|
-
}, {
|
|
214
|
-
default: withCtx(() => [
|
|
215
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.button.edit")), 1)
|
|
216
|
-
]),
|
|
217
|
-
_: 1
|
|
218
|
-
}, 8, ["disabled"])
|
|
219
|
-
])
|
|
220
|
-
]),
|
|
221
|
-
_: 1
|
|
222
|
-
}, 8, ["disabled"]),
|
|
223
|
-
createVNode(_component_n8n_tooltip, {
|
|
224
|
-
disabled: permissions.value.delete,
|
|
225
|
-
placement: "top"
|
|
226
|
-
}, {
|
|
227
|
-
content: withCtx(() => [
|
|
228
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.button.delete.onlyRoleCanDelete")), 1)
|
|
229
|
-
]),
|
|
230
|
-
default: withCtx(() => [
|
|
231
|
-
createBaseVNode("div", null, [
|
|
232
|
-
createVNode(_component_n8n_button, {
|
|
233
|
-
"data-test-id": "variable-row-delete-button",
|
|
234
|
-
type: "tertiary",
|
|
235
|
-
disabled: !permissions.value.delete,
|
|
236
|
-
onClick: onDelete
|
|
237
|
-
}, {
|
|
238
|
-
default: withCtx(() => [
|
|
239
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.row.button.delete")), 1)
|
|
240
|
-
]),
|
|
241
|
-
_: 1
|
|
242
|
-
}, 8, ["disabled"])
|
|
243
|
-
])
|
|
244
|
-
]),
|
|
245
|
-
_: 1
|
|
246
|
-
}, 8, ["disabled"])
|
|
247
|
-
], 2))
|
|
248
|
-
])) : createCommentVNode("", true)
|
|
249
|
-
], 2);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
const variablesRow = "_variablesRow_1wkcr_123";
|
|
254
|
-
const hoverButtons = "_hoverButtons_1wkcr_123";
|
|
255
|
-
const buttons = "_buttons_1wkcr_132";
|
|
256
|
-
const usageSyntax = "_usageSyntax_1wkcr_143";
|
|
257
|
-
const style0$1 = {
|
|
258
|
-
variablesRow,
|
|
259
|
-
hoverButtons,
|
|
260
|
-
buttons,
|
|
261
|
-
usageSyntax
|
|
262
|
-
};
|
|
263
|
-
const cssModules$1 = {
|
|
264
|
-
"$style": style0$1
|
|
265
|
-
};
|
|
266
|
-
const VariablesRow = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__cssModules", cssModules$1]]);
|
|
267
|
-
const _hoisted_1 = { key: 0 };
|
|
268
|
-
const _hoisted_2 = { key: 1 };
|
|
269
|
-
const TEMPORARY_VARIABLE_UID_BASE = "@tmpvar";
|
|
270
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
271
|
-
__name: "VariablesView",
|
|
272
|
-
setup(__props) {
|
|
273
|
-
const settingsStore = useSettingsStore();
|
|
274
|
-
const environmentsStore = useEnvironmentsStore();
|
|
275
|
-
const usersStore = useUsersStore();
|
|
276
|
-
const uiStore = useUIStore();
|
|
277
|
-
const telemetry = useTelemetry();
|
|
278
|
-
const i18n = useI18n();
|
|
279
|
-
const message = useMessage();
|
|
280
|
-
const sourceControlStore = useSourceControlStore();
|
|
281
|
-
const documentTitle = useDocumentTitle();
|
|
282
|
-
const pageRedirectionHelper = usePageRedirectionHelper();
|
|
283
|
-
let sourceControlStoreUnsubscribe = () => {
|
|
284
|
-
};
|
|
285
|
-
const layoutRef = ref(null);
|
|
286
|
-
const { showError } = useToast();
|
|
287
|
-
const allVariables = ref([]);
|
|
288
|
-
const editMode = ref({});
|
|
289
|
-
const loading = ref(false);
|
|
290
|
-
const permissions = computed(
|
|
291
|
-
() => getResourcePermissions(usersStore.currentUser?.globalScopes).variable
|
|
292
|
-
);
|
|
293
|
-
const isFeatureEnabled = computed(
|
|
294
|
-
() => settingsStore.isEnterpriseFeatureEnabled[EnterpriseEditionFeature.Variables]
|
|
295
|
-
);
|
|
296
|
-
const variablesToResources = computed(
|
|
297
|
-
() => allVariables.value.map((v) => ({ id: v.id, name: v.key, value: v.value }))
|
|
298
|
-
);
|
|
299
|
-
const canCreateVariables = computed(() => isFeatureEnabled.value && permissions.value.create);
|
|
300
|
-
const datatableColumns = computed(() => [
|
|
301
|
-
{
|
|
302
|
-
id: 0,
|
|
303
|
-
path: "name",
|
|
304
|
-
label: i18n.baseText("variables.table.key"),
|
|
305
|
-
classes: ["variables-key-column"]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
id: 1,
|
|
309
|
-
path: "value",
|
|
310
|
-
label: i18n.baseText("variables.table.value"),
|
|
311
|
-
classes: ["variables-value-column"]
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
id: 2,
|
|
315
|
-
path: "usage",
|
|
316
|
-
label: i18n.baseText("variables.table.usage"),
|
|
317
|
-
classes: ["variables-usage-column"]
|
|
318
|
-
},
|
|
319
|
-
...isFeatureEnabled.value ? [
|
|
320
|
-
{
|
|
321
|
-
id: 3,
|
|
322
|
-
path: "actions",
|
|
323
|
-
label: ""
|
|
324
|
-
}
|
|
325
|
-
] : []
|
|
326
|
-
]);
|
|
327
|
-
const contextBasedTranslationKeys = computed(() => uiStore.contextBasedTranslationKeys);
|
|
328
|
-
const newlyAddedVariableIds = ref([]);
|
|
329
|
-
const nameSortFn = (a, b, direction) => {
|
|
330
|
-
if (`${a.id}`.startsWith(TEMPORARY_VARIABLE_UID_BASE)) {
|
|
331
|
-
return -1;
|
|
332
|
-
} else if (`${b.id}`.startsWith(TEMPORARY_VARIABLE_UID_BASE)) {
|
|
333
|
-
return 1;
|
|
334
|
-
} else if (newlyAddedVariableIds.value.includes(a.id) && newlyAddedVariableIds.value.includes(b.id)) {
|
|
335
|
-
return newlyAddedVariableIds.value.indexOf(a.id) - newlyAddedVariableIds.value.indexOf(b.id);
|
|
336
|
-
} else if (newlyAddedVariableIds.value.includes(a.id)) {
|
|
337
|
-
return -1;
|
|
338
|
-
} else if (newlyAddedVariableIds.value.includes(b.id)) {
|
|
339
|
-
return 1;
|
|
340
|
-
}
|
|
341
|
-
return direction === "asc" ? displayName(a).trim().localeCompare(displayName(b).trim()) : displayName(b).trim().localeCompare(displayName(a).trim());
|
|
342
|
-
};
|
|
343
|
-
const sortFns = {
|
|
344
|
-
nameAsc: (a, b) => {
|
|
345
|
-
return nameSortFn(a, b, "asc");
|
|
346
|
-
},
|
|
347
|
-
nameDesc: (a, b) => {
|
|
348
|
-
return nameSortFn(a, b, "desc");
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
function resetNewVariablesList() {
|
|
352
|
-
newlyAddedVariableIds.value = [];
|
|
353
|
-
}
|
|
354
|
-
const resourceToEnvironmentVariable = (data) => ({
|
|
355
|
-
id: data.id,
|
|
356
|
-
key: data.name,
|
|
357
|
-
value: "value" in data ? data.value ?? "" : ""
|
|
358
|
-
});
|
|
359
|
-
const environmentVariableToResource = (data) => ({
|
|
360
|
-
id: data.id,
|
|
361
|
-
name: data.key,
|
|
362
|
-
value: "value" in data ? data.value : ""
|
|
363
|
-
});
|
|
364
|
-
async function initialize() {
|
|
365
|
-
if (!isFeatureEnabled.value) return;
|
|
366
|
-
loading.value = true;
|
|
367
|
-
await environmentsStore.fetchAllVariables();
|
|
368
|
-
allVariables.value = [...environmentsStore.variables];
|
|
369
|
-
loading.value = false;
|
|
370
|
-
}
|
|
371
|
-
function addTemporaryVariable() {
|
|
372
|
-
const temporaryVariable = {
|
|
373
|
-
id: uid(TEMPORARY_VARIABLE_UID_BASE),
|
|
374
|
-
key: "",
|
|
375
|
-
value: ""
|
|
376
|
-
};
|
|
377
|
-
if (layoutRef.value) {
|
|
378
|
-
if (layoutRef.value.$refs.listWrapperRef) {
|
|
379
|
-
layoutRef.value.$refs.listWrapperRef.scrollTop = 0;
|
|
380
|
-
}
|
|
381
|
-
if (layoutRef.value.currentPage !== 1) {
|
|
382
|
-
layoutRef.value.setCurrentPage(1);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
allVariables.value.unshift(temporaryVariable);
|
|
386
|
-
editMode.value[temporaryVariable.id] = true;
|
|
387
|
-
telemetry.track("User clicked add variable button");
|
|
388
|
-
}
|
|
389
|
-
async function saveVariable(data) {
|
|
390
|
-
const variable = resourceToEnvironmentVariable(data);
|
|
391
|
-
try {
|
|
392
|
-
if (typeof variable.id === "string" && variable.id.startsWith(TEMPORARY_VARIABLE_UID_BASE)) {
|
|
393
|
-
const { id, ...rest } = variable;
|
|
394
|
-
const updatedVariable = await environmentsStore.createVariable(rest);
|
|
395
|
-
allVariables.value.unshift(updatedVariable);
|
|
396
|
-
allVariables.value = allVariables.value.filter((variable2) => variable2.id !== data.id);
|
|
397
|
-
newlyAddedVariableIds.value.unshift(updatedVariable.id);
|
|
398
|
-
} else {
|
|
399
|
-
const updatedVariable = await environmentsStore.updateVariable(variable);
|
|
400
|
-
allVariables.value = allVariables.value.filter((variable2) => variable2.id !== data.id);
|
|
401
|
-
allVariables.value.push(updatedVariable);
|
|
402
|
-
toggleEditing(environmentVariableToResource(updatedVariable));
|
|
403
|
-
}
|
|
404
|
-
} catch (error) {
|
|
405
|
-
showError(error, i18n.baseText("variables.errors.save"));
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
function toggleEditing(data) {
|
|
409
|
-
editMode.value = {
|
|
410
|
-
...editMode.value,
|
|
411
|
-
[data.id]: !editMode.value[data.id]
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
function cancelEditing(data) {
|
|
415
|
-
if (typeof data.id === "string" && data.id.startsWith(TEMPORARY_VARIABLE_UID_BASE)) {
|
|
416
|
-
allVariables.value = allVariables.value.filter((variable) => variable.id !== data.id);
|
|
417
|
-
} else {
|
|
418
|
-
toggleEditing(data);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
async function deleteVariable(data) {
|
|
422
|
-
const variable = resourceToEnvironmentVariable(data);
|
|
423
|
-
try {
|
|
424
|
-
const confirmed = await message.confirm(
|
|
425
|
-
i18n.baseText("variables.modals.deleteConfirm.message", {
|
|
426
|
-
interpolate: { name: variable.key }
|
|
427
|
-
}),
|
|
428
|
-
i18n.baseText("variables.modals.deleteConfirm.title"),
|
|
429
|
-
{
|
|
430
|
-
confirmButtonText: i18n.baseText("variables.modals.deleteConfirm.confirmButton"),
|
|
431
|
-
cancelButtonText: i18n.baseText("variables.modals.deleteConfirm.cancelButton")
|
|
432
|
-
}
|
|
433
|
-
);
|
|
434
|
-
if (confirmed !== MODAL_CONFIRM) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
await environmentsStore.deleteVariable(variable);
|
|
438
|
-
allVariables.value = allVariables.value.filter((variable2) => variable2.id !== data.id);
|
|
439
|
-
} catch (error) {
|
|
440
|
-
showError(error, i18n.baseText("variables.errors.delete"));
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
function goToUpgrade() {
|
|
444
|
-
void pageRedirectionHelper.goToUpgrade("variables", "upgrade-variables");
|
|
445
|
-
}
|
|
446
|
-
function displayName(resource) {
|
|
447
|
-
return resource.name;
|
|
448
|
-
}
|
|
449
|
-
onBeforeMount(() => {
|
|
450
|
-
sourceControlStoreUnsubscribe = sourceControlStore.$onAction(({ name, after }) => {
|
|
451
|
-
if (name === "pullWorkfolder" && after) {
|
|
452
|
-
after(() => {
|
|
453
|
-
void initialize();
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
onBeforeUnmount(() => {
|
|
459
|
-
sourceControlStoreUnsubscribe();
|
|
460
|
-
});
|
|
461
|
-
onMounted(() => {
|
|
462
|
-
documentTitle.set(i18n.baseText("variables.heading"));
|
|
463
|
-
});
|
|
464
|
-
return (_ctx, _cache) => {
|
|
465
|
-
const _component_n8n_heading = resolveComponent("n8n-heading");
|
|
466
|
-
const _component_n8n_button = resolveComponent("n8n-button");
|
|
467
|
-
const _component_n8n_tooltip = resolveComponent("n8n-tooltip");
|
|
468
|
-
const _component_n8n_action_box = resolveComponent("n8n-action-box");
|
|
469
|
-
return openBlock(), createBlock(ResourcesListLayout, {
|
|
470
|
-
ref_key: "layoutRef",
|
|
471
|
-
ref: layoutRef,
|
|
472
|
-
class: "variables-view",
|
|
473
|
-
"resource-key": "variables",
|
|
474
|
-
disabled: !isFeatureEnabled.value,
|
|
475
|
-
resources: variablesToResources.value,
|
|
476
|
-
initialize,
|
|
477
|
-
shareable: false,
|
|
478
|
-
"display-name": displayName,
|
|
479
|
-
"sort-fns": sortFns,
|
|
480
|
-
"sort-options": ["nameAsc", "nameDesc"],
|
|
481
|
-
"show-filters-dropdown": false,
|
|
482
|
-
type: "datatable",
|
|
483
|
-
"type-props": { columns: datatableColumns.value },
|
|
484
|
-
loading: loading.value,
|
|
485
|
-
onSort: resetNewVariablesList,
|
|
486
|
-
"onClick:add": addTemporaryVariable
|
|
487
|
-
}, createSlots({
|
|
488
|
-
header: withCtx(() => [
|
|
489
|
-
createVNode(_component_n8n_heading, {
|
|
490
|
-
size: "2xlarge",
|
|
491
|
-
class: "mb-m"
|
|
492
|
-
}, {
|
|
493
|
-
default: withCtx(() => [
|
|
494
|
-
createTextVNode(toDisplayString(unref(i18n).baseText("variables.heading")), 1)
|
|
495
|
-
]),
|
|
496
|
-
_: 1
|
|
497
|
-
})
|
|
498
|
-
]),
|
|
499
|
-
"add-button": withCtx(() => [
|
|
500
|
-
createVNode(_component_n8n_tooltip, {
|
|
501
|
-
placement: "top",
|
|
502
|
-
disabled: canCreateVariables.value
|
|
503
|
-
}, {
|
|
504
|
-
content: withCtx(() => [
|
|
505
|
-
!isFeatureEnabled.value ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(i18n).baseText(`variables.add.unavailable${allVariables.value.length === 0 ? ".empty" : ""}`)), 1)) : (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref(i18n).baseText("variables.add.onlyOwnerCanCreate")), 1))
|
|
506
|
-
]),
|
|
507
|
-
default: withCtx(() => [
|
|
508
|
-
createBaseVNode("div", null, [
|
|
509
|
-
createVNode(_component_n8n_button, {
|
|
510
|
-
size: "large",
|
|
511
|
-
block: "",
|
|
512
|
-
disabled: !canCreateVariables.value,
|
|
513
|
-
"data-test-id": "resources-list-add",
|
|
514
|
-
onClick: addTemporaryVariable
|
|
515
|
-
}, {
|
|
516
|
-
default: withCtx(() => [
|
|
517
|
-
createTextVNode(toDisplayString(unref(i18n).baseText(`variables.add`)), 1)
|
|
518
|
-
]),
|
|
519
|
-
_: 1
|
|
520
|
-
}, 8, ["disabled"])
|
|
521
|
-
])
|
|
522
|
-
]),
|
|
523
|
-
_: 1
|
|
524
|
-
}, 8, ["disabled"])
|
|
525
|
-
]),
|
|
526
|
-
default: withCtx(({ data }) => [
|
|
527
|
-
(openBlock(), createBlock(VariablesRow, {
|
|
528
|
-
key: data.id,
|
|
529
|
-
editing: editMode.value[data.id],
|
|
530
|
-
data,
|
|
531
|
-
onSave: saveVariable,
|
|
532
|
-
onEdit: toggleEditing,
|
|
533
|
-
onCancel: cancelEditing,
|
|
534
|
-
onDelete: deleteVariable
|
|
535
|
-
}, null, 8, ["editing", "data"]))
|
|
536
|
-
]),
|
|
537
|
-
_: 2
|
|
538
|
-
}, [
|
|
539
|
-
!isFeatureEnabled.value ? {
|
|
540
|
-
name: "preamble",
|
|
541
|
-
fn: withCtx(() => [
|
|
542
|
-
createVNode(_component_n8n_action_box, {
|
|
543
|
-
class: "mb-m",
|
|
544
|
-
"data-test-id": "unavailable-resources-list",
|
|
545
|
-
emoji: "👋",
|
|
546
|
-
heading: unref(i18n).baseText(contextBasedTranslationKeys.value.variables.unavailable.title),
|
|
547
|
-
description: unref(i18n).baseText(
|
|
548
|
-
contextBasedTranslationKeys.value.variables.unavailable.description
|
|
549
|
-
),
|
|
550
|
-
"button-text": unref(i18n).baseText(contextBasedTranslationKeys.value.variables.unavailable.button),
|
|
551
|
-
"button-type": "secondary",
|
|
552
|
-
"onClick:button": goToUpgrade
|
|
553
|
-
}, null, 8, ["heading", "description", "button-text"])
|
|
554
|
-
]),
|
|
555
|
-
key: "0"
|
|
556
|
-
} : void 0,
|
|
557
|
-
!isFeatureEnabled.value || isFeatureEnabled.value && !canCreateVariables.value ? {
|
|
558
|
-
name: "empty",
|
|
559
|
-
fn: withCtx(() => [
|
|
560
|
-
!isFeatureEnabled.value ? (openBlock(), createBlock(_component_n8n_action_box, {
|
|
561
|
-
key: 0,
|
|
562
|
-
"data-test-id": "unavailable-resources-list",
|
|
563
|
-
emoji: "👋",
|
|
564
|
-
heading: unref(i18n).baseText(contextBasedTranslationKeys.value.variables.unavailable.title),
|
|
565
|
-
description: unref(i18n).baseText(
|
|
566
|
-
contextBasedTranslationKeys.value.variables.unavailable.description
|
|
567
|
-
),
|
|
568
|
-
"button-text": unref(i18n).baseText(contextBasedTranslationKeys.value.variables.unavailable.button),
|
|
569
|
-
"button-type": "secondary",
|
|
570
|
-
"onClick:button": goToUpgrade
|
|
571
|
-
}, null, 8, ["heading", "description", "button-text"])) : !canCreateVariables.value ? (openBlock(), createBlock(_component_n8n_action_box, {
|
|
572
|
-
key: 1,
|
|
573
|
-
"data-test-id": "cannot-create-variables",
|
|
574
|
-
emoji: "👋",
|
|
575
|
-
heading: unref(i18n).baseText("variables.empty.notAllowedToCreate.heading", {
|
|
576
|
-
interpolate: { name: unref(usersStore).currentUser?.firstName ?? "" }
|
|
577
|
-
}),
|
|
578
|
-
description: unref(i18n).baseText("variables.empty.notAllowedToCreate.description"),
|
|
579
|
-
onClick: goToUpgrade
|
|
580
|
-
}, null, 8, ["heading", "description"])) : createCommentVNode("", true)
|
|
581
|
-
]),
|
|
582
|
-
key: "1"
|
|
583
|
-
} : void 0
|
|
584
|
-
]), 1032, ["disabled", "resources", "type-props", "loading"]);
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
const sidebarContainer = "_sidebarContainer_d99g5_127";
|
|
589
|
-
const style0 = {
|
|
590
|
-
"type-input": "_type-input_d99g5_123",
|
|
591
|
-
sidebarContainer
|
|
592
|
-
};
|
|
593
|
-
const cssModules = {
|
|
594
|
-
"$style": style0
|
|
595
|
-
};
|
|
596
|
-
const VariablesView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-626399fb"]]);
|
|
597
|
-
export {
|
|
598
|
-
VariablesView as default
|
|
599
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { K as useUIStore, $ as useCanvasStore, r as ref, q as computed, V as VIEWS, g as useI18n, at as useNDVStore, T as useWorkflowsStore, p as useSettingsStore, aw as useLocalStorage, ak as useTelemetry } from "./index-CWcTt6jd.js";
|
|
2
|
-
function useBeforeUnload({ route }) {
|
|
3
|
-
const uiStore = useUIStore();
|
|
4
|
-
const canvasStore = useCanvasStore();
|
|
5
|
-
const i18n = useI18n();
|
|
6
|
-
const unloadTimeout = ref(null);
|
|
7
|
-
const isDemoRoute = computed(() => route.name === VIEWS.DEMO);
|
|
8
|
-
const handlers = [];
|
|
9
|
-
function onBeforeUnload(e) {
|
|
10
|
-
if (isDemoRoute.value || window.preventNodeViewBeforeUnload) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
handlers.forEach((handler) => handler());
|
|
14
|
-
if (uiStore.stateIsDirty) {
|
|
15
|
-
e.returnValue = true;
|
|
16
|
-
return true;
|
|
17
|
-
} else {
|
|
18
|
-
canvasStore.startLoading(i18n.baseText("nodeView.redirecting"));
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function addBeforeUnloadHandler(handler) {
|
|
23
|
-
handlers.push(handler);
|
|
24
|
-
}
|
|
25
|
-
function addBeforeUnloadEventBindings() {
|
|
26
|
-
window.addEventListener("beforeunload", onBeforeUnload);
|
|
27
|
-
}
|
|
28
|
-
function removeBeforeUnloadEventBindings() {
|
|
29
|
-
if (unloadTimeout.value) {
|
|
30
|
-
clearTimeout(unloadTimeout.value);
|
|
31
|
-
}
|
|
32
|
-
window.removeEventListener("beforeunload", onBeforeUnload);
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
onBeforeUnload,
|
|
36
|
-
addBeforeUnloadEventBindings,
|
|
37
|
-
removeBeforeUnloadEventBindings,
|
|
38
|
-
addBeforeUnloadHandler
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function useNodeViewVersionSwitcher() {
|
|
42
|
-
const ndvStore = useNDVStore();
|
|
43
|
-
const workflowsStore = useWorkflowsStore();
|
|
44
|
-
const telemetry = useTelemetry();
|
|
45
|
-
const settingsStore = useSettingsStore();
|
|
46
|
-
const isNewUser = computed(() => workflowsStore.activeWorkflows.length === 0);
|
|
47
|
-
const defaultVersion = settingsStore.isCanvasV2Enabled ? "2" : "1";
|
|
48
|
-
const nodeViewVersion = useLocalStorage("NodeView.version", defaultVersion);
|
|
49
|
-
const nodeViewVersionMigrated = useLocalStorage("NodeView.migrated", false);
|
|
50
|
-
function setNodeViewSwitcherDropdownOpened(visible) {
|
|
51
|
-
if (!visible) {
|
|
52
|
-
setNodeViewSwitcherDiscovered();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const nodeViewSwitcherDiscovered = useLocalStorage("NodeView.switcher.discovered.beta", false);
|
|
56
|
-
function setNodeViewSwitcherDiscovered() {
|
|
57
|
-
nodeViewSwitcherDiscovered.value = true;
|
|
58
|
-
}
|
|
59
|
-
const isNodeViewDiscoveryTooltipVisible = computed(
|
|
60
|
-
() => !isNewUser.value && !ndvStore.activeNodeName && nodeViewVersion.value === "2" && !nodeViewSwitcherDiscovered.value
|
|
61
|
-
);
|
|
62
|
-
function switchNodeViewVersion() {
|
|
63
|
-
const toVersion = nodeViewVersion.value === "2" ? "1" : "2";
|
|
64
|
-
if (!nodeViewVersionMigrated.value) {
|
|
65
|
-
nodeViewVersionMigrated.value = true;
|
|
66
|
-
}
|
|
67
|
-
telemetry.track("User switched canvas version", {
|
|
68
|
-
to_version: toVersion
|
|
69
|
-
});
|
|
70
|
-
nodeViewVersion.value = toVersion;
|
|
71
|
-
}
|
|
72
|
-
function migrateToNewNodeViewVersion() {
|
|
73
|
-
if (nodeViewVersionMigrated.value || nodeViewVersion.value === "2") {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
switchNodeViewVersion();
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
isNewUser,
|
|
80
|
-
nodeViewVersion,
|
|
81
|
-
nodeViewVersionMigrated,
|
|
82
|
-
nodeViewSwitcherDiscovered,
|
|
83
|
-
isNodeViewDiscoveryTooltipVisible,
|
|
84
|
-
setNodeViewSwitcherDropdownOpened,
|
|
85
|
-
setNodeViewSwitcherDiscovered,
|
|
86
|
-
switchNodeViewVersion,
|
|
87
|
-
migrateToNewNodeViewVersion
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
export {
|
|
91
|
-
useNodeViewVersionSwitcher as a,
|
|
92
|
-
useBeforeUnload as u
|
|
93
|
-
};
|