Skip to content

Commit 54e6b84

Browse files
committed
feat(header): implement search on organization selector
1 parent 9eccd45 commit 54e6b84

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { NgModule } from '@angular/core';
22

3-
@NgModule({})
3+
import { FuseSearchPipe } from './pipes';
4+
5+
@NgModule({
6+
declarations: [FuseSearchPipe],
7+
exports: [FuseSearchPipe],
8+
})
49
export class ModulesSharedModule {}

packages/modules/shared/src/lib/pipes/fuse-search.pipe.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { FuseSearchService } from '../services';
44

55
@Pipe({
66
name: 'fuseSearch',
7-
pure: false,
7+
pure: true,
8+
standalone: false,
89
})
910
export class FuseSearchPipe<T> implements PipeTransform {
1011
constructor(private searchService: FuseSearchService<T>) {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './fuse-search.pipe';

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
}
8888
</rc-toolbar>
8989

90-
<rc-searchbar />
90+
<rc-searchbar (search)="searchTerm = $event" />
9191

9292
<vcl-data-list
9393
[noBorder]="true"
@@ -102,7 +102,8 @@
102102
<div class="p-2">{{ vm.selectedParent.name }}</div>
103103
</vcl-data-list-item>
104104
<!-- | fuzzysearch: term -->
105-
} @for (organization of (vm.organizations); track $index) {
105+
} @for (organization of (vm.organizations | fuseSearch: searchTerm :
106+
['name', 'description']); track $index) {
106107
<vcl-data-list-item [value]="organization.id">
107108
<div class="p-2">{{ organization?.name }}</div>
108109
</vcl-data-list-item>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export class RcHeaderToolbarComponent implements OnInit {
3232
@HostBinding('class.row')
3333
_hostClasses = true;
3434

35+
searchTerm = '';
36+
3537
readonly vm$ = combineLatest({
3638
user: this.accountFacade.user$,
3739
organizations: this.organizationFacade.globalChildrenOrganizations$,

packages/modules/ui/src/lib/modules-ui.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import {
3333
VCLBadgeModule,
3434
} from '@vcl/ng-vcl';
3535

36+
import { ModulesSharedModule } from '@console-modules/shared';
37+
3638
import {
3739
RcBusyIndicatorComponent,
3840
RcCopyrightComponent,
@@ -153,6 +155,7 @@ const modules = [
153155
VCLButtonGroupModule,
154156
VCLBadgeModule,
155157
VCLFormControlGroupModule,
158+
ModulesSharedModule,
156159
];
157160

158161
const atoms = [

0 commit comments

Comments
 (0)