diff --git a/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.html b/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.html index 98de073..ab2adc5 100644 --- a/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.html +++ b/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.html @@ -1,12 +1,22 @@ - + + -

No dashboards found.

-
- -
+ + +

No dashboards found.

+
+ +
+
+ - + + + test + - \ No newline at end of file + \ No newline at end of file diff --git a/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.ts b/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.ts index a76138d..3cd1e79 100644 --- a/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.ts +++ b/src/app/pages/overview/add-dashboard-dialog/add-dashboard-dialog.component.ts @@ -7,28 +7,95 @@ import { Component, OnInit, Input } from '@angular/core'; }) export class AddDashboardDialogComponent implements OnInit { - dashboards = [ - { - id: '0', - name: 'Dashboard1', - }, - { - id: '1', - name: 'Dashboard2', - }, - { - id: '2', - name: 'Dashboard3', - }, - { - id: '3', - name: 'Dashboard4', - }, - ]; + private searchWord; + private dashboards; + private staticDashboards; constructor() { } ngOnInit() { + this.staticDashboards = [ + { + id: '0', + name: 'Dashboard1', + }, + { + id: '1', + name: 'Dashboard2', + }, + { + id: '2', + name: 'Dashboard3', + }, + { + id: '3', + name: 'Dashboard4', + }, + { + id: '0', + name: 'Dashboard1', + }, + { + id: '1', + name: 'Dashboard2', + }, + { + id: '2', + name: 'Dashboard3', + }, + { + id: '3', + name: 'Dashboard4', + }, + { + id: '0', + name: 'Dashboard1', + }, + { + id: '1', + name: 'Dashboard2', + }, + { + id: '2', + name: 'Dashboard3', + }, + { + id: '3', + name: 'Dashboard4', + }, + ]; + this.dashboards = this.staticDashboards; } + handleSearch(v: any) { + const tempArr = new Array(); + for (const dashboard of this.staticDashboards) { + if (dashboard.name.indexOf(v) !== -1) { + tempArr.push(dashboard); + } + } + this.dashboards = tempArr; + } + + handleNewDashboard(v: any) { + this.searchWord = ''; + for (const dashboard of this.staticDashboards) { + if (dashboard.name === v) { + return; + } + } + // temporary + const newDash = { + id: '5', + name: v + }; + this.staticDashboards.push(newDash); + + this.handleSearch(''); + } + + handleCleanSearch() { + this.searchWord = ''; + this.handleSearch(''); + } } diff --git a/src/app/pages/overview/overview-page.component.html b/src/app/pages/overview/overview-page.component.html index bb23c69..d90362f 100644 --- a/src/app/pages/overview/overview-page.component.html +++ b/src/app/pages/overview/overview-page.component.html @@ -1,5 +1,4 @@
-
@@ -18,9 +17,13 @@
+
+ +
+
-
+

Activities

@@ -41,5 +44,4 @@
-
\ No newline at end of file diff --git a/src/app/pages/overview/overview-page.module.ts b/src/app/pages/overview/overview-page.module.ts index 317e95e..dc2a59a 100644 --- a/src/app/pages/overview/overview-page.module.ts +++ b/src/app/pages/overview/overview-page.module.ts @@ -12,6 +12,7 @@ import { SensorItemFilterComponent } from '../../commons/component/sensor-item-f import { NgxChartsModule } from '@swimlane/ngx-charts'; import { HostSummaryCardComponent } from '../../commons/component/host-summary-card/host-summary-card.component'; import { AppSummaryCardComponent } from '../../commons/component/app-summary-card/app-summary-card.component'; +import { FormsModule } from '@angular/forms'; @NgModule({ imports: [ @@ -20,7 +21,8 @@ import { AppSummaryCardComponent } from '../../commons/component/app-summary-car DashboardCardModule, MaterialModule, PerfectScrollbarModule, - NgxChartsModule + NgxChartsModule, + FormsModule ], declarations: [ OverviewPageComponent,