adding mocked detail data for frontend viewing. placeholders for settings panels. Add dialog panel for Details setings.

pull/28/head
Jason Kulatunga 4 years ago
parent 5101a37964
commit e6eeaf7e31

File diff suppressed because it is too large Load Diff

@ -2,7 +2,11 @@ import { Injectable } from '@angular/core';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { TreoMockApi } from '@treo/lib/mock-api/mock-api.interfaces'; import { TreoMockApi } from '@treo/lib/mock-api/mock-api.interfaces';
import { TreoMockApiService } from '@treo/lib/mock-api/mock-api.service'; import { TreoMockApiService } from '@treo/lib/mock-api/mock-api.service';
import { details as detailsData } from 'app/data/mock/device/details/data'; import { sda } from 'app/data/mock/device/details/sda';
import { sdb } from 'app/data/mock/device/details/sdb';
import { sdc } from 'app/data/mock/device/details/sdc';
import { sdd } from 'app/data/mock/device/details/sdd';
import { sde } from 'app/data/mock/device/details/sde';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -21,9 +25,6 @@ export class DetailsMockApi implements TreoMockApi
private _treoMockApiService: TreoMockApiService private _treoMockApiService: TreoMockApiService
) )
{ {
// Set the data
this._details = detailsData;
// Register the API endpoints // Register the API endpoints
this.register(); this.register();
} }
@ -37,16 +38,53 @@ export class DetailsMockApi implements TreoMockApi
*/ */
register(): void register(): void
{ {
// -----------------------------------------------------------------------------------------------------
// @ Sales - GET
// -----------------------------------------------------------------------------------------------------
this._treoMockApiService this._treoMockApiService
.onGet('/api/device/:wwn/details') .onGet('/api/device/0x5002538e40a22954/details')
.reply(() => {
return [
200,
_.cloneDeep(sda)
];
});
this._treoMockApiService
.onGet('/api/device/0x5000cca264eb01d7/details')
.reply(() => {
return [
200,
_.cloneDeep(sdb)
];
});
this._treoMockApiService
.onGet('/api/device/0x5000cca264ec3183/details')
.reply(() => {
return [
200,
_.cloneDeep(sdc)
];
});
this._treoMockApiService
.onGet('/api/device/0x5000cca252c859cc/details')
.reply(() => {
return [
200,
_.cloneDeep(sdd)
];
});
this._treoMockApiService
.onGet('/api/device/0x5000cca264ebc248/details')
.reply(() => { .reply(() => {
return [ return [
200, 200,
_.cloneDeep(this._details) _.cloneDeep(sde)
]; ];
}); });
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -5,10 +5,10 @@
<div class="flex flex-col gt-xs:flex-row"> <div class="flex flex-col gt-xs:flex-row">
<mat-form-field class="flex-auto gt-xs:pr-3"> <mat-form-field class="flex-auto gt-xs:pr-3">
<mat-label>Sort By</mat-label> <mat-label>Sort By</mat-label>
<mat-select> <mat-select [value]="'status'">
<mat-option value="option1">Status</mat-option> <mat-option value="status">Status</mat-option>
<mat-option value="option2" disabled>Name</mat-option> <mat-option value="name" disabled>Name</mat-option>
<mat-option value="option3" disabled>Label</mat-option> <mat-option value="label" disabled>Label</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
@ -20,7 +20,7 @@
<div class="flex flex-col mt-5 gt-md:flex-row"> <div class="flex flex-col mt-5 gt-md:flex-row">
<mat-form-field class="flex-auto gt-md:pr-3"> <mat-form-field class="flex-auto gt-md:pr-3">
<mat-label>Critical Error Threshold</mat-label> <mat-label>Critical Error Threshold</mat-label>
<input matInput> <input matInput [value]="'10%'">
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-auto gt-md:pl-3"> <mat-form-field class="flex-auto gt-md:pl-3">
<mat-label>Critical Warning Threshold</mat-label> <mat-label>Critical Warning Threshold</mat-label>
@ -31,11 +31,11 @@
<div class="flex flex-col gt-md:flex-row"> <div class="flex flex-col gt-md:flex-row">
<mat-form-field class="flex-auto gt-md:pr-3"> <mat-form-field class="flex-auto gt-md:pr-3">
<mat-label>Error Threshold</mat-label> <mat-label>Error Threshold</mat-label>
<input matInput> <input matInput [value]="'20%'">
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-auto gt-md:pl-3"> <mat-form-field class="flex-auto gt-md:pl-3">
<mat-label>Warning Threshold</mat-label> <mat-label>Warning Threshold</mat-label>
<input matInput> <input matInput [value]="'10%'">
</mat-form-field> </mat-form-field>
</div> </div>
@ -45,7 +45,7 @@
<div class="flex flex-col mt-5 gt-md:flex-row"> <div class="flex flex-col mt-5 gt-md:flex-row">
<mat-form-field class="flex-auto gt-md:pr-3"> <mat-form-field class="flex-auto gt-md:pr-3">
<mat-label>Critical Error Threshold</mat-label> <mat-label>Critical Error Threshold</mat-label>
<input matInput> <input matInput [value]="'enabled'">
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-auto gt-md:pl-3"> <mat-form-field class="flex-auto gt-md:pl-3">
<mat-label>Critical Warning Threshold</mat-label> <mat-label>Critical Warning Threshold</mat-label>
@ -58,7 +58,7 @@
<div class="flex flex-col mt-5 gt-md:flex-row"> <div class="flex flex-col mt-5 gt-md:flex-row">
<mat-form-field class="flex-auto gt-md:pr-3"> <mat-form-field class="flex-auto gt-md:pr-3">
<mat-label>Critical Error Threshold</mat-label> <mat-label>Critical Error Threshold</mat-label>
<input matInput> <input matInput [value]="'enabled'">
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-auto gt-md:pl-3"> <mat-form-field class="flex-auto gt-md:pl-3">
<mat-label>Critical Warning Threshold</mat-label> <mat-label>Critical Warning Threshold</mat-label>
@ -73,10 +73,5 @@
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions align="end"> <mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button> <button mat-button mat-dialog-close>Cancel</button>
<button mat-button [mat-dialog-close]="true" cdkFocusInitial>Save</button> <button mat-button matTooltip="not yet implemented" [mat-dialog-close]="true" cdkFocusInitial>Save</button>
</mat-dialog-actions> </mat-dialog-actions>
<!-- Copyright 2020 Google LLC. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license -->

@ -14,6 +14,7 @@ import { MatButtonToggleModule} from "@angular/material/button-toggle";
import {MatTabsModule} from "@angular/material/tabs"; import {MatTabsModule} from "@angular/material/tabs";
import {MatSliderModule} from "@angular/material/slider"; import {MatSliderModule} from "@angular/material/slider";
import {MatSlideToggleModule} from "@angular/material/slide-toggle"; import {MatSlideToggleModule} from "@angular/material/slide-toggle";
import {MatTooltipModule} from "@angular/material/tooltip";
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -30,6 +31,7 @@ import {MatSlideToggleModule} from "@angular/material/slide-toggle";
MatInputModule, MatInputModule,
MatButtonToggleModule, MatButtonToggleModule,
MatTabsModule, MatTabsModule,
MatTooltipModule,
MatSliderModule, MatSliderModule,
MatSlideToggleModule, MatSlideToggleModule,
SharedModule SharedModule

@ -0,0 +1,30 @@
<h2 mat-dialog-title>Scrutiny Settings</h2>
<mat-dialog-content class="mat-typography">
<form class="flex flex-col p-8 pb-0 ">
<div class="flex flex-col gt-xs:flex-row">
<mat-form-field class="flex-auto gt-xs:pr-3">
<mat-label>Threshold Data</mat-label>
<mat-select [value]="'scrutiny'">
<mat-option value="scrutiny">Scrutiny</mat-option>
<mat-option value="name" disabled>Manufacturer</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="flex flex-col gt-xs:flex-row">
<mat-form-field class="flex-auto gt-xs:pr-3">
<mat-label>Notifications</mat-label>
<mat-select [value]="'enable'">
<mat-option value="enable">Enabled</mat-option>
<mat-option value="disable" disabled>Disabled</mat-option>
</mat-select>
</mat-form-field>
</div>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-button matTooltip="not yet implemented" [mat-dialog-close]="true" cdkFocusInitial>Save</button>
</mat-dialog-actions>

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DetailSettingsComponent } from './detail-settings.component';
describe('DetailSettingsComponent', () => {
let component: DetailSettingsComponent;
let fixture: ComponentFixture<DetailSettingsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DetailSettingsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DetailSettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-detail-settings',
templateUrl: './detail-settings.component.html',
styleUrls: ['./detail-settings.component.scss']
})
export class DetailSettingsComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

@ -0,0 +1,46 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { Overlay } from '@angular/cdk/overlay';
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY, MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatSelectModule } from '@angular/material/select';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { SharedModule } from 'app/shared/shared.module';
import {DetailSettingsComponent} from 'app/layout/common/detail-settings/detail-settings.component'
import { MatDialogModule } from "@angular/material/dialog";
import { MatButtonToggleModule} from "@angular/material/button-toggle";
import {MatTabsModule} from "@angular/material/tabs";
import {MatSliderModule} from "@angular/material/slider";
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
import {MatTooltipModule} from "@angular/material/tooltip";
@NgModule({
declarations: [
DetailSettingsComponent
],
imports : [
RouterModule.forChild([]),
MatAutocompleteModule,
MatDialogModule,
MatButtonModule,
MatSelectModule,
MatFormFieldModule,
MatIconModule,
MatInputModule,
MatButtonToggleModule,
MatTabsModule,
MatTooltipModule,
MatSliderModule,
MatSlideToggleModule,
SharedModule
],
exports : [
DetailSettingsComponent
],
providers : []
})
export class DetailSettingsModule
{
}

@ -16,7 +16,7 @@ const modules = [
@NgModule({ @NgModule({
declarations: [ declarations: [
LayoutComponent LayoutComponent,
], ],
imports : [ imports : [
TreoDrawerModule, TreoDrawerModule,

@ -17,7 +17,7 @@
<span class="ml-2">Export</span> <span class="ml-2">Export</span>
</button> </button>
<button class="ml-2 xs:hidden" <button class="ml-2 xs:hidden"
matTooltip="not yet implemented" (click)="openDialog()"
mat-stroked-button> mat-stroked-button>
<mat-icon class="icon-size-20 rotate-90 mirror" <mat-icon class="icon-size-20 rotate-90 mirror"
[svgIcon]="'tune'"></mat-icon> [svgIcon]="'tune'"></mat-icon>
@ -38,7 +38,7 @@
<span class="ml-2">Export</span> <span class="ml-2">Export</span>
</button> </button>
<button mat-menu-item <button mat-menu-item
matTooltip="not yet implemented"> (click)="openDialog()">
<mat-icon class="icon-size-20 rotate-90 mirror" <mat-icon class="icon-size-20 rotate-90 mirror"
[svgIcon]="'tune'"></mat-icon> [svgIcon]="'tune'"></mat-icon>
<span class="ml-2">Settings</span> <span class="ml-2">Settings</span>

@ -6,6 +6,8 @@ import {Subject} from "rxjs";
import {DetailService} from "./detail.service"; import {DetailService} from "./detail.service";
import {takeUntil} from "rxjs/operators"; import {takeUntil} from "rxjs/operators";
import {fadeOut} from "../../../@treo/animations/fade"; import {fadeOut} from "../../../@treo/animations/fade";
import {DetailSettingsComponent} from "app/layout/common/detail-settings/detail-settings.component";
import {MatDialog} from "@angular/material/dialog";
@Component({ @Component({
selector: 'detail', selector: 'detail',
@ -34,7 +36,9 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy {
* @param {DetailService} _detailService * @param {DetailService} _detailService
*/ */
constructor( constructor(
private _detailService: DetailService private _detailService: DetailService,
public dialog: MatDialog
) )
{ {
// Set the private defaults // Set the private defaults
@ -277,6 +281,15 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy {
this.smartAttributeDataSource.data = this._generateSmartAttributeTableDataSource(this.data.data.smart_results); this.smartAttributeDataSource.data = this._generateSmartAttributeTableDataSource(this.data.data.smart_results);
} }
openDialog() {
const dialogRef = this.dialog.open(DetailSettingsComponent);
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
/** /**
* Track by function for ngFor loops * Track by function for ngFor loops
* *

@ -13,6 +13,7 @@ import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip' import { MatTooltipModule } from '@angular/material/tooltip'
import { NgApexchartsModule } from 'ng-apexcharts'; import { NgApexchartsModule } from 'ng-apexcharts';
import { TreoCardModule } from '@treo/components/card'; import { TreoCardModule } from '@treo/components/card';
import {DetailSettingsModule} from "app/layout/common/detail-settings/detail-settings.module";
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -31,7 +32,7 @@ import { TreoCardModule } from '@treo/components/card';
NgApexchartsModule, NgApexchartsModule,
TreoCardModule, TreoCardModule,
SharedModule, SharedModule,
DetailSettingsModule,
] ]
}) })
export class DetailModule export class DetailModule

Loading…
Cancel
Save