Elffuss BraidHub

kikocis/dataspace-portal public

feat: refresh on environment switch in control center (#349)

Changesetf136631351025a9cb2786a136784753fee6f66170e25ddcbd657884ab8afd19d
AuthorIlia Orlov <66363651+illfixit@users.noreply.github.com> · 2024-10-09 11:37 +02:00
CommitterGitHub <noreply@github.com> · 2024-10-09 11:37 +02:00
Parentscd8c83ceb457

Browse the files at this changeset

4 files changed

modified CHANGELOG.md +1 −0
@@ -16,6 +16,7 @@
1616 #### Patch
1717
1818 - Added documentation for roles and rights ([#334](https://github.com/sovity/authority-portal/issues/334))
19+- Fixed My Organization page not updated when switching between environments ([#255](https://github.com/sovity/authority-portal/issues/255))
1920
2021 ### Known issues
2122
modified authority-portal-frontend/src/app/pages/control-center-organization-members-page/control-center-organization-members-page/control-center-organization-members-page.component.ts +12 −0
@@ -15,6 +15,7 @@
1515 import {Subject, takeUntil} from 'rxjs';
1616 import {Store} from '@ngxs/store';
1717 import {MemberInfo} from '@sovity.de/authority-portal-client';
18+import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
1819 import {BreadcrumbService} from '../../../shared/common/portal-layout/breadcrumb/breadcrumb.service';
1920 import {Reset} from './state/control-center-organization-members-page-action';
2021 import {
@@ -37,11 +38,13 @@
3738 private store: Store,
3839 private router: Router,
3940 private breadcrumbService: BreadcrumbService,
41+ private globalStateUtils: GlobalStateUtils,
4042 ) {}
4143
4244 ngOnInit(): void {
4345 this.refresh();
4446 this.startListeningToState();
47+ this.startRefreshingOnEnvChange();
4548 }
4649
4750 refresh(): void {
@@ -69,6 +72,15 @@
6972 this.router.navigate(['control-center/users-and-roles', user.userId]);
7073 }
7174
75+ startRefreshingOnEnvChange() {
76+ this.globalStateUtils.onDeploymentEnvironmentChangeSkipFirst({
77+ ngOnDestroy$: this.ngOnDestroy$,
78+ onChanged: () => {
79+ this.refresh();
80+ },
81+ });
82+ }
83+
7284 ngOnDestroy$ = new Subject();
7385 ngOnDestroy(): void {
7486 this.ngOnDestroy$.next(null);
modified authority-portal-frontend/src/app/pages/control-center-organization-profile-page/control-center-organization-profile-page/control-center-organization-profile-page.component.ts +15 −1
@@ -13,6 +13,7 @@
1313 import {Component, OnDestroy, OnInit} from '@angular/core';
1414 import {Subject, takeUntil} from 'rxjs';
1515 import {Store} from '@ngxs/store';
16+import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
1617 import {Reset} from '../state/control-center-organization-profile-page-action';
1718 import {
1819 ControlCenterOrganizationProfilePageState,
@@ -30,11 +31,15 @@
3031 state: ControlCenterOrganizationProfilePageState =
3132 DEFAULT_CONTROL_CENTER_ORGANIZATION_PROFILE_PAGE_STATE;
3233
33- constructor(private store: Store) {}
34+ constructor(
35+ private store: Store,
36+ private globalStateUtils: GlobalStateUtils,
37+ ) {}
3438
3539 ngOnInit(): void {
3640 this.refresh();
3741 this.startListeningToState();
42+ this.startRefreshingOnEnvChange();
3843 }
3944
4045 refresh(): void {
@@ -52,6 +57,15 @@
5257 });
5358 }
5459
60+ startRefreshingOnEnvChange() {
61+ this.globalStateUtils.onDeploymentEnvironmentChangeSkipFirst({
62+ ngOnDestroy$: this.ngOnDestroy$,
63+ onChanged: () => {
64+ this.refresh();
65+ },
66+ });
67+ }
68+
5569 ngOnDestroy$ = new Subject();
5670 ngOnDestroy(): void {
5771 this.ngOnDestroy$.next(null);
modified authority-portal-frontend/src/app/pages/control-center-user-profile-page/control-center-user-profile-page/control-center-user-profile-page.component.ts +15 −1
@@ -13,6 +13,7 @@
1313 import {Component, OnDestroy, OnInit} from '@angular/core';
1414 import {Subject, takeUntil} from 'rxjs';
1515 import {Store} from '@ngxs/store';
16+import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
1617 import {Reset} from '../state/control-center-user-profile-page-action';
1718 import {
1819 ControlCenterUserProfilePageState,
@@ -30,11 +31,15 @@
3031 state: ControlCenterUserProfilePageState =
3132 DEFAULT_CONTROL_CENTER_USER_PROFILE_PAGE_STATE;
3233
33- constructor(private store: Store) {}
34+ constructor(
35+ private store: Store,
36+ private globalStateUtils: GlobalStateUtils,
37+ ) {}
3438
3539 ngOnInit(): void {
3640 this.refresh();
3741 this.startListeningToState();
42+ this.startRefreshingOnEnvChange();
3843 }
3944
4045 refresh(): void {
@@ -52,6 +57,15 @@
5257 });
5358 }
5459
60+ startRefreshingOnEnvChange() {
61+ this.globalStateUtils.onDeploymentEnvironmentChangeSkipFirst({
62+ ngOnDestroy$: this.ngOnDestroy$,
63+ onChanged: () => {
64+ this.refresh();
65+ },
66+ });
67+ }
68+
5569 ngOnDestroy$ = new Subject();
5670 ngOnDestroy(): void {
5771 this.ngOnDestroy$.next(null);