From 3d4e7fed78b6169c103f97e462a4a7d41a555a29 Mon Sep 17 00:00:00 2001 From: Mojtaba Erfan Rad Date: Mon, 9 Sep 2024 15:33:39 +0330 Subject: [PATCH] fix(search-nodes): node now have filter based on category (#49) --- .../category/category.component.html | 9 +++++++ .../search-nodes/search-nodes.component.html | 15 ++++++++++- .../search-nodes/search-nodes.component.scss | 4 +++ .../search-nodes/search-nodes.component.ts | 26 ++++++++++++++++++- src/app/graph/model/Category.ts | 5 ++++ .../services/category/category.service.ts | 12 ++++++++- .../assign-file/assign-file.component.html | 9 +++++++ .../manage-users/manage-users.component.html | 9 +++++++ 8 files changed, 86 insertions(+), 3 deletions(-) diff --git a/src/app/graph/components/category/category.component.html b/src/app/graph/components/category/category.component.html index 4f7f658..b92a93f 100644 --- a/src/app/graph/components/category/category.component.html +++ b/src/app/graph/components/category/category.component.html @@ -22,6 +22,15 @@ } + + + diff --git a/src/app/graph/components/data-analysis/search-nodes/search-nodes.component.html b/src/app/graph/components/data-analysis/search-nodes/search-nodes.component.html index 95e0910..7f3c5c2 100644 --- a/src/app/graph/components/data-analysis/search-nodes/search-nodes.component.html +++ b/src/app/graph/components/data-analysis/search-nodes/search-nodes.component.html @@ -22,6 +22,19 @@ search + + Category + + All categories + @for (category of allCategories; track category) { + {{ category.name }} + } + +
@for (account of accounts; track $index) {
- } + }@empty {

No nodes Found!

} (); nodeName$!: Observable; + category = ''; constructor( private _snackBar: MatSnackBar, private loadGraphService: LoadGraphService, private dialog: MatDialog, - private loadingService: LoadingService + private loadingService: LoadingService, + private categoryService: CategoryService ) {} ngOnInit(): void { @@ -73,6 +78,21 @@ export class SearchNodesComponent implements OnInit { }, }); }); + + this.categoryService.getAllCategories().subscribe({ + next: (data) => { + this.allCategories = data; + this.loadingService.setLoading(false); + }, + error: (error) => { + this._snackBar.openFromComponent(DangerSuccessNotificationComponent, { + data: error.error.message, + panelClass: ['notification-class-danger'], + duration: 2000, + }); + this.loadingService.setLoading(false); + }, + }); } searchNodes() { @@ -113,4 +133,8 @@ export class SearchNodesComponent implements OnInit { this.length = e.length; this.loadGraphService.getAllNodes(e.pageIndex); } + + categoryChanged() { + this.loadGraphService.getAllNodes(0, this.category); + } } diff --git a/src/app/graph/model/Category.ts b/src/app/graph/model/Category.ts index 4141d51..7ec01eb 100644 --- a/src/app/graph/model/Category.ts +++ b/src/app/graph/model/Category.ts @@ -9,3 +9,8 @@ export interface GetCategoriesResponse { pageIndex: number; totalCount: number; } + +export interface AllCategories { + id: number; + name: string; +} diff --git a/src/app/graph/services/category/category.service.ts b/src/app/graph/services/category/category.service.ts index 2e5dc35..15f102c 100644 --- a/src/app/graph/services/category/category.service.ts +++ b/src/app/graph/services/category/category.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { environment } from '../../../../../api-config/api-url'; import { Subject } from 'rxjs'; -import { GetCategoriesResponse } from '../../model/Category'; +import { AllCategories, GetCategoriesResponse } from '../../model/Category'; import { LoadingService } from '../../../shared/services/loading.service'; @Injectable({ @@ -66,4 +66,14 @@ export class CategoryService { withCredentials: true, }); } + + getAllCategories() { + this.loadingService.setLoading(true); + return this.httpClient.get( + this.apiUrl + `/all-category-without-pagination`, + { + withCredentials: true, + } + ); + } } diff --git a/src/app/user/components/dashboard/assign-file/assign-file.component.html b/src/app/user/components/dashboard/assign-file/assign-file.component.html index de87ca1..e078875 100644 --- a/src/app/user/components/dashboard/assign-file/assign-file.component.html +++ b/src/app/user/components/dashboard/assign-file/assign-file.component.html @@ -1,6 +1,15 @@
+ No category Found! +
id {{ element.id }}
+ + + diff --git a/src/app/user/components/dashboard/manage-users/manage-users.component.html b/src/app/user/components/dashboard/manage-users/manage-users.component.html index ac7a652..758508c 100644 --- a/src/app/user/components/dashboard/manage-users/manage-users.component.html +++ b/src/app/user/components/dashboard/manage-users/manage-users.component.html @@ -5,6 +5,15 @@ person_addAdd new user
+ No file found! +
Name {{ element.fileName }}
+ + +
+ No user found! +
Username {{ element.userName }}