diff --git a/UIAssets/src/app/_model/fabric.ts b/UIAssets/src/app/_model/fabric.ts index 8d3844b..561b792 100644 --- a/UIAssets/src/app/_model/fabric.ts +++ b/UIAssets/src/app/_model/fabric.ts @@ -15,13 +15,29 @@ export class Fabric { apic_password: string; controllers: string[]; fabric: string; + validate: boolean; + is_new: boolean; + password_confirm: string; - constructor(apic_cert?: string, apic_hostname?: string, apic_username?: string, apic_password?: string, controllers?: string[], fabric?: string) { + constructor( + apic_cert: string = '', + apic_hostname: string = '', + apic_username: string = '', + apic_password: string = '', + controllers: string[] = [], + fabric: string = '', + validate: boolean = true, + is_new: boolean = true, + password_confirm: string = '' + ) { this.apic_cert = apic_cert; this.apic_hostname = apic_hostname; this.apic_username = apic_username; this.apic_password = apic_password; this.controllers = controllers; this.fabric = fabric; + this.validate = validate; + this.is_new = is_new; + this.password_confirm = password_confirm; } } diff --git a/UIAssets/src/app/_model/user.ts b/UIAssets/src/app/_model/user.ts index c774b89..e1d1538 100644 --- a/UIAssets/src/app/_model/user.ts +++ b/UIAssets/src/app/_model/user.ts @@ -10,10 +10,25 @@ export class UserList { export class User { username: string; - role: any; + role: number; password: string; last_login: number; + is_new: boolean; + password_confirm: string; - public constructor() { + constructor( + username: string = '', + role: number = 2, + password: string = '', + last_login: number = 0, + is_new: boolean = false, + password_confirm: string = '' + ) { + this.username = username; + this.role = role; + this.password = password; + this.last_login = last_login; + this.is_new = is_new; + this.password_confirm = password_confirm; } } diff --git a/UIAssets/src/app/_service/backend.service.ts b/UIAssets/src/app/_service/backend.service.ts index 38a6993..bb6ee40 100644 --- a/UIAssets/src/app/_service/backend.service.ts +++ b/UIAssets/src/app/_service/backend.service.ts @@ -52,19 +52,30 @@ export class BackendService { } createUser(user: User): Observable { - return this.http.post(this.baseUrl + 'users', user); + let toSave = new User( + user.username, + user.role, + user.password + ); + delete toSave.last_login; + delete toSave.is_new; + delete toSave.password_confirm; + return this.http.post(this.baseUrl + 'users', toSave); } updateUser(user: User): Observable { - if (user.role === 'Admin') { - user.role = 0; - } else if (user.role === 'User') { - user.role = 1; - } else if (user.role === 'Blacklist') { - user.role = 2; + let toSave = new User( + user.username, + user.role, + user.password + ); + delete toSave.is_new; + delete toSave.password_confirm; + delete toSave.last_login; + if (toSave.password == '') { + delete toSave.password; } - delete user.last_login; - return this.http.patch(this.baseUrl + 'users/' + user.username, user); + return this.http.patch(this.baseUrl + 'users/' + toSave.username, toSave); } deleteUser(user: User): Observable { @@ -110,7 +121,19 @@ export class BackendService { } createFabric(fabric: Fabric): Observable { - return this.http.post(this.baseUrl + 'aci/fabrics', fabric); + let toSave = new Fabric( + fabric.apic_cert, + fabric.apic_hostname, + fabric.apic_username, + fabric.apic_password, + fabric.controllers, + fabric.fabric + ); + delete toSave.controllers; + delete toSave.validate; + delete toSave.is_new; + delete toSave.password_confirm; + return this.http.post(this.baseUrl + 'aci/fabrics', toSave); } getFabrics(): Observable { @@ -121,8 +144,22 @@ export class BackendService { } updateFabric(fabric: Fabric): Observable { - delete fabric.controllers; - return this.http.patch(this.baseUrl + 'aci/fabrics/' + fabric.fabric, fabric); + let toSave = new Fabric( + fabric.apic_cert, + fabric.apic_hostname, + fabric.apic_username, + fabric.apic_password, + fabric.controllers, + fabric.fabric + ); + delete toSave.controllers; + delete toSave.validate; + delete toSave.is_new; + delete toSave.password_confirm; + if (toSave.apic_password == '') { + delete toSave.apic_password; + } + return this.http.patch(this.baseUrl + 'aci/fabrics/' + toSave.fabric, toSave); } deleteFabric(fabric: Fabric): Observable { diff --git a/UIAssets/src/app/app.component.ts b/UIAssets/src/app/app.component.ts index 1c2c855..8e59c51 100644 --- a/UIAssets/src/app/app.component.ts +++ b/UIAssets/src/app/app.component.ts @@ -7,6 +7,7 @@ import {environment} from '../environments/environment'; import {BackendService} from './_service/backend.service'; import {Title} from '@angular/platform-browser'; import {CookieService} from 'ngx-cookie-service'; +import {UserList} from "./_model/user"; @Component({ selector: 'app-root', @@ -53,6 +54,10 @@ export class AppComponent implements OnInit, OnDestroy { } else { this.app_loaded = true; } + if (environment.login_required) { + this.backendService.getUsers().subscribe((results: UserList) => { + }); + } this.login_required = (localStorage.getItem('isLoggedIn') != 'true' && environment.login_required); this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(event => { this.login_required = (localStorage.getItem('isLoggedIn') != 'true' && environment.login_required); diff --git a/UIAssets/src/app/comparison-detail/comparison-detail.component.html b/UIAssets/src/app/comparison-detail/comparison-detail.component.html index 8f8355b..c1796ef 100644 --- a/UIAssets/src/app/comparison-detail/comparison-detail.component.html +++ b/UIAssets/src/app/comparison-detail/comparison-detail.component.html @@ -241,7 +241,7 @@

Parameters

[sortable]="true" [flexGrow]="0.2"> - Global + Global {{ row['node_id'] | number }} diff --git a/UIAssets/src/app/comparison-result-detail/comparison-result-detail.component.html b/UIAssets/src/app/comparison-result-detail/comparison-result-detail.component.html index 5eb974f..75b939c 100644 --- a/UIAssets/src/app/comparison-result-detail/comparison-result-detail.component.html +++ b/UIAssets/src/app/comparison-result-detail/comparison-result-detail.component.html @@ -88,11 +88,11 @@
-
+
Line diff mode
-
-
-
+
+
+
+
+
+
+
+
+
-
- - - - -
-