mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(editor): Revert remove tooltip from info tip (no-changelog) (#10771)
This commit is contained in:
parent
a1e011dd2a
commit
99ba710642
|
@ -132,6 +132,10 @@ describe('NDV', () => {
|
|||
'contains.text',
|
||||
"An expression here won't work because it uses .item and n8n can't figure out the matching item.",
|
||||
);
|
||||
ndv.getters.nodeRunErrorIndicator().should('be.visible');
|
||||
// The error details should be hidden behind a tooltip
|
||||
ndv.getters.nodeRunErrorIndicator().should('not.contain', 'Start Time');
|
||||
ndv.getters.nodeRunErrorIndicator().should('not.contain', 'Execution Time');
|
||||
});
|
||||
|
||||
it('should save workflow using keyboard shortcut from NDV', () => {
|
||||
|
|
|
@ -17,3 +17,9 @@ const Template: StoryFn = (args, { argTypes }) => ({
|
|||
});
|
||||
|
||||
export const Note = Template.bind({});
|
||||
|
||||
export const Tooltip = Template.bind({});
|
||||
Tooltip.args = {
|
||||
type: 'tooltip',
|
||||
tooltipPlacement: 'right',
|
||||
};
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
import { computed } from 'vue';
|
||||
import type { Placement } from 'element-plus';
|
||||
import N8nIcon from '../N8nIcon';
|
||||
import N8nTooltip from '../N8nTooltip';
|
||||
|
||||
const THEME = ['info', 'info-light', 'warning', 'danger', 'success'] as const;
|
||||
const TYPE = ['note', 'tooltip'] as const;
|
||||
|
||||
interface InfoTipProps {
|
||||
theme?: (typeof THEME)[number];
|
||||
type?: (typeof TYPE)[number];
|
||||
bold?: boolean;
|
||||
tooltipPlacement?: Placement;
|
||||
}
|
||||
|
@ -14,6 +17,7 @@ interface InfoTipProps {
|
|||
defineOptions({ name: 'N8nInfoTip' });
|
||||
const props = withDefaults(defineProps<InfoTipProps>(), {
|
||||
theme: 'info',
|
||||
type: 'note',
|
||||
bold: true,
|
||||
tooltipPlacement: 'top',
|
||||
});
|
||||
|
@ -58,13 +62,28 @@ const iconData = computed((): { icon: string; color: string } => {
|
|||
<div
|
||||
:class="{
|
||||
'n8n-info-tip': true,
|
||||
[$style.note]: true,
|
||||
[$style.infoTip]: true,
|
||||
[$style[theme]]: true,
|
||||
[$style[type]]: true,
|
||||
[$style.bold]: bold,
|
||||
}"
|
||||
>
|
||||
<span :class="$style.iconText">
|
||||
<N8nTooltip
|
||||
v-if="type === 'tooltip'"
|
||||
:placement="tooltipPlacement"
|
||||
:popper-class="$style.tooltipPopper"
|
||||
:disabled="type !== 'tooltip'"
|
||||
>
|
||||
<span :class="$style.iconText" :style="{ color: iconData.color }">
|
||||
<N8nIcon :icon="iconData.icon" />
|
||||
</span>
|
||||
<template #content>
|
||||
<span>
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
</N8nTooltip>
|
||||
<span v-else :class="$style.iconText">
|
||||
<N8nIcon :icon="iconData.icon" />
|
||||
<span>
|
||||
<slot />
|
||||
|
@ -102,6 +121,11 @@ const iconData = computed((): { icon: string; color: string } => {
|
|||
}
|
||||
}
|
||||
|
||||
.tooltipPopper {
|
||||
composes: base;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.iconText {
|
||||
display: inline-flex;
|
||||
align-items: flex-start;
|
||||
|
|
|
@ -16,4 +16,17 @@ describe('N8nInfoTip', () => {
|
|||
});
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should render correctly as tooltip', () => {
|
||||
const wrapper = render(N8nInfoTip, {
|
||||
slots,
|
||||
props: {
|
||||
type: 'tooltip',
|
||||
},
|
||||
global: {
|
||||
stubs,
|
||||
},
|
||||
});
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`N8nInfoTip > should render correctly as note 1`] = `"<div class="n8n-info-tip note infoTip info bold"><span class="iconText"><span class="n8n-text compact size-medium regular n8n-icon n8n-icon"><!----></span><span>Need help doing something?<a href="/docs" target="_blank">Open docs</a></span></span></div>"`;
|
||||
exports[`N8nInfoTip > should render correctly as note 1`] = `"<div class="n8n-info-tip infoTip info note bold"><span class="iconText"><span class="n8n-text compact size-medium regular n8n-icon n8n-icon"><!----></span><span>Need help doing something?<a href="/docs" target="_blank">Open docs</a></span></span></div>"`;
|
||||
|
||||
exports[`N8nInfoTip > should render correctly as tooltip 1`] = `
|
||||
"<div class="n8n-info-tip infoTip info tooltip bold"><span class="iconText el-tooltip__trigger el-tooltip__trigger"><span class="n8n-text compact size-medium regular n8n-icon n8n-icon"><!----></span></span>
|
||||
<!--teleport start-->
|
||||
<!--teleport end-->
|
||||
</div>"
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue