-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): Add stop current execution button in new canvas (no-cha…
…ngelog) (#9968)
- Loading branch information
1 parent
d771b3b
commit ac1db5d
Showing
15 changed files
with
245 additions
and
42 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...ages/editor-ui/src/components/canvas/elements/buttons/CanvasExecuteWorkflowButton.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,33 @@ | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import CanvasExecuteWorkflowButton from './CanvasExecuteWorkflowButton.vue'; | ||
|
||
const renderComponent = createComponentRenderer(CanvasExecuteWorkflowButton); | ||
|
||
describe('CanvasExecuteWorkflowButton', () => { | ||
it('should render correctly', () => { | ||
const wrapper = renderComponent(); | ||
|
||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render different label when executing', () => { | ||
const wrapper = renderComponent({ | ||
props: { | ||
executing: true, | ||
}, | ||
}); | ||
|
||
expect(wrapper.getAllByText('Executing workflow')).toHaveLength(2); | ||
}); | ||
|
||
it('should render different label when executing and waiting for webhook', () => { | ||
const wrapper = renderComponent({ | ||
props: { | ||
executing: true, | ||
waitingForWebhook: true, | ||
}, | ||
}); | ||
|
||
expect(wrapper.getAllByText('Waiting for trigger event')).toHaveLength(2); | ||
}); | ||
}); |
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
22 changes: 22 additions & 0 deletions
22
...editor-ui/src/components/canvas/elements/buttons/CanvasStopCurrentExecutionButton.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,22 @@ | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import CanvasStopCurrentExecutionButton from './CanvasStopCurrentExecutionButton.vue'; | ||
|
||
const renderComponent = createComponentRenderer(CanvasStopCurrentExecutionButton); | ||
|
||
describe('CanvasStopCurrentExecutionButton', () => { | ||
it('should render correctly', () => { | ||
const wrapper = renderComponent(); | ||
|
||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render different title when loading', () => { | ||
const wrapper = renderComponent({ | ||
props: { | ||
stopping: true, | ||
}, | ||
}); | ||
|
||
expect(wrapper.getByTitle('Stopping current execution')).toBeInTheDocument(); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
...ges/editor-ui/src/components/canvas/elements/buttons/CanvasStopCurrentExecutionButton.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,28 @@ | ||
<script lang="ts" setup> | ||
import { useI18n } from '@/composables/useI18n'; | ||
import { computed } from 'vue'; | ||
const props = defineProps<{ | ||
stopping?: boolean; | ||
}>(); | ||
const i18n = useI18n(); | ||
const title = computed(() => | ||
props.stopping | ||
? i18n.baseText('nodeView.stoppingCurrentExecution') | ||
: i18n.baseText('nodeView.stopCurrentExecution'), | ||
); | ||
</script> | ||
|
||
<template> | ||
<n8n-icon-button | ||
icon="stop" | ||
size="large" | ||
class="stop-execution" | ||
type="secondary" | ||
:title="title" | ||
:loading="stopping" | ||
data-test-id="stop-execution-button" | ||
/> | ||
</template> |
12 changes: 12 additions & 0 deletions
12
...ditor-ui/src/components/canvas/elements/buttons/CanvasStopWaitingForWebhookButton.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,12 @@ | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import CanvasStopWaitingForWebhookButton from './CanvasStopWaitingForWebhookButton.vue'; | ||
|
||
const renderComponent = createComponentRenderer(CanvasStopWaitingForWebhookButton); | ||
|
||
describe('CanvasStopCurrentExecutionButton', () => { | ||
it('should render correctly', () => { | ||
const wrapper = renderComponent(); | ||
|
||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
...es/editor-ui/src/components/canvas/elements/buttons/CanvasStopWaitingForWebhookButton.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,15 @@ | ||
<script lang="ts" setup> | ||
import { useI18n } from '@/composables/useI18n'; | ||
const i18n = useI18n(); | ||
</script> | ||
<template> | ||
<n8n-icon-button | ||
class="stop-execution" | ||
icon="stop" | ||
size="large" | ||
:title="i18n.baseText('nodeView.stopWaitingForWebhookCall')" | ||
type="secondary" | ||
data-test-id="stop-execution-waiting-for-webhook-button" | ||
/> | ||
</template> |
7 changes: 7 additions & 0 deletions
7
...components/canvas/elements/buttons/__snapshots__/CanvasExecuteWorkflowButton.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,7 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`CanvasExecuteWorkflowButton > should render correctly 1`] = ` | ||
"<button class="button button primary large withIcon el-tooltip__trigger el-tooltip__trigger" aria-live="polite" data-test-id="execute-workflow-button"><span class="icon"><span class="n8n-text compact size-large regular n8n-icon n8n-icon"><svg class="svg-inline--fa fa-flask fa-w-14 large" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="flask" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="" fill="currentColor" d="M437.2 403.5L320 215V64h8c13.3 0 24-10.7 24-24V24c0-13.3-10.7-24-24-24H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h8v151L10.8 403.5C-18.5 450.6 15.3 512 70.9 512h306.2c55.7 0 89.4-61.5 60.1-108.5zM137.9 320l48.2-77.6c3.7-5.2 5.8-11.6 5.8-18.4V64h64v160c0 6.9 2.2 13.2 5.8 18.4l48.2 77.6h-172z"></path></svg></span></span><span>Test workflow</span></button> | ||
<!--teleport start--> | ||
<!--teleport end-->" | ||
`; |
7 changes: 7 additions & 0 deletions
7
...nents/canvas/elements/buttons/__snapshots__/CanvasStopCurrentExecutionButton.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,7 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`CanvasStopCurrentExecutionButton > should render correctly 1`] = ` | ||
"<button class="button button secondary large withIcon square stop-execution stop-execution" aria-live="polite" title="Stop current execution" data-test-id="stop-execution-button"><span class="icon"><span class="n8n-text compact size-large regular n8n-icon n8n-icon"><svg class="svg-inline--fa fa-stop fa-w-14 large" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="stop" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="" fill="currentColor" d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"></path></svg></span></span> | ||
<!--v-if--> | ||
</button>" | ||
`; |
7 changes: 7 additions & 0 deletions
7
...ents/canvas/elements/buttons/__snapshots__/CanvasStopWaitingForWebhookButton.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,7 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`CanvasStopCurrentExecutionButton > should render correctly 1`] = ` | ||
"<button class="button button secondary large withIcon square stop-execution stop-execution" aria-live="polite" title="Stop waiting for webhook call" data-test-id="stop-execution-waiting-for-webhook-button"><span class="icon"><span class="n8n-text compact size-large regular n8n-icon n8n-icon"><svg class="svg-inline--fa fa-stop fa-w-14 large" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="stop" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="" fill="currentColor" d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"></path></svg></span></span> | ||
<!--v-if--> | ||
</button>" | ||
`; |
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
Oops, something went wrong.