From f205ce14c1c1baee4c75edf6d0b056b4761a86da Mon Sep 17 00:00:00 2001 From: Jesse Lucas Date: Fri, 3 Apr 2020 16:08:07 -0400 Subject: [PATCH] start of progress indicator and animation --- src/app/app.module.ts | 4 ++- src/app/dashboard/dashboard.component.html | 3 ++- src/app/dashboard/dashboard.component.ts | 30 ++++++++++++++++++++-- src/app/services/progress.service.spec.ts | 16 ++++++++++++ src/app/services/progress.service.ts | 9 +++++++ 5 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 src/app/services/progress.service.spec.ts create mode 100644 src/app/services/progress.service.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2a8d96159..68868de2b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { HttpClientModule, HttpClientXsrfModule } from '@angular/common/http'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatTableModule } from '@angular/material/table'; import { MatPaginatorModule } from '@angular/material/paginator'; @@ -8,13 +9,13 @@ import { MatSortModule } from '@angular/material/sort'; import { MatInputModule } from '@angular/material/input'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { MatCardModule } from '@angular/material/card'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; import { FlexLayoutModule } from '@angular/flex-layout'; import { httpInterceptorProviders } from './http-interceptors'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { StatusListComponent } from './lists/status-list/status-list.component'; import { DeviceListComponent } from './lists/device-list/device-list.component'; import { DonutChartComponent } from './charts/donut-chart/donut-chart.component'; @@ -52,6 +53,7 @@ import { FolderListComponent } from './lists/folder-list/folder-list.component'; MatSortModule, MatButtonToggleModule, MatCardModule, + MatProgressBarModule, FlexLayoutModule, HttpClientModule, HttpClientXsrfModule.withOptions({ diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 6af4bc21d..9f5d68c2c 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -7,7 +7,8 @@ Tech UI -
+ +
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 2ea56b163..2ead0006b 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -1,4 +1,11 @@ import { Component, OnInit } from '@angular/core'; +import { + trigger, + state, + style, + animate, + transition, +} from '@angular/animations'; import { SystemConfigService } from '../services/system-config.service'; import { StType } from '../type'; import { FilterService } from '../services/filter.service'; @@ -7,11 +14,28 @@ import { FilterService } from '../services/filter.service'; selector: 'app-dashboard', templateUrl: './dashboard.component.html', styleUrls: ['./dashboard.component.scss'], - providers: [FilterService] + providers: [FilterService], + animations: [ + trigger('loading', [ + state('start', style({ + marginTop: '100px', + })), + state('done', style({ + marginTop: '0px', + })), + transition('open => closed', [ + animate('1s') + ]), + transition('closed => open', [ + animate('0.5s') + ]), + ]), + ] }) -export class DashboardComponent { +export class DashboardComponent implements OnInit { folderChart: StType = StType.Folder; deviceChart: StType = StType.Device; + isLoading: boolean = true; constructor(private systemConfigService: SystemConfigService) { } @@ -21,5 +45,7 @@ export class DashboardComponent { err => console.error('Observer got an error: ' + err), () => console.log('Observer got a complete notification') ); + + this.isLoading = false; } } diff --git a/src/app/services/progress.service.spec.ts b/src/app/services/progress.service.spec.ts new file mode 100644 index 000000000..79d482a8f --- /dev/null +++ b/src/app/services/progress.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ProgressService } from './progress.service'; + +describe('ProgressService', () => { + let service: ProgressService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ProgressService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/progress.service.ts b/src/app/services/progress.service.ts new file mode 100644 index 000000000..23420fc16 --- /dev/null +++ b/src/app/services/progress.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class ProgressService { + + constructor() { } +}