Skip to content

Commit

Permalink
🐛 Fixing execution retry popup closing behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Nov 10, 2022
1 parent d06197d commit 78470f5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div :class="['action-dropdown-container', $style.actionDropdownContainer]">
<el-dropdown :placement="placement" :trigger="trigger" @command="onSelect">
<div :class="$style.activator" @click.prevent>
<el-dropdown :placement="placement" :trigger="trigger" @command="onSelect" ref="elementDropdown">
<div :class="$style.activator" @click.prevent @blur="onButtonBlur">
<n8n-icon :icon="activatorIcon"/>
</div>
<el-dropdown-menu slot="dropdown" :class="$style.userActionsMenu">
Expand Down Expand Up @@ -92,6 +92,15 @@ export default Vue.extend({
onSelect(action: string) : void {
this.$emit('select', action);
},
onButtonBlur(event: FocusEvent): void {
const elementDropdown = this.$refs.elementDropdown;
// Hide dropdown when clicking outside of current document
if (elementDropdown && event.relatedTarget === null) {
// TODO: Disabling error here since this ref is always ElDropdown instance
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
(elementDropdown as unknown as InstanceType<typeof ElDropdown>).hide();
}
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@
</n8n-text>
</div>
<div>
<el-dropdown v-if="executionUIDetails.name === 'error'" trigger="click" class="mr-xs" @command="handleRetryClick">
<el-dropdown v-if="executionUIDetails.name === 'error'" trigger="click" class="mr-xs" @command="handleRetryClick" ref="retryDropdown">
<span class="retry-button">
<n8n-icon-button
size="large"
type="tertiary"
:title="$locale.baseText('executionsList.retryExecution')"
icon="redo"
@blur="onRetryButtonBlur"
/>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="current-workflow">
{{ $locale.baseText('executionsList.retryWithCurrentlySavedWorkflow') }}
</el-dropdown-item>
<el-dropdown-item command="original-workflow">
{{ $locale.baseText('executionsList.retryWithOriginalworkflow') }}
{{ $locale.baseText('executionsList.retryWithOriginalWorkflow') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
Expand All @@ -67,6 +68,7 @@ import { executionHelpers, IExecutionUIData } from '../mixins/executionsHelpers'
import { VIEWS } from '../../constants';
import { mapStores } from 'pinia';
import { useUIStore } from '@/stores/ui';
import ElDropdown from 'element-ui/lib/dropdown';
export default mixins(restApi, showMessage, executionHelpers).extend({
name: 'execution-preview',
Expand Down Expand Up @@ -106,6 +108,13 @@ export default mixins(restApi, showMessage, executionHelpers).extend({
handleRetryClick(command: string): void {
this.$emit('retryExecution', { execution: this.activeExecution, command });
},
onRetryButtonBlur(event: FocusEvent): void {
// Hide dropdown when clicking outside of current document
const retryDropdown = this.$refs.retryDropdown;
if (retryDropdown && event.relatedTarget === null) {
(retryDropdown as unknown as InstanceType<typeof ElDropdown>).hide();
}
},
},
});
</script>
Expand All @@ -125,6 +134,9 @@ export default mixins(restApi, showMessage, executionHelpers).extend({
display: flex;
justify-content: space-between;
transition: all 150ms ease-in-out;
pointer-events: none;
& * { pointer-events: all; }
&.sidebarCollapsed {
width: calc(100% - 375px);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import ExecutionsSidebar from '@/components/ExecutionsView/ExecutionsSidebar.vue';
import { MODAL_CANCEL, MODAL_CLOSE, MODAL_CONFIRMED, PLACEHOLDER_EMPTY_WORKFLOW_ID, VIEWS, WEBHOOK_NODE_TYPE } from '@/constants';
import { IExecutionsListResponse, IExecutionsSummary, INodeUi, ITag, IWorkflowDb } from '@/Interface';
import { IConnection, IConnections, IDataObject, INodeTypeDescription, INodeTypeNameVersion, IWorkflowSettings, NodeHelpers } from 'n8n-workflow';
import { IConnection, IConnections, IDataObject, INodeTypeDescription, INodeTypeNameVersion, NodeHelpers } from 'n8n-workflow';
import mixins from 'vue-typed-mixins';
import { restApi } from '../mixins/restApi';
import { showMessage } from '../mixins/showMessage';
Expand Down

0 comments on commit 78470f5

Please sign in to comment.