Merge "Improvement of controlpanel dashboard Fix some bugs in the backend to support...
authorPatrik Buhr <patrik.buhr@est.tech>
Tue, 12 Jan 2021 08:55:20 +0000 (08:55 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 12 Jan 2021 08:55:20 +0000 (08:55 +0000)
webapp-frontend/src/app/controlpanel.component.html
webapp-frontend/src/app/controlpanel.module.ts
webapp-frontend/src/app/footer/footer.component.ts
webapp-frontend/src/app/interceptor.mock.ts
webapp-frontend/src/app/interfaces/controlpanel.types.ts
webapp-frontend/src/app/mock/ei-jobs.json
webapp-frontend/src/app/mock/rics.json [new file with mode: 0644]
webapp-frontend/src/app/services/controlpanel/controlpanel.service.spec.ts [deleted file]
webapp-frontend/src/app/services/controlpanel/controlpanel.service.ts [deleted file]

index a6ae9e0..649a5d5 100644 (file)
@@ -51,7 +51,7 @@
       </div>
     </section>
     <section #sidenav class="menu-body">
-      <rd-sidenav-list></rd-sidenav-list>
+      <rd-sidenav-list (sidenavClose)="drawer.toggle()">></rd-sidenav-list>
     </section>
     <section class="menu-footer">
 
index 8e958a9..ea14a5d 100644 (file)
@@ -39,7 +39,6 @@ import { MDBBootstrapModule } from 'angular-bootstrap-md';
 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { ToastrModule } from 'ngx-toastr';
 import { ConfirmDialogComponent } from './ui/confirm-dialog/confirm-dialog.component';
-import { ControlpanelService } from './services/controlpanel/controlpanel.service';
 import { ErrorDialogComponent } from './ui/error-dialog/error-dialog.component';
 import { ErrorDialogService } from './services/ui/error-dialog.service';
 import { FlexLayoutModule } from '@angular/flex-layout';
@@ -68,24 +67,26 @@ export const isMock = environment.mock;
 @NgModule({
   declarations: [
     ConfirmDialogComponent,
+    ControlpanelComponent,
     EICardComponent,
     EICoordinatorComponent,
     ErrorDialogComponent,
     FooterComponent,
     MainComponent,
+    NodeModulesComponent,
     NoTypePolicyInstanceDialogComponent,
     PolicyCardComponent,
     PolicyControlComponent,
     PolicyInstanceComponent,
     PolicyInstanceDialogComponent,
-    ControlpanelComponent,
     SidenavListComponent,
-    NodeModulesComponent
   ],
   imports: [
     BrowserModule,
     BrowserAnimationsModule,
     ChartsModule,
+    ControlpanelRoutingModule,
+    CookieModule.forRoot(),
     FlexLayoutModule,
     FormsModule,
     HttpClientModule,
@@ -116,10 +117,8 @@ export const isMock = environment.mock;
     MatToolbarModule,
     MatTooltipModule,
     MDBBootstrapModule.forRoot(),
-    ControlpanelRoutingModule,
     ReactiveFormsModule,
     ToastrModule.forRoot(),
-    CookieModule.forRoot()
   ],
   exports: [
     ErrorDialogComponent,
@@ -146,7 +145,6 @@ export const isMock = environment.mock;
     PolicyInstanceDialogComponent
   ],
   providers: [
-    ControlpanelService,
     ErrorDialogService,
     UiService,
     {
index 47e768e..dc4c3c3 100644 (file)
@@ -20,8 +20,6 @@
  * ========================LICENSE_END===================================
  */
 import { Component, OnInit } from '@angular/core';
-import { ControlpanelSuccessTransport } from '../interfaces/controlpanel.types';
-import { ControlpanelService } from '../services/controlpanel/controlpanel.service';
 import { UiService } from '../services/ui/ui.service';
 
 @Component({
@@ -38,12 +36,10 @@ export class FooterComponent implements OnInit {
   controlpanelVersion: string;
 
   // Inject the service
-  constructor(private controlpanelService: ControlpanelService,
-    private ui: UiService) { }
+  constructor(private ui: UiService) { }
 
   ngOnInit() {
     this.controlpanelVersion = '0.0';
-    // this.controlpanelService.getVersion().subscribe((res: ControlpanelSuccessTransport) => this.controlpanelVersion = res.data);
     this.ui.darkModeState.subscribe((isDark) => {
       this.darkMode = isDark;
     });
index bffeabe..bfba913 100644 (file)
@@ -6,6 +6,7 @@ import * as policyinstances from './mock/policy-instance.json';
 import * as policyinstanceedit from './mock/policy-instance-edit.json';
 import * as eijobs from './mock/ei-jobs.json';
 import * as eiproducers from './mock/ei-producers.json';
+import * as rics from './mock/rics.json';
 
 const urls = [
     {
@@ -31,6 +32,10 @@ const urls = [
     {
         url: 'api/enrichment/eiproducers',
         json: eiproducers
+    },
+    {
+        url: 'api/policy/rics?policyType=1',
+        json: rics
     }
 ];
 
@@ -39,6 +44,10 @@ export class HttpMockRequestInterceptor implements HttpInterceptor {
     constructor(private injector: Injector) {}
 
     intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
+        if (request.method === "PUT" && request.url.includes("policies")) {
+            console.log('Answered PUT policy ' + request.url);
+            return of(new HttpResponse({ status: 200 }));
+        }
         for (const element of urls) {
             if (request.url === element.url) {
                 console.log('Loaded from stub json : ' + request.url);
index 44e1d9f..cad0630 100644 (file)
@@ -25,34 +25,3 @@ export interface ControlpanelSuccessTransport {
   status: number;
   data: string;
 }
-
-export interface EcompRoleFunction {
-  name: string;
-  code: string;
-  type: string;
-  action: string;
-}
-
-export interface EcompRole {
-  id: number;
-  name: string;
-  [position: number]: EcompRoleFunction;
-}
-
-export interface EcompUser {
-  orgId?: number;
-  managerId?: string;
-  firstName?: string;
-  middleInitial?: string;
-  lastName?: string;
-  phone?: string;
-  email?: string;
-  hrid?: string;
-  orgUserId?: string;
-  orgCode?: string;
-  orgManagerUserId?: string;
-  jobTitle?: string;
-  loginId: string;
-  active: boolean;
-  [position: number]: EcompRole;
-}
index ffe37d7..6d96872 100644 (file)
@@ -2,6 +2,7 @@
     {
       "ei_job_identity": "job1",
       "ei_type_identity": "type1",
+      "owner": "owner1",
       "ei_job_data": {
         "jobparam2": "value2_job1",
         "jobparam3": "value3_job1",
diff --git a/webapp-frontend/src/app/mock/rics.json b/webapp-frontend/src/app/mock/rics.json
new file mode 100644 (file)
index 0000000..0fa4446
--- /dev/null
@@ -0,0 +1,4 @@
+[
+    "ric1",
+    "ric2"
+]
\ No newline at end of file
diff --git a/webapp-frontend/src/app/services/controlpanel/controlpanel.service.spec.ts b/webapp-frontend/src/app/services/controlpanel/controlpanel.service.spec.ts
deleted file mode 100644 (file)
index d94a779..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================LICENSE_END===================================
- */
-import { TestBed } from '@angular/core/testing';
-
-import { ControlpanelService } from './controlpanel.service';
-
-describe('ControlpanelService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
-
-  it('should be created', () => {
-    const service: ControlpanelService = TestBed.get(ControlpanelService);
-    expect(service).toBeTruthy();
-  });
-});
diff --git a/webapp-frontend/src/app/services/controlpanel/controlpanel.service.ts b/webapp-frontend/src/app/services/controlpanel/controlpanel.service.ts
deleted file mode 100644 (file)
index 5aed53b..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================LICENSE_END===================================
- */
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { Observable } from 'rxjs';
-import { ControlpanelSuccessTransport, EcompUser } from '../../interfaces/controlpanel.types';
-
-@Injectable({
-  providedIn: 'root'
-})
-
-/**
- * Services to query the Control Panel's admin endpoints.
- */
-export class ControlpanelService {
-
-  private basePath = 'api/admin/';
-
-  constructor(private httpClient: HttpClient) {
-    // injects to variable httpClient
-  }
-
- /**
-   * Checks app health
-   * @returns Observable that should yield a ControlpanelSuccessTransport
-   */
-  getHealth(): Observable<ControlpanelSuccessTransport> {
-    return this.httpClient.get<ControlpanelSuccessTransport>(this.basePath + 'health');
-  }
-
-  /**
-   * Gets Control Panel version details
-   * @returns Observable that should yield a ControlpanelSuccessTransport object
-   */
-  getVersion(): Observable<ControlpanelSuccessTransport> {
-    return this.httpClient.get<ControlpanelSuccessTransport>(this.basePath + 'version');
-  }
-
-  /**
-   * Gets Control Panel users
-   * @returns Observable that should yield a EcompUser array
-   */
-  getUsers(): Observable<EcompUser[]> {
-    return this.httpClient.get<EcompUser[]>(this.basePath + 'user');
-  }
-
-}