feat: Replace all Vue.set usages with direct assignment and spread operator (no-changelog) (#6280)

* refactor: replace all Vue.set usages with direct assignment and spread operator

* chore: fix linting issue

* fix: fix updateNodeAtIndex function

* fix: various post-refactoring fixes

* fix: refactor recently added Vue.set directive
This commit is contained in:
Alex Grozav
2023-06-15 15:30:05 +03:00
committed by GitHub
parent c2afed4ca1
commit 596cf07e42
24 changed files with 620 additions and 307 deletions

View File

@@ -432,7 +432,7 @@ export default defineComponent({
this.allVisibleSelected = !this.allVisibleSelected;
if (!this.allVisibleSelected) {
this.allExistingSelected = false;
Vue.set(this, 'selectedItems', {});
this.selectedItems = {};
} else {
this.selectAllVisibleExecutions();
}
@@ -441,7 +441,10 @@ export default defineComponent({
if (this.selectedItems[executionId]) {
Vue.delete(this.selectedItems, executionId);
} else {
Vue.set(this.selectedItems, executionId, true);
this.selectedItems = {
...this.selectedItems,
[executionId]: true,
};
}
this.allVisibleSelected =
Object.keys(this.selectedItems).length === this.combinedExecutions.length;
@@ -502,7 +505,7 @@ export default defineComponent({
handleClearSelection(): void {
this.allVisibleSelected = false;
this.allExistingSelected = false;
Vue.set(this, 'selectedItems', {});
this.selectedItems = {};
},
async onFilterChanged(filter: ExecutionFilterType) {
this.filter = filter;
@@ -635,7 +638,7 @@ export default defineComponent({
this.finishedExecutionsCount = pastExecutions.count;
this.finishedExecutionsCountEstimated = pastExecutions.estimated;
Vue.set(this, 'finishedExecutions', alreadyPresentExecutionsFiltered);
this.finishedExecutions = alreadyPresentExecutionsFiltered;
this.workflowsStore.addToCurrentExecutions(alreadyPresentExecutionsFiltered);
this.adjustSelectionAfterMoreItemsLoaded();
@@ -706,7 +709,8 @@ export default defineComponent({
},
async loadWorkflows() {
try {
const workflows = await this.workflowsStore.fetchAllWorkflows();
const workflows =
(await this.workflowsStore.fetchAllWorkflows()) as IWorkflowShortResponse[];
workflows.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) {
return -1;
@@ -717,13 +721,12 @@ export default defineComponent({
return 0;
});
// @ts-ignore
workflows.unshift({
id: 'all',
name: this.$locale.baseText('executionsList.allWorkflows'),
});
} as IWorkflowShortResponse);
Vue.set(this, 'workflows', workflows);
this.workflows = workflows;
} catch (error) {
this.showError(
error,
@@ -900,7 +903,7 @@ export default defineComponent({
await this.refreshData();
if (this.allVisibleSelected) {
Vue.set(this, 'selectedItems', {});
this.selectedItems = {};
this.selectAllVisibleExecutions();
}
} catch (error) {
@@ -922,7 +925,7 @@ export default defineComponent({
},
selectAllVisibleExecutions() {
this.combinedExecutions.forEach((execution: IExecutionsSummary) => {
Vue.set(this.selectedItems, execution.id, true);
this.selectedItems = { ...this.selectedItems, [execution.id]: true };
});
},
adjustSelectionAfterMoreItemsLoaded() {