Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Fix execution list item selection #5606

Merged
merged 28 commits into from
Mar 17, 2023
Merged
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c0c36b6
fix(editor): Fix execution list item selection
cstuncsik Mar 3, 2023
811dd6a
fix(editor): Delete only selected executions
cstuncsik Mar 3, 2023
6db282c
fix(editor): Fix clear selection
cstuncsik Mar 3, 2023
c74e16c
fix(editor): Fix clear selection
cstuncsik Mar 3, 2023
b092793
fix(editor): Fix clear selection
cstuncsik Mar 3, 2023
5d7a652
Merge remote-tracking branch 'origin/master' into pay-101-unselect-a-…
cstuncsik Mar 6, 2023
f710769
Merge remote-tracking branch 'origin/master' into pay-101-unselect-a-…
cstuncsik Mar 7, 2023
6780c63
feat(editor): Add select all existing executions checkbox
cstuncsik Mar 7, 2023
9700903
fix(editor): Do not mark later loaded executions selected
cstuncsik Mar 7, 2023
cfe4785
test(editor): Add execution list unit test
cstuncsik Mar 9, 2023
fc9dcb9
fix(editor): Fix selection
cstuncsik Mar 9, 2023
920863c
test(editor): update execution selection test
cstuncsik Mar 9, 2023
985193f
Merge remote-tracking branch 'origin/master' into pay-101-unselect-a-…
cstuncsik Mar 10, 2023
50c1051
fix(editor): Handle UI state when there is no execution
cstuncsik Mar 10, 2023
e4e347e
fix(editor): Remove unnecessary logic
cstuncsik Mar 10, 2023
225bc8c
test(editor): Add more execution list unit tests and fake data genera…
cstuncsik Mar 10, 2023
80ee5ea
test(editor): Add more execution list unit tests
cstuncsik Mar 10, 2023
6238a43
test(editor): Simplifying test setup
cstuncsik Mar 13, 2023
fff0df6
Merge remote-tracking branch 'origin/master' into pay-101-unselect-a-…
cstuncsik Mar 13, 2023
4605be1
chore: update pnpm lock after resolving merge conflocts
cstuncsik Mar 13, 2023
0ce56df
chore: fix package version
cstuncsik Mar 13, 2023
669cabe
fix: Improved executions deletion to prevent crashing and fixed remov…
krynble Mar 14, 2023
f0605ba
fix: Add comment to clarify why change was needed
krynble Mar 14, 2023
984bd8e
fix: fix executions list bug when selecting all and changing filter
alexgrozav Mar 14, 2023
8594158
fix: fix execution lists running execution showing up on different wo…
alexgrozav Mar 14, 2023
16d7da6
Merge remote-tracking branch 'origin/master' into pay-101-unselect-a-…
cstuncsik Mar 16, 2023
a99ac01
fix(editor): Deleting an execution while all are selected
cstuncsik Mar 16, 2023
6bedc7f
fix(editor): Deleting an execution while all are selected
cstuncsik Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 12 additions & 30 deletions packages/editor-ui/src/components/ExecutionsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@
<thead>
<tr>
<th>
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
@change="handleCheckAllChange"
label=""
/>
<el-checkbox :value="checkAll" @change="handleCheckAllChange" label="" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like an intentional feature we are losing here.. can you make sure to double check with Product and design first?

</th>
<th>{{ $locale.baseText('executionsList.name') }}</th>
<th>{{ $locale.baseText('executionsList.startedAt') }}</th>
Expand Down Expand Up @@ -229,7 +224,7 @@
</div>
<div v-else :class="$style.loadedAll">{{ $locale.baseText('executionsList.loadedAll') }}</div>
</div>
<div v-if="checkAll === true || isIndeterminate === true" :class="$style.selectionOptions">
<div v-if="numSelected > 0" :class="$style.selectionOptions">
<span>
{{ $locale.baseText('executionsList.selected', { interpolate: { numSelected } }) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not handle plural case. should be 1 execution selected or 10 executions selected
Bildschirmfoto 2023-03-06 um 09 50 23

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done by Csaba

</span>
Expand Down Expand Up @@ -261,10 +256,9 @@ import {
IExecutionsCurrentSummaryExtended,
IExecutionDeleteFilter,
IExecutionsListResponse,
IExecutionsSummary,
IWorkflowShortResponse,
} from '@/Interface';
import type { ExecutionStatus, IDataObject } from 'n8n-workflow';
import type { IExecutionsSummary, ExecutionStatus, IDataObject } from 'n8n-workflow';
import { range as _range } from 'lodash-es';
import mixins from 'vue-typed-mixins';
import { mapStores } from 'pinia';
Expand Down Expand Up @@ -353,7 +347,7 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
return this.workflowsStore.activeExecutions;
},
combinedExecutions(): IExecutionsSummary[] {
const returnData: IExecutionsSummary[] = [];
const returnData = [];

if (['ALL', 'running'].includes(this.filter.status)) {
returnData.push(...this.activeExecutions);
Expand All @@ -363,23 +357,9 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
}
return returnData;
},
combinedExecutionsCount(): number {
return 0 + this.activeExecutions.length + this.finishedExecutionsCount;
},
numSelected(): number {
mutdmour marked this conversation as resolved.
Show resolved Hide resolved
if (this.checkAll) {
return this.finishedExecutionsCount;
}

return Object.keys(this.selectedItems).length;
},
isIndeterminate(): boolean {
if (this.checkAll) {
return false;
}

return this.numSelected > 0;
},
workflowFilterCurrent(): IDataObject {
const filter: IDataObject = {};
if (this.filter.workflowId !== 'ALL') {
Expand Down Expand Up @@ -435,8 +415,13 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
}
},
handleCheckAllChange() {
this.checkAll = !this.checkAll;
if (!this.checkAll) {
Vue.set(this, 'selectedItems', {});
} else {
this.combinedExecutions.forEach((execution: IExecutionsSummary) => {
Vue.set(this.selectedItems, execution.id, true);
});
}
},
handleCheckboxChanged(executionId: string) {
Expand All @@ -445,6 +430,7 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
} else {
Vue.set(this.selectedItems, executionId, true);
}
this.checkAll = Object.keys(this.selectedItems).length === this.combinedExecutions.length;
},
async handleDeleteSelected() {
const deleteExecutions = await this.confirmMessage(
Expand All @@ -464,11 +450,7 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
this.isDataLoading = true;

const sendData: IExecutionDeleteFilter = {};
if (this.checkAll) {
sendData.deleteBefore = this.finishedExecutions[0].startedAt as Date;
} else {
sendData.ids = Object.keys(this.selectedItems);
}
sendData.ids = Object.keys(this.selectedItems);

sendData.filters = this.workflowFilterPast;

Expand Down Expand Up @@ -536,7 +518,7 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
},
handleClearSelection() {
this.checkAll = false;
this.handleCheckAllChange();
Vue.set(this, 'selectedItems', {});
},
handleFilterChanged() {
this.refreshData();
Expand Down