Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(frontend:search): centralize local and global search in the navbar

johaven68805c27e0ef
diff --git a/frontend/src/app/applications/admin/admin.routes.ts b/frontend/src/app/applications/admin/admin.routes.ts
index e952fa74..38c1a1c6 100644
--- a/frontend/src/app/applications/admin/admin.routes.ts
+++ b/frontend/src/app/applications/admin/admin.routes.ts
@@ -13,12 +13,12 @@ export const adminRoutes: Routes = [
children: [
{
path: ADMIN_PATH.USERS,
- data: { type: USER_ROLE.USER },
+ data: { type: USER_ROLE.USER, navbarViewSearch: true },
loadComponent: () => import('./components/admin-users.component').then((c) => c.AdminUsersComponent)
},
{
path: ADMIN_PATH.GUESTS,
- data: { type: USER_ROLE.GUEST },
+ data: { type: USER_ROLE.GUEST, navbarViewSearch: true },
loadComponent: () => import('./components/admin-users.component').then((c) => c.AdminUsersComponent)
},
{
@@ -27,7 +27,7 @@ export const adminRoutes: Routes = [
{
path: '**',
resolve: { routes: routeResolver },
- data: { type: GROUP_TYPE.USER },
+ data: { type: GROUP_TYPE.USER, navbarViewSearch: true },
loadComponent: () => import('./components/admin-groups.component').then((c) => c.AdminGroupsComponent)
}
]
@@ -38,7 +38,7 @@ export const adminRoutes: Routes = [
{
path: '**',
resolve: { routes: routeResolver },
- data: { type: GROUP_TYPE.PERSONAL },
+ data: { type: GROUP_TYPE.PERSONAL, navbarViewSearch: true },
loadComponent: () => import('./components/admin-groups.component').then((c) => c.AdminGroupsComponent)
}
]
@@ -49,6 +49,7 @@ export const adminRoutes: Routes = [
{
path: '**',
resolve: { routes: routeResolver },
+ data: { navbarViewSearch: true },
loadComponent: () => import('./components/admin-spaces.component').then((c) => c.AdminSpacesComponent)
}
]
diff --git a/frontend/src/app/applications/admin/components/admin-groups.component.html b/frontend/src/app/applications/admin/components/admin-groups.component.html
index 25781e52..ab2459e8 100644
--- a/frontend/src/app/applications/admin/components/admin-groups.component.html
+++ b/frontend/src/app/applications/admin/components/admin-groups.component.html
@@ -58,11 +58,6 @@
Personal groups
</button>
</div>
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="refresh()"
class="d-none d-sm-block btn btn-default"
[tooltip]="'Refresh' | translate:locale.language"
@@ -96,7 +91,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="members | searchFilter:inputFilter.search()">
+ [items]="members | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (m of scrollView?.viewPortItems; track m.mid) {
diff --git a/frontend/src/app/applications/admin/components/admin-groups.component.ts b/frontend/src/app/applications/admin/components/admin-groups.component.ts
index cc9a6779..f9da3432 100644
--- a/frontend/src/app/applications/admin/components/admin-groups.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-groups.component.ts
@@ -24,7 +24,6 @@ import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipDirective } from 'ngx-bootstrap/tooltip'
import { filter, take } from 'rxjs/operators'
import { BadgeMembersComponent } from '../../../common/components/badge-members.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
import { TableHeaderConfig } from '../../../common/interfaces/table.interface'
@@ -33,6 +32,7 @@ import { TimeDateFormatPipe } from '../../../common/pipes/time-date-format.pipe'
import { originalOrderKeyValue, pathFromRoutes } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { UserGroupDialogComponent } from '../../users/components/dialogs/user-group-dialog.component'
import type { GroupBrowseModel } from '../../users/models/group-browse.model'
import { MemberModel } from '../../users/models/member.model'
@@ -53,7 +53,6 @@ import { AdminGroupEditUserDialogComponent } from './dialogs/admin-group-edit-us
KeyValuePipe,
L10nTranslateDirective,
L10nTranslatePipe,
- FilterComponent,
SearchFilterPipe,
VirtualScrollComponent,
TooltipDirective,
@@ -72,10 +71,10 @@ export class AdminGroupsComponent {
viewPortItems: MemberModel[]
scrollInto: (arg: MemberModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
GROUPS: USER_ICON.GROUPS,
diff --git a/frontend/src/app/applications/admin/components/admin-spaces.component.html b/frontend/src/app/applications/admin/components/admin-spaces.component.html
index 8fec1852..4d99b858 100644
--- a/frontend/src/app/applications/admin/components/admin-spaces.component.html
+++ b/frontend/src/app/applications/admin/components/admin-spaces.component.html
@@ -21,11 +21,6 @@
<svg [lucideIcon]="icons.SHARES"></svg>
</button>
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadSpaces()"
class="d-none d-sm-block btn btn-default"
[tooltip]="'Refresh' | translate:locale.language"
@@ -58,7 +53,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="spaces | searchFilter:inputFilter.search()">
+ [items]="spaces | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (s of scrollView?.viewPortItems; track s.id) {
diff --git a/frontend/src/app/applications/admin/components/admin-spaces.component.ts b/frontend/src/app/applications/admin/components/admin-spaces.component.ts
index 7d998e9e..744102b6 100644
--- a/frontend/src/app/applications/admin/components/admin-spaces.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-spaces.component.ts
@@ -9,7 +9,6 @@ import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipModule } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
import { BadgeMembersComponent } from '../../../common/components/badge-members.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { StorageUsageComponent } from '../../../common/components/storage-usage.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -18,6 +17,7 @@ import { SearchFilterPipe } from '../../../common/pipes/search.pipe'
import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { SharedChildrenDialogComponent } from '../../shares/components/dialogs/shared-children-dialog.component'
import { SpaceDialogComponent } from '../../spaces/components/dialogs/space-dialog.component'
import type { SpaceModel } from '../../spaces/models/space.model'
@@ -39,7 +39,6 @@ import { ToBytesPipe } from '../../../common/pipes/to-bytes.pipe'
TooltipModule,
L10nTranslatePipe,
ContextMenuModule,
- FilterComponent,
SearchFilterPipe,
TapDirective,
BadgeMembersComponent,
@@ -50,11 +49,11 @@ import { ToBytesPipe } from '../../../common/pipes/to-bytes.pipe'
})
export class AdminSpacesComponent {
@ViewChild(VirtualScrollComponent) scrollView: { element: ElementRef; viewPortItems: SpaceModel[]; scrollInto: (arg: SpaceModel | number) => void }
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
SPACES: ADMIN_ICON.SPACES,
diff --git a/frontend/src/app/applications/admin/components/admin-users.component.html b/frontend/src/app/applications/admin/components/admin-users.component.html
index 75eb906a..62acac84 100644
--- a/frontend/src/app/applications/admin/components/admin-users.component.html
+++ b/frontend/src/app/applications/admin/components/admin-users.component.html
@@ -45,11 +45,6 @@
</button>
</div>
<!--End View Switch-->
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadUsersOrGuests()"
class="d-none d-sm-block btn btn-default"
[tooltip]="'Refresh' | translate:locale.language"
@@ -83,7 +78,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="users | searchFilter:inputFilter.search()">
+ [items]="users | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (u of scrollView?.viewPortItems; track u.id) {
diff --git a/frontend/src/app/applications/admin/components/admin-users.component.ts b/frontend/src/app/applications/admin/components/admin-users.component.ts
index 4a5c9d51..a6b124b2 100644
--- a/frontend/src/app/applications/admin/components/admin-users.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-users.component.ts
@@ -19,7 +19,6 @@ import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } fr
import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipDirective } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
-import { FilterComponent } from '../../../common/components/filter.component'
import { StorageUsageComponent } from '../../../common/components/storage-usage.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -29,6 +28,7 @@ import { TimeDateFormatPipe } from '../../../common/pipes/time-date-format.pipe'
import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { UserAvatarStackComponent } from '../../users/components/utils/user-avatar-stack.component'
import { GuestUserModel } from '../../users/models/guest.model'
import { UserService } from '../../users/user.service'
@@ -44,7 +44,6 @@ import { ToBytesPipe } from '../../../common/pipes/to-bytes.pipe'
imports: [
LucideDynamicIcon,
L10nTranslatePipe,
- FilterComponent,
TooltipDirective,
KeyValuePipe,
L10nTranslateDirective,
@@ -65,10 +64,10 @@ export class AdminUsersComponent {
viewPortItems: AdminUserModel[]
scrollInto: (arg: AdminUserModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
LucideRotateCw,
diff --git a/frontend/src/app/applications/favorites/components/favorites.component.html b/frontend/src/app/applications/favorites/components/favorites.component.html
index 9a395d08..453051a1 100644
--- a/frontend/src/app/applications/favorites/components/favorites.component.html
+++ b/frontend/src/app/applications/favorites/components/favorites.component.html
@@ -15,9 +15,6 @@
<svg [lucideIcon]="icons.REMOVE_FAVORITE"></svg>
</button>
<div class="d-flex align-items-center ms-auto">
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
<button (click)="loadFavorites()"
class="d-none d-sm-block btn btn-default me-1"
[tooltip]="'Refresh' | translate:locale.language"
@@ -38,7 +35,7 @@
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[childHeight]="galleryMode.dimensions"
[childWidth]="galleryMode.dimensions"
- [items]="favorites | searchFilter:inputFilter.search()"
+ [items]="favorites | searchFilter:navbarSearch.viewFilter()"
[galleryMode]="true"
[resizeOffset]="115">
<div *ngTemplateOutlet="CommonMessages"></div>
@@ -163,7 +160,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="favorites | searchFilter:inputFilter.search()">
+ [items]="favorites | searchFilter:navbarSearch.viewFilter()">
<div *ngTemplateOutlet="CommonMessages"></div>
<table class="app-table">
<tbody tabindex="-1">
diff --git a/frontend/src/app/applications/favorites/components/favorites.component.ts b/frontend/src/app/applications/favorites/components/favorites.component.ts
index 39ecae5b..80e2c62c 100644
--- a/frontend/src/app/applications/favorites/components/favorites.component.ts
+++ b/frontend/src/app/applications/favorites/components/favorites.component.ts
@@ -17,7 +17,6 @@ import { ContextMenuComponent, ContextMenuModule } from '@perfectmemory/ngx-cont
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { TooltipModule } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
-import { FilterComponent } from '../../../common/components/filter.component'
import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -29,6 +28,7 @@ import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { TAB_MENU } from '../../../layout/layout.interfaces'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { FileLocationComponent } from '../../files/components/utils/file-location.component'
import { FileFavoriteModel } from '../../files/models/file-favorite.model'
import { FilesService } from '../../files/services/files.service'
@@ -45,7 +45,6 @@ import { FAVORITES_ICON, FAVORITES_PATH, FAVORITES_TITLE } from '../favorites.co
L10nTranslateDirective,
L10nTranslatePipe,
NavigationViewComponent,
- FilterComponent,
SearchFilterPipe,
TooltipModule,
VirtualScrollComponent,
@@ -63,12 +62,12 @@ export class FavoritesComponent implements OnInit {
viewPortItems: FileFavoriteModel[]
scrollInto: (arg: FileFavoriteModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly icons = {
FAVORITES: FAVORITES_ICON,
SHARED: SPACES_ICON.SHARED_WITH_OTHERS,
@@ -162,7 +161,7 @@ export class FavoritesComponent implements OnInit {
loadFavorites() {
this.loading = true
this.onSelect()
- this.inputFilter.clear()
+ this.navbarSearch.clearViewFilter()
this.filesService
.listFavorites()
.pipe(take(1))
diff --git a/frontend/src/app/applications/favorites/favorites.routes.ts b/frontend/src/app/applications/favorites/favorites.routes.ts
index 21d4c565..793ee3fa 100644
--- a/frontend/src/app/applications/favorites/favorites.routes.ts
+++ b/frontend/src/app/applications/favorites/favorites.routes.ts
@@ -6,6 +6,7 @@ export const favoritesRoutes: Routes = [
{
path: FAVORITES_PATH.BASE,
loadComponent: () => import('./components/favorites.component').then((c) => c.FavoritesComponent),
- canActivate: [noUserLinkGuard]
+ canActivate: [noUserLinkGuard],
+ data: { navbarViewSearch: true }
}
]
diff --git a/frontend/src/app/applications/links/components/links.component.html b/frontend/src/app/applications/links/components/links.component.html
index 7a949ebe..9aeef979 100644
--- a/frontend/src/app/applications/links/components/links.component.html
+++ b/frontend/src/app/applications/links/components/links.component.html
@@ -21,11 +21,6 @@
<svg [lucideIcon]="icons.LucideMapPin"></svg>
</button>
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadShareLinks()"
class="d-none d-sm-block btn btn-default me-1"
[tooltip]="'Refresh' | translate:locale.language"
@@ -49,7 +44,7 @@
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[childHeight]="galleryMode.dimensions"
[childWidth]="galleryMode.dimensions"
- [items]="shares | searchFilter:inputFilter.search()"
+ [items]="shares | searchFilter:navbarSearch.viewFilter()"
[galleryMode]="true"
[resizeOffset]="115">
<div class="row g-0" tabindex="-1">
@@ -124,7 +119,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="shares | searchFilter:inputFilter.search()">
+ [items]="shares | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (s of scrollView?.viewPortItems; track s.id) {
diff --git a/frontend/src/app/applications/links/components/links.component.ts b/frontend/src/app/applications/links/components/links.component.ts
index c1a064be..4cdd5cd7 100644
--- a/frontend/src/app/applications/links/components/links.component.ts
+++ b/frontend/src/app/applications/links/components/links.component.ts
@@ -22,7 +22,6 @@ import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipModule } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
import { BadgePermissionsComponent } from '../../../common/components/badge-permissions.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -32,6 +31,7 @@ import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { TAB_MENU } from '../../../layout/layout.interfaces'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { ShareRepositoryComponent } from '../../shares/components/utils/share-repository.component'
import { ShareModel } from '../../shares/models/share.model'
@@ -51,7 +51,6 @@ import { LinkDialogComponent } from './dialogs/link-dialog.component'
L10nTranslatePipe,
NavigationViewComponent,
TooltipModule,
- FilterComponent,
VirtualScrollComponent,
SearchFilterPipe,
ShareRepositoryComponent,
@@ -66,12 +65,12 @@ export class LinksComponent implements OnInit {
viewPortItems: ShareLinkModel[]
scrollInto: (arg: ShareLinkModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly icons = {
LucideLink,
LucideRotateCw,
diff --git a/frontend/src/app/applications/search/components/search.component.html b/frontend/src/app/applications/search/components/search.component.html
index 3d48bd3c..4849641c 100644
--- a/frontend/src/app/applications/search/components/search.component.html
+++ b/frontend/src/app/applications/search/components/search.component.html
@@ -1,67 +1,23 @@
-<div class="app-top-menu">
- <div class="col-12 col-md-6">
- <div class="input-group">
- <button (click)="doSearch()" [disabled]="searchContent().length < minCharsToSearch" class="btn btn-default" role="button" type="button">
- <svg [lucideIcon]="loading ? icons.LucideLoader : icons.SEARCH_ICON" [class]="loading ? 'icon-spin' : ''"></svg>
- </button>
- <input [value]="searchContent()"
- (input)="setCurrentSearch($event)"
- [placeholder]="(this.store.currentSearch().fullText ? 'Search for content' : 'Search for files')|translate:locale.language"
- (keyup.enter)="doSearch()"
- (keyup.escape)="clearSearch()"
- class="search-input flex-fill form-control"
- name="search"
- type="text"
- appAutofocus
- autocomplete="off">
- @if (searchContent()) {
- <span class="search-clear-btn">
- <svg (click)="clearSearch()" [lucideIcon]="icons.LucideX" class="fs-lg" role="button"></svg>
- </span>
- }
- <button [ngModel]="this.store.currentSearch().fullText"
- (ngModelChange)="toggleFullText()"
- [tooltip]="'Search for content'|translate:locale.language"
- placement="bottom"
- class="btn btn-custom"
- role="button"
- type="button"
- btnCheckbox>
- <svg [lucideIcon]="icons.LucideType"></svg>
- </button>
- </div>
-
- </div>
- <button (click)="goTo(null, selectedId)"
- [disabled]="selectedId === null"
- class="search-go-to-btn d-none d-md-block btn btn-default"
- [tooltip]="'Go to' | translate:locale.language"
- type="button">
- <svg [lucideIcon]="icons.LucideMapPin"></svg>
- </button>
- <!--Start Filter Button-->
- <app-input-filter class="d-none d-md-block ms-auto"></app-input-filter>
- <!--End Filter Button-->
-</div>
-<div appAutoResize class="search-results-list" role="list">
+<div appAutoResize [resizeOffset]="45" class="search-results-list" role="list">
@if (errorMessage) {
<div class="p-3 text-danger fw-500" l10nTranslate>{{ errorMessage }}</div>
}
- @for (f of this.store.filesSearch() | searchFilter:inputFilter.search(); track $index) {
- <article class="app-div-striped search-result-item"
- (click)="selectedId = $index"
- (appTap)="goTo(f)"
- [class.selected]="$index === selectedId">
+ @for (file of store.filesSearch() | searchFilter:navbarSearch.viewFilter(); track $index) {
+ <article
+ (click)="selectedId = $index"
+ (appTap)="goTo(file)"
+ [class.selected]="$index === selectedId"
+ class="app-div-striped search-result-item">
<div class="search-result-header d-flex align-items-start">
- <img [src]="f.mimeUrl" (error)="f.fallBackMimeUrl()" alt="" draggable="false" class="search-result-mime">
+ <img [src]="file.mimeUrl" (error)="file.fallBackMimeUrl()" alt="" draggable="false" class="search-result-mime">
<div class="search-result-meta d-flex flex-column">
- <span class="search-result-name text-truncate">{{ f.name }}</span>
- <app-file-location class="search-result-path" [location]="f"></app-file-location>
+ <span class="search-result-name text-truncate">{{ file.name }}</span>
+ <app-file-location class="search-result-path" [location]="file"></app-file-location>
</div>
</div>
- @if (f.matches?.length) {
+ @if (file.matches?.length) {
<div class="search-result-matches">
- @for (match of f.matches; track $index) {
+ @for (match of file.matches; track $index) {
<p class="search-result-match" [innerHTML]="match"></p>
}
</div>
diff --git a/frontend/src/app/applications/search/components/search.component.ts b/frontend/src/app/applications/search/components/search.component.ts
index 7f212e3c..06d25b88 100644
--- a/frontend/src/app/applications/search/components/search.component.ts
+++ b/frontend/src/app/applications/search/components/search.component.ts
@@ -1,107 +1,140 @@
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, computed, inject, Signal, ViewChild } from '@angular/core'
-import { FormsModule } from '@angular/forms'
-import { Router } from '@angular/router'
-import { LucideDynamicIcon, LucideLoader, LucideMapPin, LucideTrash2, LucideType, LucideX } from '@lucide/angular'
+import { Component, effect, inject } from '@angular/core'
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
+import { ActivatedRoute, type ParamMap, Router } from '@angular/router'
+import { LucideMapPin } from '@lucide/angular'
import { MIN_CHARS_TO_SEARCH } from '@sync-in-server/backend/src/applications/files/constants/indexing'
import type { SearchFilesDto } from '@sync-in-server/backend/src/applications/files/dto/file-operations.dto'
-import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
-import { ButtonCheckboxDirective } from 'ngx-bootstrap/buttons'
-import { TooltipDirective } from 'ngx-bootstrap/tooltip'
-import { FilterComponent } from '../../../common/components/filter.component'
-import { AutofocusDirective } from '../../../common/directives/auto-focus.directive'
+import { L10N_LOCALE, L10nLocale, L10nTranslateDirective } from 'angular-l10n'
+import { merge, of } from 'rxjs'
+import { catchError, finalize, map, switchMap, tap } from 'rxjs/operators'
import { AutoResizeDirective } from '../../../common/directives/auto-resize.directive'
import { TapDirective } from '../../../common/directives/tap.directive'
import { SearchFilterPipe } from '../../../common/pipes/search.pipe'
import { filterArray } from '../../../common/utils/functions'
import { LayoutService } from '../../../layout/layout.service'
+import { NAVBAR_SEARCH_MODE, type NavbarGlobalSearch } from '../../../layout/navbar/interfaces/navbar-search.interface'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { FileLocationComponent } from '../../files/components/utils/file-location.component'
import { FileContentModel } from '../../files/models/file-content.model'
import { FilesService } from '../../files/services/files.service'
import { SPACES_PATH } from '../../spaces/spaces.constants'
-import { SEARCH_ICON, SEARCH_PATH } from '../search.constants'
+import { SEARCH_ICON, SEARCH_PATH, SEARCH_QUERY_PARAM, SEARCH_TITLE } from '../search.constants'
@Component({
selector: 'app-files-search',
- imports: [
- FilterComponent,
- LucideDynamicIcon,
- L10nTranslatePipe,
- AutofocusDirective,
- ButtonCheckboxDirective,
- FormsModule,
- AutoResizeDirective,
- TooltipDirective,
- SearchFilterPipe,
- L10nTranslateDirective,
- TapDirective,
- FileLocationComponent
- ],
+ imports: [AutoResizeDirective, SearchFilterPipe, L10nTranslateDirective, TapDirective, FileLocationComponent],
templateUrl: './search.component.html'
})
export class SearchComponent {
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly store = inject(StoreService)
- public searchContent: Signal<string> = computed(() => this.store.currentSearch().content)
- protected readonly icons = { SEARCH_ICON, LucideLoader, LucideTrash2, LucideX, LucideType, LucideMapPin }
- protected minCharsToSearch = MIN_CHARS_TO_SEARCH
- protected loading = false
+ protected readonly navbarSearch = inject(NavbarSearchService)
+ protected readonly icons = { LucideMapPin }
protected errorMessage: string = null
protected selectedId: number = null
private readonly router = inject(Router)
+ private readonly activatedRoute = inject(ActivatedRoute)
private readonly layout = inject(LayoutService)
private readonly filesService = inject(FilesService)
constructor() {
this.layout.setBreadcrumbIcon(SEARCH_ICON)
- this.layout.setBreadcrumbNav({ url: `/${SEARCH_PATH.BASE}`, translating: false, sameLink: true })
+ this.updateBreadcrumb()
+
+ effect(() => {
+ this.navbarSearch.viewFilter()
+ this.selectedId = null
+ })
+
+ merge(
+ this.activatedRoute.queryParamMap.pipe(map((params) => ({ search: this.searchFromParams(params), reuseCache: true }))),
+ this.navbarSearch.refreshGlobalSearch.pipe(map((search) => ({ search, reuseCache: false })))
+ )
+ .pipe(
+ tap(({ search }) => {
+ this.selectedId = null
+ this.errorMessage = null
+ this.updateBreadcrumb(search?.content)
+ if (!search) {
+ this.store.currentSearch.set({ content: '', fullText: false })
+ this.navbarSearch.setLoading(false)
+ }
+ }),
+ switchMap(({ search, reuseCache }) => {
+ if (!search) return of({ files: [] as FileContentModel[], errorMessage: null, cachedSearch: null })
+
+ const request: SearchFilesDto = {
+ content: search.content,
+ fullText: search.mode === NAVBAR_SEARCH_MODE.CONTENT
+ }
+ if (reuseCache && this.hasCachedSearch(request)) {
+ return of({ files: this.store.filesSearch(), errorMessage: null, cachedSearch: request })
+ }
+
+ this.navbarSearch.setLoading(true)
+ return this.filesService.search(request).pipe(
+ map((files) => ({ files, errorMessage: null, cachedSearch: request })),
+ catchError((error: HttpErrorResponse) =>
+ of({ files: [] as FileContentModel[], errorMessage: this.searchErrorMessage(error), cachedSearch: null })
+ ),
+ finalize(() => this.navbarSearch.setLoading(false))
+ )
+ }),
+ takeUntilDestroyed()
+ )
+ .subscribe(({ files, errorMessage, cachedSearch }) => {
+ if (cachedSearch) {
+ this.store.currentSearch.set(cachedSearch)
+ } else if (errorMessage) {
+ this.store.currentSearch.set({ content: '', fullText: false })
+ }
+ this.store.filesSearch.set(files)
+ this.errorMessage = errorMessage
+ })
}
- setCurrentSearch(event: any) {
- this.store.currentSearch.update((s: SearchFilesDto) => ({ ...s, content: event.target.value }))
+ protected goTo(file?: FileContentModel, index?: number) {
+ if (!file) {
+ const files = this.store.filesSearch()
+ const query = this.navbarSearch.viewFilter()
+ const visibleFiles = query ? filterArray(query, files) : files
+ file = visibleFiles.find((_, fileIndex) => fileIndex === index)
+ }
+ if (!file) return
+ this.router.navigate([SPACES_PATH.SPACES, ...file.path.split('/')], { queryParams: { select: file.name } }).catch(console.error)
}
- doSearch() {
- if (this.searchContent().length < this.minCharsToSearch) {
- return
+ private searchFromParams(params: ParamMap): NavbarGlobalSearch | null {
+ const content = params.get(SEARCH_QUERY_PARAM.QUERY)?.trim() ?? ''
+ const mode = params.get(SEARCH_QUERY_PARAM.SCOPE)
+ if (content.length < MIN_CHARS_TO_SEARCH || (mode !== NAVBAR_SEARCH_MODE.NAME && mode !== NAVBAR_SEARCH_MODE.CONTENT)) {
+ return null
}
- this.errorMessage = null
- this.loading = true
- this.selectedId = null
- this.filesService.search(this.store.currentSearch()).subscribe({
- next: (fs: FileContentModel[]) => {
- this.store.filesSearch.set(fs)
- this.loading = false
- },
- error: (e: HttpErrorResponse) => {
- this.store.filesSearch.set([])
- this.errorMessage = e.error.message
- this.loading = false
- }
- })
+ return { content, mode }
}
- toggleFullText() {
- this.store.currentSearch.update((s: SearchFilesDto) => ({ ...s, fullText: !s.fullText }))
+ private hasCachedSearch(search: SearchFilesDto): boolean {
+ const cachedSearch = this.store.currentSearch()
+ return cachedSearch.content === search.content && cachedSearch.fullText === search.fullText
}
- clearSearch() {
- this.store.currentSearch.update((s: SearchFilesDto) => ({ ...s, content: '' }))
- this.store.filesSearch.set([])
+ private updateBreadcrumb(searchName?: string) {
+ this.layout.setBreadcrumbNav({
+ url: `/${SEARCH_PATH.BASE}/${SEARCH_TITLE}`,
+ sameLink: true,
+ mutateLevel: {
+ 0: {
+ setTitle: searchName || SEARCH_TITLE,
+ translateTitle: !searchName
+ }
+ }
+ })
}
- goTo(f?: FileContentModel, index?: number) {
- if (!f) {
- const files = this.store.filesSearch()
- const query = this.inputFilter?.search?.() ?? ''
- const visibleFiles = query ? filterArray(query, files) : files
- f = visibleFiles.find((_, i) => i === index)
- }
- if (!f) {
- return
- }
- this.router.navigate([SPACES_PATH.SPACES, ...f.path.split('/')], { queryParams: { select: f.name } }).catch(console.error)
+ private searchErrorMessage(error: HttpErrorResponse): string {
+ const message = error.error?.message ?? error.message
+ return Array.isArray(message) ? message.join(' & ') : `${message}`
}
}
diff --git a/frontend/src/app/applications/search/search.constants.ts b/frontend/src/app/applications/search/search.constants.ts
index 0a74b8f2..d5c84739 100644
--- a/frontend/src/app/applications/search/search.constants.ts
+++ b/frontend/src/app/applications/search/search.constants.ts
@@ -7,12 +7,18 @@ export const SEARCH_PATH = {
BASE: 'search'
} as const
+export const SEARCH_QUERY_PARAM = {
+ QUERY: 'q',
+ SCOPE: 'scope'
+} as const
+
export const SEARCH_TITLE = 'Search'
export const SEARCH_ICON: LucideIcon = LucideSearch
export const SEARCH_MENU: AppMenu = {
title: SEARCH_TITLE,
link: SEARCH_PATH.BASE,
+ matchLink: /^search(?:\?|$)/,
icon: SEARCH_ICON,
navigationMenu: SPACES_MENU
} as const
diff --git a/frontend/src/app/applications/search/search.routes.ts b/frontend/src/app/applications/search/search.routes.ts
index d290e70a..a80b47bd 100644
--- a/frontend/src/app/applications/search/search.routes.ts
+++ b/frontend/src/app/applications/search/search.routes.ts
@@ -2,5 +2,9 @@ import { Routes } from '@angular/router'
import { SEARCH_PATH } from './search.constants'
export const searchRoutes: Routes = [
- { path: SEARCH_PATH.BASE, loadComponent: () => import('./components/search.component').then((c) => c.SearchComponent) }
+ {
+ path: SEARCH_PATH.BASE,
+ loadComponent: () => import('./components/search.component').then((c) => c.SearchComponent),
+ data: { navbarViewSearch: true }
+ }
]
diff --git a/frontend/src/app/applications/shares/components/shared.component.html b/frontend/src/app/applications/shares/components/shared.component.html
index c40d4a77..ea8e5a21 100644
--- a/frontend/src/app/applications/shares/components/shared.component.html
+++ b/frontend/src/app/applications/shares/components/shared.component.html
@@ -28,11 +28,6 @@
<svg [lucideIcon]="icons.LucideMapPin"></svg>
</button>
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadShares()"
class="d-none d-sm-block btn btn-default me-1"
[tooltip]="'Refresh' | translate:locale.language"
@@ -56,7 +51,7 @@
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[childHeight]="galleryMode.dimensions"
[childWidth]="galleryMode.dimensions"
- [items]="shares | searchFilter:inputFilter.search()"
+ [items]="shares | searchFilter:navbarSearch.viewFilter()"
[galleryMode]="true"
[resizeOffset]="115">
<div class="row g-0" tabindex="-1">
@@ -132,7 +127,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="shares | searchFilter:inputFilter.search()">
+ [items]="shares | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (s of scrollView?.viewPortItems; track s.id) {
diff --git a/frontend/src/app/applications/shares/components/shared.component.ts b/frontend/src/app/applications/shares/components/shared.component.ts
index 3e44bdd4..79ce5b19 100644
--- a/frontend/src/app/applications/shares/components/shared.component.ts
+++ b/frontend/src/app/applications/shares/components/shared.component.ts
@@ -22,7 +22,6 @@ import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipModule } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
import { BadgeMembersComponent } from '../../../common/components/badge-members.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -32,6 +31,7 @@ import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { TAB_MENU } from '../../../layout/layout.interfaces'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { SPACES_ICON, SPACES_PATH, SPACES_TITLE } from '../../spaces/spaces.constants'
import { ShareFileModel } from '../models/share-file.model'
@@ -49,7 +49,6 @@ import { ShareRepositoryComponent } from './utils/share-repository.component'
L10nTranslateDirective,
L10nTranslatePipe,
NavigationViewComponent,
- FilterComponent,
SearchFilterPipe,
TooltipModule,
VirtualScrollComponent,
@@ -67,12 +66,12 @@ export class SharedComponent implements OnInit {
viewPortItems: ShareFileModel[]
scrollInto: (arg: ShareFileModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly icons = {
SHARED: SPACES_ICON.SHARED_WITH_OTHERS_2,
SHARES: SPACES_ICON.SHARES,
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.html b/frontend/src/app/applications/spaces/components/spaces-browser.component.html
index 2044845e..546462e5 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.html
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.html
@@ -201,11 +201,6 @@
</div>
<!--End Actions Button-->
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadFiles()"
class="d-none d-sm-block btn btn-default me-1"
[tooltip]="'Refresh' | translate:locale.language"
@@ -230,7 +225,7 @@
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[childHeight]="galleryMode.dimensions"
[childWidth]="galleryMode.dimensions"
- [items]="files | searchFilter:inputFilter.search():'name'"
+ [items]="files | searchFilter:navbarSearch.viewFilter():'name'"
[galleryMode]="true"
[resizeOffset]="115">
<div *ngTemplateOutlet="CommonMessages"></div>
@@ -403,7 +398,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="files | searchFilter:inputFilter.search():'name'">
+ [items]="files | searchFilter:navbarSearch.viewFilter():'name'">
<div *ngTemplateOutlet="CommonMessages"></div>
<table class="app-table">
<tbody id="table-files" tabindex="-1">
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
index 6491ab1e..c6ed8948 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
@@ -49,7 +49,6 @@ import { Subscription } from 'rxjs'
import { take } from 'rxjs/operators'
import { SERVICE_UNAVAILABLE_ERROR } from '../../../app.constants'
import { BadgePermissionsComponent } from '../../../common/components/badge-permissions.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { InputEditDirective } from '../../../common/directives/input-edit.directive'
@@ -63,6 +62,7 @@ import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { dragClass, tableTrSelectedClass } from '../../../layout/layout.constants'
import { TAB_MENU } from '../../../layout/layout.interfaces'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { FAVORITES_ICON } from '../../favorites/favorites.constants'
import { FilesCompressionDialogComponent } from '../../files/components/dialogs/files-compression-dialog.component'
@@ -97,7 +97,6 @@ const keyboardNavigationKeys: ReadonlySet<string> = new Set<KeyboardNavigationKe
LucideDynamicIcon,
TooltipModule,
BsDropdownModule,
- FilterComponent,
ToBytesPipe,
ContextMenuModule,
VirtualScrollComponent,
@@ -122,13 +121,13 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
scrollInto: (arg: FileModel | number) => void
itemsPerRow: number
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: any
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('MainReadOnlyContextMenu', { static: true }) mainReadOnlyContextMenu: ContextMenuComponent<any>
@ViewChild('FileContextMenu', { static: true }) fileContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
// Static
protected readonly icons = {
SPACES: SPACES_ICON.SPACES,
@@ -314,7 +313,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
this.forbiddenResource = false
this.locationNotFound = false
this.serviceError = false
- this.inputFilter.clear()
+ this.navbarSearch.clearViewFilter()
this.resetFilesSelection()
this.spacesBrowser.loadFiles().subscribe({
next: (spacesFiles: SpaceFiles) => {
@@ -839,7 +838,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
private getFilteredFiles(): FileModel[] {
- const search = this.inputFilter?.search()
+ const search = this.navbarSearch.viewFilter()
return search ? filterArray(search, this.files, 'name') : this.files
}
diff --git a/frontend/src/app/applications/spaces/components/spaces.component.html b/frontend/src/app/applications/spaces/components/spaces.component.html
index 52961707..78982119 100644
--- a/frontend/src/app/applications/spaces/components/spaces.component.html
+++ b/frontend/src/app/applications/spaces/components/spaces.component.html
@@ -30,11 +30,6 @@
<svg [lucideIcon]="icons.LucideAnchor"></svg>
</button>
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadSpaces()"
class="d-none d-sm-block btn btn-default me-1"
[tooltip]="'Refresh' | translate:locale.language"
@@ -59,7 +54,7 @@
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[childHeight]="galleryMode.dimensions"
[childWidth]="galleryMode.dimensions"
- [items]="spaces | searchFilter:inputFilter.search()"
+ [items]="spaces | searchFilter:navbarSearch.viewFilter()"
[galleryMode]="true"
[resizeOffset]="115">
<div class="row g-0" tabindex="-1">
@@ -139,7 +134,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="spaces | searchFilter:inputFilter.search()">
+ [items]="spaces | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (s of scrollView?.viewPortItems; track s.id) {
diff --git a/frontend/src/app/applications/spaces/components/spaces.component.ts b/frontend/src/app/applications/spaces/components/spaces.component.ts
index abbc609e..3780098e 100644
--- a/frontend/src/app/applications/spaces/components/spaces.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces.component.ts
@@ -22,7 +22,6 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
import { BadgeMembersComponent } from '../../../common/components/badge-members.component'
import { BadgePermissionsComponent } from '../../../common/components/badge-permissions.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -32,6 +31,7 @@ import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { TAB_MENU } from '../../../layout/layout.interfaces'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { SharedChildrenDialogComponent } from '../../shares/components/dialogs/shared-children-dialog.component'
import { UserAvatarStackComponent } from '../../users/components/utils/user-avatar-stack.component'
@@ -54,7 +54,6 @@ import { SpaceUserAnchorsDialogComponent } from './dialogs/space-user-anchors-di
L10nTranslatePipe,
ContextMenuModule,
NavigationViewComponent,
- FilterComponent,
SearchFilterPipe,
BadgePermissionsComponent,
TapDirective,
@@ -64,12 +63,12 @@ import { SpaceUserAnchorsDialogComponent } from './dialogs/space-user-anchors-di
})
export class SpacesComponent implements OnInit {
@ViewChild(VirtualScrollComponent) scrollView: { element: ElementRef; viewPortItems: SpaceModel[]; scrollInto: (arg: SpaceModel | number) => void }
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly SPACE_ROLE = SPACE_ROLE
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected galleryMode: ViewMode
diff --git a/frontend/src/app/applications/spaces/components/trash.component.html b/frontend/src/app/applications/spaces/components/trash.component.html
index 09df0eca..f5054704 100644
--- a/frontend/src/app/applications/spaces/components/trash.component.html
+++ b/frontend/src/app/applications/spaces/components/trash.component.html
@@ -1,11 +1,6 @@
<!--Start Top Menu-->
<div class="app-top-menu">
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="loadTrashBins()"
class="btn btn-default me-1"
[tooltip]="'Refresh' | translate:locale.language"
@@ -30,7 +25,7 @@
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[childHeight]="galleryMode.dimensions"
[childWidth]="galleryMode.dimensions"
- [items]="trashBins | searchFilter:inputFilter.search()"
+ [items]="trashBins | searchFilter:navbarSearch.viewFilter()"
[galleryMode]="true"
[resizeOffset]="115">
<div class="row g-0" tabindex="-1">
@@ -92,7 +87,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="trashBins | searchFilter:inputFilter.search()">
+ [items]="trashBins | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (t of scrollView?.viewPortItems; track t.id) {
diff --git a/frontend/src/app/applications/spaces/components/trash.component.ts b/frontend/src/app/applications/spaces/components/trash.component.ts
index 5b14bd8f..0bda6c39 100644
--- a/frontend/src/app/applications/spaces/components/trash.component.ts
+++ b/frontend/src/app/applications/spaces/components/trash.component.ts
@@ -6,7 +6,6 @@ import { ContextMenuComponent, ContextMenuModule } from '@perfectmemory/ngx-cont
import type { SpaceTrash } from '@sync-in-server/backend/src/applications/spaces/interfaces/space-trash.interface'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { TooltipModule } from 'ngx-bootstrap/tooltip'
-import { FilterComponent } from '../../../common/components/filter.component'
import { NavigationViewComponent, ViewMode } from '../../../common/components/navigation-view/navigation-view.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
@@ -16,6 +15,7 @@ import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { TAB_MENU } from '../../../layout/layout.interfaces'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { TrashModel } from '../models/trash.model'
import { SpacesService } from '../services/spaces.service'
@@ -27,7 +27,6 @@ import { SPACES_ICON, SPACES_PATH, SPACES_TITLE } from '../spaces.constants'
LucideDynamicIcon,
NavigationViewComponent,
L10nTranslatePipe,
- FilterComponent,
TooltipModule,
KeyValuePipe,
VirtualScrollComponent,
@@ -40,12 +39,12 @@ import { SPACES_ICON, SPACES_PATH, SPACES_TITLE } from '../spaces.constants'
})
export class TrashComponent implements OnInit {
@ViewChild(VirtualScrollComponent) scrollView: { element: ElementRef; viewPortItems: TrashModel[]; scrollInto: (arg: TrashModel | number) => void }
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
SPACES: SPACES_ICON.SPACES,
diff --git a/frontend/src/app/applications/spaces/spaces.routes.ts b/frontend/src/app/applications/spaces/spaces.routes.ts
index 41e7c71e..0bcf8133 100644
--- a/frontend/src/app/applications/spaces/spaces.routes.ts
+++ b/frontend/src/app/applications/spaces/spaces.routes.ts
@@ -14,28 +14,28 @@ export const spacesRoutes: Routes = [
pathMatch: 'full',
loadComponent: () => import('./components/spaces.component').then((c) => c.SpacesComponent),
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.SPACES }
+ data: { repository: SPACES_PATH.SPACES, navbarViewSearch: true }
},
{
path: SPACES_PATH.TRASH,
pathMatch: 'full',
loadComponent: () => import('./components/trash.component').then((c) => c.TrashComponent),
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.TRASHES }
+ data: { repository: SPACES_PATH.TRASHES, navbarViewSearch: true }
},
{
path: SPACES_PATH.SHARED,
pathMatch: 'full',
loadComponent: () => import('../shares/components/shared.component').then((c) => c.SharedComponent),
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.SHARED }
+ data: { repository: SPACES_PATH.SHARED, navbarViewSearch: true }
},
{
path: SPACES_PATH.LINKS,
pathMatch: 'full',
loadComponent: () => import('../links/components/links.component').then((c) => c.LinksComponent),
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.LINKS }
+ data: { repository: SPACES_PATH.LINKS, navbarViewSearch: true }
},
{
path: SPACES_PATH.SPACES_FILES,
@@ -44,7 +44,7 @@ export const spacesRoutes: Routes = [
path: '**',
loadComponent: loadSpacesBrowserComponent,
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.FILES }
+ data: { repository: SPACES_PATH.FILES, navbarViewSearch: true }
}
]
},
@@ -55,7 +55,7 @@ export const spacesRoutes: Routes = [
path: '**',
loadComponent: loadSpacesBrowserComponent,
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.SHARES }
+ data: { repository: SPACES_PATH.SHARES, navbarViewSearch: true }
}
]
},
@@ -66,7 +66,7 @@ export const spacesRoutes: Routes = [
path: '**',
loadComponent: loadSpacesBrowserComponent,
resolve: { routes: spacesResolver },
- data: { repository: SPACES_PATH.TRASH }
+ data: { repository: SPACES_PATH.TRASH, navbarViewSearch: true }
}
]
}
diff --git a/frontend/src/app/applications/sync/components/sync-paths.component.html b/frontend/src/app/applications/sync/components/sync-paths.component.html
index 4e516b7b..05364a2e 100644
--- a/frontend/src/app/applications/sync/components/sync-paths.component.html
+++ b/frontend/src/app/applications/sync/components/sync-paths.component.html
@@ -129,18 +129,13 @@
</ul>
</div>
</div>
- <!--Start Filter Button-->
<div class="d-flex align-items-center ms-auto">
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
<button (click)="onRefresh()"
[tooltip]="'Refresh' | translate:locale.language"
class="d-none d-sm-block btn btn-default" type="button">
<svg [lucideIcon]="icons.LucideRotateCw"></svg>
</button>
</div>
- <!--End Filter Button-->
</div>
<table class="app-table">
<thead>
@@ -165,10 +160,10 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="store.clientSyncPaths() | searchFilter:inputFilter.search():'name'">
+ [items]="store.clientSyncPaths() | searchFilter:navbarSearch.viewFilter():'name'">
<table class="app-table">
<tbody tabindex="-1">
- @for (s of store.clientSyncPaths() | searchFilter:inputFilter.search(); track s.id) {
+ @for (s of store.clientSyncPaths() | searchFilter:navbarSearch.viewFilter(); track s.id) {
<tr (click)="onSelect(s)"
(contextmenu)="onSyncPathContextMenu($event, s)"
(dblclick)="openSettingsDialog()"
diff --git a/frontend/src/app/applications/sync/components/sync-paths.component.ts b/frontend/src/app/applications/sync/components/sync-paths.component.ts
index 13f2ae5c..b91461e3 100644
--- a/frontend/src/app/applications/sync/components/sync-paths.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-paths.component.ts
@@ -26,7 +26,6 @@ import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } fr
import { BsDropdownDirective, BsDropdownMenuDirective, BsDropdownToggleDirective } from 'ngx-bootstrap/dropdown'
import { TooltipDirective } from 'ngx-bootstrap/tooltip'
import { Subscription } from 'rxjs'
-import { FilterComponent } from '../../../common/components/filter.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { AutoResizeDirective } from '../../../common/directives/auto-resize.directive'
import { TableHeaderConfig } from '../../../common/interfaces/table.interface'
@@ -35,6 +34,7 @@ import { SearchFilterPipe } from '../../../common/pipes/search.pipe'
import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { CLIENT_SCHEDULER_STATE } from '../constants/client'
import { SyncStatus } from '../interfaces/sync-status.interface'
@@ -56,7 +56,6 @@ import { LiveTimeAgoPipe } from '../../../common/pipes/time-ago-live.pipe'
BsDropdownDirective,
BsDropdownToggleDirective,
BsDropdownMenuDirective,
- FilterComponent,
ContextMenuModule,
SearchFilterPipe,
SyncPathDirectionIconComponent,
@@ -77,7 +76,6 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
scrollInto: (arg: SyncPathModel | number) => void
}
@ViewChild(AutoResizeDirective, { static: true }) autoResize: AutoResizeDirective
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('SyncPathContextMenu', { static: true }) syncPathContextMenu: ContextMenuComponent<any>
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
// data
@@ -86,6 +84,7 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
public allSyncsRunning = false
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly store = inject(StoreService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
LucideCalendarX,
diff --git a/frontend/src/app/applications/sync/components/sync-transfers.component.html b/frontend/src/app/applications/sync/components/sync-transfers.component.html
index f080ec25..01c3db8a 100644
--- a/frontend/src/app/applications/sync/components/sync-transfers.component.html
+++ b/frontend/src/app/applications/sync/components/sync-transfers.component.html
@@ -17,11 +17,6 @@
</select>
</div>
<div class="d-flex align-items-center ms-auto">
- <!--Start Filter Button-->
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
- <!--End Filter Button-->
<button (click)="refresh()"
[tooltip]="'Refresh' | translate:locale.language"
class="btn btn-default me-1"
diff --git a/frontend/src/app/applications/sync/components/sync-transfers.component.ts b/frontend/src/app/applications/sync/components/sync-transfers.component.ts
index 297ba4b8..a52e6277 100644
--- a/frontend/src/app/applications/sync/components/sync-transfers.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-transfers.component.ts
@@ -7,12 +7,12 @@ import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } fr
import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipDirective } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
-import { FilterComponent } from '../../../common/components/filter.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TableHeaderConfig } from '../../../common/interfaces/table.interface'
import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { StoreService } from '../../../store/store.service'
import { SyncTransfer } from '../interfaces/sync-transfer.interface'
import { SyncPathModel } from '../models/sync-path.model'
@@ -23,16 +23,7 @@ import { SyncTransfersDeleteDialogComponent } from './dialogs/sync-transfers-del
@Component({
selector: 'app-sync-transfers',
- imports: [
- FormsModule,
- L10nTranslateDirective,
- L10nTranslatePipe,
- TooltipDirective,
- VirtualScrollComponent,
- LucideDynamicIcon,
- FilterComponent,
- KeyValuePipe
- ],
+ imports: [FormsModule, L10nTranslateDirective, L10nTranslatePipe, TooltipDirective, VirtualScrollComponent, LucideDynamicIcon, KeyValuePipe],
templateUrl: 'sync-transfers.component.html'
})
export class SyncTransfersComponent {
@@ -42,11 +33,11 @@ export class SyncTransfersComponent {
viewPortItems: SyncTransferModel[]
scrollInto: (arg: SyncTransferModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
public action: string = null
public syncPathSelected: SyncPathModel = null
public transfers: SyncTransferModel[] = []
protected readonly store = inject(StoreService)
+ protected readonly navbarSearch = inject(NavbarSearchService)
// Sort
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected tableHeaders: Record<'action' | 'sync' | 'file' | 'date', TableHeaderConfig> = {
@@ -109,7 +100,7 @@ export class SyncTransfersComponent {
sameLink: true
})
effect(() => {
- this.doSearch(this.inputFilter.search())
+ this.doSearch(this.navbarSearch.viewFilter())
})
this.checkRouteState()
if (this.focusOnSyncPathErrorsId) {
diff --git a/frontend/src/app/applications/sync/sync.routes.ts b/frontend/src/app/applications/sync/sync.routes.ts
index 35d2cfc5..0d7e036f 100644
--- a/frontend/src/app/applications/sync/sync.routes.ts
+++ b/frontend/src/app/applications/sync/sync.routes.ts
@@ -14,12 +14,14 @@ export const syncRoutes: Routes = [
{
path: SYNC_PATH.PATHS,
pathMatch: 'full',
- loadComponent: () => import('./components/sync-paths.component').then((c) => c.SyncPathsComponent)
+ loadComponent: () => import('./components/sync-paths.component').then((c) => c.SyncPathsComponent),
+ data: { navbarViewSearch: true }
},
{
path: SYNC_PATH.TRANSFERS,
pathMatch: 'full',
- loadComponent: () => import('./components/sync-transfers.component').then((c) => c.SyncTransfersComponent)
+ loadComponent: () => import('./components/sync-transfers.component').then((c) => c.SyncTransfersComponent),
+ data: { navbarViewSearch: true }
},
{ path: SYNC_PATH.WIZARD, pathMatch: 'full', redirectTo: `${SYNC_PATH.WIZARD}/${SYNC_PATH.WIZARD_CLIENT}` },
{
diff --git a/frontend/src/app/applications/users/components/user-groups.component.html b/frontend/src/app/applications/users/components/user-groups.component.html
index 69049a5d..53cb3651 100644
--- a/frontend/src/app/applications/users/components/user-groups.component.html
+++ b/frontend/src/app/applications/users/components/user-groups.component.html
@@ -43,11 +43,7 @@
</ul>
</div>
}
- <!--Start Filter Button-->
<div class="d-flex align-items-center ms-auto">
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
<button (click)="refresh()"
class="btn btn-default"
[tooltip]="'Refresh' | translate:locale.language"
@@ -55,7 +51,6 @@
<svg [lucideIcon]="icons.LucideRotateCw" [class]="loading ? 'icon-spin' : ''"></svg>
</button>
</div>
- <!--End Filter Button-->
</div>
<!--End Top Menu-->
<!--Start Table Files Content-->
@@ -82,7 +77,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="members | searchFilter:inputFilter.search()">
+ [items]="members | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (m of scrollView?.viewPortItems; track m.mid) {
diff --git a/frontend/src/app/applications/users/components/user-groups.component.ts b/frontend/src/app/applications/users/components/user-groups.component.ts
index 1aec51b9..bdfb00ae 100644
--- a/frontend/src/app/applications/users/components/user-groups.component.ts
+++ b/frontend/src/app/applications/users/components/user-groups.component.ts
@@ -24,7 +24,6 @@ import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipDirective } from 'ngx-bootstrap/tooltip'
import { filter, take } from 'rxjs/operators'
import { BadgeMembersComponent } from '../../../common/components/badge-members.component'
-import { FilterComponent } from '../../../common/components/filter.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
import { TableHeaderConfig } from '../../../common/interfaces/table.interface'
@@ -33,6 +32,7 @@ import { TimeAgoPipe } from '../../../common/pipes/time-ago.pipe'
import { originalOrderKeyValue, pathFromRoutes } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { GroupBrowseModel } from '../models/group-browse.model'
import { MemberModel } from '../models/member.model'
import { USER_ICON, USER_PATH, USER_TITLE } from '../user.constants'
@@ -51,7 +51,6 @@ import { UserPersonalGroupLeaveDialogComponent } from './dialogs/user-personal-g
KeyValuePipe,
L10nTranslateDirective,
L10nTranslatePipe,
- FilterComponent,
SearchFilterPipe,
VirtualScrollComponent,
TooltipDirective,
@@ -71,10 +70,10 @@ export class UserGroupsComponent {
viewPortItems: MemberModel[]
scrollInto: (arg: MemberModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
GROUPS: USER_ICON.GROUPS,
diff --git a/frontend/src/app/applications/users/components/user-guests.component.html b/frontend/src/app/applications/users/components/user-guests.component.html
index f55fa360..44c716fc 100644
--- a/frontend/src/app/applications/users/components/user-guests.component.html
+++ b/frontend/src/app/applications/users/components/user-guests.component.html
@@ -14,11 +14,7 @@
type="button">
<svg [lucideIcon]="icons.LucidePencil"></svg>
</button>
- <!--Start Filter Button-->
<div class="d-flex align-items-center ms-auto">
- <div class="btn-group me-1">
- <app-input-filter class="d-none d-sm-block"></app-input-filter>
- </div>
<button (click)="loadGuests()"
class="btn btn-default"
[tooltip]="'Refresh' | translate:locale.language"
@@ -26,7 +22,6 @@
<svg [lucideIcon]="icons.LucideRotateCw" [class]="loading ? 'icon-spin' : ''"></svg>
</button>
</div>
- <!--End Filter Button-->
</div>
<!--End Top Menu-->
<!--Start Table Files Content-->
@@ -53,7 +48,7 @@
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
[bufferAmount]="5"
- [items]="guests | searchFilter:inputFilter.search()">
+ [items]="guests | searchFilter:navbarSearch.viewFilter()">
<table class="app-table">
<tbody tabindex="-1">
@for (u of scrollView?.viewPortItems; track u.id) {
diff --git a/frontend/src/app/applications/users/components/user-guests.component.ts b/frontend/src/app/applications/users/components/user-guests.component.ts
index d2a389ab..dac9325e 100644
--- a/frontend/src/app/applications/users/components/user-guests.component.ts
+++ b/frontend/src/app/applications/users/components/user-guests.component.ts
@@ -8,7 +8,6 @@ import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } fr
import { BsModalRef } from 'ngx-bootstrap/modal'
import { TooltipDirective } from 'ngx-bootstrap/tooltip'
import { take } from 'rxjs/operators'
-import { FilterComponent } from '../../../common/components/filter.component'
import { VirtualScrollComponent } from '../../../common/components/virtual-scroll.component'
import { TapDirective } from '../../../common/directives/tap.directive'
import { TableHeaderConfig } from '../../../common/interfaces/table.interface'
@@ -18,6 +17,7 @@ import { TimeDateFormatPipe } from '../../../common/pipes/time-date-format.pipe'
import { originalOrderKeyValue } from '../../../common/utils/functions'
import { SortSettings, SortTable } from '../../../common/utils/sort-table'
import { LayoutService } from '../../../layout/layout.service'
+import { NavbarSearchService } from '../../../layout/navbar/services/navbar-search.service'
import { GuestUserModel } from '../models/guest.model'
import { USER_ICON, USER_PATH, USER_TITLE } from '../user.constants'
import { UserService } from '../user.service'
@@ -29,7 +29,6 @@ import { UserAvatarStackComponent } from './utils/user-avatar-stack.component'
imports: [
LucideDynamicIcon,
L10nTranslatePipe,
- FilterComponent,
TooltipDirective,
KeyValuePipe,
L10nTranslateDirective,
@@ -49,10 +48,10 @@ export class UserGuestsComponent {
viewPortItems: GuestUserModel[]
scrollInto: (arg: GuestUserModel | number) => void
}
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = { LucideRotateCw, LucidePlus, LucidePencil, LucideArrowDown, LucideArrowUp, LucideKeyRound }
// Sort
diff --git a/frontend/src/app/applications/users/user.routes.ts b/frontend/src/app/applications/users/user.routes.ts
index 60639503..3032b0dc 100644
--- a/frontend/src/app/applications/users/user.routes.ts
+++ b/frontend/src/app/applications/users/user.routes.ts
@@ -25,6 +25,7 @@ export const userRoutes: Routes = [
{
path: '**',
resolve: { routes: routeResolver },
+ data: { navbarViewSearch: true },
loadComponent: () => import('./components/user-groups.component').then((c) => c.UserGroupsComponent)
}
]
@@ -32,7 +33,8 @@ export const userRoutes: Routes = [
{
path: USER_PATH.GUESTS,
canActivate: [onlyUserGuard],
- loadComponent: () => import('./components/user-guests.component').then((c) => c.UserGuestsComponent)
+ loadComponent: () => import('./components/user-guests.component').then((c) => c.UserGuestsComponent),
+ data: { navbarViewSearch: true }
},
{
path: USER_PATH.APPS,
diff --git a/frontend/src/app/layout/navbar/components/navbar-search.component.html b/frontend/src/app/layout/navbar/components/navbar-search.component.html
new file mode 100644
index 00000000..d7af54c3
--- /dev/null
+++ b/frontend/src/app/layout/navbar/components/navbar-search.component.html
@@ -0,0 +1,80 @@
+<div
+ aria-keyshortcuts="Control+D Meta+D Control+K Meta+K Control+B Meta+B"
+ class="navbar-search"
+ [class.navbar-search--mobile-open]="mobileOpen()">
+ <button
+ (click)="toggleMobileSearch()"
+ [attr.aria-expanded]="mobileOpen()"
+ [attr.aria-label]="'Search' | translate:locale.language"
+ class="navbar-search-mobile-toggle"
+ type="button">
+ <svg [lucideIcon]="icons.LucideSearch"></svg>
+ </button>
+
+ <div class="navbar-search-panel">
+ <div class="navbar-search-mode" dropdown>
+ <button
+ [attr.aria-label]="currentMode().label | translate:locale.language"
+ [attr.title]="currentMode().label | translate:locale.language"
+ class="navbar-search-mode-toggle"
+ dropdownToggle
+ type="button">
+ <svg [lucideIcon]="currentMode().icon"></svg>
+ <svg [lucideIcon]="icons.LucideChevronDown" class="navbar-search-mode-chevron"></svg>
+ </button>
+ <ul *dropdownMenu class="dropdown-menu navbar-search-mode-menu" role="menu">
+ @for (option of modes; track option.mode) {
+ <li role="none">
+ <button
+ (click)="selectMode(option.mode)"
+ [attr.aria-label]="option.label | translate:locale.language"
+ [attr.title]="option.label | translate:locale.language"
+ [class.active]="option.mode === search.mode()"
+ [disabled]="modeDisabled(option.mode)"
+ class="dropdown-item"
+ role="menuitem"
+ type="button">
+ <svg [lucideIcon]="option.icon"></svg>
+ <span>{{ option.label | translate:locale.language }}</span>
+ <kbd aria-hidden="true" class="navbar-search-mode-shortcut">{{ option.shortcut }}</kbd>
+ </button>
+ </li>
+ }
+ </ul>
+ </div>
+
+ <div
+ class="navbar-search-field"
+ [class.navbar-search-field--global]="globalMode()"
+ [class.navbar-search-field--has-query]="!!search.query()">
+ <input
+ #searchInput
+ (keyup.enter)="submit()"
+ (keyup.escape)="onEscape($event)"
+ [attr.aria-label]="currentMode().label | translate:locale.language"
+ [formControl]="searchControl"
+ [placeholder]="'Search' | translate:locale.language"
+ autocomplete="off"
+ type="search">
+ @if (search.query()) {
+ <button
+ (click)="clear()"
+ [attr.aria-label]="'Clear' | translate:locale.language"
+ class="navbar-search-clear"
+ type="button">
+ <svg [lucideIcon]="icons.LucideX"></svg>
+ </button>
+ }
+ @if (globalMode() && search.query()) {
+ <button
+ (click)="submit()"
+ [attr.aria-label]="'Search' | translate:locale.language"
+ [disabled]="!search.canSubmit()"
+ class="navbar-search-submit"
+ type="button">
+ <svg [class.icon-spin]="search.loading()" [lucideIcon]="search.loading() ? icons.LucideLoader : icons.LucideSearch"></svg>
+ </button>
+ }
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/app/layout/navbar/components/navbar-search.component.ts b/frontend/src/app/layout/navbar/components/navbar-search.component.ts
new file mode 100644
index 00000000..74f7922c
--- /dev/null
+++ b/frontend/src/app/layout/navbar/components/navbar-search.component.ts
@@ -0,0 +1,156 @@
+import { Component, computed, effect, ElementRef, HostListener, inject, signal, ViewChild } from '@angular/core'
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
+import { FormControl, ReactiveFormsModule } from '@angular/forms'
+import { NavigationStart, Router } from '@angular/router'
+import { LucideChevronDown, LucideDynamicIcon, LucideFunnel, LucideLoader, LucideSearch, LucideType, LucideX } from '@lucide/angular'
+import { L10N_LOCALE, L10nLocale, L10nTranslatePipe } from 'angular-l10n'
+import { BsDropdownModule } from 'ngx-bootstrap/dropdown'
+import { filter } from 'rxjs'
+import { isNavbarGlobalSearchMode, NAVBAR_SEARCH_MODE, type NavbarSearchOption } from '../interfaces/navbar-search.interface'
+import { NavbarSearchService } from '../services/navbar-search.service'
+
+@Component({
+ selector: 'app-navbar-search',
+ imports: [ReactiveFormsModule, LucideDynamicIcon, L10nTranslatePipe, BsDropdownModule],
+ templateUrl: 'navbar-search.component.html'
+})
+export class NavbarSearchComponent {
+ @ViewChild('searchInput', { static: true }) searchInput: ElementRef<HTMLInputElement>
+ protected readonly search = inject(NavbarSearchService)
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly searchControl = new FormControl('', { nonNullable: true })
+ protected readonly mobileOpen = signal(false)
+ protected readonly shortcutModifier = this.getShortcutModifier()
+ protected readonly modes: NavbarSearchOption[] = [
+ { mode: NAVBAR_SEARCH_MODE.VIEW, label: 'Current view', shortcut: `${this.shortcutModifier} D`, icon: LucideFunnel },
+ { mode: NAVBAR_SEARCH_MODE.NAME, label: 'Search for files', shortcut: `${this.shortcutModifier} K`, icon: LucideSearch },
+ { mode: NAVBAR_SEARCH_MODE.CONTENT, label: 'Search for content', shortcut: `${this.shortcutModifier} B`, icon: LucideType }
+ ]
+ protected readonly currentMode = computed(() => this.modes.find(({ mode }) => mode === this.search.mode()) ?? this.modes[1])
+ protected readonly globalMode = computed(() => isNavbarGlobalSearchMode(this.search.mode()))
+ protected readonly icons = { LucideChevronDown, LucideLoader, LucideSearch, LucideX }
+ private readonly host = inject<ElementRef<HTMLElement>>(ElementRef as any)
+ private readonly router = inject(Router)
+
+ constructor() {
+ effect(() => {
+ const query = this.search.query()
+ if (this.searchControl.value !== query) {
+ this.searchControl.setValue(query, { emitEvent: false })
+ }
+ })
+ this.searchControl.valueChanges.pipe(takeUntilDestroyed()).subscribe((query) => this.search.setQuery(query))
+ this.search.focusRequested.pipe(takeUntilDestroyed()).subscribe(() => this.openAndFocus())
+ this.router.events
+ .pipe(
+ filter((event) => event instanceof NavigationStart),
+ takeUntilDestroyed()
+ )
+ .subscribe(() => this.mobileOpen.set(false))
+ }
+
+ protected selectMode(mode: NAVBAR_SEARCH_MODE) {
+ this.activateMode(mode)
+ }
+
+ protected submit() {
+ if (this.search.mode() === NAVBAR_SEARCH_MODE.VIEW) {
+ this.search.flushViewFilter()
+ return
+ }
+ this.mobileOpen.set(false)
+ this.search.submitGlobalSearch().catch(console.error)
+ }
+
+ protected clear() {
+ this.search.clear()
+ this.focusInput()
+ }
+
+ protected onEscape(event: Event) {
+ if (this.search.query()) {
+ event.preventDefault()
+ this.clear()
+ return
+ }
+ this.mobileOpen.set(false)
+ }
+
+ protected toggleMobileSearch() {
+ this.mobileOpen.update((open) => !open)
+ if (this.mobileOpen()) this.focusInput()
+ }
+
+ protected modeDisabled(mode: NAVBAR_SEARCH_MODE): boolean {
+ return mode === NAVBAR_SEARCH_MODE.VIEW && !this.search.viewFilterEnabled()
+ }
+
+ @HostListener('document:keydown', ['$event'])
+ protected onDocumentKeydown(event: KeyboardEvent) {
+ if (
+ event.defaultPrevented ||
+ (!event.ctrlKey && !event.metaKey) ||
+ event.altKey ||
+ event.shiftKey ||
+ this.isEditableTarget(event.target) ||
+ document.querySelector('.modal.show')
+ ) {
+ return
+ }
+
+ let mode: NAVBAR_SEARCH_MODE
+ switch (event.key.toLowerCase()) {
+ case 'd':
+ mode = NAVBAR_SEARCH_MODE.VIEW
+ break
+ case 'k':
+ mode = NAVBAR_SEARCH_MODE.NAME
+ break
+ case 'b':
+ mode = NAVBAR_SEARCH_MODE.CONTENT
+ break
+ default:
+ return
+ }
+ if (mode === NAVBAR_SEARCH_MODE.VIEW && !this.search.viewFilterEnabled()) return
+
+ event.preventDefault()
+ event.stopPropagation()
+ this.activateMode(mode)
+ }
+
+ @HostListener('document:click', ['$event'])
+ protected onDocumentClick(event: MouseEvent) {
+ if (this.mobileOpen() && !this.host.nativeElement.contains(event.target as Node)) {
+ this.mobileOpen.set(false)
+ }
+ }
+
+ private openAndFocus() {
+ this.mobileOpen.set(true)
+ this.focusInput()
+ }
+
+ private activateMode(mode: NAVBAR_SEARCH_MODE) {
+ this.search
+ .openMode(mode)
+ .then(() => this.openAndFocus())
+ .catch(console.error)
+ }
+
+ private focusInput() {
+ setTimeout(() => this.searchInput.nativeElement.focus())
+ }
+
+ private isEditableTarget(target: EventTarget | null): boolean {
+ if (!(target instanceof HTMLElement)) return false
+ return target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName)
+ }
+
+ private getShortcutModifier(): '⌘' | 'Ctrl' {
+ if (typeof navigator === 'undefined') return 'Ctrl'
+
+ const platform = `${navigator.platform ?? ''} ${navigator.userAgent ?? ''}`
+ return /mac|iphone|ipad|ipod/i.test(platform) ? '⌘' : 'Ctrl'
+ }
+}
diff --git a/frontend/src/app/layout/navbar/interfaces/navbar-search.interface.ts b/frontend/src/app/layout/navbar/interfaces/navbar-search.interface.ts
new file mode 100644
index 00000000..ba971b00
--- /dev/null
+++ b/frontend/src/app/layout/navbar/interfaces/navbar-search.interface.ts
@@ -0,0 +1,25 @@
+import type { LucideIcon } from '@lucide/angular'
+
+export enum NAVBAR_SEARCH_MODE {
+ VIEW = 'view',
+ NAME = 'name',
+ CONTENT = 'content'
+}
+
+export type NavbarGlobalSearchMode = NAVBAR_SEARCH_MODE.NAME | NAVBAR_SEARCH_MODE.CONTENT
+
+export interface NavbarGlobalSearch {
+ content: string
+ mode: NavbarGlobalSearchMode
+}
+
+export interface NavbarSearchOption {
+ mode: NAVBAR_SEARCH_MODE
+ label: string
+ shortcut: string
+ icon: LucideIcon
+}
+
+export function isNavbarGlobalSearchMode(mode: NAVBAR_SEARCH_MODE): mode is NavbarGlobalSearchMode {
+ return mode === NAVBAR_SEARCH_MODE.NAME || mode === NAVBAR_SEARCH_MODE.CONTENT
+}
diff --git a/frontend/src/app/layout/navbar/navbar.component.html b/frontend/src/app/layout/navbar/navbar.component.html
index a2234e9d..69cdee15 100644
--- a/frontend/src/app/layout/navbar/navbar.component.html
+++ b/frontend/src/app/layout/navbar/navbar.component.html
@@ -1,5 +1,5 @@
<header class="main-header">
- <nav class="navbar navbar-content">
+ <nav class="navbar navbar-content" [class.navbar-content--search]="navbarSearch.searchRouteActive()">
@if (!leftSideBarIsOpen) {
<a (click)="toggleLeftSideBar()" class="navbar-button navbar-logo-button navbar-logo-button--delayed" role="button">
<span class="logo-container">
@@ -7,9 +7,12 @@
</span>
</a>
}
- <div class="navbar-breadcrumb">
- <app-breadcrumb></app-breadcrumb>
- </div>
+ @if (!navbarSearch.searchRouteActive()) {
+ <div class="navbar-breadcrumb">
+ <app-breadcrumb></app-breadcrumb>
+ </div>
+ }
+ <app-navbar-search></app-navbar-search>
<div class="navbar-right-side">
<div (click)="openSidebarUser()" class="menu">
<div class="d-flex align-items-center avatar">
diff --git a/frontend/src/app/layout/navbar/navbar.component.ts b/frontend/src/app/layout/navbar/navbar.component.ts
index 2d5fa43f..bad84fb5 100644
--- a/frontend/src/app/layout/navbar/navbar.component.ts
+++ b/frontend/src/app/layout/navbar/navbar.component.ts
@@ -6,14 +6,17 @@ import { StoreService } from '../../store/store.service'
import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'
import { TAB_MENU } from '../layout.interfaces'
import { LayoutService } from '../layout.service'
+import { NavbarSearchComponent } from './components/navbar-search.component'
+import { NavbarSearchService } from './services/navbar-search.service'
@Component({
selector: 'app-navbar',
templateUrl: 'navbar.component.html',
- imports: [BreadcrumbComponent]
+ imports: [BreadcrumbComponent, NavbarSearchComponent]
})
export class NavBarComponent implements OnDestroy {
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
+ protected readonly navbarSearch = inject(NavbarSearchService)
protected leftSideBarIsOpen = true
protected user: UserType
protected userAvatar: string = null
diff --git a/frontend/src/app/layout/navbar/services/navbar-search.service.ts b/frontend/src/app/layout/navbar/services/navbar-search.service.ts
new file mode 100644
index 00000000..53fb8d86
--- /dev/null
+++ b/frontend/src/app/layout/navbar/services/navbar-search.service.ts
@@ -0,0 +1,189 @@
+import { computed, inject, Injectable, signal } from '@angular/core'
+import { NavigationEnd, Router } from '@angular/router'
+import { MIN_CHARS_TO_SEARCH } from '@sync-in-server/backend/src/applications/files/constants/indexing'
+import { filter, Subject } from 'rxjs'
+import { SEARCH_PATH, SEARCH_QUERY_PARAM } from '../../../applications/search/search.constants'
+import { StoreService } from '../../../store/store.service'
+import {
+ isNavbarGlobalSearchMode,
+ NAVBAR_SEARCH_MODE,
+ type NavbarGlobalSearch,
+ type NavbarGlobalSearchMode
+} from '../interfaces/navbar-search.interface'
+
+@Injectable({ providedIn: 'root' })
+export class NavbarSearchService {
+ public readonly minimumCharacters = MIN_CHARS_TO_SEARCH
+ private readonly modeState = signal<NAVBAR_SEARCH_MODE>(NAVBAR_SEARCH_MODE.NAME)
+ private readonly queryState = signal('')
+ private readonly viewFilterState = signal('')
+ private readonly viewFilterEnabledState = signal(false)
+ private readonly loadingState = signal(false)
+ private readonly searchRouteActiveState = signal(false)
+ private readonly focusRequestedSubject = new Subject<void>()
+ private readonly refreshGlobalSearchSubject = new Subject<NavbarGlobalSearch>()
+ private readonly router = inject(Router)
+ private readonly store = inject(StoreService)
+ private viewFilterTimeoutId: ReturnType<typeof setTimeout> | null = null
+
+ public readonly mode = this.modeState.asReadonly()
+ public readonly query = this.queryState.asReadonly()
+ public readonly viewFilter = this.viewFilterState.asReadonly()
+ public readonly viewFilterEnabled = this.viewFilterEnabledState.asReadonly()
+ public readonly loading = this.loadingState.asReadonly()
+ public readonly searchRouteActive = this.searchRouteActiveState.asReadonly()
+ public readonly canSubmit = computed(() => isNavbarGlobalSearchMode(this.modeState()) && this.queryState().trim().length >= this.minimumCharacters)
+ public readonly focusRequested = this.focusRequestedSubject.asObservable()
+ public readonly refreshGlobalSearch = this.refreshGlobalSearchSubject.asObservable()
+
+ constructor() {
+ this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => this.synchronizeWithRoute())
+ queueMicrotask(() => this.synchronizeWithRoute())
+ }
+
+ setQuery(query: string) {
+ this.queryState.set(query)
+ if (this.modeState() === NAVBAR_SEARCH_MODE.VIEW) {
+ this.scheduleViewFilter(query)
+ }
+ }
+
+ setMode(mode: NAVBAR_SEARCH_MODE) {
+ if (mode === NAVBAR_SEARCH_MODE.VIEW && !this.viewFilterEnabledState()) {
+ return
+ }
+ this.cancelScheduledViewFilter()
+ this.modeState.set(mode)
+ this.viewFilterState.set(mode === NAVBAR_SEARCH_MODE.VIEW ? this.queryState() : '')
+ }
+
+ async openMode(mode: NAVBAR_SEARCH_MODE): Promise<void> {
+ this.setMode(mode)
+ if (!isNavbarGlobalSearchMode(mode) || this.isSearchRoute()) return
+
+ const cachedSearch = this.store.currentSearch()
+ const cachedMode = cachedSearch.fullText ? NAVBAR_SEARCH_MODE.CONTENT : NAVBAR_SEARCH_MODE.NAME
+ const cachedContent = cachedMode === mode ? cachedSearch.content.trim() : ''
+ await this.router.navigate([`/${SEARCH_PATH.BASE}`], {
+ queryParams: {
+ [SEARCH_QUERY_PARAM.QUERY]: cachedContent.length >= this.minimumCharacters ? cachedContent : null,
+ [SEARCH_QUERY_PARAM.SCOPE]: mode
+ }
+ })
+ }
+
+ async openLastSearch(): Promise<void> {
+ const cachedSearch = this.store.currentSearch()
+ const mode = cachedSearch.fullText ? NAVBAR_SEARCH_MODE.CONTENT : NAVBAR_SEARCH_MODE.NAME
+ if (this.isSearchRoute()) {
+ this.setMode(mode)
+ if (cachedSearch.content.trim().length >= this.minimumCharacters) {
+ this.queryState.set(cachedSearch.content)
+ }
+ return
+ }
+ await this.openMode(mode)
+ }
+
+ flushViewFilter() {
+ if (this.modeState() !== NAVBAR_SEARCH_MODE.VIEW) return
+ this.cancelScheduledViewFilter()
+ this.viewFilterState.set(this.queryState())
+ }
+
+ clear() {
+ this.cancelScheduledViewFilter()
+ this.queryState.set('')
+ this.viewFilterState.set('')
+ }
+
+ clearViewFilter() {
+ this.cancelScheduledViewFilter()
+ this.viewFilterState.set('')
+ if (this.modeState() === NAVBAR_SEARCH_MODE.VIEW) {
+ this.queryState.set('')
+ }
+ }
+
+ setLoading(loading: boolean) {
+ this.loadingState.set(loading)
+ }
+
+ requestFocus() {
+ this.focusRequestedSubject.next()
+ }
+
+ async submitGlobalSearch(): Promise<void> {
+ const mode = this.modeState()
+ const content = this.queryState().trim()
+ if (!isNavbarGlobalSearchMode(mode) || content.length < this.minimumCharacters) return
+
+ this.queryState.set(content)
+ const navigated = await this.router.navigate([`/${SEARCH_PATH.BASE}`], {
+ queryParams: {
+ [SEARCH_QUERY_PARAM.QUERY]: content,
+ [SEARCH_QUERY_PARAM.SCOPE]: mode
+ }
+ })
+ if (!navigated) {
+ this.refreshGlobalSearchSubject.next({ content, mode })
+ }
+ }
+
+ private synchronizeWithRoute() {
+ let route = this.router.routerState.snapshot.root
+ while (route.firstChild) route = route.firstChild
+
+ const viewFilterEnabled = route.data['navbarViewSearch'] === true
+ const isSearchRoute = route.routeConfig?.path === SEARCH_PATH.BASE
+ const queryParams = this.router.parseUrl(this.router.url).queryParamMap
+ const content = queryParams.get(SEARCH_QUERY_PARAM.QUERY)?.trim() ?? ''
+ const routeMode = this.toGlobalMode(queryParams.get(SEARCH_QUERY_PARAM.SCOPE))
+
+ this.cancelScheduledViewFilter()
+ this.searchRouteActiveState.set(isSearchRoute)
+ this.viewFilterEnabledState.set(viewFilterEnabled)
+ this.viewFilterState.set('')
+
+ if (isSearchRoute) {
+ this.modeState.set(routeMode ?? NAVBAR_SEARCH_MODE.NAME)
+ this.queryState.set(content)
+ if (!content) {
+ this.loadingState.set(false)
+ queueMicrotask(() => this.requestFocus())
+ }
+ return
+ }
+
+ this.loadingState.set(false)
+ this.modeState.set(viewFilterEnabled ? NAVBAR_SEARCH_MODE.VIEW : NAVBAR_SEARCH_MODE.NAME)
+ this.queryState.set('')
+ }
+
+ private isSearchRoute(): boolean {
+ let route = this.router.routerState.snapshot.root
+ while (route.firstChild) route = route.firstChild
+ return route.routeConfig?.path === SEARCH_PATH.BASE
+ }
+
+ private toGlobalMode(mode: string | null): NavbarGlobalSearchMode | null {
+ if (mode === NAVBAR_SEARCH_MODE.NAME || mode === NAVBAR_SEARCH_MODE.CONTENT) return mode
+ return null
+ }
+
+ private scheduleViewFilter(query: string) {
+ this.cancelScheduledViewFilter()
+ this.viewFilterTimeoutId = setTimeout(() => {
+ if (this.modeState() === NAVBAR_SEARCH_MODE.VIEW) {
+ this.viewFilterState.set(query)
+ }
+ this.viewFilterTimeoutId = null
+ }, 300)
+ }
+
+ private cancelScheduledViewFilter() {
+ if (this.viewFilterTimeoutId === null) return
+ clearTimeout(this.viewFilterTimeoutId)
+ this.viewFilterTimeoutId = null
+ }
+}
diff --git a/frontend/src/app/layout/sidebar/sidebar.left.component.html b/frontend/src/app/layout/sidebar/sidebar.left.component.html
index 2d11b653..3c8d6ad2 100644
--- a/frontend/src/app/layout/sidebar/sidebar.left.component.html
+++ b/frontend/src/app/layout/sidebar/sidebar.left.component.html
@@ -25,7 +25,7 @@
</div>
<div class="apps-shortcuts">
@for (menu of appMenus; track $index) {
- @if (!menu.hide) {
+ @if (showAppShortcut(menu)) {
<button (click)="navigateToMenu(menu)"
(mouseenter)="previewMenuTitle(menu.title)"
(mouseleave)="restoreMenuTitle()"
diff --git a/frontend/src/app/layout/sidebar/sidebar.left.component.ts b/frontend/src/app/layout/sidebar/sidebar.left.component.ts
index 64cec702..fd5ba85d 100644
--- a/frontend/src/app/layout/sidebar/sidebar.left.component.ts
+++ b/frontend/src/app/layout/sidebar/sidebar.left.component.ts
@@ -16,6 +16,7 @@ import { AuthService } from '../../auth/auth.service'
import { StoreService } from '../../store/store.service'
import { AppMenu, AppMenuEntry, isAppMenu, isAppMenuSeparator } from '../layout.interfaces'
import { LayoutService } from '../layout.service'
+import { NavbarSearchService } from '../navbar/services/navbar-search.service'
@Component({
selector: 'app-sidebar-left',
@@ -34,6 +35,7 @@ export class SideBarLeftComponent implements OnDestroy {
private readonly router = inject(Router)
private readonly authService = inject(AuthService)
private readonly layout = inject(LayoutService)
+ private readonly navbarSearch = inject(NavbarSearchService)
private readonly userService = inject(UserService)
private readonly canPreviewMenuTitle = window.matchMedia('(hover: hover) and (pointer: fine)')
private subscriptions: Subscription[] = []
@@ -71,10 +73,15 @@ export class SideBarLeftComponent implements OnDestroy {
}
navigateToMenu(menu: AppMenu) {
- this.router.navigate([menu.link]).catch(console.error)
if (menu === SEARCH_MENU) {
this.closeSideBarOnMobile()
+ this.navbarSearch
+ .openLastSearch()
+ .then(() => this.navbarSearch.requestFocus())
+ .catch(console.error)
+ return
}
+ this.router.navigate([menu.link]).catch(console.error)
}
closeSideBarOnMobile() {
@@ -97,6 +104,12 @@ export class SideBarLeftComponent implements OnDestroy {
this.updateDynamicTitle()
}
+ protected showAppShortcut(menu: AppMenu): boolean {
+ if (menu.hide) return false
+ const visibleButtons = this.appMenus.filter((appMenu) => !appMenu.hide).length + (this.store.userImpersonate() ? 1 : 0)
+ return menu !== SEARCH_MENU || visibleButtons <= 4
+ }
+
protected get navigationSubmenus(): AppMenuEntry[] {
return (this.currentMenu?.navigationMenu ?? this.currentMenu)?.submenus ?? []
}
diff --git a/frontend/src/app/store/store.service.ts b/frontend/src/app/store/store.service.ts
index 29ceba28..a44de97e 100644
--- a/frontend/src/app/store/store.service.ts
+++ b/frontend/src/app/store/store.service.ts
@@ -84,6 +84,7 @@ export class StoreService {
this.filesActiveTasks.next([])
this.filesEndedTasks.next([])
this.filesRecents.set([])
+ this.currentSearch.set({ content: '', fullText: false })
this.filesSearch.set([])
this.commentsRecents.set([])
// Websocket
diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json
index d71d3cda..539a5350 100644
--- a/frontend/src/i18n/de.json
+++ b/frontend/src/i18n/de.json
@@ -26,6 +26,8 @@
"Filters": "Filter",
"search": "suchen",
"Search": "Suchen",
+ "Current view": "Aktuelle Ansicht",
+ "Clear": "Leeren",
"Search for content": "Nach Inhalten suchen",
"Search for files": "Nach Dateien suchen",
"Full-text search": "Volltextsuche",
diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json
index 29ee3cc9..75e515d2 100644
--- a/frontend/src/i18n/es.json
+++ b/frontend/src/i18n/es.json
@@ -26,6 +26,8 @@
"Filters": "Filtros",
"search": "buscar",
"Search": "Buscar",
+ "Current view": "Vista actual",
+ "Clear": "Limpiar",
"Search for content": "Buscar contenido",
"Search for files": "Buscar archivos",
"Full-text search": "Búsqueda de texto completo",
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index 5932e424..f01c7922 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -26,8 +26,10 @@
"Filters": "Filtres",
"search": "rechercher",
"Search": "Rechercher",
- "Search for content": "Rechercher du contenu",
- "Search for files": "Rechercher des fichiers",
+ "Current view": "Recherche dans la vue",
+ "Clear": "Effacer",
+ "Search for content": "Recherche de contenu",
+ "Search for files": "Recherche de fichiers",
"Full-text search": "Recherche full-text",
"Full-text search is disabled": "La recherche full-text est désactivée",
"Type to search for users or groups to add": "Tapez pour rechercher des utilisateurs ou des groupes à ajouter",
diff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.json
index acfef754..78e917e7 100644
--- a/frontend/src/i18n/hi.json
+++ b/frontend/src/i18n/hi.json
@@ -26,6 +26,8 @@
"Filters": "फ़िल्टर",
"search": "खोजें",
"Search": "खोजें",
+ "Current view": "वर्तमान दृश्य",
+ "Clear": "साफ़ करें",
"Search for content": "सामग्री खोजें",
"Search for files": "फ़ाइलें खोजें",
"Full-text search": "पूर्ण-पाठ खोज",
diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json
index 8627500a..1e7a4ea0 100644
--- a/frontend/src/i18n/it.json
+++ b/frontend/src/i18n/it.json
@@ -26,6 +26,8 @@
"Filters": "Filtri",
"search": "cerca",
"Search": "Cerca",
+ "Current view": "Vista corrente",
+ "Clear": "Cancella",
"Search for content": "Cerca contenuti",
"Search for files": "Cerca file",
"Full-text search": "Ricerca full-text",
diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.json
index 5843b662..d40e0482 100644
--- a/frontend/src/i18n/ja.json
+++ b/frontend/src/i18n/ja.json
@@ -26,6 +26,8 @@
"Filters": "フィルター",
"search": "検索",
"Search": "検索",
+ "Current view": "現在のビュー",
+ "Clear": "クリア",
"Search for content": "コンテンツを検索",
"Search for files": "ファイルを検索",
"Full-text search": "フルテキスト検索",
diff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.json
index beb08c2e..a4cf42ec 100644
--- a/frontend/src/i18n/ko.json
+++ b/frontend/src/i18n/ko.json
@@ -26,6 +26,8 @@
"Filters": "필터",
"search": "검색",
"Search": "검색",
+ "Current view": "현재 보기",
+ "Clear": "지우기",
"Search for content": "콘텐츠 검색",
"Search for files": "파일 검색",
"Full-text search": "전문 검색",
diff --git a/frontend/src/i18n/nl.json b/frontend/src/i18n/nl.json
index 0b201b35..b092e6b4 100644
--- a/frontend/src/i18n/nl.json
+++ b/frontend/src/i18n/nl.json
@@ -26,6 +26,8 @@
"Filters": "Filters",
"search": "zoeken",
"Search": "Zoeken",
+ "Current view": "Huidige weergave",
+ "Clear": "Wissen",
"Search for content": "Inhoud zoeken",
"Search for files": "Bestanden zoeken",
"Full-text search": "Volledige-tekst zoeken",
diff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.json
index 30019313..33e3c1d4 100644
--- a/frontend/src/i18n/pl.json
+++ b/frontend/src/i18n/pl.json
@@ -26,6 +26,8 @@
"Filters": "Filtry",
"search": "szukaj",
"Search": "Szukaj",
+ "Current view": "Bieżący widok",
+ "Clear": "Wyczyść",
"Search for content": "Szukaj treści",
"Search for files": "Szukaj plików",
"Full-text search": "Wyszukiwanie pełnotekstowe",
diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json
index 470329c9..75759c1f 100644
--- a/frontend/src/i18n/pt-BR.json
+++ b/frontend/src/i18n/pt-BR.json
@@ -26,6 +26,8 @@
"Filters": "Filtros",
"search": "pesquisar",
"Search": "Pesquisar",
+ "Current view": "Visualização atual",
+ "Clear": "Limpar",
"Search for content": "Pesquisar conteúdo",
"Search for files": "Pesquisar arquivos",
"Full-text search": "Pesquisa de texto completo",
diff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.json
index 38dbb0ec..f4e42b84 100644
--- a/frontend/src/i18n/pt.json
+++ b/frontend/src/i18n/pt.json
@@ -26,6 +26,8 @@
"Filters": "Filtros",
"search": "pesquisar",
"Search": "Pesquisar",
+ "Current view": "Vista atual",
+ "Clear": "Limpar",
"Search for content": "Pesquisar conteúdo",
"Search for files": "Pesquisar arquivos",
"Full-text search": "Pesquisa de texto completo",
diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.json
index ab630e5f..a60624cf 100644
--- a/frontend/src/i18n/ru.json
+++ b/frontend/src/i18n/ru.json
@@ -26,6 +26,8 @@
"Filters": "Фильтры",
"search": "поиск",
"Search": "Поиск",
+ "Current view": "Текущий вид",
+ "Clear": "Очистить",
"Search for content": "Поиск по содержимому",
"Search for files": "Поиск файлов",
"Full-text search": "Полнотекстовый поиск",
diff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.json
index 7b502be2..c555fbbd 100644
--- a/frontend/src/i18n/tr.json
+++ b/frontend/src/i18n/tr.json
@@ -26,6 +26,8 @@
"Filters": "Filtreler",
"search": "ara",
"Search": "Ara",
+ "Current view": "Geçerli görünüm",
+ "Clear": "Temizle",
"Search for content": "İçerik ara",
"Search for files": "Dosya ara",
"Full-text search": "Tam metin arama",
diff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.json
index 99f40246..e254e7f1 100644
--- a/frontend/src/i18n/zh.json
+++ b/frontend/src/i18n/zh.json
@@ -26,6 +26,8 @@
"Filters": "筛选器",
"search": "搜索",
"Search": "搜索",
+ "Current view": "当前视图",
+ "Clear": "清除",
"Search for content": "搜索内容",
"Search for files": "搜索文件",
"Full-text search": "全文搜索",
diff --git a/frontend/src/styles/components/_header.scss b/frontend/src/styles/components/_header.scss
index 4c0d8ae8..cd5a3237 100644
--- a/frontend/src/styles/components/_header.scss
+++ b/frontend/src/styles/components/_header.scss
@@ -93,9 +93,217 @@
overflow: hidden;
}
+ app-navbar-search {
+ position: relative;
+ display: block;
+ flex: 0 1 250px;
+ min-width: 190px;
+ padding: 0 .5rem;
+ }
+
+ &.navbar-content--search app-navbar-search {
+ flex-basis: 360px;
+ min-width: 280px;
+ margin-left: -.5px;
+ margin-right: auto;
+ border-left: .5px solid mix($sidebar-light-icons-menu-hover-bg, $primary, 50%);
+ }
+
+ .navbar-search {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ height: $navbar-height;
+ }
+
+ .navbar-search-mobile-toggle {
+ display: none;
+ align-items: center;
+ justify-content: center;
+ width: $sidebar-apps-icons-width;
+ height: $navbar-height;
+ padding: 0;
+ border: 0;
+ background: transparent;
+ color: $white;
+
+ > .lucide {
+ font-size: 1.1rem;
+ }
+ }
+
+ .navbar-search-panel {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ min-width: 0;
+ height: 32px;
+ border: 1px solid rgba($white, .34);
+ border-radius: $border-radius-base;
+ background: rgba($black, .12);
+ }
+
+ .navbar-search-mode {
+ flex: 0 0 auto;
+ height: 100%;
+ }
+
+ .navbar-search-mode-toggle {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: .15rem;
+ width: 2.5rem;
+ height: 100%;
+ padding: 0 .25rem;
+ border: 0;
+ border-right: 1px solid rgba($white, .26);
+ background: transparent;
+ color: $white;
+
+ &:hover,
+ &:focus {
+ background: rgba($black, .1);
+ }
+
+ > .lucide:first-child {
+ font-size: $font-size-md;
+ }
+ }
+
+ .navbar-search-mode-chevron {
+ flex: 0 0 auto;
+ font-size: .625rem;
+ }
+
+ .navbar-search-mode-menu {
+ min-width: 15rem !important;
+ padding: .25rem;
+
+ .dropdown-item {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ gap: .35rem;
+ width: 100%;
+ height: 2rem;
+ padding: 0 .5rem;
+ border-radius: $border-radius-base;
+
+ > .lucide {
+ font-size: $font-size-md;
+ }
+
+ > span {
+ flex: 1 1 auto;
+ font-size: $font-size-sm;
+ white-space: nowrap;
+ }
+
+ &:disabled {
+ opacity: .45;
+ }
+ }
+ }
+
+ .navbar-search-mode-shortcut {
+ display: inline-flex;
+ flex: 0 0 auto;
+ align-items: center;
+ justify-content: center;
+ min-width: 2.75rem;
+ height: 1.35rem;
+ margin-left: .5rem;
+ padding: 0 .3rem;
+ border: 1px solid rgba($gray, .4);
+ border-radius: $border-radius-base;
+ background: rgba($gray, .12);
+ color: inherit;
+ font-family: inherit;
+ font-size: .65rem;
+ font-weight: 500;
+ line-height: 1;
+ white-space: nowrap;
+ }
+
+ .navbar-search-field {
+ position: relative;
+ display: flex;
+ flex: 1 1 auto;
+ min-width: 0;
+ height: 100%;
+
+ input {
+ width: 100%;
+ min-width: 0;
+ height: 100%;
+ padding: 0 .65rem;
+ border: 0;
+ outline: 0;
+ background: transparent;
+ color: $white;
+ font-size: $font-size-sm;
+
+ &::placeholder {
+ color: rgba($white, .72);
+ opacity: 1;
+ }
+
+ &::-webkit-search-cancel-button {
+ appearance: none;
+ }
+ }
+
+ &.navbar-search-field--has-query input {
+ padding-right: 2rem;
+ }
+
+ &.navbar-search-field--global.navbar-search-field--has-query input {
+ padding-right: 4rem;
+ }
+ }
+
+ .navbar-search-clear,
+ .navbar-search-submit {
+ position: absolute;
+ top: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 2rem;
+ height: 100%;
+ padding: 0;
+ border: 0;
+ background: transparent;
+ color: rgba($white, .82);
+
+ &:hover:not(:disabled),
+ &:focus:not(:disabled) {
+ color: $white;
+ background: rgba($black, .1);
+ }
+ }
+
+ .navbar-search-clear {
+ right: 0;
+ }
+
+ .navbar-search-field--global .navbar-search-clear {
+ right: 2rem;
+ }
+
+ .navbar-search-submit {
+ right: 0;
+ border-left: 1px solid rgba($white, .2);
+
+ &:disabled {
+ opacity: .4;
+ }
+ }
+
.navbar-right-side {
display: flex;
- margin-left: auto;
+ margin-left: 0;
flex: 0 0 auto;
min-width: $sidebar-apps-icons-width;
@@ -123,6 +331,78 @@
}
}
}
+
+ @include media-breakpoint-down(md) {
+ app-navbar-search {
+ flex-basis: 210px;
+ min-width: 180px;
+ }
+
+ &.navbar-content--search app-navbar-search {
+ flex-basis: 300px;
+ min-width: 240px;
+ }
+ }
+
+ @include media-breakpoint-down(sm) {
+ app-navbar-search {
+ flex: 0 0 $sidebar-apps-icons-width;
+ min-width: $sidebar-apps-icons-width;
+ padding: 0;
+ }
+
+ &.navbar-content--search app-navbar-search {
+ flex: 1 1 auto;
+ min-width: 0;
+ padding: 0 .5rem;
+ }
+
+ &.navbar-content--search {
+ .navbar-search-mobile-toggle {
+ display: none;
+ }
+
+ .navbar-search-panel {
+ position: static;
+ right: auto;
+ left: auto;
+ display: flex;
+ width: 100%;
+ height: 32px;
+ margin: 0;
+ border-color: rgba($white, .34);
+ background: rgba($black, .12);
+ box-shadow: none;
+ }
+ }
+
+ .navbar-search-mobile-toggle {
+ display: flex;
+
+ &:hover,
+ &:focus {
+ background-color: $sidebar-light-icons-menu-hover-bg;
+ }
+ }
+
+ .navbar-search-panel {
+ position: fixed;
+ top: $navbar-height;
+ right: 0;
+ left: 0;
+ display: none;
+ width: auto;
+ height: 42px;
+ margin: .4rem;
+ border-color: rgba($white, .5);
+ background: $primary;
+ box-shadow: 0 .35rem 1rem rgba($black, .28);
+ }
+
+ .navbar-search--mobile-open .navbar-search-panel {
+ display: flex;
+ }
+ }
}
diff --git a/frontend/src/styles/components/_search.scss b/frontend/src/styles/components/_search.scss
index 14020e2e..80c604c2 100644
--- a/frontend/src/styles/components/_search.scss
+++ b/frontend/src/styles/components/_search.scss
@@ -2,24 +2,6 @@
padding: 0.2rem 0.25rem 0.4rem;
}
-.search-input {
- padding-right: 2rem;
-}
-
-.search-clear-btn {
- position: absolute;
- top: 50%;
- right: 45px;
- z-index: 1001;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- transform: translateY(-50%);
- font-size: $font-size-md;
- line-height: 1;
- cursor: pointer;
-}
-
.search-go-to-btn {
margin-left: 0.3rem;
}