Bug Fixes, KDU Level Execution Added 75/9775/1
authorBarath Kumar R <barath.r@tataelxsi.co.in>
Thu, 1 Oct 2020 16:07:35 +0000 (21:37 +0530)
committerBarath Kumar R <barath.r@tataelxsi.co.in>
Thu, 1 Oct 2020 16:09:08 +0000 (21:39 +0530)
Change-Id: Ice38ecb1fdccffa29b2f291581ae7d2d820a8bc6
Signed-off-by: Barath Kumar R <barath.r@tataelxsi.co.in>
12 files changed:
src/app/instances/ns-primitive/NSPrimitiveComponent.html
src/app/instances/ns-primitive/NSPrimitiveComponent.ts
src/app/packages/ns-packages/ns-composer/NSComposerComponent.ts
src/app/utilities/ns-instances-action/NSInstancesActionComponent.html
src/assets/i18n/de.json
src/assets/i18n/en.json
src/assets/i18n/es.json
src/assets/i18n/pt.json
src/assets/scss/app.scss
src/models/NSDModel.ts
src/services/AuthInterceptorService.ts
src/services/RestService.ts

index 324642a..82e3992 100644 (file)
@@ -21,42 +21,39 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
         <i class="fas fa-times-circle text-danger"></i>
     </button>
 </div>
-<form [formGroup]="primitiveForm" (ngSubmit)="execNSPrimitive()">
+<form [formGroup]="primitiveForm" (ngSubmit)="execPrimitive()">
     <div class="modal-body">
         <div class="form-group row">
             <label class="col-sm-4 col-form-label">{{'PRIMITIVETYPE' | translate}}*</label>
             <div class="col-sm-8">
-                <ng-select (change)="primitiveTypeChange($event)" [clearable]="false"
-                    placeholder="{{'SELECT' | translate}}" [items]="primitiveTypeList" bindLabel="title"
-                    bindValue="value" [(ngModel)]="primitiveType" id="primitiveType"
-                    [ngModelOptions]="{standalone: true}"
+                <ng-select (change)="primitiveTypeChange($event)" [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="primitiveTypeList" bindLabel="title" bindValue="value" [(ngModel)]="primitiveType" id="primitiveType" [ngModelOptions]="{standalone: true}"
                     [ngClass]="{ 'is-invalid': submitted && !primitiveType }"></ng-select>
             </div>
         </div>
-        <div class="form-group row" *ngIf="primitiveType === 'VNF_Primitive' || primitiveType === 'VDU_Primitive'">
+        <div class="form-group row" *ngIf="primitiveType === 'VNF_Primitive' || primitiveType === 'VDU_Primitive' || primitiveType === 'KDU_Primitive'">
             <label class="col-sm-4 col-form-label">VNF {{'MEMBERINDEX' | translate}}*</label>
             <div class="col-sm-3">
-                <ng-select (change)="indexChange($event, primitiveType)" [clearable]="false" placeholder="{{'SELECT' | translate}}"
-                    [items]="params.memberIndex" bindLabel="member-vnf-index" bindValue="member-vnf-index"
-                    formControlName="vnf_member_index" id="vnf_member_index"
+                <ng-select (change)="indexChange($event, primitiveType)" [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="params.memberIndex" bindLabel="member-vnf-index" bindValue="member-vnf-index" formControlName="vnf_member_index" id="vnf_member_index"
                     [ngClass]="{ 'is-invalid': submitted && f.vnf_member_index.errors }"></ng-select>
             </div>
         </div>
         <div class="form-group row" *ngIf="primitiveType === 'VDU_Primitive'">
             <label class="col-sm-4 col-form-label">{{'SELECT' | translate}} VDU *</label>
             <div class="col-sm-8">
-                <ng-select (change)="getVDUPrimitive($event)" [clearable]="false" placeholder="{{'SELECT' | translate}}"
-                    [items]="vduList" bindLabel="name" bindValue="id" formControlName="vdu_id" id="vdu_id"
-                    [ngClass]="{ 'is-invalid': submitted && f.vdu_id.errors }"></ng-select>
+                <ng-select (change)="getPrimitiveList($event, 'vdu')" [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="vduList" bindLabel="name" bindValue="id" formControlName="vdu_id" id="vdu_id" [ngClass]="{ 'is-invalid': submitted && f.vdu_id.errors }"></ng-select>
+            </div>
+        </div>
+        <div class="form-group row" *ngIf="primitiveType === 'KDU_Primitive'">
+            <label class="col-sm-4 col-form-label">{{'SELECT' | translate}} KDU *</label>
+            <div class="col-sm-8">
+                <ng-select (change)="getPrimitiveList($event, 'kdu')" [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="kduList" bindLabel="name" bindValue="name" formControlName="kdu_name" id="kdu_name" [ngClass]="{ 'is-invalid': submitted && f.kdu_name.errors }"></ng-select>
             </div>
         </div>
         <div class="form-group row" *ngIf="primitiveType">
             <label class="col-sm-4 col-form-label">
                 {{'PAGE.NSPRIMITIVE.PRIMITIVE' | translate}}*</label>
             <div class="col-sm-8">
-                <ng-select (change)="primitiveChange($event)" [clearable]="false" placeholder="{{'SELECT' | translate}}"
-                    [items]="primitiveList" bindLabel="name" bindValue="name" formControlName="primitive" id="primitive"
-                    [ngClass]="{ 'is-invalid': submitted && f.primitive.errors }"></ng-select>
+                <ng-select (change)="primitiveChange($event)" [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="primitiveList" bindLabel="name" bindValue="name" formControlName="primitive" id="primitive" [ngClass]="{ 'is-invalid': submitted && f.primitive.errors }"></ng-select>
             </div>
         </div>
         <ng-container *ngIf="primitiveParameter.length > 0">
@@ -71,21 +68,16 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
                 <div class="form-group row" [formGroupName]="i">
                     <label class="col-sm-2 col-form-label">{{'NAME' | translate}}:</label>
                     <div class="col-sm-3">
-                        <ng-select placeholder="{{'SELECT' | translate}}" [clearable]="false"
-                            [items]="primitiveParameter" bindLabel="name" bindValue="name"
-                            formControlName="primitive_params_name" id="parameter{{i}}"
-                            [ngClass]="{ 'is-invalid': submitted && params.controls.primitive_params_name.errors }">
+                        <ng-select placeholder="{{'SELECT' | translate}}" [clearable]="false" [items]="primitiveParameter" bindLabel="name" bindValue="name" formControlName="primitive_params_name" id="parameter{{i}}" [ngClass]="{ 'is-invalid': submitted && params.controls.primitive_params_name.errors }">
                         </ng-select>
                     </div>
                     <div class="col-sm-1"></div>
                     <label class="col-sm-2 col-form-label">{{'VALUE' | translate}}:</label>
                     <div class="col-sm-3">
-                        <input type="text" class="form-control" formControlName="primitive_params_value"
-                            [ngClass]="{ 'is-invalid': submitted && params.controls.primitive_params_value.errors }">
+                        <input type="text" class="form-control" formControlName="primitive_params_value" [ngClass]="{ 'is-invalid': submitted && params.controls.primitive_params_value.errors }">
                     </div>
                     <div class="col-sm-1" [hidden]="i==0">
-                        <button type="button" class="btn btn-sm btn-danger remove-mapping"
-                            (click)="removePrimitiveParams(i)">
+                        <button type="button" class="btn btn-sm btn-danger remove-mapping" (click)="removePrimitiveParams(i)">
                             <i class="fas fa-times-circle"></i>
                         </button>
                     </div>
index 1086f49..d5cf565 100644 (file)
@@ -26,7 +26,7 @@ import { NotifierService } from 'angular-notifier';
 import { APIURLHEADER, ERRORDATA, URLPARAMS } from 'CommonModel';
 import { DataService } from 'DataService';
 import { environment } from 'environment';
-import { NSData, VDUPRIMITIVELEVEL } from 'NSDModel';
+import { KDUPRIMITIVELEVEL, NSData, VDUPRIMITIVELEVEL } from 'NSDModel';
 import { NSPrimitiveParams } from 'NSInstanceModel';
 import { RestService } from 'RestService';
 import { SharedService } from 'SharedService';
@@ -84,6 +84,9 @@ export class NSPrimitiveComponent implements OnInit {
     /** Contains list of VDU primitive lists @public */
     public vduList: {}[];
 
+    /** Contains list of KDU primitive lists @public */
+    public kduList: {}[];
+
     /** FormBuilder instance added to the formBuilder @private */
     private formBuilder: FormBuilder;
 
@@ -126,6 +129,10 @@ export class NSPrimitiveComponent implements OnInit {
             {
                 title: this.translateService.instant('VDUPRIMITIVE'),
                 value: 'VDU_Primitive'
+            },
+            {
+                title: this.translateService.instant('KDUPRIMITIVE'),
+                value: 'KDU_Primitive'
             }
         ];
     }
@@ -152,6 +159,7 @@ export class NSPrimitiveComponent implements OnInit {
             primitive: [null, [Validators.required]],
             vnf_member_index: [null, [Validators.required]],
             vdu_id: [null, [Validators.required]],
+            kdu_name: [null, [Validators.required]],
             primitive_params: this.formBuilder.array([this.primitiveParamsBuilder()])
         });
     }
@@ -180,8 +188,8 @@ export class NSPrimitiveComponent implements OnInit {
         this.primitiveParams.removeAt(index);
     }
 
-    /** Execute NS Primitive @public */
-    public execNSPrimitive(): void {
+    /** Execute Primitive @public */
+    public execPrimitive(): void {
         this.submitted = true;
         this.objectPrimitiveParams = {};
         this.sharedService.cleanForm(this.primitiveForm);
@@ -206,6 +214,12 @@ export class NSPrimitiveComponent implements OnInit {
             // tslint:disable-next-line: no-string-literal
             primitiveParamsPayLoads['vdu_id'] = this.primitiveForm.value.vdu_id;
         }
+        if (this.primitiveType === 'KDU_Primitive') {
+            // tslint:disable-next-line: no-string-literal
+            primitiveParamsPayLoads['vnf_member_index'] = this.primitiveForm.value.vnf_member_index;
+            // tslint:disable-next-line: no-string-literal
+            primitiveParamsPayLoads['kdu_name'] = this.primitiveForm.value.kdu_name;
+        }
         const apiURLHeader: APIURLHEADER = {
             url: environment.NSDINSTANCES_URL + '/' + this.nsdId + '/action'
         };
@@ -226,18 +240,19 @@ export class NSPrimitiveComponent implements OnInit {
         this.initializeForm();
         if (data.value === 'NS_Primitive') {
             this.getNSInfo(this.params.name);
-            this.getFormControl('vnf_member_index').setValidators([]);
-            this.getFormControl('vnf_member_index').updateValueAndValidity();
-            this.getFormControl('vdu_id').setValidators([]);
-            this.getFormControl('vdu_id').updateValueAndValidity();
-        } else if (data.value === 'VNF_Primitive') {
-            this.getFormControl('vdu_id').setValidators([]);
-            this.getFormControl('vdu_id').updateValueAndValidity();
+            this.setUpdateValueandValidation('vnf_member_index');
+        }
+        if (data.value === 'VNF_Primitive' || data.value === 'KDU_Primitive' || data.value === 'NS_Primitive') {
+            this.setUpdateValueandValidation('vdu_id');
+        }
+        if (data.value === 'VDU_Primitive' || data.value === 'VNF_Primitive' || data.value === 'NS_Primitive') {
+            this.setUpdateValueandValidation('kdu_name');
         }
     }
     /** Member index change event */
     public indexChange(data: {}, getType?: string): void {
         this.getFormControl('vdu_id').setValue(null);
+        this.getFormControl('kdu_name').setValue(null);
         if (data) {
             this.getVnfdInfo(data['vnfd-id-ref'], getType);
         } else {
@@ -246,9 +261,9 @@ export class NSPrimitiveComponent implements OnInit {
             this.primitiveParameter = [];
         }
     }
-    /** Get VDU Primitive from selected VDU id/name change event */
-    public getVDUPrimitive(data: {}): void {
-        this.primitiveList = data['vdu-configuration']['config-primitive'];
+    /** Get VDU/KDU primitive List for the selected event @public */
+    public getPrimitiveList(data: {}, selectedType: string): void {
+        this.primitiveList = data[selectedType + '-configuration']['config-primitive'];
     }
     /** Primivtive change event */
     public primitiveChange(data: { parameter: {}[] }): void {
@@ -268,6 +283,19 @@ export class NSPrimitiveComponent implements OnInit {
             'vdu-configuration': vduData['vdu-configuration']
         };
     }
+    /** Generate kdu section @public */
+    public generateKDUData(kduData: KDUPRIMITIVELEVEL): KDUPRIMITIVELEVEL {
+        return {
+            name: kduData.name,
+            'juju-bundle': kduData['juju-bundle'],
+            'kdu-configuration': kduData['kdu-configuration']
+        };
+    }
+    /** Used to set the validation and value and update the validation and value @public */
+    public setUpdateValueandValidation(formName: string): void {
+        this.getFormControl(formName).setValidators([]);
+        this.getFormControl(formName).updateValueAndValidity();
+    }
     /** Update primitive value based on parameter */
     private updatePrimitive(primitive: { parameter: {}[] }): void {
         if (primitive.parameter) {
@@ -294,17 +322,34 @@ export class NSPrimitiveComponent implements OnInit {
             .subscribe((vnfdInfo: {}) => {
                 if (vnfdInfo[0]['vnf-configuration'] !== undefined && vnfdInfo[0]['vnf-configuration']) {
                     this.getFormControl('vdu_id').setValidators([]);
+                    this.getFormControl('kdu_name').setValidators([]);
                     this.primitiveList = vnfdInfo[0]['vnf-configuration']['config-primitive'];
                 }
                 if (getType === 'VDU_Primitive') {
+                    this.kduList = [];
+                    this.vduList = [];
+                    this.primitiveList = [];
+                    if (!isNullOrUndefined(vnfdInfo[0].vdu)) {
+                        vnfdInfo[0].vdu.forEach((vduData: VDUPRIMITIVELEVEL) => {
+                            if (vduData['vdu-configuration']) {
+                                const vduDataObj: VDUPRIMITIVELEVEL = this.generateVDUData(vduData);
+                                this.vduList.push(vduDataObj);
+                            }
+                        });
+                    }
+                }
+                if (getType === 'KDU_Primitive') {
+                    this.kduList = [];
                     this.vduList = [];
                     this.primitiveList = [];
-                    vnfdInfo[0].vdu.forEach((vduData: VDUPRIMITIVELEVEL) => {
-                        if (vduData['vdu-configuration']) {
-                            const vduDataObj: VDUPRIMITIVELEVEL = this.generateVDUData(vduData);
-                            this.vduList.push(vduDataObj);
-                        }
-                    });
+                    if (!isNullOrUndefined(vnfdInfo[0].kdu)) {
+                        vnfdInfo[0].kdu.forEach((kduData: KDUPRIMITIVELEVEL) => {
+                            if (kduData['kdu-configuration']) {
+                                const kduDataObj: KDUPRIMITIVELEVEL = this.generateKDUData(kduData);
+                                this.kduList.push(kduDataObj);
+                            }
+                        });
+                    }
                 }
                 this.isLoadingResults = false;
             }, (error: ERRORDATA) => {
@@ -323,7 +368,7 @@ export class NSPrimitiveComponent implements OnInit {
             .subscribe((nsdInfo: {}) => {
                 if (!isNullOrUndefined(nsdInfo[0]['ns-configuration'])) {
                     this.primitiveList = !isNullOrUndefined(nsdInfo[0]['ns-configuration']['config-primitive']) ?
-                    nsdInfo[0]['ns-configuration']['config-primitive'] : [];
+                        nsdInfo[0]['ns-configuration']['config-primitive'] : [];
                 } else {
                     this.primitiveList = [];
                 }
index 082496e..687f4fa 100644 (file)
@@ -445,6 +445,7 @@ export class NSComposerComponent {
     this.restService.getResource(environment.NSDESCRIPTORSCONTENT_URL + '/' + this.identifier).subscribe((nsData: NSDDetails) => {
       delete nsData._admin;
       delete nsData._id;
+      delete nsData._links;
       this.nsData = nsData;
       this.vnfdPackageDetails.shortName = nsData['short-name'];
       this.vnfdPackageDetails.vendor = nsData.vendor;
index 2879d8b..823d99f 100644 (file)
@@ -16,16 +16,13 @@ limitations under the License.
 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
 -->
 <div class="btn-group list action" role="group">
-    <button type="button" class="btn btn-primary" (click)="metrics()" placement="top" container="body"
-        [disabled]="operationalStatus == 'failed' || configStatus == 'failed'" ngbTooltip="{{'METRICS' | translate}}">
+    <button type="button" class="btn btn-primary" (click)="metrics()" placement="top" container="body" [disabled]="operationalStatus == 'failed' || configStatus == 'failed'" ngbTooltip="{{'METRICS' | translate}}">
         <i class="fas fa-chart-bar icons"></i>
     </button>
-    <button type="button" class="btn btn-primary" [disabled]="operationalStatus != 'running'" (click)="nsTopology()"
-        placement="top" container="body" ngbTooltip="{{'TOPOLOGY' | translate}}">
+    <button type="button" class="btn btn-primary" [disabled]="operationalStatus != 'running'" (click)="nsTopology()" placement="top" container="body" ngbTooltip="{{'TOPOLOGY' | translate}}">
         <i class="fa fa-sitemap fa-fw icons"></i>
     </button>
-    <button type="button" class="btn btn-primary" (click)="deleteNSInstance(false)" placement="top" container="body"
-        ngbTooltip="{{'DELETE' | translate}}">
+    <button type="button" class="btn btn-primary" (click)="deleteNSInstance(false)" placement="top" container="body" ngbTooltip="{{'DELETE' | translate}}">
         <i class="far fa-trash-alt icons"></i>
     </button>
     <div class="btn-group" ngbDropdown display="dynamic" container="body">
@@ -33,21 +30,16 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
             {{'ACTION' | translate}}
         </button>
         <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
-            <button type="button" class="btn btn-primary dropdown-item" (click)="infoNs()" placement="left"
-                container="body" ngbTooltip="{{'INFO' | translate}}">
+            <button type="button" class="btn btn-primary dropdown-item" (click)="infoNs()" placement="left" container="body" ngbTooltip="{{'INFO' | translate}}">
                 <i class="fas fa-info icons list" title="info"></i> {{'INFO' | translate}}
             </button>
-            <button type="button" class="btn btn-primary dropdown-item" (click)="execNSPrimitiveModal()"
-                placement="left" container="body" ngbTooltip="{{'EXECNSPRIMITIVE' | translate}}"
-                [disabled]="operationalStatus == 'failed' || configStatus == 'failed'">
-                <i class="fas fa-magic"></i> {{'EXECNSPRIMITIVE' | translate}}
+            <button type="button" class="btn btn-primary dropdown-item" (click)="execNSPrimitiveModal()" placement="left" container="body" ngbTooltip="{{'EXECPRIMITIVE' | translate}}" [disabled]="operationalStatus == 'failed' || configStatus == 'failed'">
+                <i class="fas fa-magic"></i> {{'EXECPRIMITIVE' | translate}}
             </button>
-            <button type="button" class="btn btn-primary dropdown-item" (click)="historyOfOperations()" placement="left"
-                container="body" ngbTooltip="{{'HISTORYOFOPERATIONS' | translate}}">
+            <button type="button" class="btn btn-primary dropdown-item" (click)="historyOfOperations()" placement="left" container="body" ngbTooltip="{{'HISTORYOFOPERATIONS' | translate}}">
                 <i class="fas fa-history"></i> {{'HISTORYOFOPERATIONS' | translate}}
             </button>
-            <button type="button" class="btn btn-primary dropdown-item text-danger" (click)="deleteNSInstance(true)"
-                placement="left" container="body" ngbTooltip="{{'FORCEDELETE' | translate}}">
+            <button type="button" class="btn btn-primary dropdown-item text-danger" (click)="deleteNSInstance(true)" placement="left" container="body" ngbTooltip="{{'FORCEDELETE' | translate}}">
                 <i class="fas fa-trash-alt icons text-danger"></i> {{'FORCEDELETE' | translate}}
             </button>
         </div>
index 27cf950..1351aa5 100644 (file)
     "VALUE": "Wert",
     "PERFORMACTION": "Aktion ausführen",
     "EXECUTE": "Execute",
-    "EXECNSPRIMITIVE": "Exec NS Primitive",
+    "EXECPRIMITIVE": "Exec Primitive",
     "PRIMITIVETYPE": "Primitiver Typ",
     "VDUPRIMITIVE": "VDU Level Primitive",
     "VNFPRIMITIVE": "VNF Level Primitive",
     "NSPRIMITIVE": "NS Level Primitive",
+    "KDUPRIMITIVE": "KDU Level Primitive",
     "DESCRIPTOR": "Deskriptor",
     "ERROR": "Etwas ist schief gelaufen. Bitte versuche es erneut",
     "SHOWGRAPH": "Grafik anzeigen",
             "EDITOSMREPO": "Bearbeiten Sie OSM-Repositorys",
             "OSMREPOTITLE": "Registriertes OSM-Repository",
             "CREATEDSUCCESSFULLY": "OSM-Repository erfolgreich hinzugefügt",
-            "UPDATEDSUCCESSFULLY" : "OSM-Repository erfolgreich aktualisiert"
+            "UPDATEDSUCCESSFULLY": "OSM-Repository erfolgreich aktualisiert"
         }
     },
     "HTTPERROR": {
index af4b196..73b11ba 100644 (file)
     "VALUE": "Value",
     "PERFORMACTION": "Perform Action",
     "EXECUTE": "Execute",
-    "EXECNSPRIMITIVE": "Exec NS Primitive",
+    "EXECPRIMITIVE": "Exec Primitive",
     "PRIMITIVETYPE": "Primitive Type",
     "VDUPRIMITIVE": "VDU Level Primitive",
     "VNFPRIMITIVE": "VNF Level Primitive",
     "NSPRIMITIVE": "NS Level Primitive",
+    "KDUPRIMITIVE": "KDU Level Primitive",
     "DESCRIPTOR": "Descriptor",
     "ERROR": "Something Went wrong please try again",
     "SHOWGRAPH": "Show Graph",
             "EDITOSMREPO": "Edit OSM Repositories",
             "OSMREPOTITLE": "Registered OSM repository",
             "CREATEDSUCCESSFULLY": "OSM Repository Added Successfully",
-            "UPDATEDSUCCESSFULLY" : "OSM Repository Updated Successfully"
+            "UPDATEDSUCCESSFULLY": "OSM Repository Updated Successfully"
         }
     },
     "HTTPERROR": {
index c5796ea..94ff2dc 100644 (file)
     "VALUE": "Valor",
     "PERFORMACTION": "Realizar una acción",
     "EXECUTE": "Ejecutar",
-    "EXECNSPRIMITIVE": "Ejecutar NS Primitiva",
+    "EXECPRIMITIVE": "Ejecutar Primitiva",
     "PRIMITIVETYPE": "Tipo primitivo",
     "VDUPRIMITIVE": "Primitiva a nivel de VDU",
     "VNFPRIMITIVE": "Nivel VNF Primitivo",
     "NSPRIMITIVE": "NS Level Primitive",
+    "KDUPRIMITIVE": "Primitiva de nivel KDU",
     "DESCRIPTOR": "Descriptora",
     "ERROR": "Algo salió mal. Por favor, vuelva a intentarlo",
     "SHOWGRAPH": "Mostrar gráfico",
             "EDITOSMREPO": "Editar repositorios de OSM",
             "OSMREPOTITLE": "Repositorio OSM registrado",
             "CREATEDSUCCESSFULLY": "registrado OSM agregado con éxito",
-            "UPDATEDSUCCESSFULLY" : "El registrado de OSM se actualizó correctamente"
+            "UPDATEDSUCCESSFULLY": "El registrado de OSM se actualizó correctamente"
         }
     },
     "HTTPERROR": {
index 496d330..71ce69f 100644 (file)
     "VALUE": "Valor",
     "PERFORMACTION": "Executar a ação",
     "EXECUTE": "Executar",
-    "EXECNSPRIMITIVE": "Exec NS Primitive",
+    "EXECPRIMITIVE": "Exec Primitive",
     "PRIMITIVETYPE": "Tipo primitivo",
     "VDUPRIMITIVE": "Primitivo de nível VDU",
     "VNFPRIMITIVE": "Primitivo de nível VNF",
     "NSPRIMITIVE": "NS Level Primitive",
+    "KDUPRIMITIVE": "Nível KDU Primitivo",
     "DESCRIPTOR": "Descritora",
     "ERROR": "Alguma coisa deu errado. Por favor tente outra vez",
     "SHOWGRAPH": "Mostrar gráfico",
             "EDITOSMREPO": "Editar repositórios OSM",
             "OSMREPOTITLE": "Repositório OSM registrado",
             "CREATEDSUCCESSFULLY": "registrado OSM adicionado com sucesso",
-            "UPDATEDSUCCESSFULLY" : "registrado OSM atualizado com sucesso"
+            "UPDATEDSUCCESSFULLY": "registrado OSM atualizado com sucesso"
         }
     },
     "HTTPERROR": {
index 9e8948d..3f976be 100644 (file)
@@ -71,6 +71,10 @@ body {
     &:focus {
       text-decoration: none;
     }
+    &:not([href]),
+    &:not([href]):hover {
+      color: inherit;
+    }
   }
   .badge {
     @include line-height(normal);
index 584f4e0..c8aa257 100644 (file)
@@ -49,6 +49,7 @@ export interface NSDDetails {
     vld: VLD[];
     _admin: VNFDAdminDetails;
     _id: string;
+    _links?: string;
     'constituent-vnfr-ref': string[];
 }
 
@@ -173,3 +174,10 @@ export interface VDUPRIMITIVELEVEL {
     name: string;
     'vdu-configuration': {};
 }
+
+/** Interface for the KDU Primitive Levels */
+export interface KDUPRIMITIVELEVEL {
+    name: string;
+    'juju-bundle': string;
+    'kdu-configuration': {};
+}
index ede10a8..4a66482 100644 (file)
@@ -103,18 +103,23 @@ export class AuthInterceptorService implements HttpInterceptor {
     public errorRes(err: HttpErrorResponse, req: HttpRequest<{}>, next: HttpHandler): Observable<{}> {
         if (err instanceof HttpErrorResponse) {
             switch (err.status) {
-                case HttpStatus.UNAUTHORIZED || HttpStatus.FORBIDDEN:
+                case HttpStatus.UNAUTHORIZED:
+                case HttpStatus.FORBIDDEN:
                     this.handleError(err);
                     break;
+                case HttpStatus.GATEWAY_TIMEOUT:
+                case HttpStatus.BAD_GATEWAY:
+                    this.notifierService.hideAll();
+                    this.authService.logoutResponse();
+                    break;
                 default: return throwError(err);
             }
         } else { return throwError(err); }
     }
 
-    /** Method to handle  401 & 403 error */
+    /** Method to handle  401, 403 & 502 error */
     private handleError(err: HttpErrorResponse): void {
-        if (err.error.detail === 'Expired Token or Authorization HTTP header' ||
-            err.error.detail === 'Invalid Token or Authorization HTTP header') {
+        if (err.error.detail !== 'Access denied: lack of permissions.') {
             this.notifierService.hideAll();
             this.authService.logoutResponse();
             if (this.authService.handle401) {
index d7ded6f..708d91b 100644 (file)
@@ -25,9 +25,10 @@ import { Injectable } from '@angular/core';
 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
 import { TranslateService } from '@ngx-translate/core';
 import { NotifierService } from 'angular-notifier';
-import { ERRORDATA } from 'CommonModel';
+import { APIURLHEADER, ERRORDATA } from 'CommonModel';
 import * as HttpStatus from 'http-status-codes';
 import { Observable } from 'rxjs';
+import { isNullOrUndefined } from 'util';
 
 /**
  * An Injectable is a class adorned with the @Injectable decorator function.
@@ -60,7 +61,12 @@ export class RestService {
      */
 
     public getResource(apiURL: string, httpHeaders?: { headers: HttpHeaders }): Observable<{}> {
-        return this.http.get(apiURL, httpHeaders);
+        const getRequest: APIURLHEADER = this.getHttpoptions(apiURL);
+        if (!isNullOrUndefined(httpHeaders)) {
+            return this.http.get(apiURL, httpHeaders);
+        } else {
+            return this.http.get(getRequest.url, getRequest.httpOptions);
+        }
     }
 
     /**
@@ -70,7 +76,12 @@ export class RestService {
      */
 
     public postResource(apiURLHeader: { url: string, httpOptions?: { headers: HttpHeaders } }, payload: {}): Observable<{}> {
-        return this.http.post(apiURLHeader.url, payload, apiURLHeader.httpOptions);
+        const getRequest: APIURLHEADER = this.getHttpoptions(apiURLHeader.url);
+        if (!isNullOrUndefined(apiURLHeader.httpOptions)) {
+            return this.http.post(apiURLHeader.url, payload, apiURLHeader.httpOptions);
+        } else {
+            return this.http.post(getRequest.url, payload, getRequest.httpOptions);
+        }
     }
 
     /**
@@ -80,7 +91,12 @@ export class RestService {
      */
 
     public patchResource(apiURLHeader: { url: string, httpOptions?: { headers: HttpHeaders } }, payload: {}): Observable<object> {
-        return this.http.patch(apiURLHeader.url, payload, apiURLHeader.httpOptions);
+        const getRequest: APIURLHEADER = this.getHttpoptions(apiURLHeader.url);
+        if (!isNullOrUndefined(apiURLHeader.httpOptions)) {
+            return this.http.patch(apiURLHeader.url, payload, apiURLHeader.httpOptions);
+        } else {
+            return this.http.patch(getRequest.url, payload, getRequest.httpOptions);
+        }
     }
 
     /**
@@ -90,7 +106,12 @@ export class RestService {
      */
 
     public putResource(apiURLHeader: { url: string, httpOptions?: { headers: HttpHeaders } }, payload: {}): Observable<object> {
-        return this.http.put(apiURLHeader.url, payload, apiURLHeader.httpOptions);
+        const getRequest: APIURLHEADER = this.getHttpoptions(apiURLHeader.url);
+        if (!isNullOrUndefined(apiURLHeader.httpOptions)) {
+            return this.http.put(apiURLHeader.url, payload, apiURLHeader.httpOptions);
+        } else {
+            return this.http.put(getRequest.url, payload, getRequest.httpOptions);
+        }
     }
 
     /**
@@ -99,8 +120,14 @@ export class RestService {
      */
 
     public deleteResource(apiURL: string, httpHeaders?: { headers: HttpHeaders }): Observable<object> {
-        return this.http.delete(apiURL, httpHeaders);
+        const getRequest: APIURLHEADER = this.getHttpoptions(apiURL);
+        if (!isNullOrUndefined(httpHeaders)) {
+            return this.http.delete(apiURL, httpHeaders);
+        } else {
+            return this.http.delete(getRequest.url, getRequest.httpOptions);
+        }
     }
+
     /**
      * Handle Error response based on the status.
      * @param error The error response reecieved from API call.
@@ -141,4 +168,17 @@ export class RestService {
                 err.error.detail : this.translateService.instant('ERROR'));
         }
     }
+
+    /** Set headers for get Methods @public */
+    private getHttpoptions(apiURL: string): APIURLHEADER {
+        const apiHeaders: HttpHeaders = new HttpHeaders({
+            'Content-Type': 'application/json; charset=UTF-8',
+            Accept: 'application/json',
+            'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0'
+        });
+        return {
+            url: apiURL,
+            httpOptions: {headers : apiHeaders}
+        };
+    }
 }