mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
chore(editor): Clean up feature flag for trigger button variant (#13411)
This commit is contained in:
parent
dd43854a8e
commit
8ff7ba9b82
|
@ -3,14 +3,9 @@ import { computed, ref, useCssModule, watch } from 'vue';
|
||||||
import { useNodeConnections } from '@/composables/useNodeConnections';
|
import { useNodeConnections } from '@/composables/useNodeConnections';
|
||||||
import { useI18n } from '@/composables/useI18n';
|
import { useI18n } from '@/composables/useI18n';
|
||||||
import { useCanvasNode } from '@/composables/useCanvasNode';
|
import { useCanvasNode } from '@/composables/useCanvasNode';
|
||||||
import {
|
import { NODE_INSERT_SPACER_BETWEEN_INPUT_GROUPS } from '@/constants';
|
||||||
LOCAL_STORAGE_CANVAS_TRIGGER_BUTTON_VARIANT,
|
|
||||||
NODE_INSERT_SPACER_BETWEEN_INPUT_GROUPS,
|
|
||||||
} from '@/constants';
|
|
||||||
import type { CanvasNodeDefaultRender } from '@/types';
|
import type { CanvasNodeDefaultRender } from '@/types';
|
||||||
import { useCanvas } from '@/composables/useCanvas';
|
import { useCanvas } from '@/composables/useCanvas';
|
||||||
import { useLocalStorage } from '@vueuse/core';
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
||||||
|
|
||||||
const $style = useCssModule();
|
const $style = useCssModule();
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
@ -111,8 +106,6 @@ const isStrikethroughVisible = computed(() => {
|
||||||
|
|
||||||
const showTooltip = ref(false);
|
const showTooltip = ref(false);
|
||||||
|
|
||||||
const triggerButtonVariant = useLocalStorage<1 | 2>(LOCAL_STORAGE_CANVAS_TRIGGER_BUTTON_VARIANT, 2);
|
|
||||||
|
|
||||||
watch(initialized, () => {
|
watch(initialized, () => {
|
||||||
if (initialized.value) {
|
if (initialized.value) {
|
||||||
showTooltip.value = true;
|
showTooltip.value = true;
|
||||||
|
@ -140,9 +133,6 @@ function openContextMenu(event: MouseEvent) {
|
||||||
<div :class="$style.description">
|
<div :class="$style.description">
|
||||||
<div v-if="label" :class="$style.label">
|
<div v-if="label" :class="$style.label">
|
||||||
{{ label }}
|
{{ label }}
|
||||||
<div v-if="renderOptions.trigger && triggerButtonVariant === 1" :class="$style.triggerIcon">
|
|
||||||
<FontAwesomeIcon icon="bolt" size="lg" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isDisabled" :class="$style.disabledLabel">
|
<div v-if="isDisabled" :class="$style.disabledLabel">
|
||||||
({{ i18n.baseText('node.disabled') }})
|
({{ i18n.baseText('node.disabled') }})
|
||||||
|
@ -327,11 +317,4 @@ function openContextMenu(event: MouseEvent) {
|
||||||
bottom: var(--canvas-node--status-icons-offset);
|
bottom: var(--canvas-node--status-icons-offset);
|
||||||
right: var(--canvas-node--status-icons-offset);
|
right: var(--canvas-node--status-icons-offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
.triggerIcon {
|
|
||||||
display: inline;
|
|
||||||
position: static;
|
|
||||||
color: var(--color-primary);
|
|
||||||
padding: var(--spacing-4xs);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -18,7 +18,6 @@ exports[`CanvasNodeDefault > configurable > should render configurable node corr
|
||||||
class="label"
|
class="label"
|
||||||
>
|
>
|
||||||
Test Node
|
Test Node
|
||||||
<!--v-if-->
|
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
<div
|
<div
|
||||||
|
@ -48,7 +47,6 @@ exports[`CanvasNodeDefault > configuration > should render configurable configur
|
||||||
class="label"
|
class="label"
|
||||||
>
|
>
|
||||||
Test Node
|
Test Node
|
||||||
<!--v-if-->
|
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
<div
|
<div
|
||||||
|
@ -78,7 +76,6 @@ exports[`CanvasNodeDefault > configuration > should render configuration node co
|
||||||
class="label"
|
class="label"
|
||||||
>
|
>
|
||||||
Test Node
|
Test Node
|
||||||
<!--v-if-->
|
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
<div
|
<div
|
||||||
|
@ -108,7 +105,6 @@ exports[`CanvasNodeDefault > should render node correctly 1`] = `
|
||||||
class="label"
|
class="label"
|
||||||
>
|
>
|
||||||
Test Node
|
Test Node
|
||||||
<!--v-if-->
|
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
<div
|
<div
|
||||||
|
@ -138,7 +134,6 @@ exports[`CanvasNodeDefault > trigger > should render trigger node correctly 1`]
|
||||||
class="label"
|
class="label"
|
||||||
>
|
>
|
||||||
Test Node
|
Test Node
|
||||||
<!--v-if-->
|
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
import { useCanvasOperations } from '@/composables/useCanvasOperations';
|
import { useCanvasOperations } from '@/composables/useCanvasOperations';
|
||||||
import { useI18n } from '@/composables/useI18n';
|
import { useI18n } from '@/composables/useI18n';
|
||||||
import { useRunWorkflow } from '@/composables/useRunWorkflow';
|
import { useRunWorkflow } from '@/composables/useRunWorkflow';
|
||||||
import { CHAT_TRIGGER_NODE_TYPE, LOCAL_STORAGE_CANVAS_TRIGGER_BUTTON_VARIANT } from '@/constants';
|
import { CHAT_TRIGGER_NODE_TYPE } from '@/constants';
|
||||||
import { useUIStore } from '@/stores/ui.store';
|
import { useUIStore } from '@/stores/ui.store';
|
||||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||||
import { useLocalStorage } from '@vueuse/core';
|
|
||||||
import { computed, useCssModule } from 'vue';
|
import { computed, useCssModule } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -25,16 +24,12 @@ const {
|
||||||
class?: string;
|
class?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const variant = useLocalStorage<1 | 2>(LOCAL_STORAGE_CANVAS_TRIGGER_BUTTON_VARIANT, 2);
|
|
||||||
|
|
||||||
const style = useCssModule();
|
const style = useCssModule();
|
||||||
const containerClass = computed(() => ({
|
const containerClass = computed(() => ({
|
||||||
[cls ?? '']: true,
|
[cls ?? '']: true,
|
||||||
[style.container]: true,
|
[style.container]: true,
|
||||||
[style.interactive]: !disabled && !readOnly,
|
[style.interactive]: !disabled && !readOnly,
|
||||||
[style.hovered]: !!hovered,
|
[style.hovered]: !!hovered,
|
||||||
[style.variant1]: variant.value === 1,
|
|
||||||
[style.variant2]: variant.value === 2,
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -53,31 +48,13 @@ const testId = computed(() => `execute-workflow-button-${name}`);
|
||||||
<!-- click and mousedown event are suppressed to avoid unwanted selection or dragging of the node -->
|
<!-- click and mousedown event are suppressed to avoid unwanted selection or dragging of the node -->
|
||||||
<div :class="containerClass" @click.stop.prevent @mousedown.stop.prevent>
|
<div :class="containerClass" @click.stop.prevent @mousedown.stop.prevent>
|
||||||
<div>
|
<div>
|
||||||
<div v-if="variant === 2" :class="$style.bolt">
|
<div :class="$style.bolt">
|
||||||
<FontAwesomeIcon icon="bolt" size="lg" />
|
<FontAwesomeIcon icon="bolt" size="lg" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-if="!readOnly">
|
<template v-if="!readOnly">
|
||||||
<N8nButton
|
<N8nButton
|
||||||
v-if="variant === 1 && type === CHAT_TRIGGER_NODE_TYPE"
|
v-if="type === CHAT_TRIGGER_NODE_TYPE"
|
||||||
type="secondary"
|
|
||||||
size="large"
|
|
||||||
:disabled="isExecuting"
|
|
||||||
:data-test-id="testId"
|
|
||||||
@click.capture="toggleChatOpen('node')"
|
|
||||||
>{{ isChatOpen ? i18n.baseText('chat.hide') : i18n.baseText('chat.open') }}</N8nButton
|
|
||||||
>
|
|
||||||
<N8nButton
|
|
||||||
v-else-if="variant === 1"
|
|
||||||
type="secondary"
|
|
||||||
size="large"
|
|
||||||
:disabled="isExecuting"
|
|
||||||
:data-test-id="testId"
|
|
||||||
@click.capture="runEntireWorkflow('node', name)"
|
|
||||||
>{{ i18n.baseText('nodeView.runButtonText.executeWorkflow') }}</N8nButton
|
|
||||||
>
|
|
||||||
<N8nButton
|
|
||||||
v-else-if="variant === 2 && type === CHAT_TRIGGER_NODE_TYPE"
|
|
||||||
:type="isChatOpen ? 'secondary' : 'primary'"
|
:type="isChatOpen ? 'secondary' : 'primary'"
|
||||||
size="large"
|
size="large"
|
||||||
:disabled="isExecuting"
|
:disabled="isExecuting"
|
||||||
|
@ -116,23 +93,6 @@ const testId = computed(() => `execute-workflow-button-${name}`);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.interactive.hovered button {
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.variant1 {
|
|
||||||
& button {
|
|
||||||
margin-right: var(--spacing-xl);
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.interactive button {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.variant2 {
|
|
||||||
& button {
|
& button {
|
||||||
margin-right: var(--spacing-s);
|
margin-right: var(--spacing-s);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
@ -145,6 +105,7 @@ const testId = computed(() => `execute-workflow-button-${name}`);
|
||||||
&.interactive.hovered button {
|
&.interactive.hovered button {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
translate: 0 0;
|
translate: 0 0;
|
||||||
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,6 @@ export const LOCAL_STORAGE_EXPERIMENT_OVERRIDES = 'N8N_EXPERIMENT_OVERRIDES';
|
||||||
export const LOCAL_STORAGE_HIDE_GITHUB_STAR_BUTTON = 'N8N_HIDE_HIDE_GITHUB_STAR_BUTTON';
|
export const LOCAL_STORAGE_HIDE_GITHUB_STAR_BUTTON = 'N8N_HIDE_HIDE_GITHUB_STAR_BUTTON';
|
||||||
export const LOCAL_STORAGE_NDV_INPUT_PANEL_DISPLAY_MODE = 'N8N_NDV_INPUT_PANEL_DISPLAY_MODE';
|
export const LOCAL_STORAGE_NDV_INPUT_PANEL_DISPLAY_MODE = 'N8N_NDV_INPUT_PANEL_DISPLAY_MODE';
|
||||||
export const LOCAL_STORAGE_NDV_OUTPUT_PANEL_DISPLAY_MODE = 'N8N_NDV_OUTPUT_PANEL_DISPLAY_MODE';
|
export const LOCAL_STORAGE_NDV_OUTPUT_PANEL_DISPLAY_MODE = 'N8N_NDV_OUTPUT_PANEL_DISPLAY_MODE';
|
||||||
export const LOCAL_STORAGE_CANVAS_TRIGGER_BUTTON_VARIANT = 'Canvas.TriggerButtonVariant';
|
|
||||||
export const BASE_NODE_SURVEY_URL = 'https://n8n-community.typeform.com/to/BvmzxqYv#nodename=';
|
export const BASE_NODE_SURVEY_URL = 'https://n8n-community.typeform.com/to/BvmzxqYv#nodename=';
|
||||||
|
|
||||||
export const HIRING_BANNER = `
|
export const HIRING_BANNER = `
|
||||||
|
|
Loading…
Reference in a new issue