-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into node-1511-google-sh…
…eets-set-default-for-when-filter-has-multiple
- Loading branch information
Showing
13 changed files
with
250 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/editor-ui/src/components/canvas/elements/buttons/CanvasControlButtons.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import CanvasControlButtons from './CanvasControlButtons.vue'; | ||
|
||
const renderComponent = createComponentRenderer(CanvasControlButtons); | ||
|
||
describe('CanvasChatButton', () => { | ||
it('should render correctly', () => { | ||
const wrapper = renderComponent(); | ||
|
||
expect(wrapper.getByTestId('zoom-in-button')).toBeVisible(); | ||
expect(wrapper.getByTestId('zoom-out-button')).toBeVisible(); | ||
expect(wrapper.getByTestId('zoom-to-fit')).toBeVisible(); | ||
|
||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should show reset zoom button when zoom is not equal to 1', () => { | ||
const wrapper = renderComponent({ | ||
props: { | ||
zoom: 1.5, | ||
}, | ||
}); | ||
|
||
expect(wrapper.getByTestId('reset-zoom-button')).toBeVisible(); | ||
}); | ||
}); |
76 changes: 76 additions & 0 deletions
76
packages/editor-ui/src/components/canvas/elements/buttons/CanvasControlButtons.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<script setup lang="ts"> | ||
import { Controls } from '@vue-flow/controls'; | ||
import KeyboardShortcutTooltip from '@/components/KeyboardShortcutTooltip.vue'; | ||
import { computed } from 'vue'; | ||
const props = withDefaults( | ||
defineProps<{ | ||
zoom?: number; | ||
}>(), | ||
{ | ||
zoom: 1, | ||
}, | ||
); | ||
const emit = defineEmits<{ | ||
'reset-zoom': []; | ||
}>(); | ||
const isResetZoomVisible = computed(() => props.zoom !== 1); | ||
function onResetZoom() { | ||
emit('reset-zoom'); | ||
} | ||
</script> | ||
<template> | ||
<Controls :show-zoom="false" :show-fit-view="false"> | ||
<KeyboardShortcutTooltip | ||
:label="$locale.baseText('nodeView.zoomIn')" | ||
:shortcut="{ keys: ['+'] }" | ||
> | ||
<N8nIconButton | ||
type="tertiary" | ||
size="large" | ||
icon="search-plus" | ||
data-test-id="zoom-in-button" | ||
/> | ||
</KeyboardShortcutTooltip> | ||
<KeyboardShortcutTooltip | ||
:label="$locale.baseText('nodeView.zoomOut')" | ||
:shortcut="{ keys: ['-'] }" | ||
> | ||
<N8nIconButton | ||
type="tertiary" | ||
size="large" | ||
icon="search-minus" | ||
data-test-id="zoom-out-button" | ||
/> | ||
</KeyboardShortcutTooltip> | ||
<KeyboardShortcutTooltip | ||
:label="$locale.baseText('nodeView.zoomToFit')" | ||
:shortcut="{ keys: ['1'] }" | ||
> | ||
<N8nIconButton type="tertiary" size="large" icon="expand" data-test-id="zoom-to-fit" /> | ||
</KeyboardShortcutTooltip> | ||
<KeyboardShortcutTooltip | ||
v-if="isResetZoomVisible" | ||
:label="$locale.baseText('nodeView.resetZoom')" | ||
:shortcut="{ keys: ['0'] }" | ||
> | ||
<N8nIconButton | ||
type="tertiary" | ||
size="large" | ||
icon="undo" | ||
data-test-id="reset-zoom-button" | ||
@click="onResetZoom" | ||
/> | ||
</KeyboardShortcutTooltip> | ||
</Controls> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.vue-flow__controls { | ||
display: flex; | ||
gap: var(--spacing-xs); | ||
} | ||
</style> |
25 changes: 25 additions & 0 deletions
25
...ui/src/components/canvas/elements/buttons/__snapshots__/CanvasControlButtons.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`CanvasChatButton > should render correctly 1`] = ` | ||
"<div class="vue-flow__panel bottom left vue-flow__controls" style="pointer-events: all;"> | ||
<!----> | ||
<!----><button class="vue-flow__controls-button vue-flow__controls-interactive"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"> | ||
<path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"></path> | ||
</svg> | ||
<!----> | ||
</button><button class="button button tertiary large withIcon square el-tooltip__trigger el-tooltip__trigger" aria-live="polite" data-test-id="zoom-in-button"><span class="icon"><span class="n8n-text compact size-large regular n8n-icon n8n-icon"><svg class="svg-inline--fa fa-search-plus fa-w-16 large" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search-plus" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="" fill="currentColor" d="M304 192v32c0 6.6-5.4 12-12 12h-56v56c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-56h-56c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h56v-56c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v56h56c6.6 0 12 5.4 12 12zm201 284.7L476.7 505c-9.4 9.4-24.6 9.4-33.9 0L343 405.3c-4.5-4.5-7-10.6-7-17V372c-35.3 27.6-79.7 44-128 44C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208c0 48.3-16.4 92.7-44 128h16.3c6.4 0 12.5 2.5 17 7l99.7 99.7c9.3 9.4 9.3 24.6 0 34zM344 208c0-75.2-60.8-136-136-136S72 132.8 72 208s60.8 136 136 136 136-60.8 136-136z"></path></svg></span></span> | ||
<!--v-if--> | ||
</button> | ||
<!--teleport start--> | ||
<!--teleport end--><button class="button button tertiary large withIcon square el-tooltip__trigger el-tooltip__trigger" aria-live="polite" data-test-id="zoom-out-button"><span class="icon"><span class="n8n-text compact size-large regular n8n-icon n8n-icon"><svg class="svg-inline--fa fa-search-minus fa-w-16 large" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search-minus" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="" fill="currentColor" d="M304 192v32c0 6.6-5.4 12-12 12H124c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm201 284.7L476.7 505c-9.4 9.4-24.6 9.4-33.9 0L343 405.3c-4.5-4.5-7-10.6-7-17V372c-35.3 27.6-79.7 44-128 44C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208c0 48.3-16.4 92.7-44 128h16.3c6.4 0 12.5 2.5 17 7l99.7 99.7c9.3 9.4 9.3 24.6 0 34zM344 208c0-75.2-60.8-136-136-136S72 132.8 72 208s60.8 136 136 136 136-60.8 136-136z"></path></svg></span></span> | ||
<!--v-if--> | ||
</button> | ||
<!--teleport start--> | ||
<!--teleport end--><button class="button button tertiary large withIcon square el-tooltip__trigger el-tooltip__trigger" aria-live="polite" data-test-id="zoom-to-fit"><span class="icon"><span class="n8n-text compact size-large regular n8n-icon n8n-icon"><svg class="svg-inline--fa fa-expand fa-w-14 large" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="expand" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="" fill="currentColor" d="M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"></path></svg></span></span> | ||
<!--v-if--> | ||
</button> | ||
<!--teleport start--> | ||
<!--teleport end--> | ||
<!--v-if--> | ||
</div>" | ||
`; |
Oops, something went wrong.