Skip to content

Commit e44ddee

Browse files
committed
fix: organization list filter
1 parent 4d2c3c1 commit e44ddee

File tree

2 files changed

+65
-34
lines changed

2 files changed

+65
-34
lines changed

packages/core/state/src/lib/+state/management/organization/organization.effects.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { OrganizationService, ErrorHandlingService } from '../../../services';
1919
import { AppFacade } from '../../app';
2020

2121
import * as organizationActions from './organization.actions';
22+
import { concatLatestFrom } from '@ngrx/operators';
23+
import { OrganizationFacade } from './organization.facade';
2224

2325
@Injectable()
2426
export class OrganizationEffects {
@@ -302,6 +304,31 @@ export class OrganizationEffects {
302304
{ dispatch: false }
303305
);
304306

307+
handleOrganizationChangedNotification$ = createEffect(
308+
() => {
309+
return this.actions$.pipe(
310+
ofType(
311+
organizationActions.setSelectedGlobalOrganizationId,
312+
organizationActions.selectedGlobalOrganizationHistory,
313+
organizationActions.setPreviousSelectedGlobalOrganizationHistory,
314+
organizationActions.cancelSelection
315+
),
316+
concatLatestFrom(() => [
317+
this.organizationFacade.globalOrganizationLeaf$,
318+
this.organizationFacade.globalOrganization$,
319+
]),
320+
tap(([, leafOrganization, parentOrganization]) => {
321+
const organization = leafOrganization || parentOrganization;
322+
this.appFacade.addNotification({
323+
content: `Organization changed to ${organization?.name}`,
324+
type: ENotificationTypes.Info,
325+
});
326+
})
327+
);
328+
},
329+
{ dispatch: false }
330+
);
331+
305332
handleNotificationErrors$ = createEffect(
306333
() => {
307334
return this.actions$.pipe(
@@ -329,6 +356,7 @@ export class OrganizationEffects {
329356
private readonly actions$: Actions,
330357
private readonly appFacade: AppFacade,
331358
private readonly organizationService: OrganizationService,
359+
private readonly organizationFacade: OrganizationFacade,
332360
private readonly errorHandlingService: ErrorHandlingService
333361
) {}
334362
}

packages/modules/ui/src/lib/components/organisms/header/header-toolbar.component.html

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,45 @@
4545
[positions]="rightOrientedPositions"
4646
>
4747
<div>
48-
<div class="row justify-content-between align-items-center">
49-
<div class="flex p-2">
50-
@if (vm.globalOrganization?.parentId) {
51-
<button
52-
vcl-button
53-
class="half-transparent organization"
54-
(click)="resetGlobalSelectOrganization($event)"
55-
>
56-
<vcl-icon icon="vcl:home"></vcl-icon>
57-
</button>
48+
<rc-toolbar>
49+
@if (vm.globalOrganization?.parentId || vm.selectedParent?.parentId) {
50+
<button
51+
rc-prepend
52+
vcl-button
53+
class="half-transparent organization"
54+
(click)="resetGlobalSelectOrganization($event)"
55+
>
56+
<vcl-icon icon="vcl:home"></vcl-icon>
57+
</button>
5858

59-
<button
60-
vcl-button
61-
class="half-transparent organization"
62-
(click)="lastSelectedGlobalOrganization($event)"
63-
>
64-
<vcl-icon icon="vcl:arrow-left"></vcl-icon>
65-
</button>
66-
}
67-
</div>
68-
<div class="overflow-ellipsis flex p-2">
69-
{{ vm.globalOrganization?.name }}
70-
</div>
59+
} @if (vm.globalOrganization?.parentId || vm.selectedParent?.parentId) {
60+
<button
61+
rc-prepend
62+
vcl-button
63+
class="half-transparent organization"
64+
(click)="lastSelectedGlobalOrganization($event)"
65+
title=""
66+
>
67+
<vcl-icon icon="vcl:arrow-left"></vcl-icon>
68+
</button>
69+
}
70+
71+
<span class="pr-2 overflow-ellipsis">{{
72+
vm.globalOrganization?.name || vm.selectedParent?.name
73+
}}</span>
7174

72-
<div class="flex row justify-content-end">
73-
@if (vm.globalOrganization?.isLeaf) {
74-
<button
75-
vcl-button
76-
class="half-transparent organization"
77-
(click)="cancelSelection()"
78-
>
79-
<vcl-icon icon="vcl:close"></vcl-icon>
80-
</button>
81-
}
82-
</div>
83-
</div>
75+
@if (vm.globalOrganization?.parentId) {
76+
<button
77+
rc-append
78+
vcl-button
79+
class="half-transparent organization"
80+
(click)="cancelSelection()"
81+
title=""
82+
>
83+
<vcl-icon icon="vcl:close"></vcl-icon>
84+
</button>
85+
}
86+
</rc-toolbar>
8487

8588
<vcl-data-list
8689
[noBorder]="true"

0 commit comments

Comments
 (0)