Skip to content

Commit e04ee8f

Browse files
mattjokexkureck
authored andcommitted
fix(admin): subgroup name bug
* Fixed broken links when loading subgroups
1 parent c59d414 commit e04ee8f

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

apps/admin-gui/src/app/vos/pages/group-detail-page/group-overview/group-overview.component.ts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
NotificatorService,
1515
} from '@perun-web-apps/perun/services';
1616
import { Urns } from '@perun-web-apps/perun/urns';
17+
import { addRecentlyVisited, addRecentlyVisitedObject } from '@perun-web-apps/perun/utils';
1718

1819
@Component({
1920
selector: 'app-group-overview',
@@ -42,18 +43,47 @@ export class GroupOverviewComponent implements OnInit {
4243

4344
ngOnInit() {
4445
this.loading = true;
45-
this.group = this.entityStorageService.getEntity();
46-
if (this.group.parentGroupId !== null) {
47-
this.loadParentGroupData();
48-
} else {
49-
this.parentGroup = null;
50-
this.initNavItems();
51-
this.loading = false;
52-
}
46+
this.loadData();
47+
}
48+
49+
loadData() {
50+
this.loading = true;
51+
this.route.params.subscribe((params) => {
52+
const voId = params['voId'];
53+
const groupId = params['groupId'];
54+
this.voService.getVoById(voId).subscribe(
55+
(vo) => {
56+
this.groupService.getGroupById(groupId).subscribe(
57+
(group) => {
58+
this.group = group;
59+
this.entityStorageService.setEntity({
60+
id: group.id,
61+
voId: vo.id,
62+
parentGroupId: group.parentGroupId,
63+
beanName: group.beanName,
64+
});
65+
addRecentlyVisited('groups', this.group);
66+
addRecentlyVisitedObject(this.group, vo.name);
67+
this.loadParentGroupData(this.group.parentGroupId);
68+
if (this.group.parentGroupId == null) {
69+
this.parentGroup = null;
70+
this.initNavItems();
71+
this.loading = false;
72+
return;
73+
}
74+
this.loading = false;
75+
},
76+
() => (this.loading = false)
77+
);
78+
},
79+
() => (this.loading = false)
80+
);
81+
});
5382
}
5483

55-
private loadParentGroupData() {
56-
this.groupService.getGroupById(this.group.parentGroupId).subscribe(
84+
private loadParentGroupData(id?: number) {
85+
if (id == null) return;
86+
this.groupService.getGroupById(id).subscribe(
5787
(parentGroup) => {
5888
this.parentGroup = parentGroup;
5989
this.initNavItems();

0 commit comments

Comments
 (0)