ref 3008. Last selected OU
parent
379886134d
commit
d739c6b81c
|
|
@ -168,7 +168,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.updateGridCols();
|
||||
this.refreshData();
|
||||
this.refreshData(localStorage.getItem('lastSelectedOU') ?? undefined);
|
||||
window.addEventListener('resize', this.updateGridCols);
|
||||
|
||||
this.selectedClients.filterPredicate = (client: Client, filter: string): boolean => {
|
||||
|
|
@ -340,12 +340,12 @@ export class GroupsComponent implements OnInit, OnDestroy {
|
|||
this.treeDataSource.data = [...this.originalTreeData];
|
||||
if (selectedNodeIdOrUuid) {
|
||||
this.selectedNode = this.findNodeByIdOrUuid(this.treeDataSource.data, selectedNodeIdOrUuid);
|
||||
}
|
||||
|
||||
if (this.selectedNode) {
|
||||
this.treeControl.collapseAll();
|
||||
this.expandPathToNode(this.selectedNode);
|
||||
this.fetchClientsForNode(this.selectedNode, selectedClientsBeforeEdit);
|
||||
}
|
||||
if (selectedNodeIdOrUuid && this.selectedNode) {
|
||||
this.treeControl.collapseAll();
|
||||
this.expandPathToNode(this.selectedNode);
|
||||
this.fetchClientsForNode(this.selectedNode, selectedClientsBeforeEdit);
|
||||
} else {
|
||||
this.treeControl.collapseAll();
|
||||
if (this.treeDataSource.data.length > 0) {
|
||||
|
|
@ -419,8 +419,9 @@ export class GroupsComponent implements OnInit, OnDestroy {
|
|||
onNodeClick(event: MouseEvent, node: TreeNode): void {
|
||||
event.stopPropagation();
|
||||
this.selectedNode = node;
|
||||
this.persistSelectedNode(node);
|
||||
const selectedClientsBeforeEdit = this.selection.selected.map(client => client.uuid);
|
||||
|
||||
|
||||
const checkStatusAfterLoad = node.type === NodeType.Classroom || node.type === NodeType.ClientsGroup;
|
||||
this.fetchClientsForNode(node, selectedClientsBeforeEdit, checkStatusAfterLoad);
|
||||
}
|
||||
|
|
@ -428,10 +429,17 @@ export class GroupsComponent implements OnInit, OnDestroy {
|
|||
onMenuClick(event: Event, node: any): void {
|
||||
event.stopPropagation();
|
||||
this.selectedNode = node;
|
||||
this.persistSelectedNode(node);
|
||||
const selectedClientsBeforeEdit = this.selection.selected.map(client => client.uuid);
|
||||
this.fetchClientsForNode(node, selectedClientsBeforeEdit);
|
||||
}
|
||||
|
||||
private persistSelectedNode(node: TreeNode): void {
|
||||
if (node.uuid) {
|
||||
localStorage.setItem('lastSelectedOU', node.uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ export class AuthService {
|
|||
localStorage.removeItem('username');
|
||||
localStorage.removeItem('groupsView');
|
||||
localStorage.removeItem('language');
|
||||
localStorage.removeItem('lastSelectedOU');
|
||||
this.tokenPayload = null;
|
||||
if (options.redirect && this.router.url !== '/auth/login') {
|
||||
this.router.navigate(['/auth/login']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue