Verified Commit 0f4e1c83 authored by uncol's avatar uncol
Browse files

clarity added

parent f860f68e
Pipeline #20663 passed with stages
in 6 minutes and 9 seconds
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"version": 1,
"newProjectRoot": "projects",
"projects": {
"noc-ui": {
......@@ -24,9 +24,14 @@
"src/assets"
],
"styles": [
"node_modules/@clr/icons/clr-icons.min.css",
"node_modules/@clr/ui/clr-ui.min.css",
"src/styles.css"
],
"scripts": []
"scripts": [
"node_modules/@webcomponents/custom-elements/custom-elements.min.js",
"node_modules/@clr/icons/clr-icons.min.js"
]
},
"configurations": {
"production": {
......@@ -119,6 +124,7 @@
}
}
}
}},
}
},
"defaultProject": "noc-ui"
}
}
\ No newline at end of file
This diff is collapsed.
import { Component } from '@angular/core';
import { ClrCommonStringsService } from '@clr/angular';
import { ExtJSResponse, MoService, Pending } from './services/mo.service';
@Component({
selector: 'noc-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
selector: 'noc-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'noc-ui';
readonly response$: Pending<ExtJSResponse>;
title = 'noc-ui';
collapsed = true;
constructor(
dataService: MoService,
public commonStrings: ClrCommonStringsService
) {
this.response$ = dataService.loadMO();
}
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { ClarityModule } from '@clr/angular';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
ClarityModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {
}
import { TestBed } from '@angular/core/testing';
import { MoService } from './mo.service';
describe('MoService', () => {
let service: MoService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MoService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { defer, Observable, ReplaySubject } from 'rxjs';
import { catchError, retry, tap } from 'rxjs/operators';
export interface ExtJSResponse {
total: number;
success: boolean;
data: any[];
}
export interface Pending<T> {
data: Observable<T>;
status: Observable<Status>;
}
export enum Status {
LOADING = 'LOADING',
SUCCESS = 'SUCCESS',
ERROR = 'ERROR'
}
@Injectable({
providedIn: 'root'
})
export class MoService {
constructor(private httpClient: HttpClient) {
}
loadMO(): Pending<ExtJSResponse> {
const status = new ReplaySubject<Status>();
const request = this.httpClient
.get<ExtJSResponse>('assets/data/ui_ext_output.json')
.pipe(
retry(2),
catchError(error => {
status.next(Status.ERROR);
throw new Error(`error loading data: ${error.message}`);
}),
tap(() => status.next(Status.SUCCESS))
);
const data = defer(() => {
// Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
// Previous value: 'undefined'. Current value: 'LOADING'.
// status.next(Status.LOADING);
return request;
});
return {data, status};
}
}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment