web/elements: keep selected elements in table when fetching (#7519)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
627b3bc095
commit
31592712a4
|
@ -194,7 +194,6 @@ export abstract class Table<T> extends AKElement {
|
||||||
this.data = await this.apiEndpoint(this.page);
|
this.data = await this.apiEndpoint(this.page);
|
||||||
this.error = undefined;
|
this.error = undefined;
|
||||||
this.page = this.data.pagination.current;
|
this.page = this.data.pagination.current;
|
||||||
const newSelected: T[] = [];
|
|
||||||
const newExpanded: T[] = [];
|
const newExpanded: T[] = [];
|
||||||
this.data.results.forEach((res) => {
|
this.data.results.forEach((res) => {
|
||||||
const jsonRes = JSON.stringify(res);
|
const jsonRes = JSON.stringify(res);
|
||||||
|
@ -214,18 +213,12 @@ export abstract class Table<T> extends AKElement {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedIndex = this.selectedElements.findIndex(comp);
|
|
||||||
if (selectedIndex > -1) {
|
|
||||||
newSelected.push(res);
|
|
||||||
}
|
|
||||||
const expandedIndex = this.expandedElements.findIndex(comp);
|
const expandedIndex = this.expandedElements.findIndex(comp);
|
||||||
if (expandedIndex > -1) {
|
if (expandedIndex > -1) {
|
||||||
newExpanded.push(res);
|
newExpanded.push(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.selectedElements = newSelected;
|
|
||||||
this.expandedElements = newExpanded;
|
this.expandedElements = newExpanded;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
|
Reference in New Issue