"file-saver": "^1.3.3",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
- "mdbootstrap": "4.5.3",
- "ng2-ace-editor": "0.1.9",
+ "mdbootstrap": "4.5.5",
+ "ng2-ace-editor": "0.2.0",
"ng2-bootstrap-modal": "1.0.1",
"ng2-bs3-modal": "0.10.4",
"ngx-progressbar": "^2.1.1",
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
-
.textarea {
- width: 800px;
+ width: 100%;
height: 200px
}
\ No newline at end of file
<div class="mdl-card__title">
<div class="text-center">
Contact us @:
- <a href="mailto:{{contactUsMail.CONTACT_US_EMAIL}}?Subject={{contactUsMail.CONTACT_US_SUBJECT}}">APPC DEVELOPMENT TEAM</a>
+ <a href="mailto:{{contactUsMail.CONTACT_US_EMAIL}}?Subject={{contactUsMail.CONTACT_US_SUBJECT}}">
+ CDT DEVELOPMENT TEAM </a>
</div>
</div>
</div>    
</div>
<div class="text-right">
<div class="mdl-dialog__content">
- <a class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="open(content)">VIEW CHANGE LOG</a>
+ <a class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="versionLogFile(); versionLog.open();">VIEW CHANGE LOG</a>
</div>
</div>
</div>
</div>
</div>
+
+<!-- Modal for version Log and download file -->
+<modal #versionLog id="versionLog">
+ <modal-header [show-close]="true">
+ <h4 class="modal-title">VERSION CHANGE LOG</h4>
+ </modal-header>
+ <modal-body>
+ <textarea class="textarea">{{this.data}}</textarea>
+ </modal-body>
+ <modal-footer [show-default-buttons]="false">
+ <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="downloadLogFile()">
+ Download
+ </button>
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" data-dismiss="modal">cancel</button>
+ </modal-footer>
+</modal>
============LICENSE_END============================================
*/
-
-import { Component, OnInit, OnDestroy } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';
import { NotificationsService } from 'angular2-notifications';
import { saveAs } from 'file-saver';
-import { DialogService } from 'ng2-bootstrap-modal';
-import { ConfirmComponent } from '../shared/confirmModal/confirm.component';
-import { appConstants } from '../../constants/app-constants';
+import { ModalDismissReasons, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import {UtilityService} from '../shared/services/utilityService/utility.service';
@Component({
templateUrl: './aboutus.component.html',
styleUrls: ['./aboutus.component.css']
})
-export class AboutUsComponent implements OnInit, OnDestroy {
+export class AboutUsComponent implements OnInit {
+
clName= "AboutUsComponent";
public releaseName: any;
public versionNo: any;
public contactUsMail: any;
+
public data: any;
closeResult: string;
versionLogSubscription: Subscription;
};
constructor(
- private http: Http, private dialogService: DialogService, private notificationsService: NotificationsService,
+ private http: Http, private modalService: NgbModal,
private utilSvc: UtilityService ) {
}
ngOnInit() {
this.versionNo = require('./appVersion.json').versionNo;
this.releaseName = require('./appVersion.json').releaseName;
- this.contactUsMail = require('../cdt.application.properties.json').CONTACT_US;
- }
-
- ngOnDestroy() {
- if (this.versionLogSubscription) {
- this.versionLogSubscription.unsubscribe();
- }
+ this.contactUsMail = require('../../cdt.application.properties.json').CONTACT_US;
}
- versionLogFile(): Observable<any> {
- return this.http.get('app/about-us/versionLog.txt');
+ versionLogFile() {
+ this.http.get('app/about-us/versionLog.txt')
+ .subscribe(res => this.data = res.text());
}
- open(content) {
- this.versionLogSubscription = this.versionLogFile()
- .subscribe((res) => {
- this.data = res.text();
- this.dialogService.addDialog(ConfirmComponent, {
- title: 'VERSION CHANGE LOG',
- message: this.data,
- cancelButtonText: 'CLOSE',
- confirmButtonText: 'DOWNLOAD'
- }).subscribe(isConfirmed => {
- if (isConfirmed) {
- this.downloadLogFile()
- } else {
- // do nothing
- }
- });
-
- },
- (error)=>{
- this.notificationsService.error(appConstants.errors.error, 'unable to fetch change log details');
- });
- }
+ // open(content) {
+ // this.modalService.open(content).result.then((result) => {
+ // console.log('result', result)
+ // this.closeResult = `Closed with: ${ result }`;
+ // }, (reason) => {
+ // console.log('reson', reason)
+ // this.closeResult = `Dismissed ${ this.getDismissReason(reason) }`;
+ // });
+ // }
downloadLogFile() {
var blob = new Blob([this.data], {
--- /dev/null
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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============================================
+*/
+
+.build-button {
+ padding: 11px;
+ font-size: 20px;
+ color: green;
+ border: 1PX SOLID GREEN;
+ MARGIN-BOTTOM: 40PX
+}
+
+table.table th,
+table.table td {
+ padding: 0rem;
+}
\ No newline at end of file
--- /dev/null
+<!--
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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============================================
+-->
+<simple-notifications [options]="options"></simple-notifications>
+<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'" [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress>
+
+<div class="container" style="margin-left:-15px;" *ngIf="noData != true">
+ <table class="table">
+ <thead>
+ <tr>
+ <th>CONFIGURATION SERVER <i class="fa fa-sort" (click)="sortOrder= !sortOrder; sortBy='serverandport'" aria-hidden="true"></i></th>
+ <th>CLOUD-OWNER/CLOUD-REGION/TENANT<i class="fa fa-sort" (click)="sortOrder= !sortOrder; sortBy='ownerid'" aria-hidden="true"></i></th>
+ <th>DESCRIPTION</th>
+ <th>MODIFIER<i class="fa fa-sort" (click)="sortOrder= !sortOrder; sortBy='modifier'" aria-hidden="true"></i></th>
+ <th>DATE MODIFIED<i class="fa fa-sort" (click)="sortOrder= !sortOrder; sortBy='modified-date'" aria-hidden="true"></i></th>
+ <th></th>
+ </tr>
+ </thead>
+
+ <tbody style="padding: 5px 5px">
+ <tr *ngFor="let item of displayAnsibleServerData | orderBy:sortBy:sortOrder; let i=index">
+ <td><strong>{{item['serverandport']}}</strong></td>
+
+ <td>
+ <table class="table">
+ <thead></thead>
+ <tbody style="padding: 5px 5px">
+ <tr *ngFor="let info of item.info">
+ <td><strong>{{info.ownerid}} / {{info.regionid}}</strong> / {{info.tenantid}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+
+ <td><strong>{{item['descr']}} </strong></td>
+
+ <td><strong>{{item['modifier']}} </strong></td>
+
+ <td><strong>{{item['modified-date']}} </strong></td>
+
+ <td>
+ <button type="button" class="mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="viewAnbsibleServer(item,i)" style="width:100px;height:40px;">
+ <i class="fa fa-edit"></i> View/Edit
+ </button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+</div>
+
+
+<div *ngIf="noData == true" class="text-center">
+ <div class="card">
+ <div class="mdl-dialog__content">
+ <div class="mdl-card__title">
+ <h2 class="mdl-card__title-text">There is no admin Artifacts</h2>
+ </div>
+ <div class="mdl-card__supporting-text">
+ {{noDataMsg}}
+ </div>
+ </div>
+ </div>
+</div>
+<div class="col-lg-12-ln2">
+ <button type="button" (click)="createAnsibleServer()" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">
+ CREATE NEW SERVER
+ </button>
+ <button type="button" (click)="download()" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">
+ DOWNLOAD ALL TO PC
+ </button>
+ <button type="button" (click)="saveToAppc()" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">
+ SAVE ALL TO APPC
+ </button>
+</div>
\ No newline at end of file
--- /dev/null
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 { Component, OnInit } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
+import { HttpUtilService } from '../shared/services/httpUtil/http-util.service';
+import { MappingEditorService } from '../shared/services/mapping-editor.service';
+import { ParamShareService } from '../shared/services/paramShare.service';
+import { environment } from '../../environments/environment';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { NgProgress } from 'ngx-progressbar';
+import { APIService } from "../shared/services/cdt.apicall";
+import { UtilityService } from '../shared/services/utilityService/utility.service';
+import { NotificationsService } from 'angular2-notifications';
+
+
+@Component({ selector: 'admin', templateUrl: './admin.component.html', styleUrls: ['./admin.component.css']})
+export class AdminComponent implements OnInit {
+ displayAnsibleServerData: Array<Object> = [];
+ ansibleServerData;
+ sortOrder = false;
+ noData = false;
+ sortBy: string;
+ filter: Object = {};
+ noDataMsg: string;
+ errorMessage = '';
+ invalid = true;
+ currentUser;
+ fileName = "ansible_admin_FQDN_Artifact_0.0.1V.json";
+
+ options = {
+ timeOut: 4000,
+ showProgressBar: true,
+ pauseOnHover: true,
+ clickToClose: true,
+ maxLength: 200
+ };
+
+ constructor (
+ private paramShareService: ParamShareService,
+ private ngProgress: NgProgress,
+ private httpUtil: HttpUtilService,
+ private router: Router,
+ private activeROute: ActivatedRoute,
+ private mappingEditorService: MappingEditorService,
+ private modalService: NgbModal,
+ private apiService:APIService,
+ private utilService: UtilityService,
+ private nService: NotificationsService
+ ) {
+ }
+
+ ngOnInit() {
+ const apiToken = localStorage['apiToken'];
+ this.currentUser = localStorage['userId'];
+
+ if(this.paramShareService.ansibleServerData) {
+ this.ansibleServerData = this.paramShareService.ansibleServerData;
+ console.log("cached ansibleServerData===>"+JSON.stringify(this.ansibleServerData));
+ this.formatRawData();
+ } else {
+ //testing
+ //this.ansibleServerData = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\": \"fqdn-value1:url\:port\",\"cloud-owner-list\":[{\"cloud-owner\": \"owner1\",\"region-id-list\": [{\"region-id\": \"regiodnid1\",\"tenant-id-list\": [\"tenantid1\",\"tenantid2\"]},{\"region-id\": \"regiondid2\",\"tenant-id-list\": [\"tenantid1\",\"tenantid2\"]}]},{\"cloud-owner\": \"owner2\",\"region-id-list\": [{\"region-id\": \"regionid1\",\"tenant-id-list\": [\"tenantid1\",\"tenantid2\"]}]}],\"description\": \"fqdn for east zone vUSP Production\",\"username\": \"albino attuid\",\"create-date\": \"\",\"modify-username\": \"Asgar\",\"modify-date\": \"10/26/2018\"}]}";
+ //this.ansibleServerData = JSON.parse(this.ansibleServerData);
+ //this.formatRawData();
+ this.getArtifacts();
+ }
+
+ }
+
+ getArtifacts() {
+
+ const input = {
+ "input":{
+ "design-request":{
+ "request-id":localStorage['apiToken'],
+ "action":"getArtifact",
+ "payload":"{\"vnf-type\":\"NULL\",\"vnfc-type\":\"NULL\",\"protocol\":\"\",\"incart\":\"N\",\"action\":\"NULL\",\"artifact-name\":\""+this.fileName+"\",\"artifact-type\":\"APPC-CONFIG\",\"userID\":\"admin\"}"
+ }
+ }
+ };
+ //const x = JSON.parse(data.input['design-request']['payload']);
+ //x.userID = localStorage['userId'];
+ //data.input['design-request']['payload'] = JSON.stringify(x);
+ console.log("input to payload====", JSON.stringify(input));
+
+ this.ngProgress.start();
+
+ this.apiService.callGetArtifactsApi(input).subscribe(data => {
+
+ if( this.utilService.checkResult(data)) {
+ console.log("response===>"+JSON.stringify(data));
+ this.ansibleServerData = JSON.parse(data.output.data.block).artifactInfo[0]["artifact-content"];
+ this.ansibleServerData = JSON.parse(this.ansibleServerData);
+ console.log("ansibleServerData===>"+JSON.stringify(this.ansibleServerData))
+ this.paramShareService.ansibleServerData = this.ansibleServerData;
+ this.formatRawData();
+ }
+ this.ngProgress.done();
+ },
+ error => {
+
+ this.nService.error('Error',
+ 'Error in connecting to APPC Server', this.options );
+ });
+
+
+ }
+
+ formatRawData(){
+ this.displayAnsibleServerData = [this.ansibleServerData["fqdn-list"].length];
+ console.log("length==>"+this.ansibleServerData["fqdn-list"].length)
+ for(let i=0;i<this.ansibleServerData["fqdn-list"].length;i++) {
+ let fqdl = this.ansibleServerData["fqdn-list"][i];
+ this.displayAnsibleServerData[i] = {};
+ let cloudInfoArray = [];
+ let serverAndPort = fqdl["vnf-management-server-fqdn"];
+ this.displayAnsibleServerData[i]['serverandport'] = serverAndPort;
+ let splitArray = serverAndPort.split(":");
+ let regEx = new RegExp(":"+splitArray[splitArray.length-1]+"$", "g");
+ this.displayAnsibleServerData[i]['server'] = serverAndPort.replace(regEx, "");
+ this.displayAnsibleServerData[i]['port'] = "";
+ if(splitArray.length > 1) {
+ this.displayAnsibleServerData[i]['port'] = splitArray[splitArray.length-1];
+ }
+ let clouditem = "";
+ for(let j=0; j<fqdl["cloud-owner-list"].length;j++) {
+ let cloudOwnerItem = fqdl["cloud-owner-list"][j];
+ let cloud = cloudOwnerItem["cloud-owner"];
+ let cloudrow;
+ let ownerid = cloud;
+
+ for(let k=0; k<cloudOwnerItem["region-id-list"].length; k++) {
+ let regionItem = cloudOwnerItem["region-id-list"][k];
+ let regionrow = cloud + " / " + regionItem["region-id"];
+ let regionid = regionItem["region-id"];
+ console.log("regionrow : "+regionrow);
+ for(let m=0; m<regionItem["tenant-id-list"].length; m++) {
+ cloudrow = regionrow + " / " + regionItem["tenant-id-list"][m]+"\n";
+ console.log("cloudrow : "+cloudrow);
+ clouditem = clouditem + cloudrow;
+ console.log("clouditem : "+clouditem);
+ let tenantid = regionItem["tenant-id-list"][m];
+ cloudInfoArray.push({"ownerid": ownerid, "regionid": regionid, "tenantid": tenantid});
+ console.log("info===>"+JSON.stringify({"ownerid": ownerid, "regionid": regionid, "tenantid": tenantid}))
+ }
+
+ }
+
+ }
+ console.log("info array==>"+JSON.stringify(cloudInfoArray))
+ this.displayAnsibleServerData[i]["info"] = cloudInfoArray;
+ this.displayAnsibleServerData[i]["cloud"] = clouditem;
+ this.displayAnsibleServerData[i]["descr"] = fqdl["description"];
+ this.displayAnsibleServerData[i]["creator"] = fqdl["username"];
+ this.displayAnsibleServerData[i]["created-date"] = fqdl["create-date"];
+ this.displayAnsibleServerData[i]["modifier"] = fqdl["modify-username"];
+ this.displayAnsibleServerData[i]["modified-date"] = fqdl["modify-date"];
+
+ }
+ }
+
+
+
+ viewAnbsibleServer(selectedConfig, updateIndex) {
+ sessionStorage.setItem('updateIndex', updateIndex);
+ sessionStorage.setItem('ansibleserver', JSON.stringify(selectedConfig));
+
+ this
+ .router
+ .navigate(['../ansible-server'], {
+ relativeTo: this.activeROute
+ });
+ }
+
+ createAnsibleServer() {
+ let newServer = {"server":"","port":"","info":[],"cloud":"","descr":"","creator":this.currentUser,"created-date":this.utilService.getDate(),"modifier":"","modified-date":""};
+ sessionStorage.setItem('ansibleserver', JSON.stringify(newServer));
+
+ if(this.ansibleServerData) {
+ sessionStorage.setItem('updateIndex', this.ansibleServerData["fqdn-list"].length);
+ } else {
+ sessionStorage.setItem('updateIndex', '0');
+ }
+
+ this
+ .router
+ .navigate(['../ansible-server'], {
+ relativeTo: this.activeROute
+ });
+ }
+
+
+ saveToAppc() {
+ let artifactContent = this.utilService.appendSlashes(JSON.stringify(this.paramShareService.ansibleServerData));
+ let input = {
+ "input": {
+ "design-request": {
+ "request-id": localStorage['apiToken'],
+ "action": "uploadAdminArtifact",
+ "payload": "{\"userID\": \"admin\",\"vnf-type\" : \"NULL \",\"action\" : \"NULL\",\"artifact-name\" : \""+this.fileName+"\",\"artifact-type\" : \"APPC-CONFIG\",\"artifact-version\" : \"0.1\",\"artifact-contents\":\""+artifactContent+"\"}",
+ }
+ }
+ }
+ let response = this.apiService.callGetArtifactsApi(input);
+ response.subscribe(response => {
+ this.utilService.processApiSubscribe(response, this.utilService.putAction, "admin artifact");
+ //this.clearCache();
+ },
+ error => this.utilService.processApiError());
+ }
+
+ // ngOnDestroy() {
+ // console.log("destry....")
+ // }
+
+ clearCache() {
+ this.paramShareService.ansibleServerData = undefined;
+ sessionStorage.removeItem('ansibleserver');
+ }
+
+ download() {
+ if(this.ansibleServerData){
+ this.utilService.downloadArtifactToPc(JSON.stringify(this.ansibleServerData, null, '\t'), "json", this.fileName, 100)
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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============================================
+*/
+
+.form-group {
+ padding: 5px
+}
+
+.panel {
+ margin-top: 20px;
+}
+
+.form-control {
+ width: 100%;
+}
+
+.panel-header {
+ padding: 20px 0px;
+}
+
+.container {
+ border-radius: 0.375rem;
+ transition: all 0.3s ease;
+ padding: 40px;
+}
+
+.container2 {
+ box-shadow: -4px 14px 20px 0px rgba(46, 61, 73, 0.15);
+ border-radius: 0.375rem;
+ transition: all 0.3s ease;
+ padding: 10px;
+ margin-top: 57px;
+}
+
+.error-message {
+ color: red;
+}
+
+.warning-message {
+ color: rgb(255,191,0);
+}
+
+.create-wrapper {
+ text-align: left;
+}
+
+.removevnfcClass {
+ text-align: right;
+}
+
+.form-custom-group {
+ margin-bottom: 0;
+ vertical-align: middle;
+}
+
+.side-by-side {
+ position: relative;
+}
+
+.sidebtn {
+ position: absolute;
+ left: 26.5em;
+ top: 0em;
+}
+
+.clear-control {
+ margin: 40px 20px;
+ display: inherit;
+}
+
+.short-column {
+ width: 100px;
+}
+
+.long-column {
+ width: 200px;
+}
+
+th,
+td {
+ min-width: 150px;
+}
+
+.headlinesInBold {
+ font-weight: bold;
+}
+
+.titleCustom {
+ padding-left: 25px;
+ overflow: visible;
+}
+
+.anchorHover {
+ cursor: pointer;
+}
+
+.custom-btn {
+ margin-top: 20px;
+ margin-bottom: 10px;
+}
+
+.clear-btn {
+ margin-top: 23px;
+}
+
+.col-md-button {
+ margin: auto;
+ margin-right: 20px;
+ text-align: center;
+ margin-bottom: 15px;
+}
+
+.selectedAction {
+ /* change here */
+ font-weight: bold;
+ color: #1A86E4
+}
+
+.file {
+ visibility: hidden;
+ position: absolute;
+}
+
+.col-md-1point5 {width: 12%}
+.col-md-2point5 {width: 21%;}
\ No newline at end of file
--- /dev/null
+<!--
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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============================================
+-->
+
+<simple-notifications [options]="options"></simple-notifications>
+<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'" [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress>
+ <div class="card">
+
+ <div class="card-block" style=" border-top: 5px solid #6ab344; border-top-right-radius: 7px;border-top-left-radius: 7px;">
+ <div class="row" style="padding: 15px 25px">
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Configuration Server FQDN *</label>
+ <input type="text" value={{item.server}} class="form-control" id="txtServer" [(ngModel)]="item.server" name="server" (ngModelChange)="validateFdqn($event)">
+ <span class="error-message">{{errorMessage}}</span><span class="warning-message">{{warningMessage}}</span>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Port *</label>
+ <input type="text" value={{item.port}} class="form-control" id="txtPort" [(ngModel)]="item.port" name="port" (ngModelChange)="validatePort($event)">
+ <span class="error-message">{{porterrorMessage}}</span><span class="warning-message">{{portwarningMessage}}</span>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Description </label>
+ <input type="text" class="form-control" id="txtDescr" [(ngModel)]="item.descr" #descr="ngModel" name="descr">
+ </div>
+ </div>
+ <div class="row" style="padding: 15px 25px">
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Creator </label>
+ <input type="text" readonly class="form-control" id="txtCreator" [(ngModel)]="item.creator" #creator="ngModel" name="creator">
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Date Created</label>
+ <input type="text" readonly class="form-control" id="txtCreatedDate" name="created-date" value="{{item['created-date'].toString()}}">
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Modifier </label>
+ <input type="text" readonly class="form-control" id="txtModifier" [(ngModel)]="item.modifier" #modifier="ngModel" name="modifier">
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label>Date Modified </label>
+ <input type="text" readonly class="form-control" id="txtModifiedDate" name="modified-date" value="{{item['modified-date'].toString()}}">
+ </div>
+
+ </div>
+
+ </div>
+ <div class="card-block" style="padding: 10px">
+ <div>
+ <div class="create-wrapper" style="padding: 0px 25px">
+
+ <div class="row">
+ <div class="col-12">
+
+
+ <div class="row" >
+ <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
+ <label style="font-size:12px;">Cloud-Owner</label>
+ <input type="text" class="form-control" id="sampleowner" [(ngModel)]="sample['ownerid']" #sampleOwner="ngModel" name="sampleowner">
+ <span class="error-message">{{ownerIdErrMsg}}</span>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px">Cloud-Region-ID</label>
+ <input type="text" class="form-control" id="sampleregionid" [(ngModel)]="sample['regionid']" #sampleRegionId="ngModel" name="sampleregionid">
+ <span class="error-message">{{regionIdErrMsg}}</span>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px">Tenant ID</label>
+ <input type="text" class="form-control" id="sampletenantid" [(ngModel)]="sample['tenantid']" #sampleTenantId="ngModel" name="sampletenantid">
+ <span class="error-message">{{tenantIdErrMsg}}</span>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px"></label>
+ <div class="form-group">
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="button" (click)="addInfo()">Add </button>
+ </div>
+ </div>
+ </div>
+ <div class="row" >
+ <span class="error-message">{{zeroTenantIdsErrorMsg}}</span>
+ </div>
+
+ <div *ngIf="item.info?.length>0">
+ <div class="row" *ngFor="let info of item.info;trackBy:trackByFn; let j=index">
+ <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
+ <label style="font-size:12px;">Cloud-Owner</label>
+ <input type="text" class="form-control" id="ownerid{{j}}" [(ngModel)]="info['ownerid']" name="ownerid{{j}}">
+ <div *ngIf="info['ownerid'].length==0"><span class="error-message">Enter Owner ID</span></div>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px">Cloud-Region-ID</label>
+ <input type="text" class="form-control" id="regionid{{j}}" [(ngModel)]="info['regionid']" name="regionid{{j}}">
+ <div *ngIf="info['regionid'].length==0"><span class="error-message">Enter Region ID</span></div>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px">Tenant ID</label>
+ <input type="text" class="form-control" id="tenantid{{j}}" [(ngModel)]="info['tenantid']" name="tenantid{{j}}">
+ <div *ngIf="info['tenantid'].length==0"><span class="error-message">Enter Tenant ID</span></div>
+ </div>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px"> </label>
+ <div class="form-group">
+ <a role="button" style="color: white" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="removeInfo(j)">Remove</a>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+
+ <div class="row justify-content-end" style="padding: 15px 25px">
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <a role="button" style="color: white" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="cancel()">Cancel</a>
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="validate()" >Return</button>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </div>
--- /dev/null
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 * as XLSX from 'xlsx';
+import * as _ from 'underscore';
+
+import { ActivatedRoute, Router } from '@angular/router';
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { Observable } from 'rxjs/Observable';
+import { UtilityService } from '../../shared/services/utilityService/utility.service';
+
+// Common Confirm Modal
+import { DialogService } from 'ng2-bootstrap-modal';
+import { ParamShareService } from '../../shared/services/paramShare.service';
+
+
+declare var $: any;
+type AOA = Array<Array<any>>;
+
+@Component({
+ selector: 'ansible-server',
+ templateUrl: './ansible-server.component.html',
+ styleUrls: ['./ansible-server.component.css'],
+})
+export class AnsibleServerComponent implements OnInit {
+
+ //settings for the notifications.
+ options = {
+ timeOut: 4500,
+ showProgressBar: true,
+ pauseOnHover: true,
+ clickToClose: true,
+ maxLength: 200
+ };
+
+ public ownerIdErrMsg;
+ public regionIdErrMsg;
+ public tenantIdErrMsg
+ public zeroTenantIdsErrorMsg;
+ public porterrorMessage;
+ public portwarningMessage;
+ public errorMessage;
+ public warningMessage;
+ public invalid = true;
+ public portinvalid = true;
+ public item;
+ public sample = {ownerid:"", regionid:"", tenantid:""};
+ public updateIndex;
+ public currentUser;
+ constructor(
+ private paramShareService: ParamShareService,
+ private router: Router,
+ private activeROute: ActivatedRoute,
+ private utilService: UtilityService
+
+ )
+ {
+ console.log("testing....");
+ }
+
+ngOnInit() {
+ this.currentUser = localStorage['userId'];
+ this.item = JSON.parse(sessionStorage.getItem("ansibleserver"));
+ this.updateIndex = parseInt(sessionStorage.getItem("updateIndex"));
+ console.log("index===>"+this.updateIndex);
+ if(!this.paramShareService.ansibleServerData) {
+ this.invalid = true;
+ } else {
+ this.invalid = false;
+ }
+ console.log("selecteditem===>"+JSON.stringify(this.item));
+}
+
+addInfo() {
+ console.log("selectediteminfo===>"+JSON.stringify(this.item.info));
+ if(this.validateTenantId()) {
+ this.item.info.push(this.sample)
+ this.sample = {ownerid:"", regionid:"", tenantid:""};
+ this.zeroTenantIdsErrorMsg = "";
+ }
+
+}
+
+removeInfo(index) {
+ console.log("selectediteminfo===>"+index+JSON.stringify(this.item.info));
+ this.item.info.splice(index, 1);
+ console.log("selectediteminfo===>"+JSON.stringify(this.item.info));
+
+}
+
+// save() {
+// console.log("ansibleServerData===>"+ JSON.stringify(this.paramShareService.ansibleServerData))
+// let ansibleServer = this.createAnsibleserverData(this.item);
+// this.paramShareService.ansibleServerData["fqdn-list"].push(ansibleServer);
+// this.router.navigate(['../admin'], {
+// relativeTo: this.activeROute
+// });
+// }
+
+update() {
+ console.log("ansibleServerData===>"+ JSON.stringify(this.paramShareService.ansibleServerData))
+
+
+ let ansibleServer = this.createAnsibleserverData(this.item);
+ //need to revisit to initialize paramShareService.ansibleServerData
+ if(!this.paramShareService.ansibleServerData) {
+ this.paramShareService.ansibleServerData = {"fqdn-list" : []};
+ }
+ if(this.updateIndex != this.paramShareService.ansibleServerData["fqdn-list"].length) {
+ ansibleServer["modify-username"] = this.currentUser;
+ ansibleServer["modify-date"] = this.utilService.getDate();
+ console.log("update........")
+ }
+ this.paramShareService.ansibleServerData["fqdn-list"][this.updateIndex] = ansibleServer;
+ this.router.navigate(['../admin'], {
+ relativeTo: this.activeROute
+ });
+
+
+}
+
+cancel() {
+ sessionStorage.removeItem("ansibleserver");
+ this.router.navigate(['../admin'], {
+ relativeTo: this.activeROute
+ });
+}
+
+createAnsibleserverData(displayAnsibleServer){
+ let cloudOwnerList = this.createCloudOwnerList(displayAnsibleServer);
+ let anisble = {
+ "vnf-management-server-fqdn": displayAnsibleServer.server+":"+displayAnsibleServer.port,
+ "cloud-owner-list":cloudOwnerList,
+ "description":displayAnsibleServer.descr,
+ "username":displayAnsibleServer.creator,
+ "create-date":displayAnsibleServer['created-date'],
+ "modify-username":displayAnsibleServer.modifier,
+ "modify-date":displayAnsibleServer['modified-date']
+ };
+ return anisble;
+
+}
+
+createCloudOwnerList(displayAnsibleServer) {
+ let cloudOwnerList = [];
+
+ //prepare unique cloud-owner
+ for(let i=0; i<displayAnsibleServer.info.length; i++) {
+ let info = displayAnsibleServer.info[i];
+ let cloudOwner = {};
+ cloudOwner["cloud-owner"] = info.ownerid;
+ let exist = false;
+ cloudOwnerList.forEach(element => {
+ if(element["cloud-owner"] == info.ownerid) {
+ exist = true;
+
+ }
+ });
+ if(!exist){
+ cloudOwnerList.push(cloudOwner);
+ }
+
+ }
+ console.log("cloudOwnerList===>"+JSON.stringify(cloudOwnerList));
+
+ //prepare region id
+ cloudOwnerList.forEach(cloudOwner => {
+ let regionIdList = [];
+ for(let i=0; i<displayAnsibleServer.info.length; i++) {
+ let info = displayAnsibleServer.info[i];
+ if(cloudOwner["cloud-owner"] == info.ownerid) {
+ let exist = false;
+ regionIdList.forEach(element => {
+ if(element["region-id"] == info.regionid) {
+ exist = true;
+ }
+ });
+ if(!exist){
+ regionIdList.push({"region-id":info.regionid});
+ }
+ }
+
+ }
+ cloudOwner["region-id-list"] = regionIdList;
+ });
+
+ console.log("cloudOwnerList===>"+JSON.stringify(cloudOwnerList));
+
+ //prepare tenant id
+ cloudOwnerList.forEach(cloudOwner => {
+ cloudOwner["region-id-list"].forEach(regionid => {
+ let teanantIdList = [];
+ for(let i=0; i<displayAnsibleServer.info.length; i++) {
+ let info = displayAnsibleServer.info[i];
+ if(cloudOwner["cloud-owner"] == info.ownerid && regionid["region-id"] == info.regionid) {
+ let exist = false;
+ teanantIdList.forEach(element => {
+ if(element == info.tenantid) {
+ exist = true;
+ }
+ });
+ if(!exist){
+ teanantIdList.push(info.tenantid);
+ }
+ }
+
+ }
+ regionid["tenant-id-list"] = teanantIdList;
+ });
+ });
+ console.log("cloudOwnerList===>"+JSON.stringify(cloudOwnerList));
+ return cloudOwnerList;
+ }
+
+ //validating the fdqn url
+ validateFdqn(fdqn) {
+ if (fdqn.trim().length < 1) {
+ this.errorMessage = 'Please enter Configuration Server FQDN';
+ this.warningMessage = '';
+ this.invalid = true;
+ } else if (fdqn.startsWith(' ') || fdqn.endsWith(' ')) {
+ this.errorMessage = 'Leading and trailing spaces are not allowed';
+ this.warningMessage = '';
+ this.invalid = true;
+ } else if (!(fdqn.startsWith('http') || fdqn.endsWith('https'))) {
+ this.warningMessage = 'FDQN can start with eighther http or https protocol';
+ this.errorMessage = '';
+ this.invalid = false;
+
+ // } else if (name.includes(' ')) {
+ // this.errorMessage = 'More than one space is not allowed in VNFC Type';
+ // this.invalid = true;
+ // } else if (name.length > 50) {
+ // this.errorMessage = 'VNFC Type should be of minimum one character and maximum 50 character';
+ // this.invalid = true;
+ //
+ } else {
+ this.invalid = false;
+ this.errorMessage = '';
+ this.warningMessage = '';
+ }
+ }
+
+ //validating the port
+ validatePort(port) {
+ if (port.trim().length < 1) {
+ this.porterrorMessage = 'Please enter port';
+ this.portwarningMessage = '';
+ this.invalid = true;
+ } else if (port.startsWith(' ') || port.endsWith(' ')) {
+ this.porterrorMessage = 'Leading and trailing spaces are not allowed';
+ this.portwarningMessage = '';
+ this.invalid = true;
+
+ } else if (isNaN(port)) {
+ this.portwarningMessage = '';
+ this.porterrorMessage = 'Port should be a number';
+ this.invalid = true;
+ port = parseInt(port);
+ } else if (!(0 <= port && port <= 65535 )) {
+ this.portwarningMessage = 'Port should be a number in range of 0 to 65535';
+ this.porterrorMessage = '';
+ this.invalid = false;
+ } else {
+ this.invalid = false;
+ this.porterrorMessage = '';
+ this.portwarningMessage = '';
+ }
+ }
+
+ validate() {
+ this.validateFdqn(this.item.server);
+ this.validatePort(this.item.port);
+ if(this.item.info.length <= 0) {
+ this.zeroTenantIdsErrorMsg = "Please add atleast one Tenant ID.";
+ this.invalid = true;
+ }
+ if(!this.invalid) {
+ this.update();
+ }
+ }
+
+ validateTenantId(){
+ let valid = true;
+ if(this.sample.ownerid.trim().length == 0) {
+ this.ownerIdErrMsg = "Enter OwnerID";
+ valid = false;
+ } else {
+ this.ownerIdErrMsg = "";
+ }
+ if(this.sample.regionid.trim().length == 0) {
+ this.regionIdErrMsg = "Enter RegionID";
+ valid = false;
+ } else {
+ this.regionIdErrMsg = "";
+ }
+ if(this.sample.tenantid.trim().length == 0) {
+ this.tenantIdErrMsg = "Enter TenantID";
+ valid = false;
+ } else {
+ this.tenantIdErrMsg = "";
+ }
+ return valid;
+ }
+
+
+}
============LICENSE_END============================================
*/
-import { BrowserModule } from '@angular/platform-browser';
-import { NgModule } from '@angular/core';
-import { FormsModule } from '@angular/forms';
-import { SimpleNotificationsModule } from 'angular2-notifications';
-import { BootstrapModalModule } from 'ng2-bootstrap-modal';
-import { HomeModule } from './home/home.module';
-import { AppComponent } from './app.component';
-import { AppRoutingModule } from './app.routing';
-import { SharedModule } from './shared/shared.module';
-import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
-import { HashLocationStrategy, LocationStrategy } from '@angular/common';
-import { NoopAnimationsModule } from '@angular/platform-browser/animations';
-import { RouterModule } from '@angular/router';
-import { TestComponent } from './test/test.component';
-import { AboutUsComponent } from './about-us/aboutus.component';
-import { NgProgressModule } from 'ngx-progressbar';
-import { LoginGuardService } from './vnfs/LoginGuardService/Login-guard-service';
-import { ConfirmComponent } from './shared/confirmModal/confirm.component';
+import {BrowserModule} from '@angular/platform-browser';
+import {NgModule} from '@angular/core';
+import {FormsModule} from '@angular/forms';
+import {SimpleNotificationsModule} from 'angular2-notifications';
+import {HomeModule} from './home/home.module';
+import {AppComponent} from './app.component';
+import {AppRoutingModule} from './app.routing';
+import {SharedModule} from './shared/shared.module';
+import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
+import {HashLocationStrategy, LocationStrategy} from '@angular/common';
+import {NoopAnimationsModule} from '@angular/platform-browser/animations';
+import {RouterModule} from '@angular/router';
+import {TestComponent} from './test/test.component';
+import {AboutUsComponent} from './about-us/aboutus.component';
+import {NgProgressModule} from 'ngx-progressbar';
+import {LoginGuardService} from './vnfs/LoginGuardService/Login-guard-service';
+import {Ng2Bs3ModalModule} from 'ng2-bs3-modal/ng2-bs3-modal';
import { NgxSpinnerModule } from 'ngx-spinner';
+import {AdminComponent} from './admin/admin.component';
+import {AnsibleServerComponent} from './admin/view-edit/ansible-server.component';
+
@NgModule({
- declarations: [AppComponent, TestComponent, AboutUsComponent, ConfirmComponent],
+ declarations: [AppComponent, TestComponent,AnsibleServerComponent, AdminComponent, AboutUsComponent],
imports: [BrowserModule, FormsModule, HomeModule, SharedModule.forRoot(),
- NgbModule.forRoot(), NoopAnimationsModule, AppRoutingModule, SimpleNotificationsModule, NgProgressModule, BootstrapModalModule, NgxSpinnerModule],
+ NgbModule.forRoot(), NoopAnimationsModule, AppRoutingModule, SimpleNotificationsModule, NgProgressModule, Ng2Bs3ModalModule, NgxSpinnerModule],
exports: [RouterModule],
- providers: [{ provide: LocationStrategy, useClass: HashLocationStrategy }, LoginGuardService],
- entryComponents: [ConfirmComponent],
+ providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}, LoginGuardService],
+
+ bootstrap: [AppComponent],
+ entryComponents: [AnsibleServerComponent]
- bootstrap: [AppComponent]
})
export class AppModule {
-}
+}
\ No newline at end of file
import {LogoutComponent} from './shared/components/logout/logout.component';
import {NgModule} from '@angular/core';
import {TestComponent} from './test/test.component';
+import {AdminComponent} from './admin/admin.component';
+import {AnsibleServerComponent} from './admin/view-edit/ansible-server.component';
+
const routes: Routes = [
{
component: TestComponent,
canActivate:[LoginGuardService]
},
+ {
+ path: 'admin',
+ component: AdminComponent,
+ canActivate:[LoginGuardService]
+ },
+ {
+ path: 'ansible-server',
+ component: AnsibleServerComponent,
+ canActivate:[LoginGuardService]
+ },
{
path: 'help',
component: HelpComponent,
+++ /dev/null
-{
- "CONTACT_US": {
- "CONTACT_US_EMAIL": "cdtSupportTeam@yourCompany.com",
- "CONTACT_US_SUBJECT": "CDT Contact Us"
- },
- "username": "admin",
- "password": "admin"
-}
\ No newline at end of file
============LICENSE_END============================================ -->
<div class="android-more-section">
- <div class="android-section-title mdl-typography--display-1-color-contrast">WELCOME TO CONTROLLER DESIGN TOOL
+ <div class="android-section-title mdl-typography--display-1-color-contrast" style="margin-inline-start: 15%">WELCOME TO CONTROLLER DESIGN TOOL
</div>
<div class="mdl-card__title">
- <h4 class="mdl-card__title-text">The Controller Design Tool allows technology owners to create artifacts for Configuration and Life Cycle Management functions that are required to manage the lifecycle of Virtual Network Functions (VNFs).<br> Select My VNFS to enter credentials and view existing designs or create new ones.
+ <h4 class="mdl-card__title-text">The Controller Design Tool allows technology owners to create artifacts for Configuration and Life Cycle Management functions that are required
+ to manage the lifecycle of Virtual Network Functions (VNFs).<br> Select My VNFS to enter credentials and view existing designs or create new
+ ones.
</h4>
</div>
-</div>
+</div>
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================ */
-import {Pipe, PipeTransform} from '@angular/core';
+import { Pipe, PipeTransform } from '@angular/core';
-@Pipe({name: 'vmFiltering', pure: false})
+@Pipe({ name: 'vmFiltering', pure: false })
export class VmFilteringPipe implements PipeTransform {
- transform(value: any, action: any, templateId): any {
-
+ transform(value: any, action: any, templateId, newVnfc): any {
+ let filterValue
+ if(action == 'ConfigScaleOut'){
+ filterValue= templateId
+ } else if(action == 'Configure' || action == 'ConfigModify'){
+ filterValue= newVnfc
+ }
if (action == 'ConfigScaleOut') {
let x = value.filter(obj => {
//return value
- return obj['template-id'] == templateId;
+ return obj['template-id'] == filterValue;
});
- console.log(x);
+
+ return x;
+ } else if( action == 'Configure' || action == 'ConfigModify'){
+ let x = value.filter(obj => {
+ //return value
+ return ( obj['vnfcType-id'] == filterValue || obj['vnfcType-id'] == undefined);
+ });
+
+
return x;
} else {
return value;
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
-import { Component, Input, OnInit, OnDestroy } from '@angular/core';
-import { Router } from '@angular/router';
+import {Component, Input, OnInit} from '@angular/core';
+import {Router} from '@angular/router';
+import {EmitterService} from '../../services/emitter.service';
import { Subscription } from 'rxjs/Subscription';
-import { EmitterService } from '../../services/emitter.service';
-@Component({ selector: 'app-navigation', templateUrl: './navigation.component.html', styleUrls: ['./navigation.component.css'] })
-export class NavigationComponent implements OnInit, OnDestroy {
+
+@Component({selector: 'app-navigation', templateUrl: './navigation.component.html', styleUrls: ['./navigation.component.css']})
+export class NavigationComponent implements OnInit {
navigationTabs: Array<Object> = [];
//@ViewChild(GoldenConfigurationComponent) goldenConfig: GoldenConfigurationComponent;
@Input() id: string;
name: 'Test',
url: 'test',
},
+ {
+ name: 'Admin',
+ url: 'admin'
+ },
+
{
name: 'About us',
url: 'aboutUs'
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================ */
import { Component } from '@angular/core';
export interface ConfirmModel {
title: string;
message: string;
- cancelButtonText: string;
- confirmButtonText: string;
}
@Component({
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
- <h4 class="modal-title">{{title}}</h4>
- <button type="button" class="close" (click)="cancel()">×</button>
+ <button type="button" class="close" (click)="close()">×</button>
+ <h6 class="modal-title">{{title || 'Save all changes for current action to APPC database.'}}</h6>
</div>
<div class="modal-body">
- <p>{{message}}</p>
+ <p>{{message || 'Do you want to save the changes?'}}</p>
</div>
<div class="modal-footer">
- <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="confirm()">{{confirmButtonText}}</button>
- <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="cancel()">{{cancelButtonText}}</button>
+ <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="onCancel()">No</button>
+ <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="onConfirm()">Yes</button>
</div>
</div>
</div>`
export class ConfirmComponent extends DialogComponent<ConfirmModel, boolean> implements ConfirmModel {
title: string;
message: string;
- cancelButtonText: string;
- confirmButtonText: string;
constructor(dialogService: DialogService) {
super(dialogService);
}
- confirm() {
- // we set dialog result as true on click on confirm button,
+ onConfirm() {
+ // we set dialog result as true on click on Yes button,
// then we can get dialog result from caller code
this.result = true;
this.close();
}
- cancel() {
- // we set dialog result as false on click on cancel/close button,
+ onCancel() {
+ // we set dialog result as false on click on Yes button,
// then we can get dialog result from caller code
this.result = false;
this.close();
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================ */
-import {Pipe, PipeTransform} from '@angular/core';
+import { Pipe, PipeTransform } from '@angular/core';
-@Pipe({name: 'vmFiltering', pure: false})
+@Pipe({ name: 'vmFiltering', pure: false })
export class VmFilteringPipe implements PipeTransform {
- transform(value: any, action: any, templateId): any {
-
+ transform(value: any, action: any, templateId, newVnfc): any {
+ let filterValue
+ if(action == 'ConfigScaleOut'){
+ filterValue= templateId
+ } else if(action == 'Configure' || action == 'ConfigModify'){
+ filterValue= newVnfc
+ }
if (action == 'ConfigScaleOut') {
let x = value.filter(obj => {
//return value
- return obj['template-id'] == templateId;
+ return obj['template-id'] == filterValue;
});
+
+ return x;
+ } else if( action == 'Configure' || action == 'ConfigModify'){
+ let x = value.filter(obj => {
+ //return value
+ return ( obj['vnfcType-id'] == filterValue || obj['vnfcType-id'] == undefined);
+ });
+
+
return x;
} else {
return value;
--- /dev/null
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {NotificationsService} from 'angular2-notifications';
+import { HttpUtilService } from './httpUtil/http-util.service';
+import { environment } from '../../../environments/environment';
+
+
+@Injectable()
+export class APIService {
+
+ constructor(private notificationService: NotificationsService, private httpUtils: HttpUtilService) {
+ }
+
+ public callGetArtifactsApi(payloadData){
+ console.log("APIService: PAYLOAD====>"+JSON.stringify(payloadData));
+ return this.httpUtils.post({
+ url: environment.getDesigns,
+ data: payloadData
+ })/*.subscribe(response => {
+ if (this.checkResult(response, action, artifactType)) {
+ //Call the respective response handler.
+ }
+ },
+ error => this.notificationService.error('Error', this.connectionErrorMessage))*/
+ }
+
+
+
+}
export class HttpUtilService {
headers: Headers;
options: RequestOptions
- private username = require('../../../cdt.application.properties.json').username;
- private password = require('../../../cdt.application.properties.json').password;
+ private username = require('../../../../cdt.application.properties.json').username;
+ private password = require('../../../../cdt.application.properties.json').password;
constructor(private http: Http) {
this.headers = new Headers({ 'Content-Type': 'application/json' }); // ... Set content type to JSON
- this.options = new RequestOptions({headers: this.headers}); //
}
-
get(req) {
+
return this
.http
.get(req.url, this.options)
.map((res: Response) => res.json())
}
-
post(req) {
this.headers.append('Authorization', 'Basic ' + btoa(this.username + ':' + this.password));
this.options = new RequestOptions({ headers: this.headers });
+
return this
.http
.post(req.url, req.data, this.options)
public latestAction: any;
public selectedWord: any;
identifier: any;
+ private selectedVNFCType;
private _navItem = {};
private _observer: Observer<any>;
private referenceList = [];
- newObject: any;
-
+ newObject: any
constructor() {
this.navChange$ = new Observable(observer =>
this._observer = observer).share();
}
selectedObj(data) {
this.newObject = data;
+
}
-
saveLatestIdentifier(identifier) {
this.identifier = identifier;
}
+ setSelectedVNFCType(vnfcType) {
+ this.selectedVNFCType = vnfcType;
+ }
+
+ getSelectedVNFCType() {
+ return this.selectedVNFCType;
+ }
+
public getParamContent() {
return this.paramContent;
}
}
- public initialise(editor: any, editorContent: string, modal: any): void {
+ public initialise(editor: any, editorContent: string): void {
this.editor = editor;
this.editor.session = editor.session;
this.editor.selection.session.$backMarkers = {};
this.editorContent = editorContent;
this.editor.$blockScrolling = Infinity;
this.editor.$blockSelectEnabled = false;
- this.initialiseCommands(modal);
- this.editor.setValue(this.editorContent);
+ //this.initialiseCommands(modal);
+ //this.editor.setValue(this.editorContent);
this.refreshEditor();
}
for (var prop in paramJson) {
let value: string = paramJson[prop];
if (value) {
- var occurances = this.editor.findAll(value, {regExp: false});
+ var occurances = this.editor.findAll(value, { regExp: false });
var ranges = this.editor.getSelection().getAllRanges();
if (ranges && occurances && occurances > 0) {
selectedRange.start.column = selectedRange.start.column - 1;
selectedRange.end.column = selectedRange.end.column + 1;
if ((this.editor.session.getTextRange(selectedRange).startsWith(' ')
- || this.editor.session.getTextRange(selectedRange).startsWith('"')
- || this.editor.session.getTextRange(selectedRange).startsWith('>'))
+ || this.editor.session.getTextRange(selectedRange).startsWith('"')
+ || this.editor.session.getTextRange(selectedRange).startsWith('>'))
&& (this.editor.session.getTextRange(selectedRange).endsWith(' ')
|| this.editor.session.getTextRange(selectedRange).endsWith('"')
|| this.editor.session.getTextRange(selectedRange).endsWith(',')
}
public autoAnnotateTemplateForParam(): void {
- var occurances = this.editor.findAll(this.T_KEY_EXPRESSION, {regExp: true});
+ var occurances = this.editor.findAll(this.T_KEY_EXPRESSION, { regExp: true });
var ranges = this.editor.getSelection().getAllRanges();
if (ranges) {
for (var r = 0; r < ranges.length; r++) {
}
replaceNamesWithBlankValues() {
- var occurances = this.editor.findAll(this.SYNC_T_KEY_EXPRESSION, {regExp: true});
+ var occurances = this.editor.findAll(this.SYNC_T_KEY_EXPRESSION, { regExp: true });
var ranges = this.editor.getSelection().getAllRanges();
if (occurances > 0) {
if (ranges) {
for (var r = 0; r < ranges.length; r++) {
let selectedRange: any = ranges[r];
+ // console.log("Selected range == " + selectedRange)
let selectedWord: string = this.editor.session.getTextRange(selectedRange);
let specialKeys = (selectedWord.substring(2, selectedWord.length - 1)).match(this.checkSpecialCharsReg);
- if (selectedWord && this.checkAppliedForNamesOnly(selectedRange) && !specialKeys) {
+ // console.log("Selected word == " + selectedWord.length)
+ //if (!selectedWord.startsWith('<') || !selectedWord.startsWith('{')) {
+ if (specialKeys && specialKeys.length) {
+ }
+
+ else if (selectedWord && this.checkAppliedForNamesOnly(selectedRange) && !specialKeys && this.checkComments(selectedRange)) {
let replaceWord: any = this.KEY_START + '' + this.KEY_MID + selectedWord.substring(2, selectedWord.length - 1) + this.KEY_END;
this.editor.session.replace(selectedRange, replaceWord);
}
-
+ // }
}
}
}
this.hasErrorCode = false;
for (var r = 0; r < ranges.length; r++) {
let keyValue: string = this.editor.session.getTextRange(ranges[r]);
- if (keyValue && keyValue.startsWith(this.KEY_START) && keyValue.endsWith(this.KEY_END) && keyValue.includes(this.KEY_MID)) {
+ //console.log("keyValues==="+keyValue)
+ if (this.checkComments(ranges[r]) && keyValue && keyValue.startsWith(this.KEY_START) && keyValue.endsWith(this.KEY_END) && keyValue.includes(this.KEY_MID)) {
let key: string = keyValue.substring(keyValue.indexOf(this.KEY_MID) + this.KEY_MID_LENGTH, keyValue.indexOf(this.KEY_END));
let value: string = keyValue.substring(this.KEY_START_LENGTH, keyValue.indexOf(this.KEY_MID));
let specialKeys = key.match(this.checkSpecialCharsReg);
if (this.fromScreen === 'TemplateScreen') {
if (key) {
paramJson[key] = value;
- var obj: any = {'paramName': '', 'paramValue': ''};
+ var obj: any = { 'paramName': '', 'paramValue': '' };
obj.paramName = key;
obj.paramValue = value;
paramData.push(obj);
else if (this.fromScreen === 'MappingScreen') {
if (key) {
paramJson[key] = value;
- var obj: any = {'paramName': '', 'paramValue': ''};
+ var obj: any = { 'paramName': '', 'paramValue': '' };
obj.paramName = key;
obj.paramValue = value;
public refreshMarker(): void {
if (this.editor) {
this.hasErrorCode = false;
- var occurances = this.editor.findAll(this.KEY_EXPRESSION, {regExp: true});
+ var occurances = this.editor.findAll(this.KEY_EXPRESSION, { regExp: true });
var ranges = this.editor.getSelection().getAllRanges();
var keysList = [];
// Populate missing keys
for (var r = 0; r < ranges.length; r++) {
let keyValue: string = this.editor.session.getTextRange(ranges[r]);
- if (keyValue && keyValue.startsWith(this.KEY_START) && keyValue.endsWith(this.KEY_END) && keyValue.includes(this.KEY_MID)) {
+ if (this.checkComments(ranges[r]) && keyValue && keyValue.startsWith(this.KEY_START) && keyValue.endsWith(this.KEY_END) && keyValue.includes(this.KEY_MID)) {
let key: string = keyValue.substring(keyValue.indexOf(this.KEY_MID) + this.KEY_MID_LENGTH, keyValue.indexOf(this.KEY_END));
let value: string = keyValue.substring(this.KEY_START_LENGTH, keyValue.indexOf(this.KEY_MID));
let specialKeys = key.match(this.checkSpecialCharsReg);
public generateTemplate(templateEditor: any): void {
if (templateEditor) {
templateEditor.setValue(this.editor.getValue());
- var occurances = templateEditor.findAll(this.KEY_EXPRESSION, {regExp: true});
+ var occurances = templateEditor.findAll(this.KEY_EXPRESSION, { regExp: true });
var ranges = templateEditor.getSelection().getAllRanges();
if (ranges) {
for (var r = 0; r < ranges.length; r++) {
public generateParams(paramsEditor: any, paramsKeyValueEditor: any): JSON {
if (paramsEditor && paramsKeyValueEditor) {
- var occurances = this.editor.findAll(this.KEY_EXPRESSION, {regExp: true});
+ var occurances = this.editor.findAll(this.KEY_EXPRESSION, { regExp: true });
var ranges = this.editor.getSelection().getAllRanges();
if (ranges) {
let paramsJSON: JSON = JSON.parse('{}');
}
-}
+}
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
public templateData: {};
public displayData: {};
public paramData = [];
+ public ansibleServerData : {};
+
setData(data) {
--- /dev/null
+//.. processing document on the server side
+import { Injectable } from '@angular/core';
+//import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { Http, Response, Headers, RequestOptions } from '@angular/http';
+import { Observable } from 'rxjs';
+import { NotificationsService } from 'angular2-notifications';
+
+import { UtilityService } from '../../shared/services/utilityService/utility.service';
+
+//const httpOptionsT = {
+ // headers: new HttpHeaders({ 'Content-Type': 'text/plain' })
+//};
+
+@Injectable(
+// { providedIn: 'root' }
+)
+export class ProcOnSrvSideSvc
+{
+ clName: string = "ProcOnSrvSideSvc";
+ public theUrl: string = "/api/proc_cont";
+ public resUrlPfx: string = "/api/get_result";
+ public parmsUrlPfx: string = "/api/get_params";
+ public taskId: string = '';
+ public stringBuf: string;
+ public responBuf: string;
+ public procResult: string;
+ public parmsBuf: string;
+ public responObj: any;
+ // private respObs: Observable<string>;
+ private respObs: Observable<Response>;
+ private respObsObj: Observable<Object>;
+ public ppartLen: number = 102400; //.. 102912 is too large payload
+ // public ppartLen: number = 10240;
+ public ppartCnt: number = 0;
+ public p_offset: number = 0;
+ public interval: any;
+ cycleCnt: number;
+ cycleMAX: number = 40;
+ editorHolder: any;
+ templSyncer: any;
+ fHeaders: Headers;
+ rOptions: RequestOptions;
+ noptions = {
+ timeOut: 4000,
+ showProgressBar: true,
+ pauseOnHover: true,
+ clickToClose: true,
+ maxLength: 250
+ };
+ prevTstampInt: number = 0;
+ currTstampInt: number = 0;
+ notifDelayMsec: number = 1200;
+
+ constructor(
+ // private http: HttpClient,
+ private http: Http,
+ private utilSvc: UtilityService,
+ private nService: NotificationsService )
+ {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": new: start");
+ this.fHeaders= new Headers({'Content-Type': 'text/plain'});
+ this.rOptions= new RequestOptions({'responseType':0});
+ }
+
+ sendToSrv( content: string, editorHolder: any, templSyncer: any ) {
+ var methName= "sendToSrv";
+ this.stringBuf= content;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": start: content length="+
+ this.stringBuf.length );
+ this.editorHolder= editorHolder;
+ this.templSyncer= templSyncer;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": emptying editor...");
+ this.editorHolder.editor.session.setValue("temp empty");
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": theUrl:["+this.theUrl+"]");
+ this.nService.info( "Start processing",
+ "sending: content length="+this.stringBuf.length, this.noptions );
+ this.taskId= '';
+ let contLen= this.stringBuf.length;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": content length="+contLen+
+ " ppartLen="+this.ppartLen );
+ this.ppartCnt= 1+ Math.floor(contLen / this.ppartLen);
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": ppartCnt="+ this.ppartCnt );
+ if( this.ppartCnt > 1 ) {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": will send multiple parts...");
+ this.nService.info( "Start processing", "will send multiple parts...");
+ this.prevTstampInt= Date.now();
+ this.p_offset= 0;
+ let ppart= this.stringBuf.substr( this.p_offset, this.ppartLen );
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": First part:["+ppart+"]");
+ //.. first
+ this.sendPart( this.theUrl, ppart, 1 );
+ }
+ else { //.. ppartCnt == 1
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": will send all-in-1");
+ this.nService.info( "Start processing",
+ "will send all-in-1 part", this.noptions);
+ this.prevTstampInt= Date.now();
+ //.. single
+ var sUrl= this.theUrl+"?part=1of1";
+ this.sendPart( sUrl, this.stringBuf, 1 );
+ };
+ }
+
+ sendPart( postUrl: string, contPart: string, partNum: number ) {
+ var methName= "sendPart";
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": start: Url:["+postUrl+"]");
+ this.currTstampInt= Date.now();
+ let ntDiff= this.currTstampInt - this.prevTstampInt;
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log( this.clName+": "+methName+
+ ": prevTstampInt="+this.prevTstampInt+
+ " currTstampInt="+this.currTstampInt+" the diff="+ntDiff );
+ if( ntDiff > this.notifDelayMsec ) {
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log(this.clName+": "+methName+": notif.delay's long enough.");
+ this.prevTstampInt= this.currTstampInt;
+ this.nService.info( "Transferring file",
+ " part Number="+partNum, this.noptions );
+ };
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": part length="+ contPart.length );
+ this.respObs=
+ this.http.post( postUrl, contPart, this.rOptions );
+ // this.http.post<string>( postUrl, contPart, httpOptionsT );
+ // this.respObs.subscribe( (respo: string) => {
+ this.respObs.subscribe( (respo: Response) => {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": got response:["+respo+"]");
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log( this.clName+": "+methName+": json:["+
+ JSON.stringify(respo)+"]");
+ this.responBuf= respo.text();
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": responBuf:["+this.responBuf+"]");
+ if( this.taskId.length < 1 ) {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+
+ ": taskId is empty -get it from response");
+ let respObj= JSON.parse(this.responBuf);
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": respObj.taskId:["+
+ respObj.taskId+"]");
+ if( respObj.taskId == null || respObj.taskId.length == 0 ) {
+ let errMsg= this.clName+": "+methName+
+ ": Error: failed to get taskId from the server response !";
+ console.log( errMsg );
+ this.nService.error( "Transferring file", errMsg, this.noptions );
+ return;
+ }
+ else { //.. extracted respObj.taskId
+ this.taskId= respObj.taskId;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": obtained new taskId:["+
+ this.taskId+"]");
+ this.nService.info( "Transferring file",
+ "current taskId:["+this.taskId+"]", this.noptions);
+ };
+ };
+ let tpercent= (100.0*partNum/this.ppartCnt).toFixed();
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+
+ ": part#="+partNum+" transfer percent="+tpercent );
+ this.currTstampInt= Date.now();
+ let ntDiff= this.currTstampInt - this.prevTstampInt;
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log( this.clName+": "+methName+
+ ": prevTstampInt="+this.prevTstampInt+
+ " currTstampInt="+this.currTstampInt+" the diff="+ntDiff );
+ if( ntDiff > this.notifDelayMsec ) {
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log(this.clName+": "+methName+": notif.delay long enough.");
+ this.prevTstampInt= this.currTstampInt;
+ this.nService.info( "Transferring file",
+ " progress: "+tpercent+" %", this.noptions );
+ //" part Number="+partNum+" vs part Count="+this.ppartCnt, this.noptions );
+ };
+ if( partNum < this.ppartCnt ) {
+ // this.nService.info( methName,"need to send more parts...");
+ let partN= partNum + 1;
+ this.p_offset= this.p_offset + this.ppartLen;
+ var ppart= '';
+ if( partN < this.ppartCnt ) {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+
+ ": next part is not the last: partN="+partN );
+ ppart= this.stringBuf.substr( this.p_offset, this.ppartLen );
+ }
+ else {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+ ": next part is the last.");
+ ppart= this.stringBuf.substr( this.p_offset );
+ };
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": next part:["+ppart+"]");
+ let nUrl=
+ this.theUrl+"?taskId="+this.taskId+"&part="+partN+"of"+this.ppartCnt;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": next Url:["+nUrl+"]");
+ this.sendPart( nUrl, ppart, partN );
+ }
+ else { //.. partNum == this.ppartCnt
+ this.nService.info( "Transferring file",
+ "all "+this.ppartCnt+ " parts are sent - check processing...",
+ this.noptions);
+ var progrUrl= "/api/get_progress?taskId="+this.taskId;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(this.clName+": "+methName+": progrUrl:["+progrUrl+"]");
+ this.showProcProgr( progrUrl );
+ };
+ },
+ error => {
+ console.log( this.clName+": "+methName+
+ ": got Error:["+JSON.stringify(error)+']');
+ this.responBuf= JSON.stringify(error);
+ this.nService.error( "Transferring file",
+ " Error:["+this.responBuf+"]", this.noptions);
+ });
+ }
+
+ showProcProgr( proUrl: string ) {
+ var methName= "showProcProgr";
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(methName+": start: proUrl:["+proUrl+"]");
+ this.cycleCnt= 0;
+ this.interval = setInterval( () => {
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log(methName+": call getProcProgr");
+ this.getProcProgr( proUrl );
+ }, 2500 );
+ }
+
+ getProcProgr( proUrl: string ) {
+ var methName= "getProcProgr";
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( methName+": getProcProgr: start: proUrl:["+proUrl+"]");
+ this.cycleCnt++;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( methName+": cycleCnt="+this.cycleCnt );
+ this.nService.info( "Processing",
+ "Requesting server status...", this.noptions);
+ // this.respObsObj=
+ // this.http.get( proUrl );
+ this.respObs=
+ this.http.get( proUrl );
+ // this.respObs.subscribe( (respo: string) => {
+ //this.respObsObj.subscribe( (respo) => {
+ this.respObs.subscribe( (respo: Response) => {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( methName+": response:["+JSON.stringify(respo)+"]");
+ this.responBuf= respo.text();
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( methName+": responBuf:["+this.responBuf+"]");
+ let respObj= JSON.parse(this.responBuf);
+ // this.responObj= respo; //.. Object
+ if( respObj.percentage != undefined &&
+ respObj.percentage != null )
+ {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(methName+": got percentage:["+respObj.percentage+"]");
+ if( respObj.percentage >= 100.0 ) {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(methName+": percentage == 100 !");
+ this.nService.info( "Processing completed",
+ "The server finished: 100% !", this.noptions);
+ clearInterval( this.interval );
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(methName+": getting the processing result...");
+ this.getProcResult();
+ }
+ };
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log(methName+": cycleCnt="+this.cycleCnt+
+ " vs MAX="+this.cycleMAX );
+ if( this.cycleCnt > this.cycleMAX ) {
+ this.nService.error( "Processing",
+ "Too many status requests - stop !",this.noptions );
+ clearInterval( this.interval );
+ }
+ },
+ error => {
+ console.log( this.clName+": "+methName+": got Error:["+
+ JSON.stringify(error)+']');
+ this.responObj= error; //.. as Object
+ this.nService.error( "Processing"," Error:["+
+ JSON.stringify(error)+']', this.noptions );
+ clearInterval( this.interval );
+ });
+ }
+
+ getProcResult() {
+ var methName= "getProcResult";
+ let resUrl= this.resUrlPfx+"?taskId="+this.taskId;
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": start: resUrl:["+resUrl+"]");
+ this.respObs=
+ this.http.get( resUrl, this.rOptions );
+ // this.http.get( resUrl, {responseType: 'text'} );
+ // this.respObs.subscribe( (respo: string) => {
+ this.respObs.subscribe( (respo: Response) => {
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": got response:["+respo+"]");
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log( this.clName+": "+methName+": json:["+
+ JSON.stringify(respo)+"]");
+ this.responBuf= respo.text();
+ if( this.utilSvc.getTracelvl() > 1 )
+ console.log( this.clName+": "+methName+": responBuf:["+this.responBuf+"]");
+ if( this.utilSvc.getTracelvl() == 0 ) {
+ let respoBg= this.responBuf.substr(0, 300);
+ console.log(this.clName+": "+methName+": response Begin:["+respoBg+"...]");
+ };
+ this.procResult= this.responBuf;
+ this.nService.info( "Processing completed",
+ "the result length="+this.procResult.length, this.noptions );
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+
+ ": setting response to the editor...");
+ this.editorHolder.editor.session.setValue( this.procResult );
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": calling syncTemplate ...");
+ this.templSyncer.syncTemplate('1');
+ if( this.utilSvc.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": finished.");
+ },
+ error => {
+ console.log( this.clName+": "+methName+": subscribe Error:["+
+ JSON.stringify(error)+']');
+ this.procResult= JSON.stringify(error);
+ this.nService.error( "Getting Processing result",
+ " Error:["+JSON.stringify(error)+']', this.noptions);
+ });
+ }
+}
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
return artifactData.replace(/"/g, '\\"');
}
+ // get current date in "mm/dd/yyyy"
+ getDate() {
+ let toDay = new Date();
+ return (toDay.getMonth()+1) +"/"+ toDay.getDate() +"/"+ toDay.getFullYear();
+ }
+
+
+
+
public checkResult(result: any) {
if (result.output.status.code == appConstants.errorCode["401"]) {
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
import {ParamShareService} from './services/paramShare.service';
import {TidyTableModule} from './modules/tidy-table/tidy-table.module';
import {UtilityService} from './services/utilityService/utility.service';
-import {VmFilteringPipe} from '../pipes/vm-filtering.pipe';
+import {ProcOnSrvSideSvc} from './services/procOnSrvSide.service';
+
import {SimpleNotificationsModule} from 'angular2-notifications';
import { NgProgressModule } from 'ngx-progressbar';
import {FormsModule} from '@angular/forms';
+import { VmFilteringPipe } from './pipes/vm-filtering.pipe';
+import {APIService} from './services/cdt.apicall'
+
@NgModule({
imports: [
FormsModule,
- CommonModule, HttpModule, RouterModule, TidyTableModule, NgProgressModule, NgbModule, SimpleNotificationsModule.forRoot()],
+ CommonModule, HttpModule, RouterModule, TidyTableModule,
+ // HttpClient, HttpHeaders,
+ NgProgressModule, NgbModule, SimpleNotificationsModule.forRoot()],
declarations: [VmFilteringPipe,
-
HelpComponent,
- HeaderComponent, NavigationComponent, LogoutComponent, Collapse, Dropdown, DropdownNotClosableZone, DropdownOpen, DropDownToggleDirective
+ HeaderComponent, NavigationComponent, LogoutComponent, Collapse,
+ Dropdown, DropdownNotClosableZone, DropdownOpen, DropDownToggleDirective
],
- exports: [VmFilteringPipe, NgProgressModule, NgbModule, HelpComponent, DropDownToggleDirective, HeaderComponent, NavigationComponent, LogoutComponent, TidyTableModule, Collapse, Dropdown, DropdownNotClosableZone, DropdownOpen]
+ exports: [
+ VmFilteringPipe, NgProgressModule, NgbModule, HelpComponent,
+ DropDownToggleDirective, HeaderComponent, NavigationComponent,
+ LogoutComponent, TidyTableModule, Collapse, Dropdown,
+ DropdownNotClosableZone, DropdownOpen
+ ]
})
export class SharedModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: SharedModule,
- providers: [HttpUtilService, EmitterService, NotificationService,
- UtilityService,
- ParamShareService, MappingEditorService]
+ providers: [
+ HttpUtilService, EmitterService, NotificationService,
+ UtilityService,APIService, ProcOnSrvSideSvc,
+ ParamShareService, MappingEditorService
+ ]
};
}
-}
\ No newline at end of file
+}
</div>
</div>
+ <div class="row" style="padding: 10px 15px">
+ <div class="col-lg-3 col-sm-6 col-md-4 col-xs-12">
+ <label>Force Flag </label>
+ <input [(ngModel)]="force" name="Force Flag" type="checkbox">
+ </div>
+ </div>
+
</div>
</div>
<br>
<div style="padding-left:60%;padding-bottom:0.5cm">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="button" [disabled]="!enableDownload" (click)="download()">Download Raw Request/Response
</button>
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button" [disabled]="!enableAbort" (click)="abortTest()">Abandon Test</button>
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button" [disabled]="!enableAbort" (click)="abortTest()">Abandon Test
+ </button>
+
</div>
</div>
<br>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="margin-left: 25%">
<input placeholder="Request Id" [(ngModel)]="requestId" class="mdl-textfield__input" id="requestId" required name="requestId">
</div><br/>
- <button style="margin-left: 30%" type="submit" [disabled]="!enablePollButton" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)=pollTestStatus()>Poll Test Status
+ <button style="margin-left: 33%" type="submit" [disabled]="!enablePollButton" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary"
+ (click)=pollTestStatus()>Poll Test Status
</button>
<br/><br/>
<div class="col-md-12">
- <span style="margin-left: 18.5%"><b>POLL TEST STATUS RESPONSE</b></span>
+ <span style="margin-left: 11%"><b>POLL TEST STATUS RESPONSE</b></span>
</div>
- <div style="margin-left: 18.5%;height:130px;width:60%;border:solid 2px grey;overflow:scroll;overflow-x:hidden;overflow-y:hidden;">
+ <div style="margin-left: 11%;height:150px;width:80%;border:solid 2px grey;overflow:scroll;overflow-x:hidden;overflow-y:hidden;">
<div *ngIf="showStatusResponseDiv">
<div *ngIf="enableCounterDiv"><b>Poll test no {{pollCounter}}</b></div>
import { saveAs } from 'file-saver';
import { Location } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
+import { NotificationService } from '.././shared/services/notification.service';
import { ParamShareService } from '.././shared/services/paramShare.service';
import { MappingEditorService } from '.././shared/services/mapping-editor.service';
import { NotificationsService } from 'angular2-notifications';
vnfcType: any;
protocol: any;
mode: any = 'NORMAL';
- force: any = 'True';
+ public force = 'TRUE';
ttl: any;
public formattedNameValuePairs = {};
public requestId = '';
public apiRequest = '';
public apiResponse = '';
public statusResponse;
+ public appcTimestampResponse;
public outputTimeStamp;
public status;
public statusReason;
- public errorResponse;
+ public errorResponse;
public timer;
public subscribe;
public enableTestButton: boolean = false;
public enableCounterDiv: boolean = false;
public enableDownload: boolean = false;
private userId = localStorage['userId'];
- constructor (
- private location: Location,
- private activeRoutes: ActivatedRoute,
- private nService: NotificationsService,
- private router: Router,
- private paramShareService: ParamShareService,
- private mappingEditorService: MappingEditorService,
- private httpUtil: HttpUtilService,
- private utiltiy: UtilityService,
- private ngProgress: NgProgress,
- private spinner: NgxSpinnerService
- ) {
+ timeStampInt: number;
+ AppcTimeStampInt: number;
+ AppcTimeDiff: number;
+ isAppcTimestampReceived: boolean = false;
+
+ constructor (private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService, private nService: NotificationsService, private router: Router, private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private httpUtil: HttpUtilService,
+ private utiltiy: UtilityService, private ngProgress: NgProgress, private spinner: NgxSpinnerService) {
}
ngOnInit() {
+ let timeStampI = new Date();
+ console.log("ngOnInit: local timeStamp:[" + timeStampI + "]");
+ let timeStampS = timeStampI.toISOString();
+ console.log("ngOnInit: local ISO timestamp:[" + timeStampS + "]");
+ //.. send HTTP request to APPC
+ this.getAppcTimestamp();
+ }
- }
+ /*public download() {
+ let stringData: any;
+ stringData = JSON.stringify(this.paramShareService.getSessionParamData());
+ let paramsKeyValueFromEditor: JSON;
+ paramsKeyValueFromEditor = JSON.parse(stringData);
+ let fileName = 'param_' + this.action + '_' + this.type + '_' + "0.0.1" + 'V';
+ this.JSONToCSVConvertor([paramsKeyValueFromEditor], fileName, true);
+ }*/
public download() {
if (this.apiRequest) {
- var fileName = 'test_' + this.action + '_' + this.actionIdentifiers['vnf-id'] + '_request';
+ var fileName = 'test_' + this.action + '_' + this.actionIdentifiers['vnf-id'] + '_request.json';
var theJSON = this.apiRequest;
if (fileName != null || fileName != '') {
var blob = new Blob([theJSON], {
}
if (this.apiResponse) {
- var fileName = 'test_' + this.action + '_' + this.actionIdentifiers['vnf-id'] + '_response';
+ var fileName = 'test_' + this.action + '_' + this.actionIdentifiers['vnf-id'] + '_response.json';
var theJSON = this.apiResponse;
if (fileName != null || fileName != '') {
var blob = new Blob([theJSON], {
this.enableTestButton = true;
this.enablePollButton = true;
if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe();
+ this.apiResponse="Test has been abandoned and polling stopped";
this.nService.info("Information", "Test has been abandoned and polling stopped");
}
constructTestPayload(listName2, listName3, key, value) {
- if (listName2 == undefined && listName3 == undefined) {
+ if ((listName2 == undefined || listName2 == '') && (listName3 == undefined || listName3 == '')) {
this.subPayload[key] = value;
}
if (listName2) {
}
else {
this.vnfcJson[key] = value;
- this.vmJson['vnfc'] = this.vnfcJson;
+ this.vmJson['vnfc'] = [this.vnfcJson];
this.flag = 1;
}
if (this.vmJson) this.lastvmJson = this.vmJson;
}
constructRequest() {
- let timeStamp = new Date().toISOString();
+ this.timeStampInt = Date.now(); //.. milliseconds
+ let timeStamp;
+ console.log("constructRequest: isAppcTimestampReceived:" +
+ (this.isAppcTimestampReceived ? "true" : "false"));
+ if (this.isAppcTimestampReceived) {
+ console.log("constructRequest: AppcTimeDiff:[" + this.AppcTimeDiff + "]");
+ this.timeStampInt += this.AppcTimeDiff;
+ timeStamp = new Date(this.timeStampInt).toISOString();
+ console.log("constructRequest: got timeStamp from APPC:[" + timeStamp + "]");
+ }
+ else { //.. still not received
+ console.log('constructRequest: Appc Timestamp is not ready (use local)');
+ this.timeStampInt -= 100000;
+ timeStamp = new Date(this.timeStampInt).toISOString();
+ };
+ console.log('constructRequest: timeStamp:[' + timeStamp + ']');
let reqId;
this.requestId = reqId = new Date().getTime().toString();
let data = {
'sub-request-id': this.requestId,
'flags': {
'mode': 'NORMAL',
- 'force': 'TRUE',
+ 'force': this.force.toString().toUpperCase(),
'ttl': 3600
}
},
'payload': JSON.stringify(this.payload)
}
};
+ if (this.action == 'Unlock') {
+ let payload = JSON.parse(data.input['payload']);
+ data.input['common-header']['request-id'] = payload['request-id'];
+ data.input['common-header']['sub-request-id'] = payload['request-id'];
+ }
+
+ if(this.action == 'Unlock' || this.action == 'Lock' || this.action == 'CheckLock') {
+ delete data.input['payload'];
+ }
return data;
}
this.enableTestButton = false;
this.enablePollButton = false;
this.timer = Observable.interval(10000);
- this.subscribe = this.timer.subscribe((t) => this.pollTestStatus());
+ if(this.action == 'Unlock' || this.action == 'Lock' || this.action == 'CheckLock') {
+ this.enablePollButton = true;
+ this.enableBrowse = true;
+ this.enableTestButton = true;
+ this.requestId = '';
+ } else {
+ this.subscribe = this.timer.subscribe((t) => this.pollTestStatus());
+ }
this.ngProgress.start();
this.apiRequest = JSON.stringify(this.constructRequest());
this.httpUtil.post(
{
- url: environment.testVnf + "?urlAction=" + this.getUrlEndPoint(this.action.toLowerCase()),
+ url: environment.testVnf + "?urlAction=" + this.getUrlEndPoint(this.action),
data: this.apiRequest
})
.subscribe(resp => {
},
error => {
this.nService.error('Error', 'Error in connecting to APPC Server');
- this.enableBrowse = true;
+ // this.enableBrowse = true;
this.enableTestButton = true;
this.enablePollButton = true;
this.enableCounterDiv = false;
+ this.enableBrowse = true;
if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe();
});
}, 3500);
}
+ getAppcTimestamp() {
+ this.timeStampInt = Date.now(); //.. milliseconds
+ console.log("getAppcTimestamp: timeStampInt:[" + this.timeStampInt + "]");
+ let timeStampP = new Date(this.timeStampInt).toISOString();
+ console.log("getAppcTimestamp: from int timestamp:[" + timeStampP + "]");
+ this.isAppcTimestampReceived = false;
+ let reqId = new Date().getTime().toString();
+ try {
+ let data = {
+ 'input': {
+ 'design-request': {
+ 'request-id': reqId,
+ 'action': 'getAppcTimestampUTC',
+ 'payload': '{}'
+ }
+ }
+ };
+ console.log('getAppcTimestamp: sending httpUtil.post...');
+ this.httpUtil.post(
+ {
+ url: environment.getDesigns, data: data
+ })
+ .subscribe(resp => {
+ this.appcTimestampResponse = resp;
+ // this.appcTimestampResponse = JSON.stringify(resp);
+ console.log('appcTimestampResponse:[' + resp + ']');
+ this.parseAppcTimestamp(this.appcTimestampResponse);
+ });
+ }
+ catch (e) {
+ this.nService.warn('status',
+ 'Error while retrieving APPC Timestamp(using local by default)!');
+ }
+ }
+
+ parseAppcTimestamp(tstampStr: string) {
+ //.. parse the response to get timestamp as milliseconds
+ // input format: YYYY-MM-DDTHH:mm:ss.sssZ (24 chars)
+ var rexp =
+ new RegExp(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z/);
+ var mresult = rexp.exec(tstampStr);
+ if (mresult[0]) {
+ console.log("parseAppcTimestamp: response format is OK...");
+ var aYearS = mresult[1];
+ var aYear = parseInt(aYearS, 10);
+ var aMonS = mresult[2];
+ var aMon = parseInt(aMonS, 10) - 1;
+ var aDayS = mresult[3];
+ var aDay = parseInt(aDayS, 10);
+ var aHrS = mresult[4];
+ var aHr = parseInt(aHrS, 10);
+ var aMntS = mresult[5];
+ var aMnt = parseInt(aMntS, 10);
+ var aSecS = mresult[6];
+ var aSec = parseInt(aSecS, 10);
+ var aMsecS = mresult[7];
+ var aMsec = parseInt(aMsecS, 10);
+ this.AppcTimeStampInt =
+ Date.UTC(aYear, aMon, aDay, aHr, aMnt, aSec, aMsec);
+ console.log(
+ "parseAppcTimestamp: AppcTimeStampInt:[" + this.AppcTimeStampInt + "]");
+ let timeStampP = new Date(this.AppcTimeStampInt).toISOString();
+ console.log("parseAppcTimestamp: from int timestamp:[" + timeStampP + "]");
+ //.. AppcTimeDiff - time difference in milliseconds
+ this.AppcTimeDiff = this.AppcTimeStampInt - this.timeStampInt;
+ console.log("parseAppcTimestamp: AppcTimeDiff:[" + this.AppcTimeDiff + "]");
+ this.isAppcTimestampReceived = true;
+ }
+ else {
+ throw new Error(
+ 'The received APPC Timestamp is not matching expected format: YYYY-MM-DDTHH:mm:ss.sssZ !');
+ }
+ }
pollTestStatus() {
if (this.requestId && this.actionIdentifiers['vnf-id']) {
- let timeStamp = new Date().toISOString();
+ // console.log("payload==" + JSON.stringify(this.payload))
+ this.timeStampInt = Date.now(); //.. milliseconds
+ let timeStamp;
+ console.log("pollTestStatus: isAppcTimestampReceived:" +
+ (this.isAppcTimestampReceived ? "true" : "false"));
+ if (this.isAppcTimestampReceived) {
+ this.timeStampInt += this.AppcTimeDiff;
+ timeStamp = new Date(this.timeStampInt).toISOString();
+ console.log("pollTestStatus: got timeStamp from APPC:[" + timeStamp + "]");
+ }
+ else { //.. still not received
+ console.log('pollTestStatus: Appc Timestamp is not ready (use local)');
+ this.timeStampInt -= 100000;
+ timeStamp = new Date(this.timeStampInt).toISOString();
+ };
+ console.log("pollTestStatus: timestamp:[" + timeStamp + "]");
let reqId = new Date().getTime().toString();
let data = {
'input': {
'sub-request-id': reqId,
'flags': {
'mode': 'NORMAL',
- 'force': 'TRUE',
+ 'force': this.force.toString().toUpperCase(),
'ttl': 3600
}
},
if (status.toUpperCase() === 'SUCCESS' || status.toUpperCase() === 'SUCCESSFUL') {
if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe();
this.enablePollButton = true;
+ this.enableBrowse = true;
+ this.enableTestButton = true;
}
if (status.toUpperCase() === 'FAILED') {
if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe();
this.enablePollButton = true;
+ this.enableBrowse = true;
+ this.enableTestButton = true;
}
}
else {
this.showStatusResponseDiv = false;
this.errorResponse = 'Error Connecting to APPC server';
this.enableCounterDiv = false;
+ this.enableBrowse = true;
+ this.enableTestButton = true;
if (this.subscribe && this.subscribe != undefined) {
this.subscribe.unsubscribe();
this.enablePollButton = true;
}
});
+
}
else {
this.nService.error("Error", "Please enter vnf Id & request Id");
}
getUrlEndPoint(action) {
- switch (action) {
- case 'configmodify':
- return 'config-modify';
- case 'configbackup':
- return 'config-backup';
- case 'configrestore':
- return 'config-restore';
- case 'healthcheck':
- return 'health-check';
- case 'quiescetraffic':
- return 'quiesce-traffic';
- case 'resumetraffic':
- return 'resume-traffic';
- case 'distributetraffic':
- return 'distribute-traffic';
- case 'startapplication':
- return 'start-application';
- case 'stopapplication':
- return 'stop-application';
- case 'upgradebackout':
- return 'upgrade-backout';
- case 'upgradepostcheck':
- return 'upgrade-post-check';
- case 'upgradeprecheck':
- return 'upgrade-pre-check';
- case 'upgradesoftware':
- return 'upgrade-software';
- case 'upgradebackup':
- return 'upgrade-backup';
- case 'attachvolume':
- return 'attach-volume';
- case 'detachvolume':
- return 'detach-volume';
- default:
- return action.toLowerCase();
+ let charArray = action.split('');
+ let url = '';
+ for (let i = 0; i < charArray.length; i++) {
+ if (charArray[i] == charArray[i].toUpperCase() && i != 0) {
+ url = url + '-';
+ }
+ url = url + charArray[i];
}
+ return url.toLowerCase();
}
setValuesOnFileUploadFailure() {
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
import {Injectable} from '@angular/core';
+import {MappingEditorService} from '../../shared/services/mapping-editor.service';
+import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
@Injectable()
export class LoginGuardService implements CanActivate {
- constructor(private router: Router) {
+ constructor(private ngbModal: NgbModal, private mapService: MappingEditorService, private router: Router) {
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
}
}
-}
+}
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================ */
import {Component, OnInit} from '@angular/core';
+import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-auth-guard-modal',
})
export class AuthGuardModalComponent implements OnInit {
- constructor() {
+ constructor(public activeModal: NgbActiveModal) {
}
ngOnInit() {
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
- <ul class="nav nav-tabs custom-heade-nav" style="margin-bottom: 12px;">
- <li [ngClass]="{'active-tab':((router.url.indexOf('/'+item.url))>-1 || router.url.indexOf(item.url)>-1 )}" *ngFor="let item of tabs">
- <a *ngIf="this.refDataRequiredFiels == true"
+ <ul class="nav nav-tabs custom-heade-nav" style=" margin-bottom: 12px;">
+ <li [ngClass]="{'active-tab':((router.url.indexOf('/'+item.url))>-1 || router.url.indexOf(item.url)>-1 )}"
+ *ngFor="let item of tabs">
+
+ <a *ngIf="this.refDataRequiredFiels == true"
[routerLink]="[item.url]"
[type]="item.type"
class="nav-link">{{item.name}}</a>
import { NotificationsService } from 'angular2-notifications';
import { appConstants } from '../../../constants/app-constants';
-export const ACTIONS_REQUIRED_DROPDOWN = ['Configure', 'ConfigModify', 'ConfigScaleOut', 'DistributeTraffic'];
+export const ACTIONS_REQUIRED_DROPDOWN = ['Configure', 'ConfigModify', 'ConfigScaleOut', 'DistributeTraffic']
+
@Component({ selector: 'app-build-design', templateUrl: './build-artifacts.component.html', styleUrls: ['./build-artifacts.component.css'] })
export class BuildDesignComponent implements OnInit {
public refDataRequiredFiels: boolean = false;
public refList;
- constructor(private router: Router, private notificationsService: NotificationsService) {
+ constructor (private router: Router, private notificationsService: NotificationsService) {
}
ngOnInit() {
}
}
- public getRefData( referenceList, reqObj?) {
- console.log( "getRefData: start: referenceList.action:["+
- referenceList.action+"]");
+ public getRefData(referenceList, reqObj?) {
this.refList = referenceList;
- if( referenceList.action !== '' &&
- referenceList.scope['vnf-type'] !== '' &&
- referenceList['device-protocol'] !== '' )
- {
- if( ACTIONS_REQUIRED_DROPDOWN.indexOf(referenceList.action) > -1)
- {
- if( referenceList.action == 'ConfigScaleOut')
- {
- if( reqObj != undefined && reqObj.hasOwnProperty('reqField') &&
- reqObj.reqField != ''
- )
- this.refDataRequiredFiels = true;
- else
- this.refDataRequiredFiels = false;
+ if (referenceList.action !== '' && referenceList.scope['vnf-type'] !== '' && referenceList['device-protocol'] !== '') {
+ if(ACTIONS_REQUIRED_DROPDOWN.indexOf(referenceList.action) > -1) {
+ //if (referenceList.action === 'ConfigScaleOut') {
+ //console.log(typeof reqObj, selectedIdentifier)
+ // if (referenceList.hasOwnProperty('template-id') && referenceList['template-id'] !== undefined && referenceList['template-id'] != '')
+ // this.refDataRequiredFiels = true;
+ // else this.refDataRequiredFiels = false;
+ if(referenceList.action == 'ConfigScaleOut') {
+ if(reqObj != undefined && reqObj.hasOwnProperty('reqField') && reqObj.reqField != '') this.refDataRequiredFiels = true;
+ else this.refDataRequiredFiels = false;
+ }
+
+ // else if( referenceList.action == 'Configure' || referenceList.action == 'ConfigModify' ) {
+ // if(referenceList.displayVnfc == 'false') this.refDataRequiredFiels = true;
+ // else if( referenceList.displayVnfc != 'false' && referenceList.vnfcIdentifier ) this.refDataRequiredFiels = true;
+ // }
+
+ else this.refDataRequiredFiels = true;
}
- else
- this.refDataRequiredFiels = true;
- }
- else
- this.refDataRequiredFiels = true;
+ else this.refDataRequiredFiels = true;
}
else {
- this.refDataRequiredFiels = false;
+ this.refDataRequiredFiels = false;
}
}
import {NotificationsService} from 'angular2-notifications';
import 'rxjs/add/operator/map';
import { appConstants } from '../../../../constants/app-constants';
+import { HttpUtilService } from '../../../shared/services/httpUtil/http-util.service';
+
let YAML = require('yamljs');
@Injectable()
export class ParameterDefinitionService {
-
+ clName= "ParameterDefinitionSvc";
public vnfcTypeData: string = '';
public selectedUploadType: string;
@ViewChild(ModalComponent) modalComponent: ModalComponent;
private selectedActionReference: any;
private apiToken = localStorage['apiToken'];
private userId = localStorage['userId'];
+ public versionNoForApiCall=require('../../../../cdt.application.properties.json').versionNoForApiCall;
+
constructor(private mappingEditorService: MappingEditorService,
private paramShareService: ParamShareService,
private nService: NotificationsService,
+ private httpService: HttpUtilService,
private utilService: UtilityService) {
}
this.protocol = protocol;
this.action = action;
this.artifact_fileName = artifactName;
+ this.appDataObject = this.mappingEditorService.appDataObject;
+ this.downloadDataObject = this.mappingEditorService.downloadDataObject;
}
public afterInit(artifactName, displayParamObjects) {
/* Saves pd to appc */
public sendPD(yamlString: String) {
let result: any;
- let payload = '{"userID": "' + this.userId + '","vnf-type" : "' + this.vnfType + '","action" : "' + this.action + '","artifact-name" : "' + this.artifact_fileName + '","artifact-type" : "APPC-CONFIG","artifact-version" : "0.0.1","artifact-contents" : ' + yamlString + '}';
+ let input = this.utilService.createPayLoadForSave("pd_data",this.vnfType,this.action,this.artifact_fileName, this.versionNoForApiCall, yamlString);
+ /*let payload = '{"userID": "' + this.userId + '","vnf-type" : "' + this.vnfType + '","action" : "' + this.action + '","artifact-name" : "' + this.artifact_fileName + '","artifact-type" : "APPC-CONFIG","artifact-version" : "0.0.1","artifact-contents" : ' + yamlString + '}';
let input = {
'input': {
'design-request': {
'payload': payload
}
}
- };
+ };*/
this.appDataObject.pd = input;
}
return result;
}
- //========================== End of removeUnwantedvalues() Method============================================
- populateDataUponSource(displayParamObjects) {
- displayParamObjects.forEach(parameter => {
- if (parameter.source == 'A&AI') {
- parameter.ruleTypeValues = [null, 'vnf-name', 'vm-name-list', 'vnfc-name-list', 'vnf-oam-ipv4-address', 'vnfc-oam-ipv4-address-list'];
- if (parameter['rule-type'] == 'vm-name-list' || parameter['rule-type'] == 'vnfc-name-list' || parameter['rule-type'] == 'vnfc-oam-ipv4-address-list') {
- parameter.showFilterFields = true;
- parameter.enableFilterByValue = false;
- } else {
- parameter.showFilterFields = false;
- }
-
- } else if (parameter.source == 'Manual') {
+ //.. setup display of each parameter row depending on the paramater name,
+ // pre-set values of source and rule-type fields (columns)
+ populateDataUponSource( displayParamObjects) {
+ var methName= "populateDataUponSource";
+ if( this.utilService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": start: displayParamObjects "+
+ "length="+displayParamObjects.length );
+ displayParamObjects.forEach( parameter => {
+ if( this.utilService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": param: name:["+
+ parameter.name+"] source:["+
+ parameter.source+"] rule-type:["+parameter['rule-type']+"]");
+ if( parameter.name == 'NodeList-DD') {
+ if( this.utilService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": the Param is NodeList");
+ parameter.source= "DataDictionary";
+ }
+ else if( parameter.name == 'vnfName-DD' ) {
+ if( this.utilService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": the Param's vnfName-DD");
+ parameter.source= "A&AI";
+ parameter['rule-type']= "vnf-name";
+ };
+ if( parameter.source == 'A&AI') {
+ parameter.ruleTypeValues = [null, 'vnf-name', 'vm-name-list', 'vnfc-name-list', 'vnf-oam-ipv4-address', 'vnfc-oam-ipv4-address-list'];
+ if( parameter['rule-type'] == 'vm-name-list' ||
+ parameter['rule-type'] == 'vnfc-name-list' ||
+ parameter['rule-type'] == 'vnfc-oam-ipv4-address-list')
+ {
+ parameter.showFilterFields = true;
+ parameter.enableFilterByValue = false;
+ } else {
+ parameter.showFilterFields = false;
+ }
+ }
+ else if( parameter.source == 'Manual') {
parameter.ruleTypeValues = [null];
}
+ else if( parameter.source == 'DataDictionary') {
+ parameter.sourceValues = ['DataDictionary'];
+ parameter.ruleTypeValues = ['NodeList'];
+ parameter['rule-type']= 'NodeList';
+ }
else {
parameter.ruleTypeValues = [parameter['rule-type']];
}
+ //.. print-out the parameter's drop-downs for source and rule-type
+ if( this.utilService.getTracelvl() > 1 ) {
+ if( parameter.sourceValues != null &&
+ parameter.sourceValues != undefined )
+ {
+ console.log( this.clName+": "+methName+": sourceValues length="+
+ parameter.sourceValues.length );
+ if( parameter.sourceValues.length > 0 ) {
+ for( var i0=0; i0 < parameter.sourceValues.length; i0++ )
+ console.log( methName+": sourceValues["+i0+"]:["+
+ parameter.sourceValues[i0]+"]");
+ };
+ };
+ if( parameter.ruleTypeValues != null &&
+ parameter.ruleTypeValues != undefined )
+ {
+ console.log( this.clName+": "+methName+": ruleTypeValues length="+
+ parameter.ruleTypeValues.length );
+ if( parameter.ruleTypeValues.length > 0 ) {
+ for( var i0=0; i0 < parameter.ruleTypeValues.length; i0++ )
+ console.log( methName+": ruleTypeValues["+i0+"]:["+
+ parameter.ruleTypeValues[i0]+"]");
+ };
+ };
+ };
});
-
}
//========================== End of getPD() Method============================================
//Added code to deserialize, serialize and format the response keys for display purposes ??May be unneessary?? To Do: - Check
let fileObj = JSON.parse(fileContent);
this.displayParamObjects = this.formatFileContentForDisplay(fileObj);
- this.populateDataUponSource(this.displayParamObjects);
+ this.populateDataUponSource( this.displayParamObjects);
this.formatResponseForKey(this.displayParamObjects);
if (undefined !== this.displayParamObjects)
this.modelParamDefinitionObjects = this.displayParamObjects;
return this.displayParamObjects;
}
- //========================== End of populatePD() Method============================================
/* Formats each object read from YAML file as per page expectations */
formatResponseForKey(param: any[]) {
for (var i = 0; i < param.length; i++) {
}
}
}
-
//========================== End of formatKeys() Method============================================
+
//Send null if there are no keys present - Check with key names being absent
formatKeysForFileGeneration() {
for (var i = 0; i < this.modelParamDefinitionObjects.length; i++) {
}
delete fileModel[i]['response-keys'];
fileModel[i]['response-keys'] = fileModel[i]['response-keys-new'];
- delete fileModel[i]['response-keys=new'];
+ delete fileModel[i]['response-keys-new'];
}
}
return fileModel;
return result;
}
-
- public prepareFileName(): any {
- let fileNameObject: any = this.mappingEditorService.latestAction;
- this.appDataObject = this.mappingEditorService.appDataObject;
- this.downloadDataObject = this.mappingEditorService.downloadDataObject;
- return fileNameObject;
+ //========================== End of clearSessionStorageForParam() Method============================================
+ isValidateSourceAndResponseKeys(objs: any[]) {
+ let isValid = true;
+ if (undefined != objs || null != objs) {
+ for (var i = 0; i < objs.length; i++) {
+ if (objs[i].source == 'INSTAR' && (null == objs[i]['response-keys'] || undefined == objs[i]['response-keys'])) {
+ isValid = false;
+ return isValid;
+ }
+ }
+ }
+ return isValid;
}
+
+
public destroy(displayParamObjects) {
this.displayParamObjects = displayParamObjects;
if (this.mappingEditorService.referenceNameObjects) {
jsonString = jsonString.replace(/"null"/g, 'null');
let saveModel = JSON.parse(jsonString);
let pdFileObject = this.processResponseKeys(saveModel);
+ //Validate for Source =INSTAR and responsekeys present
+ if (this.isValidateSourceAndResponseKeys(pdFileObject)) {
let yamlObject = {
'kind': 'Property Definition',
'version': 'V1',
else {
this.sendPD(JSON.stringify(yamlString));
}
-
+ }
+ else {
+ for (var i = 0; i < this.modelParamDefinitionObjects.length; i++) {
+ this.formatKeys(this.modelParamDefinitionObjects[i]);
+ }
+ this.nService.error('Error', 'Response Keys cannot be empty if source is INSTAR');
+ return;
+ }
//Restore Keys for display
for (var i = 0; i < this.modelParamDefinitionObjects.length; i++) {
this.formatKeys(this.modelParamDefinitionObjects[i]);
}
parameterDefinitionObject['source'] = fields[0];
parameterDefinitionObject['rule-type'] = fields[1];
- }
+ } else {
+ if (parameterDefinitionObject['source'] === 'INSTAR') {
+ parameterDefinitionObject['source'] = 'Manual';
+ parameterDefinitionObject['ruleTypeValues'] = [null];
+ parameterDefinitionObject['rule-type'] = null;
+ parameterDefinitionObject['showFilterFields'] = false;
+ for (let x = 0; x < 5; x++) {
+ parameterDefinitionObject['response-keys'][x]['key-name'] = null;
+ parameterDefinitionObject['response-keys'][x]['key-value'] = null;
+ }
+ }
+ }
this.formatKeys(parameterDefinitionObject); //Ensure there are 3 elements for response-keys, request-keys for display purposes
if (!result.present) { //only push if not present
this.modelParamDefinitionObjects.push(parameterDefinitionObject);
<label>Vnf Type</label><input class="form-control" type="text" disabled value="{{vnfType}}" />
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="vnfcType">
- <label>Vnfc Type</label><input class="form-control" type="text" disabled value="{{vnfcType}}" />
+ <label>Vnfc Type</label> <label style="font-size:12px;">(NFC Function)</label>
+ <input class="form-control" type="text" disabled value="{{vnfcType}}" />
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="!vnfcType">
-
+
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Protocol</label><input class="form-control" type="text" disabled value="{{protocol}}" />
<option *ngFor="let src of sourceValues"
[value]="src"
[selected]="src === obj.source"
- >
+ [disabled]="(obj.name == 'NodeList-DD' && src != 'DataDictionary')||(obj.name == 'vnfName-DD' && src == 'DataDictionary')||(obj.name != 'NodeList-DD' && obj.name != 'vnfName-DD' && src == 'INSTAR')">
{{src}}
</option>
import { NgProgress } from 'ngx-progressbar';
import { NgxSpinnerService } from 'ngx-spinner';
import { appConstants } from '../../../../constants/app-constants';
+import { APIService } from "../../../shared/services/cdt.apicall";
let YAML = require('yamljs');
providers: [ParameterDefinitionService]
})
export class ParameterComponent implements OnInit {
+ clName= "ParameterCompon";
public paramForm: any;
public actionType: any;
public showFilterFields: boolean;
+
public filterByFieldvalues = appConstants.filterByFieldvalues;
public ruleTypeConfiguaration = appConstants.ruleTypeConfiguaration;
public requiredValues: boolean[] = appConstants.requiredValues;
public artifactName;
public appDataObject: any;
public downloadDataObject: any;
- public artifact_fileName = "";
+ public artifact_fileName="";
template_id: any;
private selectedActionReference: any;
constructor(private httpService: HttpUtilService,
+ private apiService:APIService,
private parameterDefinitionService: ParameterDefinitionService,
private paramShareService: ParamShareService,
private mappingEditorService: MappingEditorService,
}
ngOnInit() {
- this.selectedActionReference = this.parameterDefinitionService.prepareFileName();
+ var methName= "ngOnInit";
+ this.selectedActionReference = this.mappingEditorService.newObject;
if (this.selectedActionReference && this.selectedActionReference != undefined) {
-
- this.vnfType = this.selectedActionReference.scope['vnf-type'];
- this.vnfcType = this.selectedActionReference.scope['vnfc-type'];
- this.protocol = this.selectedActionReference['device-protocol'];
- this.action = this.selectedActionReference.action;
-
- for (let i = 0; i < this.selectedActionReference['artifact-list'].length; i++) {
- let artifactList = this.selectedActionReference['artifact-list'];
- if (artifactList[i]['artifact-type'] === 'parameter_definitions') {
- var artifactName = artifactList[i]['artifact-name'];
- var artifactNameWithoutExtension = '';
- if (artifactName) {
- artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."));
- }
- if (this.mappingEditorService.identifier) {
- if (artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) {
- this.artifact_fileName = artifactName;
- }
-
- }
- else {
- this.artifact_fileName = artifactName;
- }
- }
+ this.vnfType = this.selectedActionReference.vnf;
+ this.protocol = this.selectedActionReference.protocol;
+ this.action = this.selectedActionReference.action;
+ if( this.utilService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": vnfType:["+this.vnfType+
+ "] action:["+this.action+"] protocol:["+this.protocol+"]");
+ if(this.selectedActionReference.vnfc) {
+ this.vnfcType = this.selectedActionReference.vnfc;
+ if( this.utilService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": have vnfcType:["+
+ this.vnfcType+"]");
+ }
+ if( this.action === 'ConfigScaleOut'){
+ // this.template_id = this.selectedActionReference.templateId;
+ this.template_id = this.mappingEditorService.identifier;
}
+ this.artifact_fileName = this.selectedActionReference.pd_artifact;
this.parameterDefinitionService.setValues(this.vnfType, this.vnfcType, this.protocol, this.action, this.artifact_fileName);
}
else {
'scopeType': ''
};
}
-
- this.template_id = this.mappingEditorService.identifier;
+ //let path = this.location.path
+ /* this.activeRoutes.url.subscribe(UrlSegment => {
+ this.actionType = UrlSegment[0].path
+ })
+ */
}
ngAfterViewInit() {
- if (this.mappingEditorService.latestAction) {
+ if( this.mappingEditorService.latestAction) {
this.displayParamObjects = [];
this.modelParamDefinitionObjects = [];
- if (this.paramShareService.getSessionParamData() != undefined && this.paramShareService.getSessionParamData().length > 0) {
- this.getPDFromSession();
+ this.displayParamObjects= this.paramShareService.getSessionParamData();
+ // if( this.paramShareService.getSessionParamData() != undefined &&
+ // this.paramShareService.getSessionParamData().length > 0)
+ if( this.displayParamObjects != undefined &&
+ this.displayParamObjects.length > 0 )
+ {
+ this.parameterDefinitionService.populateDataUponSource( this.displayParamObjects);
} else {
- this.ngProgress.start();
- this.getPD();
- setTimeout(() => {
- this.ngProgress.done();
- }, 3500);
+ this.getPD();
}
} else {
this.nService.error(appConstants.errors.error, appConstants.errors["noAction&VNFTypeInRDscreenError"]);
public getPD() {
let result: any;
- let input=this.utilService.createPayloadForRetrieve(false, this.action, this.vnfType,this.artifact_fileName);
+ let input=
+ this.utilService.createPayloadForRetrieve( false, this.action, this.vnfType,this.artifact_fileName);
let artifactContent: any;
- return this.httpService.post({
- url: environment.getDesigns,
- data: input
- }).subscribe(data => {
- if (this.utilService.checkResult(data)) {
- let result: any = JSON.parse(data.output.data.block).artifactInfo[0];
+ this.ngProgress.start();
+ return this.apiService.callGetArtifactsApi(input).subscribe( data => {
+ if( this.utilService.checkResult(data)) {
+ let result: any = JSON.parse(data.output.data.block).artifactInfo[0];
var pdObject = YAML.parse(result['artifact-content']);
let fileModel = pdObject['vnf-parameter-list'];
this.displayParamObjects = this.parameterDefinitionService.populatePD(fileModel);
}
-
+ else {
+ }
+ this.ngProgress.done();
},
error => this.nService.error(appConstants.errors.error, appConstants.errors.connectionError));
public getPDFromSession() {
- this.ngProgress.start();
+ this.ngProgress.start();
return this.httpService.get({
url: 'testurl',
- }).subscribe(data => {
- this.displayParamObjects = this.paramShareService.getSessionParamData();
- this.ngProgress.done();
+ }).subscribe( data => {
+ this.displayParamObjects = this.paramShareService.getSessionParamData();
+ this.ngProgress.done();
},
- error => {
- this.displayParamObjects = this.paramShareService.getSessionParamData();
- this.ngProgress.done();
- });
+ error => {
+ this.displayParamObjects = this.paramShareService.getSessionParamData();
+ this.ngProgress.done();
+ });
}
- //========================== End of NGInit() Method============================================
selectedNavItem(item: any) {
this.item = item;
}
// Create the file reader
let reader = new FileReader();
this.readFile(input.files[0], reader, (result) => {
+ if ('keyfile' === uploadType) {
+ this.myKeyFileName = input.files[0].name;
+ this.displayParamObjects = this.parameterDefinitionService.processKeyFile(this.myKeyFileName, result);
+ }
if ('pdfile' === uploadType) {
this.myPdFileName = input.files[0].name;
this.displayParamObjects = this.parameterDefinitionService.processPDfile(this.myPdFileName, result);
let obj: any = fileInput.target.files;
}
-
- sourceChanged(data, obj) {
+ sourceChanged( data, obj) {
if (data == 'A&AI') {
obj.ruleTypeValues = appConstants.ruleTypeValues;
for (let x = 0; x < 5; x++) {
}
//========================== End of sourceChanged() Method============================================
- ruleTypeChanged(data, obj) {
+ ruleTypeChanged( data, obj) {
if (data == null || data == undefined || data == 'null') {
obj.showFilterFields = false;
obj['rule-type'] = null;
}
for (let x = 0; x < sourceObject.length; x++) {
obj['response-keys'][x]['key-name'] = sourceObject[x]['key-name'];
- obj['response-keys'][x]['key-value'] = sourceObject[x]['key-value'];
+ obj['response-keys'][x]['key-value'] = sourceObject[x]['key-value'];
}
}
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
.file {
visibility: hidden;
position: absolute;
-}
\ No newline at end of file
+}
+
+.col-md-1point5 {width: 12%}
+.col-md-2point5 {width: 21%;}
<span class="error-message" [hidden]="vnfParams?.vnfType || vnftype.valid || (vnftype.pristine && !userForm.submitted)">Required Field</span>
</div>
- <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="((displayVnfc=='true') || isVnfcType) && (referenceDataObject['action']=='Configure' || referenceDataObject['action']=='ConfigModify' || referenceDataObject['action']=='DistributeTraffic')">
- <label>VNFC Type</label>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="((displayVnfc=='true') || isVnfcType) && (referenceDataObject['action']=='Configure' || referenceDataObject['action']=='ConfigModify' || referenceDataObject['action']=='DistributeTraffic')">
+ <label>VNFC Type</label> <label style="font-size:12px;">(NFC Function)</label>
<input *ngIf="isVnfcType" type="text" class="form-control" readonly id="txtVnfcType" [(ngModel)]="referenceDataObject.scope['vnfc-type']" (blur)="setVnfcType($event.target.value)" (ngModelChange)="updateSessionValues($event,'vnfcType')" #vnfcType="ngModel"
name="vnfcType">
- <select *ngIf="isVnfcTypeList" class="form-control" id="vnfcType" (ngModelChange)="vnfcChanged($event,content,userForm)" [ngModel]="vnfcIdentifier" #deviceProtocol="ngModel" name="templateIdentifier">
+ <select *ngIf="isVnfcTypeList" class="form-control" id="vnfcType" (ngModelChange)="vnfcChanged($event,userForm)" [ngModel]="vnfcIdentifier" #deviceProtocol="ngModel" name="templateIdentifier">
<option [value]="val" *ngFor="let val of referenceDataObject.scope['vnfc-type-list']">{{val}}
</option>
</select>
<a *ngIf="isVnfcTypeList" style=" color: blue;" href="javascript:void(0)" (click)="vnfcModal.open()">Add New VNFC Type</a>
</div>
+
- <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="displayVnfc!='true' || (referenceDataObject['action']!='Configure' && referenceDataObject['action']!='ConfigModify' && referenceDataObject['action']!='DistributeTraffic')">
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="displayVnfc!='true' || (referenceDataObject['action']!='Configure' && referenceDataObject['action']!='ConfigModify' || referenceDataObject['action']=='DistributeTraffic')">
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Device Protocol*</label>
<option [value]="val" *ngFor="let val of referenceDataObject['template-id-list']">{{val}}
</option>
</select>
- <!-- <span class="error-message" [hidden]="deviceProtocol.valid || (deviceProtocol.pristine && !userForm.submitted)">Required Field</span> -->
+ <!-- <span class="error-message" [hidden]="deviceProtocol.valid || (deviceProtocol.pristine && !userForm.submitted)">Required Field</span> -->
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="referenceDataObject['action']== 'ConfigScaleOut'" style="margin-top: 30px">
<span *ngIf="referenceDataObject.action === 'ConfigScaleOut'"> <a style=" color: blue;"
href="javascript:void(0)"
- (click)="showIdentifier()">Assign New Template Identifier</a></span>
+ (click)="identifierModal.open()">Assign New Template Identifier</a></span>
</div>
+
+
</div>
+
<div class="col-12" *ngIf="!(referenceDataObject.action === 'OpenStack Actions')">
<div class="input-group">
<input id="inputFile" class="file" #myInput type='file' (change)="fileChange($event)">
<input type="text" class="form-control" id="txtIpaddress" [(ngModel)]="referenceDataObject['url']" name="contextUrl">
</div>
</div>
+ <br/>
<div class="card-block" *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined)" style="border-top: 5px solid #6ab344;border-top-right-radius: 7px;border-top-left-radius: 7px;">
<div class="col-12">
<h5 style="margin-top: 0.5rem;font-family: Roboto"> VNFC Information
</div>
<div class="row" *ngIf="(( referenceDataObject.action =='ConfigScaleOut' ||referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ) && isCollapsedContent) ">
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
- <label style="font-size:12px;">VNFC Type</label>
+ <label style="font-size:12px;">VNFC Type (NFC Function)</label>
<input type="text" class="form-control" id="txtVnfcTypeInColl" [(ngModel)]="Sample['vnfc-type']" (blur)="checkVnfcTypeEqual(vnfcType.value)" #vnfcType="ngModel" name="samplevnfcType">
</div>
- <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
- <label style="font-size:12px">VNFC Function Code</label>
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
+ <label style="font-size:12px">VNFC Function Code (NFC Naming Code)</label>
<input type="text" class="form-control" id="txtVnfcFunctionCode" [(ngModel)]="Sample['vnfc-function-code']" #vnfcFunctionCode="ngModel" name="samplevnfcFunctionCode">
</div>
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
- <label style="font-size:12px;">IPAddress V4</label>
+ <label style="font-size:12px;">IPAddress V4 OAM VIP</label>
<select class="form-control" id="cmbIpAddedBoo" [(ngModel)]="Sample['ipaddress-v4-oam-vip']" name="sampleIpaddress">
<option [value]="hasIp" *ngFor="let hasIp of ipAddressBoolean">{{hasIp}}
</option>
<label style="font-size:12px;">Group Notation Value</label>
<input type="text" class="form-control" [readonly]="disableGrpNotationValue" id="txtGroupValue" [(ngModel)]="Sample['group-notation-value']" name="sampleGroupValue">
</div>
- <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
+ <div class="col-lg-1 col-sm-6 col-md-1 col-xs-12">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent clear-btn" (click)="clearVnfcData()">Clear VNFC Info
</button>
</div>
</div>
</div>
<div *ngIf="referenceDataObject.vm?.length>0">
- <div class="row" *ngFor="let noOfvm of referenceDataObject.vm | vmFiltering:referenceDataObject?.action:templateIdentifier; trackBy:trackByFn;let j=index">
- <div *ngIf="((referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ))" class="col-12">
+ <div class="row" *ngFor="let noOfvm of referenceDataObject.vm | vmFiltering:referenceDataObject?.action:templateIdentifier:vnfcIdentifier; trackBy:trackByFn;let j=index">
+ <div *ngIf="((referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ))" class="col-12">
<div class="row" *ngFor="let item of noOfvm.vnfc;trackBy:trackByFn, let i=index">
<div class="col-md-12" *ngIf="i==0">
<h5 class="headlinesInBold">VM Number: {{j+1}}</h5>
</div>
- <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
+ <div class="col-md-1point5">
<label style="font-size:12px;">VNFC Instance No.</label>
<input type="text" class="form-control" id="txtVmnumber" disabled='true' [(ngModel)]="item['vnfc-instance']" name="vmNumber{{j}}">
</div>
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
- <label style="font-size:12px;">VNFC Type</label>
+ <label style="font-size:12px;">VNFC Type (NFC Function)</label>
<input type="text" class="form-control" id="txtVnfcTypeInColl" required [(ngModel)]="item['vnfc-type']" #vnfcType="ngModel" name="vnfcType{{j}}">
<span class="error-message" [hidden]="vnfcType.valid || (vnfcType.pristine && !userForm.submitted)">Required Field</span>
</div>
- <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
- <label style="font-size:12px;">VNFC Function Code</label>
+ <div class="col-md-2point5">
+ <label style="font-size:12px;">VNFC Function Code (NFC Naming Code)</label>
<input type="text" class="form-control" id="txtVnfcFunctionCode" required [(ngModel)]="item['vnfc-function-code']" #vnfcFunctionCode="ngModel" name="vnfcFunctionCode{{j}}">
<span class="error-message" [hidden]="vnfcFunctionCode.valid || (vnfcFunctionCode.pristine && !userForm.submitted)">Required Field</span>
</div>
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
- <label style="font-size:12px;">IPAddress V4</label>
+ <label style="font-size:12px;">IPAddress V4 OAM VIP</label>
<select class="form-control" id="cmbIpAddress" [(ngModel)]="item['ipaddress-v4-oam-vip']" name="ipaddress{{j}}">
<option [value]="hasIP" [selected]="item.ipAddressBoolean===hasIP"
*ngFor="let hasIP of ipAddressBoolean">{{hasIP}}
<modal-body>
<div>
<input pattern=".*[^ ].*" name="test" type="text" class="" (ngModelChange)="validateVnfcName($event)" [(ngModel)]="newVnfcType" placeholder="vnfctype">
- <span class="error-message">{{errorMessage}}</span>
+ <span class="error-message">{{errorMessage}}</span>
</div>
</modal-body>
<modal-footer [show-default-buttons]="false">
</modal-footer>
</modal>
-<div id="identifierModal" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="android-more-button mdl-button mdl-js-button mdl-button--accent" data-dismiss="modal">×
- </button>
- <h4 class="modal-title">Enter New Template Identifier</h4>
- </div>
- <div class="modal-body">
- <div>
- <div>
- <input pattern=".*[^ ].*" name="test" type="text" class="" [(ngModel)]="templateId" placeholder="identifier">
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <div>
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" data-dismiss="modal" (click)="addToIdentDrp()">Add</button>
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="templateId=''" data-dismiss="modal">cancel</button>
- </div>
- </div>
+<!-- Modal for Template Identifier -->
+<modal #identifierModal>
+ <modal-header [show-close]="true">
+ <h4 class="modal-title">Enter New Template Identifier</h4>
+ </modal-header>
+ <modal-body>
+ <div>
+ <input pattern=".*[^ ].*" name="test" type="text" class="" [(ngModel)]="templateId" placeholder="identifier">
</div>
- </div>
-</div>
-<ng-template #content let-c="close" let-d="dismiss">
- <div class="modal-header">
- <h6 class="modal-title">Save all changes for current action to APPC database.</h6>
- <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <p>Do you want to save the changes?</p>
- </div>
- <div class="modal-footer">
- <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="c('no')">No
- </button>
- <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="c('yes')">Yes
- </button>
- </div>
-</ng-template>
+ </modal-body>
+ <modal-footer [show-default-buttons]="false">
+ <div>
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="templateId=''" data-dismiss="modal">cancel</button>
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" data-dismiss="modal" (click)="addToIdentDrp()">Add</button>
+ </div>
+ </modal-footer>
+</modal>
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
-Copyright (C) 2018 IBM.
-===================================================================
+
Unless otherwise specified, all software contained herein is licensed
under the Apache License, Version 2.0 (the License);
you may not use this software except in compliance with the License.
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 * as XLSX from 'xlsx';
import * as _ from 'underscore';
+
import { ActivatedRoute, Router } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core';
+import { Observable } from 'rxjs/Observable';
import { BuildDesignComponent } from '../build-artifacts.component';
import { HttpUtilService } from '../../../shared/services/httpUtil/http-util.service';
import { Location } from '@angular/common';
import { MappingEditorService } from '../../..//shared/services/mapping-editor.service';
-import { ModalComponent } from '../../../shared/modal/modal.component';
import { NgProgress } from 'ngx-progressbar';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NotificationService } from '../../../shared/services/notification.service';
import { ParamShareService } from '../../..//shared/services/paramShare.service';
import { environment } from '../../../../environments/environment';
import { saveAs } from 'file-saver';
+import { Jsonp } from '@angular/http';
import { ReferenceDataFormUtil } from './reference-dataform.util';
import { UtilityService } from '../../../shared/services/utilityService/utility.service';
-import { appConstants } from '../../../../constants/app-constants';
+import { APIService } from "../../../shared/services/cdt.apicall";
+
// Common Confirm Modal
import { DialogService } from 'ng2-bootstrap-modal';
import { ConfirmComponent } from "../../../shared/confirmModal/confirm.component";
+
declare var $: any;
type AOA = Array<Array<any>>;
-const REFERENCE_DATA: string = "reference_data";
@Component({
selector: 'reference-dataform',
providers: [ReferenceDataFormUtil]
})
export class ReferenceDataformComponent implements OnInit {
- public classNm = "ReferenceDataformCompon";
- @ViewChild(ModalComponent) modalComponent: ModalComponent;
+ public classNm= "ReferenceDataformComp";
public showUploadStatus: boolean = false;
public fileUploaded: boolean = false;
public uploadedData: any;
errorMessage = '';
invalid = true;
fileName: any;
- vnfcIdentifier = '';
- oldVnfcIdentifier: any;
+ vnfcIdentifier;
+ oldVnfcIdentifier: any
public uploadFileName: any;
public addVmClickedFlag: boolean = false;
public getExcelUploadStatus: boolean = false;
identifierDrpValues: any = [];
//settings for the notifications.
options = {
- timeOut: 1000,
+ timeOut: 4500,
showProgressBar: true,
pauseOnHover: true,
clickToClose: true,
maxLength: 200
};
- //initializing this object to contain all the parameters to be captured
+ //initializing this object to contain all the parameters to be captured later
public referenceDataObject = {
action: '',
'action-level': 'vnf',
'artifact-list': []
};
public refernceScopeObj = { sourceType: '', from: '', to: '' };
- public actions = [appConstants.Actions.blank,
- appConstants.Actions.configure,
- appConstants.Actions.ConfigModify,
- appConstants.Actions.configBackup,
- appConstants.Actions.configRestore,
- appConstants.Actions.getRunningConfig,
- appConstants.Actions.healthCheck,
- appConstants.Actions.startApplication,
- appConstants.Actions.stopApplication,
- appConstants.Actions.quiesceTraffic,
- appConstants.Actions.resumeTraffic,
- appConstants.Actions.distributeTraffic,
- appConstants.Actions.upgradeBackout,
- appConstants.Actions.upgradeBackup,
- appConstants.Actions.upgradePostCheck,
- appConstants.Actions.upgradePreCheck,
- appConstants.Actions.upgradeSoftware,
- appConstants.Actions.openStackActions,
- appConstants.Actions.configScaleOut
- ];
- public groupAnotationValue = [appConstants.groupAnotationValue.blank, appConstants.groupAnotationValue.pair];
- public groupAnotationType = [appConstants.groupAnotationType.blank, appConstants.groupAnotationType.firstVnfcName, appConstants.groupAnotationType.fixedValue, appConstants.groupAnotationType.relativeValue];
- public deviceProtocols = [appConstants.DeviceProtocols.blank, appConstants.DeviceProtocols.ansible, appConstants.DeviceProtocols.chef, appConstants.DeviceProtocols.netconfXML, appConstants.DeviceProtocols.rest, appConstants.DeviceProtocols.cli, appConstants.DeviceProtocols.restConf];
- public deviceTemplates = [appConstants.deviceTemplates.blank, appConstants.deviceTemplates.y, appConstants.deviceTemplates.n];
- public sourceTypeColl = [appConstants.sourceTypeColl.blank, appConstants.sourceTypeColl.vnfType, appConstants.sourceTypeColl.vnfcType];
+ public actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'DistributeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions', 'ConfigScaleOut'];
+ public groupAnotationValue = ['', 'Pair'];
+ public groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value'];
+ public deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'NETCONF-XML', 'REST', 'CLI', 'RESTCONF'];
+ public deviceTemplates = ['', 'Y', 'N'];
+ public sourceTypeColl = ['', 'vnfType', 'vnfcType'];
public ipAddressBoolean = ['', 'Y', 'N'];
public Sample: any = {
'vnfc-instance': '1',
public firstArrayElement = [];
public remUploadedDataArray = [];
isConfigScaleOut = false
- isConfigureAction = false;
- configScaleOutExist: boolean = true;
+ isConfigOrConfigModify = false
+ configScaleOutExist: boolean
displayVnfc = 'false';
isVnfcType: boolean;
isVnfcTypeList: boolean = true;
- public actionList = {
- "ConfigScaleOut": "ConfigScaleOut",
- "Configure": "Configure"
- };
- public versionNoForApiCall = "0.0.1";
+ public referencDataTab = [
+ {
+
+ name: 'Reference Data',
+ url: 'references',
+ }];
+ public allTabs = [
+ {
+ name: 'Reference Data',
+ url: 'references',
+ }, {
+ name: 'Template',
+ url: 'templates/myTemplates',
+ }, {
+ name: 'Parameter Definition',
+ url: 'parameterDefinitions/create'
+ }/*, {
+ name: "Test",
+ url: 'test',
+ }*/
+ ];
+ public actionList = require('../../../../cdt.application.properties.json').Actions;
+
+ public versionNoForApiCall = require('../../../../cdt.application.properties.json').versionNoForApiCall;
private displayVMBlock: boolean = true;
- constructor (
- private buildDesignComponent: BuildDesignComponent,
- private httpUtils: HttpUtilService,
- private route: Router,
- private location: Location,
- private activeRoutes: ActivatedRoute,
- private notificationService: NotificationService,
- private paramShareService: ParamShareService,
- private mappingEditorService: MappingEditorService,
- private modalService: NgbModal,
- private nService: NotificationsService,
- private ngProgress: NgProgress,
- private utilityService: UtilityService,
- private dialogService: DialogService,
- private referenceDataFormUtil: ReferenceDataFormUtil) {
- console.log(this.classNm + ": new: start.");
+ constructor(
+ private buildDesignComponent: BuildDesignComponent, private apiService: APIService, private utilityService: UtilityService, private httpUtils: HttpUtilService, private referenceDataFormUtil: ReferenceDataFormUtil, private route: Router, private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService,
+ private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private modalService: NgbModal, private nService: NotificationsService, private ngProgress: NgProgress,
+ private dialogService: DialogService)
+ {
+ console.log(this.classNm+
+ ": new: start: tracelvl="+this.utilityService.getTracelvl() );
}
ngOnInit() {
- let methName = "ngOnInit";
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": start.");
+ let methName= "ngOnInit";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": ngOnInit: start ");
+ // this.handleVMBlockDisplay();
+
+ //initializing the variables and checking for configscaleout fromm properties file
+ this.configScaleOutExist = require('../../../../cdt.application.properties.json').displayConfigScaleout;
this.displayVnfc = sessionStorage.getItem("vnfcSelectionFlag");
if (this.configScaleOutExist) {
this.actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'DistributeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions', 'ConfigScaleOut'];
this.self = this;
let path = this.location.path;
this.title = 'Reference Data';
+ // setting the structure for the reference data object
this.referenceDataObject = {
action: '',
'action-level': 'vnf',
'port-number': '',
'artifact-list': []
};
+ //getting the data from session data, calling get Artifact if the data is undefined
this.updateParams = sessionStorage.getItem('updateParams');
+ //getting the data from the referencenameobjects if the nav is changed and assiging it to the cace data
let cacheData = this.mappingEditorService.referenceNameObjects;
- if (cacheData != undefined && cacheData != null && cacheData.length > 0) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": ngOnInit: have cacheData.");
+
+ if (this.utilityService.checkNotNull(cacheData)) {
+ //if cache data exists then assiging the data to the latest temp all data object.
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": ngOnInit: have cacheData.");
this.tempAllData = cacheData;
+ //calling the highligted method to highlight the selected actions in the action dropdown
+ this.highlightSelectedActions(this.tempAllData)
+ // getting the latest action that the user has selected and assiging it to the reference data object once the user toggles between tabs from reference
if (this.mappingEditorService.latestAction != undefined) {
+ //adding the latest action to the screen
this.referenceDataObject = this.mappingEditorService.latestAction;
this.toggleIdentifier(this.referenceDataObject.action);
+ //this.referenceDataObject['template-id-list'] = this.mappingEditorService.identifier
+ //use these commented objects to be used in template and pd pages
+ //this.templateIdentifier = this.mappingEditorService.identifier
+ //adding the scope from referencedata obj to referencescopeobject
this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
+ //assigning the latest action fetched to the old action from reference data object
this.oldAction = this.referenceDataObject.action;
+ //this method is called with the action reterived and subsequent values are assigned to refdataobj for displaying
this.populateExistinAction(this.referenceDataObject.action);
this.displayHideVnfc();
}
} else if (this.updateParams != 'undefined') {
+ //calls the get artifact() to reterive the values if cache data is not present
this.getArtifact();
}
+ //getting the appdata & downloadDataObject from mapping editor service and assiging it.
var appData = this.mappingEditorService.appDataObject;
if (appData != null || appData != undefined) this.appData = appData;
var downloadData = this.mappingEditorService.downloadDataObject;
if (downloadData != null || downloadData != undefined) this.downloadData = downloadData;
+
if (sessionStorage.getItem('vnfParams')) {
this.vnfParams = JSON.parse(sessionStorage.getItem('vnfParams'));
}
if (this.vnfParams && this.vnfParams.vnfType) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": vnfParams.vnfType:[" +
- this.vnfParams.vnfType + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": vnfParams.vnfType:["+
+ this.vnfParams.vnfType+"]");
this.referenceDataObject['scope']['vnf-type'] = this.vnfParams.vnfType;
}
if (this.vnfParams && this.vnfParams.vnfcType) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": vnfParams.vnfcType:[" +
- this.vnfParams.vnfcType + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": vnfParams.vnfcType:["+
+ this.vnfParams.vnfcType+"]");
this.referenceDataObject['scope']['vnfc-type'] = this.vnfParams.vnfcType;
}
this.uploadedDataArray = [];
this.firstArrayElement = [];
this.uploadFileName = '';
this.templateIdentifier = this.mappingEditorService.identifier
+ // if (this.mappingEditorService.newObject) {
+ // this.vnfcIdentifier = this.mappingEditorService.newObject.vnfc;
+ // }
+ // else {
+ // this.vnfcIdentifier = '';
+ // this.referenceDataObject['vnfcIdentifier'] = '';
+ // }
this.oldVnfcIdentifier = this.vnfcIdentifier;
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": " + methName + ": displayVnfc:[" +
- this.displayVnfc + "]");
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": " + methName + ": templateIdentifier:[" +
- this.templateIdentifier + "]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": "+methName+": displayVnfc:["+
+ this.displayVnfc+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": "+methName+": templateIdentifier:["+
+ this.templateIdentifier+"]");
// Enable or Block Template and PD Tabs
this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: this.templateIdentifier });
+ { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
+ { reqField: this.templateIdentifier });
//.. configure some drop-downs
- this.configDrp(this.referenceDataObject.action)
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": finish.");
+ this.configDrp(this.referenceDataObject.action);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": finish.");
}
+ //setting the value to display or hide the template identifier dropdown in the screen
toggleIdentifier(data) {
if (data == 'ConfigScaleOut') {
this.isConfigScaleOut = true
//to retrive the data from appc and assign it to the vaiables, if no data display the message reterived from the API
getArtifact() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": getArtifact: start.");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": getArtifact: start...");
try {
+ // setting the isVnfcTypeList & isVnfcType to false initially
+ this.isVnfcTypeList = false;
+ this.isVnfcType = false
let data = this.utilityService.createPayloadForRetrieve(true, '', '', '');
this.ngProgress.start();
- this.httpUtils.post({
- url: environment.getDesigns,
- data: data
- }).subscribe(resp => {
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": getArtifact: got response ...");
+ let serviceCall = this.apiService.callGetArtifactsApi(data);
+ serviceCall.subscribe(resp => {
+ //getting the response and assigining it to the variables used and end the progress bar aftr the data is fetched.
if (resp.output.data.block != undefined) {
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm +
- ": getArtifact: output.data.block not empty.");
- this.nService.success(appConstants.notifications.titles.status, appConstants.messages.datafetched);
+ this.nService.success('Status', 'data fetched ');
let artifactInfo = JSON.parse(resp.output.data.block).artifactInfo[0];
+ let referenceDataAll = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
let reference_data = JSON.parse(artifactInfo['artifact-content'])['reference_data'][0];
this.referenceDataObject = reference_data;
this.toggleIdentifier(this.referenceDataObject.action);
- if (this.referenceDataObject.action == appConstants.Actions.configScaleOut) {
- this.groupAnotationType = [appConstants.groupAnotationType.blank, appConstants.groupAnotationType.firstVnfcName, appConstants.groupAnotationType.fixedValue, appConstants.groupAnotationType.relativeValue, appConstants.groupAnotationType.existingGroupName];
+ if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
}
+ this.highlightSelectedActions(referenceDataAll)
+
//chck vnfc or vnfcTypeList
this.displayHideVnfc();
+
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+
this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
this.mappingEditorService.getReferenceList().push(JSON.parse(artifactInfo['artifact-content']));
this.tempAllData = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
this.oldAction = this.referenceDataObject.action;
this.oldVnfcIdentifier = this.vnfcIdentifier;
- if (this.referenceDataObject.action === appConstants.Actions.openStackActions) {
- this.deviceProtocols = [appConstants.DeviceProtocols.blank, appConstants.DeviceProtocols.openStack];
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }];
- }
- else {
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }, {
- name: 'Template',
- url: 'templates/myTemplates',
- }, {
- name: 'Parameter Definition',
- url: 'parameterDefinitions/create'
- }/*, {
- name: "Test",
- url: 'test',
- }*/
- ];
- }
+
+ this.processReferenceDataAfterRetrieval();
this.getArtifactsOpenStack();
} else {
this.nService.success('Status', 'Sorry !!! I dont have any artifact Named : ' + (JSON.parse(sessionStorage.getItem('updateParams')))['artifact-name']);
}
displayHideVnfc() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": displayHideVnfc: start...");
- if (this.utilityService.getTracelvl() > 1) {
- if (this.referenceDataObject.scope['vnfc-type-list']) {
- console.log(this.classNm +
- ": displayHideVnfc: refDataObj.scope.vnfc-type-list.length=" +
- this.referenceDataObject.scope['vnfc-type-list'].length);
- } else {
- console.log(this.classNm +
- ": displayHideVnfc: refDataObj.scope.vnfc-type-list not defined");
- };
- console.log(this.classNm + ": displayHideVnfc: scope.vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": displayHideVnfc: start...");
+ if( this.utilityService.getTracelvl() > 1 ) {
+ if( this.referenceDataObject.scope['vnfc-type-list'] ) {
+ console.log( this.classNm+
+ ": displayHideVnfc: refDataObj.scope.vnfc-type-list.length="+
+ this.referenceDataObject.scope['vnfc-type-list'].length );
+ } else {
+ console.log( this.classNm+
+ ": displayHideVnfc: refDataObj.scope.vnfc-type-list not defined");
+ };
+ console.log( this.classNm+": displayHideVnfc: scope.vnfc-type:["+
+ this.referenceDataObject.scope['vnfc-type']+"]");
};
if (this.referenceDataObject.scope['vnfc-type-list'] == undefined && (this.referenceDataObject.scope['vnfc-type'] != undefined || this.referenceDataObject.scope['vnfc-type'] != "")) {
this.isVnfcType = true
this.isVnfcType = false
this.displayVnfc = 'true'
this.isVnfcTypeList = true
- if (!this.mappingEditorService.newObject.vnfc) {
+ if(!this.mappingEditorService.newObject || !this.mappingEditorService.newObject.vnfc) {
this.vnfcIdentifier = this.referenceDataObject.scope['vnfc-type-list'][0];
// this.mappingEditorService.newObject.vnfc = this.vnfcIdentifier;
- // this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
-
} else {
this.vnfcIdentifier = this.mappingEditorService.newObject.vnfc;
}
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": displayHideVnfc: vnfcIdentifier:[" +
- this.vnfcIdentifier + "]");
+ this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
+ //this.vnfcChanged(this.vnfcIdentifier, FormData);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": displayHideVnfc: vnfcIdentifier:["+
+ this.vnfcIdentifier+"]");
}
if (this.referenceDataObject.scope['vnfc-type-list'] != undefined && this.referenceDataObject.scope['vnfc-type-list'].length == 0 && this.referenceDataObject.scope['vnfc-type'] != undefined && this.referenceDataObject.scope['vnfc-type'].length == 0) {
- if (this.displayVnfc == 'true') {
+ if(this.displayVnfc == 'true') {
this.isVnfcType = false
this.displayVnfc = 'true'
this.isVnfcTypeList = true
this.displayVnfc = 'false'
this.isVnfcTypeList = false
}
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": displayHideVnfc: finish. isVnfcType:[" +
- this.isVnfcType + " displayVnfc:[" + this.displayVnfc + "] isVnfcTypeList:[" +
- this.isVnfcTypeList + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": displayHideVnfc: finish. isVnfcType:["+
+ this.isVnfcType+" displayVnfc:["+this.displayVnfc+"] isVnfcTypeList:["+
+ this.isVnfcTypeList+"]");
}
- //reinitializing the required values
+ //reinitializing the required values. when changing to template or pd sending the values to mapping service
ngOnDestroy() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": ngOnDestroy: start:" +
- " vnfcIdentifier:[" + this.vnfcIdentifier + "]");
let referenceObject = this.prepareReferenceObject();
this.mappingEditorService.changeNavAppData(this.appData);
this.mappingEditorService.changeNavDownloadData(this.downloadData);
this.firstArrayElement = [];
this.uploadFileName = '';
}
-
+ // vaidating the number
numberValidation(event: any) {
if (this.numberTest.test(event) && event != 0) {
this.numberOfVmTest = true;
}
// update my vnf pop up session values
updateSessionValues(event: any, type: string) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": updateSessionValues: type:[" + type + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": updateSessionValues: type:["+type+"]");
if (type === 'action') {
sessionStorage.setItem('action', event);
}
sessionStorage.setItem('vnfType', event);
}
}
-
+ // adding vnfc data for each vm
addVnfcData(vmNumber: number) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": addVnfcData: start: vmNumber="+ vmNumber);
var newObj = {
'vnfc-instance': this.referenceDataObject.vm[vmNumber].vnfc.length + 1,
'vnfc-type': this.vnfcTypeData,
};
this.referenceDataObject.vm[vmNumber].vnfc.push(newObj);
}
-
//validating the vnf and vnfc data in the pop up
validateVnfcName(name) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": validateVnfcName: start: name:[" + name + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": validateVnfcName: start: name:["+name+"]");
if (!name.trim() || name.length < 1) {
this.errorMessage = '';
this.invalid = true;
}
}
+
//to remove the VM's created by the user
removeFeature(vmNumber: any, index: any, templateId) {
if (this.referenceDataObject.action == "Configure") {
if (arrIndex >= vmNumber) {
obj["vm-instance"] = obj["vm-instance"] - 1
}
+ // obj["vm-instance"] = arrIndex+1
+
})
} else {
let data = this.referenceDataObject.vm.filter(obj => {
}
}
+ //utility function while adding VM to check index
findVmindex(data, vmNumber, templateId) {
return this.referenceDataObject.vm.findIndex(obj => {
let x = obj['vm-instance'] == (vmNumber + 1) && templateId == obj['template-id']//true
}
- //add new VM's to the configure
+ //add new VM's to the configure and configmodify.
addVms() {
let arr = [];
+
let mberOFVm = Number(this.refernceScopeObj.from);
- if (this.referenceDataObject.action == 'ConfigScaleOut') {
- let existingVmsLength = this.referenceDataObject.vm.filter(obj => {
- return obj['template-id'] == this.templateIdentifier
+ let key
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ key = "vnfcType-id"
+ } else if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ key = "template-id"
+ }
+ if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ let existingVmsLength = this.referenceDataObject.vm.map(obj => {
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ return obj["vnfcType-id"] == this.templateIdentifier
+ } else if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ return obj["template-id"] == this.templateIdentifier
+ }
}).length;
- mberOFVm = existingVmsLength + mberOFVm;
+ //mberOFVm = existingVmsLength + mberOFVm;
let index = 0;
- for (var i = (existingVmsLength); i < mberOFVm; i++) {
+ let identifierValue
+ if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ identifierValue = this.templateIdentifier
+ } else if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ identifierValue = this.vnfcIdentifier
+ }
+
+ for (var i = 0; i < mberOFVm; i++) {
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+
+ if (identifierValue && identifierValue != "") {
+ this.referenceDataObject.vm.push({ 'vnfcType-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
+ } else {
+ this.referenceDataObject.vm.push({ 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
+ }
+
+ } else if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ if (identifierValue && identifierValue != "") {
+ this.referenceDataObject.vm.push({ 'template-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
+ }
+
+ }
- this.referenceDataObject.vm.push({ 'template-id': this.templateIdentifier, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
index++;
}
}
}
- //Reference object to create reference data
+ //preparing reference obj with required business use cases
prepareReferenceObject(isSaving?: any) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": prepareReferenceObject: start.");
+ let methName= "prepareReferenceObject";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: isSaving:["+
+ isSaving+"]");
let scopeName = this.resetParamsOnVnfcType();
- let extension = this.decideExtension(this.referenceDataObject);
+ let extension = this.referenceDataFormUtil.decideExtension(this.referenceDataObject);
this.prepareArtifactList(scopeName, extension);
+
if (this.referenceDataObject.action === 'OpenStack Actions') {
this.referenceDataObject['template'] = 'N';
this.referenceDataObject['artifact-list'] = [];
this.referenceDataObject['firstRowVmSpreadSheet'] = this.firstArrayElement;
}
- //detaching the object from the form and processing further
+ else{
+ this.referenceDataObject['firstRowVmSpreadSheet']=undefined;
+ }
+ //ditaching the object from the form and processing pfurther
let newObj = $.extend(true, {}, this.referenceDataObject);
let action = this.referenceDataObject.action;
+ // if (action=="ConfigScaleOut"){
+ // this.referenceDataObject.action="true";
+ // }
+ //preparing Obj for save/download
newObj = this.deleteVmsforNonActions(newObj, action)
+
+ if (newObj['device-protocol'] != 'REST') {
+ delete newObj['url']
+ }
this.pushOrReplaceTempData(newObj, action);
this.addAllActionObj(newObj, scopeName);
this.resetTempData()
+
+
+ //rmove context url
+ //if()
//saving data to service
this.mappingEditorService.getReferenceList().push(JSON.parse(JSON.stringify(this.referenceDataObject)));
this.buildDesignComponent.updateAccessUpdatePages(this.referenceDataObject.action, this.mappingEditorService.getReferenceList());
return { totlaRefDtaa: this.tempAllData, scopeName: scopeName };
}
+ // utility function to check element existence
public checkIfelementExistsInArray(element, array) {
- //// console.log("Element==" + element)
var result: boolean = false;
array.forEach(function (item) {
- // // console.log("Item==" + item)
if (element === item) {
- // console.log('Element==' + element + 'Item==' + item);
result = true;
}
}
);
return result;
}
-
+ // when uploading the file
upload(evt: any) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": upload: start.");
/* wire up file reader */
const target: DataTransfer = <DataTransfer>(evt.target);
this.uploadFileName = evt.target.files[0].name;
var fileExtension = this.uploadFileName.substr(this.uploadFileName.lastIndexOf('.') + 1);
if (target.files.length != 1) {
- console.log(this.classNm + ": upload: Error: got no file !");
- throw new Error(appConstants.errors.multipleFileUploadError);
+ throw new Error('Cannot upload multiple files on the entry');
}
- console.log(this.classNm + ": upload: filename:[" + evt.target.files[0].name + "]");
if (fileExtension.toUpperCase() === 'XLS' || fileExtension.toUpperCase() === 'XLSX') {
const reader = new FileReader();
reader.onload = (e: any) => {
/* read workbook */
const bstr = e.target.result;
- // // console.log("print 1---" + bstr);
const wb = XLSX.read(bstr, { type: 'binary' });
- // // console.log("print 2---" + JSON.stringify(wb));
/* grab first sheet */
const wsname = wb.SheetNames[0];
- // // console.log("Name:---" + wsname);
const ws = wb.Sheets[wsname];
/* save data */
-
+ this.firstArrayElement = []
let arrData = (<AOA>(XLSX.utils.sheet_to_json(ws, { header: 1 })));
this.uploadedDataArray = arrData;
- this.firstArrayElement = arrData[0];
+ for (var i = 0; i < arrData[0].length; i++) {
+ this.firstArrayElement.push(arrData[0][i].replace(/[\n\r]+/g, ''))
+ }
var remUploadedDataArray = arrData;
remUploadedDataArray.shift();
this.remUploadedDataArray = remUploadedDataArray;
if (arrData != null) {
this.getExcelUploadStatus = true;
- this.nService.success(appConstants.notifications.titles.success, appConstants.messages.vmDataUploadSuccess);
+ this.nService.success('Success', 'Vm capabilities data uploaded successfully');
}
else {
- this.nService.success(appConstants.notifications.titles.error, appConstants.messages.emptyVmUpload);
+ this.nService.success('Error', 'Empty Vm capabilities file uploaded');
}
};
reader.readAsBinaryString(target.files[0]);
}
else {
- this.nService.error(appConstants.notifications.titles.error, appConstants.messages.incorrectVmUpload);
+ this.nService.error('Error', 'Incorrect VM capabilities file uploaded');
}
}
addVmCapabilitiesData() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": addVmCapabilitiesData: start.");
for (var i = 0; i < this.uploadedDataArray.length; i++) {
var vnfcFuncCodeArray = [];
var data = this.uploadedDataArray[i];
if (data[j] != undefined) {
if (data[j].toUpperCase() === 'Y') {
vnfcFuncCodeArray.push(this.firstArrayElement[j]);
+ //vnfcFuncCodeArray.push({name:this.firstArrayElement[j]});
}
}
}
'action-level': 'vm',
'scope': {
'vnf-type': this.referenceDataObject['scope']['vnf-type'], //need to confirm what should be this value
- 'vnfc-type': null
+ 'vnfc-type-list': null
},
'vnfc-function-code-list': vnfcFuncCodeArray,
'template': 'N',
}
}
- //download template
+ //download the templae pd and reference file with all the actions added.
save(form: any, isValid: boolean) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": save: start: referenceDataObject.action:[" +
- this.referenceDataObject.action + "]");
- if (this.referenceDataObject.action === '') {
- this.nService.error(appConstants.notifications.titles.error, appConstants.errors.noActionError);
- return;
- }
- if (this.referenceDataObject['device-protocol'] === '') {
- this.nService.error(appConstants.notifications.titles.error, appConstants.errors.noDeviceProtocolError);
- return;
- }
+ // will show error message
+ this.showValidationErrors(this.referenceDataObject);
if (isValid) {
let referenceObject = this.prepareReferenceObject();
+ let removedKeysArray = []
+ this.tempAllData.forEach((data, index) => {
+ if (data.action) {
+ removedKeysArray.push(JSON.parse(JSON.stringify(this.deleteUnwantedKeys(data))))
+ }
+ });
+ this.tempAllData = removedKeysArray;
+ /* var tempAllData = this.tempAllData;
+ tempAllData=this.removeParamFileNameBeforeSave(tempAllData)*/
+
+ //tempAllData["artifact_list"]=newArtifactList;
let theJSON = JSON.stringify({ 'reference_data': this.tempAllData }, null, '\t');
let uri = 'data:application/json;charset=UTF-8,' + encodeURIComponent(theJSON);
this.downloadData.reference = theJSON;
+ let referenceFileName = 'reference_AllAction_' + this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
+ this.utilityService.downloadArtifactToPc(theJSON, 'json', referenceFileName, 100);
this.validateTempAllData();
- var blob = new Blob([theJSON], {
- type: 'text/plain'
- });
- let fileName = 'reference_AllAction_' + referenceObject.scopeName + '_' + '0.0.1V.json';
- this.downloadFile(blob, fileName, 100)
var templateData = JSON.stringify(this.downloadData.template.templateData);
+ var templateFileName = this.downloadData.template.templateFileName;
+ if (templateFileName != null || templateFileName != '') {
+ var fileExtensionArr = templateFileName.split('.');
+ }
+ var nameValueFileName = this.downloadData.template.nameValueFileName;
+ let pdFileName = this.downloadData.pd.pdFileName;
var nameValueData = JSON.stringify(this.downloadData.template.nameValueData);
var pdData = this.downloadData.pd.pdData;
- if (templateData != '{}' && templateData != null && templateData != undefined) this.downloadTemplate();
- if (nameValueData != '{}' && nameValueData != null && nameValueData != undefined) this.downloadNameValue();
- if (pdData != '' && pdData != null && pdData != undefined) this.downloadPd();
- }
- }
- downloadFile(blob, fileName, delay) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": downloadFile: start.");
- setTimeout(() => {
- saveAs(blob, fileName);
- }, delay)
- }
-
- downloadTemplate() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": downloadTemplate: start.");
- var fileName = this.downloadData.template.templateFileName;
- console.log(this.classNm + ": downloadTemplate: fileName:[" + fileName + "]");
- var theJSON = this.downloadData.template.templateData;
- if (fileName != null || fileName != '') {
- var fileExtensionArr = fileName.split('.');
- var blob = new Blob([theJSON], {
- type: 'text/' + fileExtensionArr[1]
- });
- this.downloadFile(blob, fileName, 130)
+ if (templateData != '{}' && templateData != null && templateData != undefined) this.utilityService.downloadArtifactToPc(this.downloadData.template.templateData, fileExtensionArr[1], templateFileName, 130);
+ if (nameValueData != '{}' && nameValueData != null && nameValueData != undefined) this.utilityService.downloadArtifactToPc(this.downloadData.template.nameValueData, 'json', nameValueFileName, 160);
+ if (pdData != '' && pdData != null && pdData != undefined) this.utilityService.downloadArtifactToPc(pdData, 'yaml', pdFileName, 180);
}
}
- downloadNameValue() {
- var fileName = this.downloadData.template.nameValueFileName;
- var theJSON = this.downloadData.template.nameValueData;
- var blob = new Blob([theJSON], {
- type: 'text/json'
- });
-
- this.downloadFile(blob, fileName, 160)
- }
-
- downloadPd() {
- let fileName = this.downloadData.pd.pdFileName;
- let theJSON = this.downloadData.pd.pdData;
- var blob = new Blob([theJSON], {
- type: 'text/plain'
- });
-
- this.downloadFile(blob, fileName, 180)
- }
-
+ /* removeParamFileNameBeforeSave(tempAllData)
+ {
+ var newArtifactList = [];
+ var element={};
+ for (var i = 0; i < tempAllData.length; i++) {
+ if (this.checkIfelementExistsInArray(tempAllData[i].action,this.actions)) {
+ var artifactList = tempAllData[i]["artifact-list"]
+
+ for (var j = 0; j < artifactList.length; j++) {
+ if (artifactList[j]["artifact-type"] != "param_values") {
+ element = artifactList[j];
+ newArtifactList.push(element);
+ }
+ }
+ tempAllData[i]["artifact-list"] = newArtifactList
+ newArtifactList = [];
+ element={};
+ }
+ }
+ return tempAllData;
+ }*/
// save the values to the cache, on action change without download
- validateDataAndSaveToAppc(valid, form, event) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": validateDataAndSaveToAppc: start: valid:" + valid);
+ validateDataAndSaveToAppc( valid, form, event) {
+ let methName= "validateDataAndSaveToAppc";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: valid:["+valid+"]");
// will show error message
this.showValidationErrors(this.referenceDataObject);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
try {
form._submitted = true;
if (valid) {
this.nService.warn('status', 'unable to save the artifact');
}
}
-
//this method saves reference, template, param and PD data to APPC
saveToAppc() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": saveToAppc: start: vnf-type:[" +
- this.referenceDataObject.scope['vnf-type'] + "]");
- let theJSON = JSON.stringify(this.tempAllData);
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": saveToAppc: tempAllData:[" + theJSON + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": saveToAppc: start: vnf-type:["+
+ this.referenceDataObject.scope['vnf-type']+"]");
+ let theJSON = JSON.stringify( this.tempAllData );
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": saveToAppc: tempAllData:["+theJSON+"]");
let fileName = 'reference_AllAction_' + this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
- this.saveReferenceDataToAppc(
- JSON.stringify({ reference_data: this.tempAllData }), this.referenceDataObject.scope['vnf-type'], fileName);
+ /*var tempAllData=this.removeParamFileNameBeforeSave(this.tempAllData);
+ this.tempAllData=tempAllData;*/
+ this.saveReferenceDataToAppc(JSON.stringify({ reference_data: this.tempAllData }), this.tempAllData[this.tempAllData.length - 1], fileName);
var templateData = JSON.stringify(this.appData.template.templateData);
var nameValueData = JSON.stringify(this.appData.template.nameValueData);
// valaidation of template data
validateTempAllData() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": validateTempAllData: start.");
if (this.tempAllData) {
var updatedData = [];
this.tempAllData.forEach(data => {
}
}
- //.. prepare and send the data to the API.
- saveReferenceDataToAppc(artifactData, vnf_type, fileName) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": saveReferenceDataToAppc: start: vnf_type:[" +
- vnf_type + "]");
+ //preparig and send the data to the API.
+ saveReferenceDataToAppc(artifactData, dataJson, fileName) {
let data = [];
let slashedPayload = this.referenceDataFormUtil.appendSlashes(artifactData);
- let payload = this.utilityService.createPayLoadForSave("reference_data", vnf_type, "AllAction", fileName, this.versionNoForApiCall, slashedPayload);
+
+ let payload = this.utilityService.createPayLoadForSave("reference_data", dataJson['scope']['vnf-type'], "AllAction", fileName, this.versionNoForApiCall, slashedPayload);
this.ngProgress.start();
this.httpUtils.post({
url: environment.getDesigns,
this.ngProgress.done();
}, 3500);
}
-
+ // if no data present in the session, fetching data from API
retriveFromAppc() {
- console.log(this.classNm + ": retriveFromAppc: start.");
if (sessionStorage.getItem('updateParams') != 'undefined') {
this.getArtifact();
this.noCacheData = false;
}
}
- cloneMessage(servermessage) {
- var clone = {};
- for (var key in servermessage) {
- if (servermessage.hasOwnProperty(key)) //ensure not adding inherited props
- clone[key] = servermessage[key];
- }
- return clone;
- }
-
public showUpload() {
this.selectedUploadType = this.uploadTypes[0].value;
};
-
+ // used when user uploads a file using upload file
public fileChange(input) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: start.");
this.fileName = input.target.files[0].name.replace(/C:\\fakepath\\/i, '');
this.fileUploaded = true;
this.disableRetrieve = true;
return;
}
}
+
this.displayVnfc = 'false';
this.isVnfcType = false;
this.isVnfcTypeList = false;
this.displayVnfc = 'true';
this.isVnfcTypeList = true;
this.vnfcIdentifier = obj.scope['vnfc-type-list'][0];
+
}
}
- this.oldAction = obj.action;
+ this.oldAction=obj.action;
this.tempAllData = JSON.parse(JSON.stringify(jsonObject));
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: read & parsed.");
+ //check vnfc tyoe list for old files
+ // if (this.referenceDataObject.scope['vnfc-type-list'] == undefined) {
+ // this.tempAllData = []
+ // this.referenceDataObject = {
+ // action: '',
+ // 'action-level': 'vnf',
+ // scope: { 'vnf-type': '', 'vnfc-type-list': [] },
+ // 'template': 'Y',
+ // vm: [],
+ // 'device-protocol': '',
+ // 'user-name': '',
+ // 'port-number': '',
+ // 'artifact-list': []
+ // }
+ // this.nService.error('Error', 'Incorrect file format');
+ // return
+ // }
this.notificationService.notifySuccessMessage('Reference Data file successfully uploaded..');
- if (jsonObject instanceof Array) {
- this.referenceDataObject = jsonObject[0];
- jsonObject.forEach(obj => {
- this.selectedActions.push(obj.action);
- });
- } else {
- this.referenceDataObject = jsonObject;
-
- this.selectedActions.push(jsonObject.action);
- }
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: " +
- "referenceDataObject.action:[" +
- this.referenceDataObject.action + "]");
+ this.highlightSelectedActions(jsonObject)
this.toggleIdentifier(this.referenceDataObject.action)
+ this.populateExistinAction(this.referenceDataObject.action)
this.configDrp(this.referenceDataObject.action)
- if (this.referenceDataObject.action === 'OpenStack Actions') {
- this.deviceProtocols = ['', 'OpenStack'];
- this.buildDesignComponent.tabs = [
- {
- type: 'dropdown',
- name: 'Reference Data',
- url: 'references',
- }];
- }
- else {
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }, {
- name: 'Template',
- url: 'templates/myTemplates',
- }, {
- name: 'Parameter Definition',
- url: 'parameterDefinitions/create'
- } /*, {
- name: "Test",
- url: 'test',
- }*/
- ];
- }
+
+
+ this.processReferenceDataAfterRetrieval();
+
this.getArtifactsOpenStack();
if (this.referenceDataObject.template == null) {
this.referenceDataObject.template = 'Y';
if (this.referenceDataObject['action-level'] == null) {
this.referenceDataObject['action-level'] = 'VNF';
}
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: displayVnfc:[" +
- this.displayVnfc + "]");
+
+
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
} catch (e) {
- this.nService.error(appConstants.notifications.titles.error, appConstants.messages.incorrectFileFormat);
+ this.nService.error('Error', 'Incorrect file format');
}
}
this.hideModal = true;
});
} else {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: Error: Failed to read file!");
this.notificationService.notifyErrorMessage('Failed to read file..');
}
+
+ }
+
+ // Highlights selected action on new file upload and on existing VNF
+ public highlightSelectedActions(jsonObject) {
+ if (jsonObject instanceof Array) {
+ this.referenceDataObject = jsonObject[0];
+ jsonObject.forEach(obj => {
+ this.selectedActions.push(obj.action);
+ });
+ } else {
+ this.referenceDataObject = jsonObject;
+
+ this.selectedActions.push(jsonObject.action);
+ }
}
public readFile(file, reader, callback) {
- console.log(this.classNm + ": readFile: start.");
// Set a callback funtion to fire after the file is fully loaded
reader.onload = () => {
// callback with the results
fileChangeEvent(fileInput: any) {
let obj: any = fileInput.target.files;
}
-
+ //resetting the values
clearVnfcData() {
- console.log(this.classNm + ": clearVnfcData: start.");
this.Sample = {
'vnfc-instance': '1',
'vnfc-function-code': '',
// this.referenceDataObject.scope['vnfc-type'] = '';
// }
// }
-
+ // resetting the form
resetForm() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": resetForm: start.");
+ console.log( this.classNm+": resetForm: start.");
this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject.template = 'Y';
this.referenceDataObject['device-protocol'] = '';
// this method gets called with the action as parameter and the respective action details are fetched and assigned to the current page
populateExistinAction(data) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": populateExistinAction: start.");
+ let methName= "populateExistinAction";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: data:["+data+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
let existAction = this.tempAllData.findIndex(obj => {
return obj.action == data;
});
this.referenceDataObject.scope['vnfc-type-list'] = obj['scope']['vnfc-type-list'];
this.referenceDataObject['device-protocol'] = obj['device-protocol'];
this.refernceScopeObj['sourceType'] = obj['scopeType'];
- if (obj['scope']['vnfc-type-list'] != undefined && obj['scope']['vnfc-type-list'].length > 0) {
+ if(obj['scope']['vnfc-type-list'] != undefined && obj['scope']['vnfc-type-list'].length >0) {
this.referenceDataObject['vnfcIdentifier'] = obj['scope']['vnfc-type-list'][0];
}
} else {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": populateExistinAction: action not found");
+ console.log( this.classNm+": populateExistinAction: action not found");
this.resetForm();
this.referenceDataObject.action = data;
}
break;
case 'UpgradeBackout':
case 'ResumeTraffic':
- case 'QuiesceTraffic':
case 'DistributeTraffic':
+ case 'QuiesceTraffic':
case 'UpgradeBackup':
case 'UpgradePostCheck':
case 'UpgradePreCheck':
}
}
- //Modal pop up for action change with values entered.
- actionChange(data, userForm) {
- var methName = "actionChange";
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": start: data:[" + data + "]" +
- " userForm.valid:[" + userForm.valid + "]");
+ //Modal pop up for action change with values entered.
+ actionChange( data, userForm) {
+ let methName= "actionChange";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: data:["+data+"]"+
+ " userForm.valid:["+userForm.valid+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
this.disableGrpNotationValue = false
if (data == null) {
- console.log(this.classNm + ": " + methName + ": data == null");
+ console.log( this.classNm+": "+methName+": data == null");
return;
}
- if ((userForm.valid) && this.oldAction != '' && this.oldAction != undefined) {
+ if((userForm.valid) && this.oldAction != '' && this.oldAction != undefined) {
this.actionChanged = true;
- console.log(this.classNm + ": " + methName +
- ": userForm valid and oldAction defined");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+
+ ": userForm valid and oldAction defined");
// Calling common Confirmation Modal
let disposable = this.dialogService.addDialog(ConfirmComponent)
- .subscribe((isConfirmed) => {
+ .subscribe((isConfirmed)=>{
//We get dialog result
- console.log(this.classNm + ": " + methName + ": isConfirmed:[" +
- isConfirmed + "]");
- if (isConfirmed) {
+ if(isConfirmed) {
// User clicked on Yes
this.currentAction = this.referenceDataObject.action;
- console.log(this.classNm + ": " + methName +
- ": clicked on Yes: currentAction:[" + this.currentAction +
- "] oldAction:[" + this.oldAction + "]");
this.referenceDataObject.action = this.oldAction;
$('#saveToAppc').click();//make sure the save all is done before the tempall obj is saved form the API
this.toggleIdentifier(data)
this.oldAction = this.currentAction;// this.referenceDataObject.action + '';
- this.referenceDataObject.action = this.currentAction;
+ this.referenceDataObject.action = this.currentAction
+
this.populateExistinAction(data);
if (this.oldAction === 'OpenStack Actions') {
// User clicked on No
this.toggleIdentifier(data)
this.currentAction = this.referenceDataObject.action;
- console.log(this.classNm + ": " + methName +
- ": clicked on No: currentAction:[" + this.currentAction + "]");
this.populateExistinAction(data);
this.resetVmsForScaleout(data);
this.oldAction = this.referenceDataObject.action + '';
}
if (this.referenceDataObject.action === 'Configure' || this.referenceDataObject.action === 'ConfigModify' || this.referenceDataObject.action === 'DistributeTraffic') {
- this.isConfigureAction = true;
+ this.isConfigOrConfigModify = true;
} else {
- this.isConfigureAction = false;
+ this.isConfigOrConfigModify = false;
delete this.mappingEditorService.newObject['vnfc'];
}
-
+
// Enable or Block Template and PD Tabs
if (this.currentAction == 'ConfigScaleOut' && this.templateIdentifier && this.templateIdentifier != '') {
// let referenceDataObjectTemp = this.referenceDataObject;
// referenceDataObjectTemp['template-id'] = this.templateIdentifier;
// this.buildDesignComponent.getRefData(referenceDataObjectTemp);
this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: this.templateIdentifier });
-
+
} else {
this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
- }
+ }
});
} else {
- console.log(this.classNm + ": " + methName +
- ": userForm Not valid or oldAction not defined");
+ console.log( this.classNm+": "+methName+
+ ": userForm Not valid or oldAction not defined");
this.actionChanged = true;
this.currentAction = this.referenceDataObject.action;
this.oldAction = this.referenceDataObject.action + '';
this.toggleIdentifier(data);
// Enable or Block Template and PD Tabs
- if (this.currentAction == 'ConfigScaleOut' && this.templateIdentifier) {
+ if(this.currentAction == 'ConfigScaleOut' && this.templateIdentifier) {
// let referenceDataObjectTemp = this.referenceDataObject;
// referenceDataObjectTemp['template-id'] = this.templateIdentifier;
// this.buildDesignComponent.getRefData(referenceDataObjectTemp);
this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
}
}
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
this.configDrp(data)
}
configDrp(data) {
- console.log(this.classNm + ": configDrp: start: data:[" + data + "]");
+ console.log( this.classNm+": configDrp: start: data:["+data+"]");
if (data == 'ConfigScaleOut') {
this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
} else {
this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value'];
}
if (data == 'OpenStack Actions') {
- this.buildDesignComponent.tabs = [
- {
- type: 'dropdown',
- name: 'Reference Data',
- url: 'references',
- }];
+ this.buildDesignComponent.tabs = this.referencDataTab;
}
else {
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }, {
- name: 'Template',
- url: 'templates/myTemplates',
- }, {
- name: 'Parameter Definition',
- url: 'parameterDefinitions/create'
- }/*, {
- name: "Test",
- url: 'test',
- }*/
- ];
+ this.buildDesignComponent.tabs = this.allTabs;
}
if (data == 'Configure' || data == 'ConfigModify' || data == 'DistributeTraffic') {
this.nonConfigureAction = false;
this.nonConfigureAction = true;
}
}
-
+ // removing and adding the url key based on the protocol selected
deviceProtocolChange() {
- console.log(this.classNm + ": deviceProtocolChange: start.");
+ let methName= "deviceProtocolChange";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start.");
if (this.referenceDataObject['device-protocol'] == 'REST') {
} else {
delete this.referenceDataObject['context-url']
}
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: this.templateIdentifier });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, {reqField: this.templateIdentifier})
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
}
// used to call or trigger save object on template Identifier changes
idChange(data, userForm) {
- console.log(this.classNm + ": idChange: start: data:[" + data + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": idChange: start: data:["+data+"]");
if (data == null) {
return;
}
+
// Enable or Block Template and PD Tabs
// let referenceDataObjectTemp = this.referenceDataObject;
// referenceDataObjectTemp['template-id'] = data;
// this.buildDesignComponent.getRefData(referenceDataObjectTemp);
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: data });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: data });
if ((userForm.valid)) {
this.currentAction = "ConfigScaleOut"
let referenceObject = this.prepareReferenceObject();
this.actionChanged = true;
if (this.templateIdentifier) {
- // Calling common Confirmation Modal
- let disposable = this.dialogService.addDialog(ConfirmComponent)
- .subscribe((isConfirmed) => {
- //We get dialog result
- if (isConfirmed) {
- // User clicked on Yes
- this.validateTempAllData();
- this.saveToAppc();
- this.clearCache();
- this.clearVnfcData();
- this.refernceScopeObj.from = '';
- }
- else {
- // User clicked on No
- this.clearCache();
- this.refernceScopeObj.from = '';
- }
- });
+ // Calling common Confirmation Modal
+ let disposable = this.dialogService.addDialog(ConfirmComponent)
+ .subscribe((isConfirmed)=>{
+ //We get dialog result
+ if(isConfirmed) {
+ // User clicked on Yes
+ this.validateTempAllData();
+ this.saveToAppc();
+ this.clearCache();
+ this.clearVnfcData();
+ this.refernceScopeObj.from = '';
+ }
+ else {
+ // User clicked on No
+ this.clearCache();
+ this.refernceScopeObj.from = '';
+ }
+ });
}
} else {
- this.oldtemplateIdentifier = this.templateIdentifier;
+ this.oldtemplateIdentifier = this.templateIdentifier
}
+
+ // if (this.referenceDataObject.action == 'ConfigScaleOut' && data ) {
+ // let referenceDataObjectTemp = this.referenceDataObject;
+ // referenceDataObjectTemp['selectedTemplateId'] = data;
+ // this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+ // } else {
+ // this.buildDesignComponent.getRefData(this.referenceDataObject);
+ // }
}
// used to call or trigger save object on multiple VNFC's changes
- vnfcChanged(data, userForm) {
- console.log(this.classNm + ": vnfcChanged: new vnfcIdentifier:[" + data + "]");
- console.log(this.classNm + ": vnfcChanged: oldVnfcIdentifier:[" +
- this.oldVnfcIdentifier + "]");
- console.log(this.classNm + ": vnfcChanged: scope.vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
+ vnfcChanged( data, userForm) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": vnfcChanged: new vnfcIdentifier:["+data+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": vnfcChanged: oldVnfcIdentifier:["+
+ this.oldVnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": vnfcChanged: scope.vnfc-type:["+
+ this.referenceDataObject.scope['vnfc-type']+"]");
this.vnfcIdentifier = data;
- this.clearCache();
+ //this.clearCache();
if (data == null) {
return;
}
- //.. populate VNFC Type in Sample field
- this.setVnfcTypeInSample(this.vnfcIdentifier);
+
// Enable or Block Template and PD Tabs
let referenceDataObjectTemp = this.referenceDataObject;
referenceDataObjectTemp['vnfcIdentifier'] = data;
- console.log(this.classNm +
- ": vnfcChanged: displayVnfc:[" + this.displayVnfc + "]");
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: data });
- console.log(this.classNm +
- ": vnfcChanged: userForm.valid:[" + userForm.valid + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+
+ ": vnfcChanged: displayVnfc:["+this.displayVnfc+"]");
+ //this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: data });
+
+
+ console.log( this.classNm+
+ ": vnfcChanged: userForm.valid:["+userForm.valid+"]");
if ((userForm.valid) && this.oldVnfcIdentifier != '' && this.oldVnfcIdentifier != undefined) {
this.currentAction = this.referenceDataObject.action
this.oldVnfcIdentifier = this.vnfcIdentifier
let referenceObject = this.prepareReferenceObject();
this.actionChanged = true;
if (this.vnfcIdentifier) {
- // Calling common Confirmation Modal
- let disposable = this.dialogService.addDialog(ConfirmComponent)
- .subscribe((isConfirmed) => {
- //We get dialog result
- if (isConfirmed) {
- // User clicked on Yes
- this.validateTempAllData();
- this.saveToAppc();
- this.clearCache();
- this.clearVnfcData()
- this.refernceScopeObj.from = '';
- }
- else {
- // User clicked on No
- this.clearCache();
- this.refernceScopeObj.from = '';
- }
- });
+ // Calling common Confirmation Modal
+ let disposable = this.dialogService.addDialog(ConfirmComponent)
+ .subscribe((isConfirmed)=>{
+ //We get dialog result
+ if(isConfirmed) {
+ // User clicked on Yes
+ this.validateTempAllData();
+ this.saveToAppc();
+ this.clearCache();
+ this.clearVnfcData()
+ this.refernceScopeObj.from = '';
+ //.. populate VNFC Type in Sample field
+ this.setVnfcTypeInSample( this.vnfcIdentifier );
+ }
+ else {
+ // User clicked on No
+ this.clearCache();
+ this.clearVnfcData()
+ this.refernceScopeObj.from = '';
+ //.. populate VNFC Type in Sample field
+ this.setVnfcTypeInSample( this.vnfcIdentifier );
+ }
+ });
}
} else {
if (data != null) {
}
}
- clearCache() {
- console.log(this.classNm + ": clearCache: start.");
+ clearCache()
+ //needed for the the clearing template cache.
+ {
// get the value and save the userid and persist it.
this.clearTemplateCache();
this.clearPdCache();
this.paramShareService.setSessionParamData(undefined);
}
- saveTemp() {
- console.log(this.classNm + ": saveTemp: start.");
- this
- .httpUtils
- .post(
- { url: environment.getDesigns, data: this.appData.template.templateData })
- .subscribe(resp => {
- if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
- this.nService.success('Status', 'Successfully uploaded the Template Data');
- }
- if (resp.output.status.code === '401') {
- this.nService.warn('Status', 'Error in saving the Template to Appc');
-
- }
- },
- (err) => this.nService.error('Status', 'Error Connecting to the APPC Network'));
- }
-
- saveNameValue() {
- console.log(this.classNm + ": saveNameValue: start.");
- this
- .httpUtils
- .post(
- {
- url: environment.getDesigns, data: this.appData.template.nameValueData
- })
- .subscribe(resp => {
- if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
- this.nService.success('Status', 'Successfully uploaded the Name Value Pairs');
- }
- if (resp.output.status.code === '401') {
- this.nService.warn('Status', 'Error in saving the Name value pairs to Appc');
- }
- },
- error => {
- this.nService.error('Status', 'Error Connecting to the APPC Network');
- return false;
- });
- }
-
- savePd() {
- this
- .httpUtils
- .post(
- {
- url: environment.getDesigns, data: this.appData.pd
- })
- .subscribe(resp => {
- if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
- this.nService.success('Status', 'Successfully uploaded PD file');
- }
- if (resp.output.status.code === '401') {
- this.nService.warn('Status', 'Error in saving the PD to Appc');
- }
- },
- error => {
- this.nService.error('Status', 'Error Connecting to the APPC Network');
- return false;
- });
- }
-
- openModel(toShow: any, message: any, title: any) {
- console.log(this.classNm + ": openModel: start: title:[" + title + "]");
- this.modalComponent.isShow = toShow;
- this.modalComponent.message = message;
- this.modalComponent.title = title;
- }
-
browseOption() {
$('#inputFile').trigger('click');
}
$('#excelInputFile').trigger('click');
}
- showIdentifier() {
- $('#identifierModal').modal();
- }
+ /* showIdentifier() {
+ $('#identifierModal').modal();
+ }
+
+ showVnfcPopup() {
+ $('#vnfcModal').modal();
+ }*/
addToIdentDrp() {
if (!(this.referenceDataObject['template-id-list'])) {
if (!(this.referenceDataObject['template-id-list'].indexOf(this.templateId.trim()) > -1)) {
this.referenceDataObject['template-id-list'].push(this.templateId.trim());
}
- // Changing value to blank otherwise it will show previous value in text box of popup
- this.templateId = '';
- }
+ // Changing newVnfcType value to blank otherwise it will show previous value in text box of popup
+ this.templateId = ''
+ }
// adds the vnfc to the vnfc dropdown list
addVnfc() {
- var newVnfcTypeV = this.newVnfcType.trim();
- console.log(this.classNm +
- ": addVnfc: start: newVnfcTypeV:[" + newVnfcTypeV + "]");
+ var newVnfcTypeV= this.newVnfcType.trim();
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+
+ ": addVnfc: start: newVnfcTypeV:["+newVnfcTypeV+"]");
if (!(this.referenceDataObject.scope['vnfc-type-list'])) {
this.referenceDataObject.scope['vnfc-type-list'] = [];
- // this.vnfcIdentifier = newVnfcTypeV;
- } else if (this.referenceDataObject.scope['vnfc-type-list'].length == 0) {
- // this.vnfcIdentifier = newVnfcTypeV;
+ this.vnfcIdentifier = newVnfcTypeV;
+ } else {
+ this.vnfcIdentifier = newVnfcTypeV;
}
- this.vnfcIdentifier = newVnfcTypeV;
- console.log(this.classNm +
- ": addVnfc: vnfcIdentifier:[" + this.vnfcIdentifier + "]");
+ //this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
if (!(this.referenceDataObject.scope['vnfc-type-list'].indexOf(newVnfcTypeV) > -1)) {
this.referenceDataObject.scope['vnfc-type-list'].push(newVnfcTypeV);
}
this.tempAllData.forEach(obj => {
- if (obj.action == "Configure" || obj.action == "ConfigModify" || obj.action == "DistributeTraffic") {
+ if (obj.action == "Configure" || obj.action == "ConfigModify" || obj.action == "DistributeTraffic") {
obj.scope['vnfc-type-list'] = this.referenceDataObject.scope['vnfc-type-list']
}
this.resetArtifactList(obj);
});
- console.log(this.classNm + ": addVnfc: scope vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
- this.setVnfcTypeInSample(newVnfcTypeV);
+ //this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+ this.setVnfcTypeInSample( newVnfcTypeV );
+ let userForm = {valid: true};
+ this.vnfcChanged(this.newVnfcType, userForm)
// Changing newVnfcType value to blank otherwise it will show previous value in text box of popup
this.newVnfcType = ''
}
resetVms() {
- console.log(this.classNm + ": resetVms: start.");
this.referenceDataObject.vm = [];
}
dataModified() {
// this.referenceDataObject.vm = this.referenceDataObject.vm;
}
-
+ // used to show and hide the group notation value in VNFC information
resetGroupNotation() {
if (this.Sample['group-notation-type'] == "existing-group-name") {
this.Sample['group-notation-value'] = ""
}
resetParamsOnVnfcType() {
- console.log(this.classNm + ": resetParamsOnVnfcType: start:\n " +
- "ref.DataObject.scope vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
- let scopeName = '';
- //if only vnf is there
- if (this.referenceDataObject.scope['vnfc-type'] == '' || this.referenceDataObject.scope['vnfc-type'] == null || this.referenceDataObject.scope['vnfc-type'] == 'null') {
- scopeName = this.referenceDataObject.scope['vnf-type'];
+ let scopeName: any;
+ let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list']
+ let vnfcType = this.referenceDataObject.scope['vnfc-type']
+ let vnfType = this.referenceDataObject.scope['vnf-type'];
+ //called only if only vnf is there
+ if ((this.referenceDataFormUtil.nullCheckForVnfcTypeList(vnfcTypeList)) && (this.referenceDataFormUtil.nullCheckForVnfcType(vnfcType))
+ ) {
+ scopeName = vnfType;
this.referenceDataObject.scope['vnfc-type'] = '';
this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject['scopeType'] = 'vnf-type';
+ scopeName = scopeName.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
}
//if VNFC is entered set action level & Scope type to VNFC for configure and configure modify, and default the values to vnf and vnf type for all other actions
else {
- scopeName = this.referenceDataObject.scope['vnfc-type'];
+ if (this.referenceDataFormUtil.nullCheckForVnfcTypeList(vnfcTypeList)) {
+ scopeName = vnfcType ? vnfcType : "";
+ } else {
+ // scopeName = this.referenceDataObject.scope['vnfc-type-list'];
+ }
+
if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
- this.referenceDataObject['action-level'] = 'vnfc';
+ this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject['scopeType'] = 'vnfc-type';
} else {
this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject['scopeType'] = 'vnf-type';
}
}
- //replacing / with _ and removing spaces in the scopeName
- if (scopeName) {
- scopeName = scopeName.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
- }
- console.log(this.classNm + ": resetParamsOnVnfcType: return scopeName:[" +
- scopeName + "]");
+ this.referenceDataObject.scope['vnfc-type'] = this.referenceDataObject.scope['vnfc-type'] ? this.referenceDataObject.scope['vnfc-type'] : "";
return scopeName
}
- decideExtension(obj) {
- //marking the extension based on the device-protocol selected by the user
- let extension = '.json';
- switch (obj['device-protocol']) {
- case 'ANSIBLE':
- case 'CHEF':
- case 'CLI':
- extension = '.json';
- break;
- case 'NETCONF-XML':
- case 'REST':
- extension = '.xml';
- break;
- }
- return extension;
- }
+ //used to form the structure of the reference file
prepareArtifactList(scopeName, extension) {
- console.log(this.classNm + ": prepareArtifactList: start: scopeName:[" +
- scopeName + "] extension:[" + extension + "]");
this.referenceDataObject['artifact-list'] = [];
- //preparing the artifact list array file names along with extension
- let config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V' + extension;
- let pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.yaml';
- let reference_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.json';
- let configTemplate = {
- 'artifact-name': 'template_' + config_template_fileName,
- 'artifact-type': 'config_template'
- };
- let pdTemplate = {
- 'artifact-name': 'pd_' + pd_fileName,
- 'artifact-type': 'parameter_definitions'
- };
- if (this.referenceDataObject.action != 'ConfigScaleOut') {
- this.referenceDataObject['artifact-list'].push(configTemplate,
- pdTemplate
- );
- } else {
- let identifiers = this.referenceDataObject['template-id-list'];
- if (identifiers) {
- for (var x = 0; x < identifiers.length; x++) {
+ let configTemplate
+ let pdTemplate
+ let paramValue
+ let vnf = this.referenceDataObject.scope['vnf-type']
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list'];
+ let pd_fileName
+ let config_template_fileName
+
+ let param_fileName
+ if (vnfcTypeList && vnfcTypeList.length > 0) {
+
+
+ for (var x = 0; x < vnfcTypeList.length; x++) {
//for replacing spaces and "/" with "_"
- identifiers[x] = identifiers[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
- pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V_' + identifiers[x] + '.yaml';
- config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V_' + identifiers[x] + extension;
-
- configTemplate = {
- 'artifact-name': 'template_' + config_template_fileName,
- 'artifact-type': 'config_template'
- };
- pdTemplate = {
- 'artifact-name': 'pd_' + pd_fileName,
- 'artifact-type': 'parameter_definitions'
- };
+ let type = vnfcTypeList[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
+ pd_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, '.yaml')
+ config_template_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, extension)
+ param_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, '.json')
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+
this.referenceDataObject['artifact-list'].push(configTemplate,
- pdTemplate
+ pdTemplate, paramValue
);
}
+ } else if (scopeName) {
+ pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.yaml';
+ config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V' + extension;
+ param_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.json';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+ this.referenceDataObject['artifact-list'].push(configTemplate,
+ pdTemplate, paramValue
+ );
}
+ } else {
+
+ //preparing the artifact list array file names along with extension
+ let config_template_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', extension);
+ let pd_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.yaml');
+ let reference_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.json');
+ let param_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.json');
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+ if (this.referenceDataObject.action != 'ConfigScaleOut') {
+
+ this.referenceDataObject['artifact-list'].push(configTemplate,
+ pdTemplate, paramValue
+ );
+
+ } else {
+
+ let identifiers = this.referenceDataObject['template-id-list'];
+ if (identifiers) {
+ for (var x = 0; x < identifiers.length; x++) {
+ //for replacing spaces and "/" with "_"
+ let type = identifiers[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
+ pd_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, '.yaml');
+ config_template_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, extension);
+ param_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, '.json');
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+
+ this.referenceDataObject['artifact-list'].push(configTemplate,
+ pdTemplate, paramValue
+ );
+ }
+ }
+
+ }
}
}
+ // used to remove the added vms for actions other than configure & scaleout
deleteVmsforNonActions(newObj, action) {
let configureObject = (action == 'Configure');
let ConfigScaleOut = (action == 'ConfigScaleOut');
}
return newObj
}
+ // used to replace the data in tempall obj and form the artifact names
pushOrReplaceTempData(newObj, action) {
- console.log(this.classNm + ": pushOrReplaceTempData: start: action:[" +
- action + "]\n newObj.scope vnfc-type:[" + newObj.scope['vnfc-type'] + "]");
- if (newObj.scope['vnfc-type'] == undefined ||
- newObj.scope['vnfc-type'] == null ||
- newObj.scope['vnfc-type'].length < 1) {
- console.log(this.classNm + ": pushOrReplaceTempData: scope vnfc-type" +
- " is empty.\n vnfcIdentifier:[" + this.vnfcIdentifier + "]");
- if (this.vnfcIdentifier != null && this.vnfcIdentifier != undefined &&
- this.vnfcIdentifier.length > 0) {
- newObj.scope['vnfc-type'] = this.vnfcIdentifier;
+ let configTemplate
+ let pdTemplate
+ let paramValue
+ if (newObj.action == "Configure" || newObj.action == "ConfigModify" || newObj.action == "DistributeTraffic") {
+ let extension = this.referenceDataFormUtil.decideExtension(this.referenceDataObject);
+ let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + (newObj['vnfcIdentifier'] ? (newObj['vnfcIdentifier'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_') : "") + '0.0.1V.yaml';
+ let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + (newObj['vnfcIdentifier'] ? (newObj['vnfcIdentifier'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_') : "") + '0.0.1V' + extension;
+ let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + (newObj['vnfcIdentifier'] ? (newObj['vnfcIdentifier'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_') : "") + '0.0.1V.json';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
+ let idValue = ""
+ if (newObj.scope['vnfc-type']) {
+ idValue = newObj.scope['vnfc-type']
+ } else if (this.vnfcIdentifier) {
+ idValue = this.vnfcIdentifier
}
- };
+
+ let arr = [configTemplate, pdTemplate, paramValue]
+ this.mappingEditorService.selectedObj({
+ action: newObj.action,
+ vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
+ vnfc: idValue,
+ protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
+ param_artifact: paramValue['param_artifact'],
+ pd_artifact: pdTemplate['pd_artifact'],
+ template_artifact: configTemplate['template_artifact']
+ });
+ } else if (newObj.action == "ConfigScaleOut") {
+ let extension = this.referenceDataFormUtil.decideExtension(newObj);
+ let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_0.0.1V' + '_' + (this.templateIdentifier ? (this.templateIdentifier.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '')) : "") + ".yaml";
+ let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V_' + (this.templateIdentifier ? (this.templateIdentifier.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '') : "") + extension;
+ let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V_' + (this.templateIdentifier ? (this.templateIdentifier.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '') : "") + '.json';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
+ let arr = [configTemplate, pdTemplate, paramValue]
+ this.mappingEditorService.selectedObj({
+ action: newObj.action,
+ vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
+ //vnfc: newObj['vnfcIdentifier'] ? newObj['vnfcIdentifier'] : "",
+ protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
+ templateId: this.templateIdentifier,
+ param_artifact: paramValue['param_artifact'],
+ pd_artifact: pdTemplate['pd_artifact'],
+ template_artifact: configTemplate['template_artifact']
+ });
+ }
+ else {
+ let extension = this.referenceDataFormUtil.decideExtension(newObj);
+ let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.yaml';
+ let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V' + extension;
+ let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
+ let arr = [configTemplate, pdTemplate, paramValue]
+ this.mappingEditorService.selectedObj({
+ action: newObj.action,
+ vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
+ protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
+ param_artifact: paramValue['param_artifact'],
+ pd_artifact: pdTemplate['pd_artifact'],
+ template_artifact: configTemplate['template_artifact']
+ });
+ }
+
let actionObjIndex = this.tempAllData.findIndex(obj => {
return obj['action'] == action;
});
- if (newObj.action != 'HealthCheck') {
- delete newObj['url'];
- }
-
if (actionObjIndex > -1) {
this.tempAllData[actionObjIndex] = newObj;
this.mappingEditorService.saveLatestAction(this.tempAllData[actionObjIndex]);
}
} else {
if (newObj.action != '') {
+
this.tempAllData.push(newObj);
this.mappingEditorService.saveLatestAction(newObj);
+
if (newObj.action == "ConfigScaleOut") {
this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier);
}
}
}
}
-
}
-
// removes the unwanted keys added in the artifact for vnfc level actions
deleteUnwantedKeys(newObj) {
- console.log(this.classNm + ": deleteUnwantedKeys: start.");
newObj = JSON.parse(JSON.stringify(newObj))
delete newObj['template-id']
delete newObj['vnfcIdentifier']
if (newObj.action != 'HealthCheck') {
delete newObj['url'];
}
- if (newObj.action != "Configure" && newObj.action != "ConfigModify" && newObj.action != "DistributeTraffic") {
+ if (newObj.action != "Configure" && newObj.action != "ConfigModify" && newObj.action == "DistributeTraffic") {
newObj.scope['vnfc-type-list'] = [];
}
return newObj
}
addAllActionObj(newObj, scopeName) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": addAllActionObj: start.");
+
//Creating all action block to allow mulitple actions at once
let allAction = {
action: 'AllAction',
'action-level': 'vnf',
scope: newObj.scope,
- 'artifact-list': [{
- 'artifact-name': 'reference_AllAction' + '_' + scopeName + '_' + '0.0.1V.json',
- 'artifact-type': 'reference_template'
- }]
+ 'artifact-list': []
};
+ let vnfType = this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
+
+ allAction['artifact-list'].push({
+ 'artifact-name': 'reference_AllAction' + '_' + vnfType + '_' + '0.0.1V.json',
+ 'artifact-type': 'reference_template'
+ })
+
let allActionIndex = this.tempAllData.findIndex(obj => {
return obj['action'] == 'AllAction';
});
}
resetTempData() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": resetTempData: start.");
- if (this.uploadedDataArray && this.uploadedDataArray != undefined && this.uploadedDataArray.length != 0) {
- if (this.tempAllData && this.tempAllData != undefined) {
+ let methName= "resetTempData";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start.");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
+ if (this.utilityService.checkNotNull(this.uploadedDataArray)) {
+
+ if (this.utilityService.checkNotNull(this.tempAllData)) {
for (var i = 0; i < this.tempAllData.length; i++) {
var result = false;
+
if (this.tempAllData[i].action === 'AllAction') {
result = true;
}
}
trackByFn(index, item) {
- return index;
+ return index; // or item.id
}
-
getArtifactsOpenStack() {
- console.log(this.classNm + ": getArtifactsOpenStack: start: " +
- "tempAllData length=" + this.tempAllData.length);
var array = []
var vnfcFunctionCodeArrayList = [];
var vnfcSetArray = [];
+ // var vnfcSet = new Set();
for (var i = 0; i < this.tempAllData.length; i++) {
if (!this.checkIfelementExistsInArray(this.tempAllData[i].action, this.actions) && (this.tempAllData[i].action != 'AllAction')) {
var vnfcFunctionCodeArray = this.tempAllData[i]["vnfc-function-code-list"]
+ // vnfcSet.add("Actions")
+ /* for (var j = 0; j < vnfcFunctionCodeArray.length; j++) {
+ vnfcSet.add(vnfcFunctionCodeArray[j])
+ }*/
vnfcFunctionCodeArrayList.push([this.tempAllData[i].action].concat(this.tempAllData[i]["vnfc-function-code-list"]))
}
if (this.tempAllData[i].action === 'OpenStack Actions') {
vnfcSetArray = this.tempAllData[i]['firstRowVmSpreadSheet']
}
}
- console.log(this.classNm + ": getArtifactsOpenStack: vnfcSetArray length=" +
- vnfcSetArray.length);
+
if (vnfcSetArray) {
let vnfcSetArrayLen = vnfcSetArray.length;
}
}
- /**
- * Handles the display of VM block based on the action change
- */
- handleVMBlockDisplay() {
- switch (this.referenceDataObject.action) {
- case this.actionList.ConfigScaleOut:
- case this.actionList.Configure:
- case undefined:
- case '':
- this.displayVMBlock = true;
- break;
- default:
- this.displayVMBlock = false;
- }
- }
-
- //.. check VNFC Type equality in Upper Selection vs entered in Sample field
- checkVnfcTypeEqual(vnfctp: string) {
- var methName = "checkVnfcTypeEqual";
- console.log(this.classNm + ": " + methName + ": vnfctp:[" + vnfctp + "]");
- console.log(this.classNm + ": " + methName + ": vnfcIdentifier:[" +
- this.vnfcIdentifier + "]");
- console.log(this.classNm + ": " + methName + ": Sample[vnfc-type]:[" +
- this.Sample['vnfc-type'] + "]");
- if (vnfctp != null && vnfctp.length > 0) {
- if (this.vnfcIdentifier != null && this.vnfcIdentifier.length > 0) {
- console.log(
- this.classNm + ": " + methName + ": compare non empty VNFC Types...");
- if (vnfctp != this.vnfcIdentifier) {
- console.log(this.classNm + ": " + methName + ": Non-match WARNING !");
- //.. display in pop-up
- this.nService.warn('WARNING',
- "The specified VNFC Types don't match." +
- " Can cause discrepancy in the artifacts.", this.options);
- } else {
- console.log(this.classNm + ": checkVnfcTypeEqual: VNFC Types're equal.");
- };
- };
- };
- };
-
- //.. populating VNFC Type in Sample fields
- setVnfcTypeInSample(vnfctp: string) {
- // if( this.utilityService.getTracelvl() > 0 )
- console.log(this.classNm + ": setVnfcTypeInSample: vnfctp:[" + vnfctp + "]");
- this.Sample['vnfc-type'] = vnfctp;
- };
-
// Common method to show validation errors
private showValidationErrors(referenceDataObject) {
if (this.referenceDataObject.action === '') {
if (referenceDataObject.action === 'ConfigScaleOut' && !this.templateIdentifier) {
this.nService.error('Error', 'Select a valid Template Identifier');
}
+
+ // if ((referenceDataObject.action === 'Configure' || referenceDataObject.action === 'ConfigModify') && !this.vnfcIdentifier && this.displayVnfc != 'false') {
+ // this.nService.error('Error', 'Select a valid Vnfc Type');
+ // return;
+ // }
}
resetArtifactList(obj) {
- console.log(this.classNm + ": resetArtifactList: start...");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": resetArtifactList: start...");
let vnfcTypeList = obj.scope['vnfc-type-list'];
let vnf = this.referenceDataObject.scope['vnf-type']
let pd_fileName
);
}
}
+
+ /**
+ * Handles the display of VM block based on the action change
+ */
+ handleVMBlockDisplay() {
+ switch (this.referenceDataObject.action) {
+ case this.actionList.ConfigScaleOut:
+ case this.actionList.Configure:
+ case undefined:
+ case '':
+ this.displayVMBlock = true;
+ break;
+ default:
+ this.displayVMBlock = false;
+ }
+ }
+
+ //.. check VNFC Type equality in Upper Selection vs entered in Sample field
+ checkVnfcTypeEqual( vnfctp: string ) {
+ var methName= "checkVnfcTypeEqual";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": "+methName+": vnfctp:["+vnfctp+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": vnfcIdentifier:["+
+ this.vnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": "+methName+": Sample[vnfc-type]:["+
+ this.Sample['vnfc-type']+"]");
+ if( vnfctp != null && vnfctp.length > 0 ) {
+ if( this.vnfcIdentifier != null && this.vnfcIdentifier.length > 0 ) {
+ console.log(
+ this.classNm+": "+methName+": compare non empty VNFC Types...");
+ if( vnfctp != this.vnfcIdentifier ) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": Non-match WARNING !");
+ //.. display in pop-up
+ this.nService.warn( 'WARNING',
+ "The specified VNFC Types don't match."+
+ " Can cause discrepancy in the artifacts.", this.options );
+ } else {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": checkVnfcTypeEqual: VNFC Types're equal.");
+ };
+ };
+ };
+ };
+
+ //.. populating VNFC Type in Sample fields
+ setVnfcTypeInSample( vnfctp: string ) {
+ //clear vnfc information samples
+ this.clearVnfcData();
+
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": setVnfcTypeInSample: vnfctp:["+vnfctp+"]");
+ this.Sample['vnfc-type']= vnfctp;
+ };
+
+ /**
+ * Procesess reference data after retrieval from appc or after a reference file has been uploaded from PC.
+ */
+ processReferenceDataAfterRetrieval() {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": processReferenceDataAfterRetr: start...");
+ if (this.referenceDataObject.action === 'OpenStack Actions') {
+ this.deviceProtocols = ['', 'OpenStack'];
+ this.buildDesignComponent.tabs = this.referencDataTab;
+ } else {
+ this.buildDesignComponent.tabs = this.allTabs;
+ }
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": processReferenceDataAfterRetr: done.");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": vnfcIdentifier:["+this.vnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": oldVnfcIdentifier:["+
+ this.oldVnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": refDataObj.scope.vnfc-type:["+
+ this.referenceDataObject.scope['vnfc-type']+"]");
+ this.setVnfcTypeInSample( this.vnfcIdentifier );
+ }
+
}
import {UtilityService} from '../../../shared/services/utilityService/utility.service';
import { environment } from '../../../../environments/environment';
import { HttpUtilService } from '../../../shared/services/httpUtil/http-util.service';
-//import {APIService} from "../../../shared/services/cdt.apicall";
+import {APIService} from "../../../shared/services/cdt.apicall";
@Injectable()
export class ReferenceDataFormUtil {
private failureMessage = 'There is no artifact saved in APPC for the selected action!';
private response: Observable<Object>;
- constructor(
- private notificationService: NotificationsService, private utilityService:UtilityService, private httpUtils: HttpUtilService
- ) {
+ constructor(private notificationService: NotificationsService, private utilityService:UtilityService, private apiService: APIService) {
}
checkResult(result: any) {
return paramValue;
}
- handleApiData(payloadData,artifactType)
+ handleApiData(data,artifactType)
{
- this.response =
- this.httpUtils.post({
- url: environment.getDesigns,
- data: payloadData });
- this.response.subscribe( response => {
+ this.response = this.apiService.callGetArtifactsApi(data);
+ this.response.subscribe(response => {
this.utilityService.processApiSubscribe(response, this.utilityService.putAction, artifactType)
},
error => this.utilityService.processApiError());
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
-->
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Vnf Type</label><input class="form-control" type="text" disabled value="{{vnfType}}" />
</div>
- <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="
-vnfcType"
->
- <label>Vnfc Type</label><input class="form-control" type="text" disabled value="{{vnfcType}}" />
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="vnfcType">
+ <label>Vnfc Type</label> <label style="font-size:12px;">(NFC Function)</label>
+ <input class="form-control" type="text" disabled value="{{vnfcType}}" />
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="!vnfcType">
-
+
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Protocol</label><input class="form-control" type="text" disabled value="{{protocol}}" />
</div>
</div>
<hr>
-
+ <!--Commenting out 1712 changes here-->
+ <!--<div class="col-md-12" [hidden]="!showMappingDownloadDiv"><label>Download Name/Value pair as : </label>
+ <select class="form-control col-md-3" [(ngModel)]="mapppingDownloadType" (ngModelChange)="onDownloadParameter()">
+ <option value="">Select</option>
+ <option value="Json">JSON</option>
+ <option value="Xls">XLS</option>
+ </select>
+</div>-->
+
<div class="col-md-12"></div>
<div><label for="textAreaGeneratedTemplate">
<div class="mdl-card__title-text">Param Name Value List</div>
<div><font size="1">(Please click anywhere on the editor to see the synced name value pairs)</font></div>
</label>
+ <!-- <ace-editor [(text)]="this.artifactRequest.paramsContent" [theme]="'chrome'" [mode]="'velocity'" (textChanged)="onParamChanges($event)" [options]="{maxLines: 'Infinity', fontSize: '13pt'}"
+ style="min-height: 500px; width: fit-content;"></ace-editor> -->
<ace-editor [(text)]="this.artifactRequest.paramsContent" #templateeditor [theme]="'chrome'" [mode]="'velocity'" (textChanged)="onParamChanges($event)" [options]="{maxLines: '100', fontSize: '13pt' }" style="min-height: 200px; width: 100%"></ace-editor>
</div>
</tab>
-</tabs>
+</tabs>
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
import * as XLSX from 'xlsx';
import { NgxSpinnerService } from 'ngx-spinner';
import {UtilityService} from '../../../../shared/services/utilityService/utility.service';
+import { APIService } from "../../../../shared/services/cdt.apicall";
declare var $: any;
@ViewChild('myInputParam') myInputParam: any;
@ViewChild(ModalComponent) modalComponent: ModalComponent;
@ContentChildren(Tab) tabs: QueryList<Tab>;
- public subscription: Subscription;
+ public subscription: any;
public item: any = {};
vnfType: any = '';
vnfcType: any = '';
protocol: any = '';
refObj: any;
- public paramsContent = localStorage['paramsContent'];
- nameValueSubscription: Subscription;
+ public paramsContent:any;
constructor(
private buildDesignComponent: BuildDesignComponent,
private nService: NotificationsService,
private ngProgress: NgProgress,
private spinner: NgxSpinnerService,
- private utilityService: UtilityService,
+ private apiService:APIService,
+ private utilityService: UtilityService
+
) {
this.artifactRequest.action = '';
this.artifactRequest.version = '';
ngOnInit() {
var refObj = this.refObj = this.prepareFileName();
if (refObj && refObj != undefined) {
+ try{
+ this.paramsContent=JSON.stringify(JSON.parse(localStorage['paramsContent']))
+ }
+ catch(e)
+ {
+ console.log("error parsing param values");
+ }
if (this.paramsContent && this.paramsContent != undefined && this.paramsContent !== '{}') {
this.artifactRequest.paramsContent = this.formatNameValuePairs(this.paramsContent);
- // this.artifactRequest.paramsContent = this.paramsContent;
-
+
}
else {
this.artifactRequest.paramsContent = '{}';
}
- // refObj = refObj[refObj.length - 1];
this.item = refObj;
- this.vnfType = this.item.scope['vnf-type'];
- this.vnfcType = this.item.scope['vnfc-type'];
- this.protocol = this.item['device-protocol'];
+ this.vnfType = this.item.vnf;
+ this.vnfcType = this.item.vnfc;
+ this.protocol = this.item.protocol;
this.action = this.item.action;
var artifactList = this.item['artifact-list'];
- for (var i = 0; i < artifactList.length; i++) {
- var artifactName = artifactList[i]['artifact-name'];
- var array = artifactName.split('_');
- if (array[0].toUpperCase() === 'TEMPLATE') {
- this.artifactName = artifactName;
- }
- }
}
else {
this.item = {
'scopeType': ''
};
}
- this.initialAction = this.item.action;
- this.subscription = this.activeRoutes.url.subscribe(UrlSegment => {
- this.actionType = UrlSegment[0].path;
- });
-
- if (this.actionType === 'myTemplates') {
- this.mappingEditorService.fromScreen = 'MappingScreen';
- }
this.mappingEditorService.paramData = [];
this.identifier = this.mappingEditorService.identifier;
-
}
//========================== End of ngOnInit() Method============================================
}
//========================== End of browseOption() Method============================================
-
ngOnDestroy() {
this.prepareFileName();
if( this.subscription ) { this.subscription.unsubscribe(); }
- if( this.nameValueSubscription ) { this.nameValueSubscription.unsubscribe(); }
+ // if( this.nameValueSubscription ) { this.nameValueSubscription.unsubscribe(); }
}
//========================== End of ngOnDestroy() Method============================================
ngAfterViewInit() {
- if (this.mappingEditorService.fromScreen === 'MappingScreen') {
- this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
- this.fileType = sessionStorage.getItem('fileType');
- if (this.configMappingEditorContent)
- this.mappingEditorService.initialise(this.mappingComponent.templateeditor.getEditor(), this.configMappingEditorContent, this.modal);
- }
+ this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
+ this.fileType = sessionStorage.getItem('fileType');
+ if (this.configMappingEditorContent)
+ this.mappingEditorService.initialise(this.mappingComponent.templateeditor.getEditor(), this.configMappingEditorContent);
+
if (this.refObj) {
-
- this.artifactRequest.action = this.item.action;
- this.artifactRequest.vnfType = this.vnfType;
if (this.vnfcType && this.vnfcType.length != 0) {
this.scopeName = this.vnfcType;
}
// Create the file reader
let reader = new FileReader();
this.readFile(input.files[0], reader, (result) => {
- if ('Mapping Data' === this.selectedUploadType) {
- var jsonObject = JSON.parse(result);
- this.artifactRequest.paramsContent = JSON.stringify(jsonObject, null, 1);
- this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
- this.mappingEditorService.setParamContent(this.artifactRequest.paramsContent);
- localStorage['paramsContent'] = this.artifactRequest.paramsContent;
- }
+ var jsonObject = JSON.parse(result);
+ this.artifactRequest.paramsContent = JSON.stringify(jsonObject, null, 1);
+ this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
+ this.mappingEditorService.setParamContent(this.artifactRequest.paramsContent);
+ localStorage['paramsContent'] = this.artifactRequest.paramsContent;
this.enableMerge = true;
this.initialData = result;
setTimeout(() => {
// callback with the results
callback(reader.result);
};
- this.notificationService.notifySuccessMessage('Uploading File ' + file.name + ':' + file.type + ':' + file.size);
// Read the file
reader.readAsText(file, 'UTF-8');
}
}
//========================== End of onParamChanges() Method============================================
-
- updateFileName(action: any, scopeName: any, versionNo: any) {
- let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V.json';
- this.downloadedFileName = fileName;
- return fileName;
- }
-
- //========================== End of updateFileName() Method============================================
- updateFileNameForConfigScaleOut(action: any, scopeName: any, versionNo: any, id: any) {
- let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V_' + id + '.json';
- this.downloadedFileName = fileName;
- return fileName;
- }
- //========================== End of updateFileNameForConfigScaleOut() Method============================================
prepareFileName(): any {
- let fileNameObject: any = this.mappingEditorService.latestAction;
+ let fileNameObject: any = this.mappingEditorService.newObject;
return fileNameObject;
}
//========================== End of prepareFileName() Method============================================
-
retrieveNameValueFromAppc() {
let refObj = this.refObj;
if (refObj && refObj != undefined) {
this.enableMerge = true;
var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
let fileName = '';
- let id = this.mappingEditorService.identifier;
- if (id) fileName = this.updateFileNameForConfigScaleOut(this.item.action, scopeName, this.versionNo, id);
- else fileName = this.updateFileName(this.item.action, scopeName, this.versionNo);
-
+ fileName=refObj["param_artifact"]
let input=this.utilityService.createPayloadForRetrieve(false, this.item.action, this.vnfType, fileName);
let artifactContent: any;
this.ngProgress.start();
- this.nameValueSubscription = this.httpUtil.post({
- url: environment.getDesigns,
- data: input
- }).subscribe(resp => {
+ this.apiService.callGetArtifactsApi(input).subscribe(resp => {
if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
this.nService.success('Success', 'Name/value pairs retrieved successfully from APPC');
this.enableMerge = true;
}
//========================== End of retrieveNameValueFromAppc() Method============================================
-
formatNameValuePairs(namevaluePairs: string) {
var string = namevaluePairs.substring(1, namevaluePairs.length - 1);
var stringArr = string.split(',');
'ruleTypeValues': arr2item.ruleTypeValues
};
pdDataArrayForSession.splice(i, 1, json);
-
+
}
});
}
}
catch (error) {
- console.log('Error occured in syncing param names' + JSON.stringify(error));
this.nService.error('Error', 'Error synchronising with name values. Please check the format of json uploaded/ retrieved');
}
}
-}
+}
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
.options-menu {
padding: 3px 20px;
+}
+.ace_cursor{
+ background-color: greenyellow;
+
+}
+.ace-monokai{
+ color: greenyellow;
+
+}
+.ace_scroller{
+ color: white;
+ background-color: wheat;
}
\ No newline at end of file
<label>Vnf Type</label><input class="form-control" type="text" disabled value="{{vnfType}}" />
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="vnfcType">
- <label>Vnfc Type</label><input class="form-control" type="text" disabled value="{{vnfcType}}" />
+ <label>Vnfc Type</label> <label style="font-size:12px;">(NFC Function)</label>
+ <input class="form-control" type="text" disabled value="{{vnfcType}}" />
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="!vnfcType">
-
+
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Protocol</label><input class="form-control" type="text" disabled value="{{protocol}}" />
</div>
<div *ngIf="(action === 'ConfigScaleOut')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Template Identifier</label><input class="form-control" type="text" [(ngModel)]="identifier" disabled />
-
</div>
</div>
</div>
<div class="input-group">
<input id="inputFile" class="file" #myInput type='file' (change)='fileChange(myInput)'>
<input [(ngModel)]="fileName" type="text" class="input-lg" disabled placeholder="Upload template from PC" style="width:80%">
- <button (click)="browseOption($event)" [disabled]="!enableBrowse" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" type="button">Upload Template File
+ <button (click)="browseOption($event)" [disabled]="!enableBrowse" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg"
+ type="button">Upload Template File
</button>
</div>
</div>
<br>
<div class="row" style="margin-bottom: 20px;">
<div class="col-md-12 text-right">
- <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="syncTemplate()">Synchronize Template Parameters
+ <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="syncTemplate(0)">Synchronize Template Parameters
</button>
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="mergeParams()"> Merge from Param
</button>
<div><label for="textAreaGeneratedTemplate">
<div class="mdl-card__title-text">File Editor</div>
</label>
- <ace-editor [(text)]="configMappingEditorContent" #templateeditor [theme]="'chrome'" [mode]="'velocity'" [options]="{maxLines: '100', fontSize: '13pt' }" style="min-height: 200px; width: 100%; caret-color: white "></ace-editor>
+ <!-- <ace-editor [(text)]="configMappingEditorContent" #templateeditor [theme]="'chrome'" [mode]="'velocity'" [options]="{maxLines: 'Infinity', fontSize: '13pt'}"
+ style="min-height: 500px; width: fit-content;scroll-snap-coordinate: 3%"></ace-editor> -->
+ <ace-editor [(text)]="configMappingEditorContent" #templateeditor [theme]="'chrome'" [mode]="'velocity'" [options]="{maxLines: '100', fontSize: '13pt' }"
+ style="min-height: 200px; width: 100%; caret-color: white "></ace-editor>
</div>
- <app-modal [title]="'Confirmation'" [isShow]="false" [message]="'Template is saved and ready for creating parameter definition'" #modalComponent>
- </app-modal>
+
<modal #myModal>
- <modal-header style="height:65px">
- <h4 class="modal-title" style="position:absolute;">Enter Name for <b>"{{selectedWord}}"</b></h4>
- <button type="button" class="close" aria-label="Close" (click)="modal.close()" style="margin-left:auto">
- <span aria-hidden="true">×</span>
- </button>
-
+ <modal-header [show-close]="true">
+ <h4 class="modal-title">Enter Name for <b>"{{selectedWord}}"</b></h4>
</modal-header>
<modal-body>
<div class="form-group row">
<div class="col-12">
<input class="form-control" [(ngModel)]="tempName" name="templateName" type="text" id="tempName">
<span class="error-message" [hidden]="checkNameEntered" style="color: red;">Required Field</span>
+ <span class="error-message" [hidden]="checkSpace" style="color: red;">Name can't start or end with space(s)</span>
</div>
</div>
</modal-body>
<modal-footer [show-default-buttons]="false">
+ <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent
+
+ " (click)="modal.close();checkNameEntered=true;checkSpace=true;tempName=''">Cancel</button>
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="submitNameValues()">Submit
</button>
- <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent
-
- " (click)="modal.close()">Cancel</button>
+
</modal-footer>
</modal>
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
-Copyright (C) 2018 IBM.
-===================================================================
Unless otherwise specified, all software contained herein is licensed
under the Apache License, Version 2.0 (the License);
*/
import { Component, Input, OnInit, ViewChild } from '@angular/core';
-import { Subscription } from 'rxjs/Subscription';
import { HttpUtilService } from '../../../../shared/services/httpUtil/http-util.service';
import { MappingEditorService } from '../../../../shared/services/mapping-editor.service';
import { ArtifactRequest } from '../../../../shared/models/index';
import { environment } from '../../../../../environments/environment';
import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal';
import { NgProgress } from 'ngx-progressbar';
-import { NgxSpinnerService } from 'ngx-spinner';
import { UtilityService } from '../../../../shared/services/utilityService/utility.service';
+import { APIService } from "../../../../shared/services/cdt.apicall";
+import { ProcOnSrvSideSvc } from "../../../../shared/services/procOnSrvSide.service";
declare var $: any
-const PARAM_DATA:string="param_data";
-const TEMPLATE_DATA:string="template_data";
+
@Component({ selector: 'app-golden-configuration', templateUrl: './template-configuration.component.html', styleUrls: ['./template-configuration.component.css'] })
export class GoldenConfigurationComponent implements OnInit {
- clName= "TemplateConfigCompon";
+ clName= "TemplateConfComp";
@ViewChild('templateeditor') templateeditor;
@Input() configMappingEditorContent: string;
@Input() isMappingComp: boolean;
@ViewChild('myInput') myInputVariable: any;
+ // @ViewChild(ModalComponent) modalComponent: ModalComponent;
@ViewChild('myModal') modal: ModalComponent;
aceText: string = ""
fileName: string = ""
showTemplateVersionDiv: any;
downloadedTemplateFileName: any;
downloadedParamFileName: any;
- templateVersionNo: any = '0.0.1';
+ templateVersionNo: any = require('../../../../../cdt.application.properties.json').versionNoForApiCall;
saveToGuiCacheFlag = 'false';
initialAction: any;
public referenceData: Array<Object> = [];
public scopeName: any;
- public subscription: Subscription;
- public templateSubscription : Subscription;
+ public subscription: any;
public item: any = {};
public goldenActions: Array<string> = [];
public refNameObj = {};
enableBrowse: boolean = true;
enableMerge: boolean = false;
uploadValidationSuccess: boolean = false;
- fileExtension: any = "xml";
apiToken = localStorage['apiToken'];
public appDataObject: any;
public downloadDataObject: any;
{ action: "StartApplication", value: "StartApplication" },
{ action: "StopApplication", value: "StopApplication" },
{ action: "DistributeTraffic", value: "DistributeTraffic" }
+
];
options = {
- timeOut: 1000,
+ timeOut: 4500,
showProgressBar: true,
pauseOnHover: true,
clickToClose: true,
}
public replaceWord;
public enableDownloadButtons: boolean = false;
-
+
constructor(
- private buildDesignComponent: BuildDesignComponent,
- private paramShareService: ParamShareService,
- private dialogService: DialogService,
- private notificationService: NotificationService,
- private httpUtil: HttpUtilService,
- private mappingEditorService: MappingEditorService,
- private activeRoutes: ActivatedRoute,
- private router: Router,
- private nService: NotificationsService,
- private ngProgress: NgProgress,
- private spinner: NgxSpinnerService,
- private utilityService: UtilityService) {
+ private buildDesignComponent: BuildDesignComponent,
+ private apiService: APIService,
+ private utilityService: UtilityService,
+ private paramShareService: ParamShareService,
+ private dialogService: DialogService,
+ private notificationService: NotificationService,
+ private httpUtil: HttpUtilService,
+ private mappingEditorService: MappingEditorService,
+ private activeRoutes: ActivatedRoute,
+ private router: Router,
+ private nService: NotificationsService,
+ private procOnSrvSideSvc: ProcOnSrvSideSvc,
+ private ngProgress: NgProgress)
+ {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": new: start.");
this.artifactRequest.action = '';
this.artifactRequest.version = '';
this.artifactRequest.paramsContent = '{}';
this.artifactRequest.paramKeysContent = '';
}
+
public templateEditor: any;
public fileType: any = '';
public actionType: any;
editor: any;
editorContent: any;
tempName: any;
+ paramArtifactName: any;
enableValidateTemplate: boolean = false;;
public selectedUploadType: string = this.uploadTypes[0].value;
- identifier: any;
+ checkSpace: boolean = true;
+
public tempRetrievalResponse: any;
public mergeStatus: boolean = false;
-
- //======================================Start of ngOnInit() Method============================================
+ //====================================================
ngOnInit() {
var methName= "ngOnInit";
if( this.utilityService.getTracelvl() > 0 )
console.log( this.clName+": "+methName+": start.");
var refObj = this.refObj = this.prepareFileName();
- if( this.utilityService.getTracelvl() > 0 )
- console.log( this.clName+": "+methName+
- ": refObj:["+JSON.stringify(refObj)+"]");
+ // console.log("Ref object: " + JSON.stringify(refObj))
if (refObj && refObj != undefined) {
this.item = refObj;
- this.vnfType = this.item.scope["vnf-type"];
- this.vnfcType = this.item.scope["vnfc-type"];
- this.protocol = this.item['device-protocol'];
+ this.vnfType = this.item.vnf;
+ this.vnfcType = this.item.vnfc;
+ this.protocol = this.item.protocol;
this.action = this.item.action;
if( this.utilityService.getTracelvl() > 0 )
console.log( this.clName+": "+methName+": vnfType:["+this.vnfType+
"] vnfcType:["+this.vnfcType+"] protocol:["+this.protocol+"] action:["+
this.action+"]");
+ this.artifactName = this.item["template_artifact"]
+ this.paramArtifactName = this.item["param_artifact"]
this.artifactRequest.action = this.item.action;
this.artifactRequest.vnfType = this.vnfType;
if (this.vnfcType != undefined && this.vnfcType.length != 0) {
}
}
else {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": refObj is not defined.");
this.item = { "action": "", "scope": { "vnf-type": "", "vnfc-type": "" }, "vm": [], "protocol": "", "download-dg-reference": "", "user-name": "", "port-number": "", "artifact-list": [], "deviceTemplate": "", "scopeType": "" };
}
this.initialAction = this.item.action;
- this.subscription = this.activeRoutes.url.subscribe(UrlSegment => {
+ this.activeRoutes.url.subscribe(UrlSegment => {
this.actionType = UrlSegment[0].path
})
this.mappingEditorService.fromScreen = 'MappingScreen';
- this.identifier = this.mappingEditorService.identifier;
+
}
//========================== End of ngOnInit() Method============================================
ngOnDestroy() {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": ngOnDestroy: start.");
if (this.refObj && this.refObj != undefined) {
if (this.configMappingEditorContent && this.configMappingEditorContent != undefined) {
this.saveTemplate();
this.mappingEditorService.changeNavDownloadData(this.downloadDataObject);
}
}
-
- if(this.subscription) { this.subscription.unsubscribe(); }
- if(this.templateSubscription) { this.templateSubscription.unsubscribe(); }
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": ngOnDestroy: finish.");
}
//========================== End of ngOnDestroy() Method============================================
ngAfterViewInit() {
+ var methName= "ngAfterViewInit";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": start.");
if (this.mappingEditorService.latestAction) {
this.refNameObj = this.mappingEditorService.latestAction;
if (this.vnfcType !== 'null') {
else {
this.type = this.vnfType;
}
- for (let i = 0; i < this.refNameObj['artifact-list'].length; i++) {
- let artifactList = this.refNameObj['artifact-list'];
- if (artifactList[i]['artifact-type'] === 'config_template') {
- var artifactName = artifactList[i]['artifact-name'];
- var artifactNameWithoutExtension = '';
- if (artifactName) {
- artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."));
- }
- if(this.mappingEditorService.identifier) {
- if(artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) {
- this.artifactName = artifactName;
- }
- }
- else {
- this.artifactName = artifactName;
- }
-
- }
- }
}
let self = this;
this.templateEditor = self.templateeditor.getEditor();
+ this.templateeditor.getEditor().commands.addCommand({
+ name: 'annotateCommand',
+ bindKey: { win: 'ctrl-z', mac: 'Command-z' },
+ exec: (editor: any) => {
+ this.handleUndo(this.modal);
+ }
+ });
this.templateeditor.getEditor().commands.addCommand({
name: 'annotateCommandAlternate',
bindKey: { win: 'CTRL-4', mac: 'Command-4' },
exec: (editor: any) => {
+ this.checkNameEntered = true;
+ this.checkSpace = true;
this.handleAnnotation(this.modal);
}
});
- this.templateeditor.getEditor().$enableBlockSelect = false;
- this.templateeditor.getEditor().$enableMultiselect = false;
if (this.mappingEditorService.fromScreen === 'MappingScreen') {
this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
this.fileType = sessionStorage.getItem('fileType');
}
if (this.configMappingEditorContent) {
this.artifactRequest.templateContent = this.configMappingEditorContent;
- this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
+ this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent);
}
if (this.refObj) {
- if (this.mappingEditorService.getTemplateMappingDataFromStore() && this.mappingEditorService.getTemplateMappingDataFromStore() != undefined) {
+ if (this.mappingEditorService.getTemplateMappingDataFromStore() &&
+ this.mappingEditorService.getTemplateMappingDataFromStore() != undefined) {
this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
}
else {
else {
this.Actions = [];
this.enableBrowse = false;
- this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
+ this.nService.error("Error",
+ "Please enter Action and VNF type in Reference Data screen", this.options);
}
}
$("#inputFile").trigger('click');
}
//========================== End of browseOption() Method============================================
- //save to GUI
public saveTemplate() {
- this.saveToGuiCacheFlag = 'true';
+ var methName= "saveTemplate";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": start.");
this.mappingEditorService.paramData = [];
if (this.configMappingEditorContent) {
- this.initialData = this.configMappingEditorContent;
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": do refreshEditor ...");
this.mappingEditorService.refreshEditor();
let paramArr: any = []
if (this.mappingEditorService.paramData && this.mappingEditorService.paramData != undefined) {
if (this.mappingEditorService.paramData.length === 0 && this.mappingEditorService.hasErrorCode === true) {
- this.nService.error("Error", 'Special characters error', 'Error')
+ this.nService.error("Error", 'Special characters error', this.options);
return;
}
else {
this.showError = false;
}
}
- this.showTemplateVersionDiv = true;
-
- if (this.mappingEditorService.fromScreen === 'MappingScreen') {
- this.mappingEditorService.setTemplateMappingDataFromStore(this.configMappingEditorContent);
- }
- if (this.fileType === 'text/xml') {
- sessionStorage.setItem('fileType', 'text/xml');
- }
- if (this.fileType === '') {
- sessionStorage.setItem('fileType', '');
- }
+ this.mappingEditorService.setTemplateMappingDataFromStore(this.configMappingEditorContent);
}
}
//========================== End of saveTemplate() Method============================================
retrieveTemplateFromAppc() {
+ var methName= "retrieveTemplateFromAppc";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": start ...");
let refObj = this.refObj;
if (refObj && refObj != undefined) {
-
let fileName = this.artifactName;
let input = this.utilityService.createPayloadForRetrieve(false, this.item.action, this.vnfType, fileName);
+ // console.log("Retrieve artifact payload=="+ payload);
let artifactContent: any;
this.ngProgress.start();
- this.templateSubscription = this.httpUtil.post({
- url: environment.getDesigns,
- data: input
- }).subscribe(resp => {
+ this.apiService.callGetArtifactsApi(input).subscribe(resp => {
if (resp.output.status.code === '400' && resp.output.status.message === "success") {
- this.nService.success("Success", "Template retrieved successfully from APPC");
+ this.nService.success("Success","Template retrieved successfully from APPC", this.options);
this.tempRetrievalResponse = resp;
let result = JSON.parse(resp.output.data.block).artifactInfo[0];
result = result['artifact-content'];
- if ('Generated Template' === this.selectedUploadType) {
- this.configMappingEditorContent = result
- this.artifactRequest.templateContent = this.configMappingEditorContent;
- this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
- if (this.artifactRequest.templateContent) {
- this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
- }
- }
+ this.configMappingEditorContent = result
+ this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent);
this.tempretrieveFlag = true;
this.fileNameForTempSave = fileName;
- this.enableDownloadButtons = true;
- this.initialData = result;
this.saveTemplate();
}
else {
- this.nService.info("Information", "There is no template saved in APPC for the selected action!");
+ this.nService.info("Information","There is no template saved in APPC for the selected action!", this.options);
}
this.ngProgress.done();
},
- error => this.nService.error("Error", "Error in connecting to APPC Server"));
+ error => this.nService.error("Error", "Error in connecting to APPC Server", this.options));
setTimeout(() => {
this.ngProgress.done();
}, 3500);
}
//========================== End of retrieveTemplateFromAppc() Method============================================
prepareAppData() {
+ var methName= "prepareAppData";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": start.");
let refObj = this.refObj;
if (refObj && refObj != undefined) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": parse locStor.paramsContent");
let paramsKeyValueFromEditor: JSON;
try {
paramsKeyValueFromEditor = JSON.parse(localStorage["paramsContent"]);
}
catch (error) {
- console.log("Could not parse name value pairs==" + error);
+ console.log(methName+": Could not parse name value pairs:" + error);
}
if (paramsKeyValueFromEditor) {
- this.showTemplateVersionDiv = true;
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+
+ ": have paramsKeyValueFromEditor");
let action = this.item.action;
- var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
+ var scopeName =
+ this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
var fileName = '';
- let id = this.mappingEditorService.identifier;
- if (id) fileName = this.updateFileNameForConfigScaleOut(this.item.action, scopeName, this.templateVersionNo, id);
- else fileName = this.updateParamFileName(this.item.action, scopeName, this.templateVersionNo);
-
- let vnfType = this.vnfType;
+ fileName = this.paramArtifactName;
let Json = [paramsKeyValueFromEditor];
let slashedPayload = this.appendSlashes(JSON.stringify(Json));
- let data = this.utilityService.createPayLoadForSave(PARAM_DATA, this.vnfType, action, fileName, this.templateVersionNo, slashedPayload);
+ let data =
+ this.utilityService.createPayLoadForSave("param_data", this.vnfType, action, fileName, this.templateVersionNo, slashedPayload);
this.appDataObject.template.nameValueData = data;
}
if (this.configMappingEditorContent) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+
+ ": have configMappingEditorContent");
let actualContent = this.configMappingEditorContent;
this.mappingEditorService.generateTemplate(this.templateEditor);
- this.showTemplateVersionDiv = true;
let action = this.item.action;
let versionandFileType: any;
if (this.fileType === "text/xml") {
-
versionandFileType = this.templateVersionNo + 'V.xml'
} else {
-
versionandFileType = this.templateVersionNo + 'V.json'
}
let fileName: any;
fileName = this.artifactName;
}
let vnfType = this.vnfType;
- let data = this.utilityService.createPayLoadForSave(TEMPLATE_DATA, this.vnfType, action, fileName, this.templateVersionNo, this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}'));
+
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+
+ ": start replace: content length="+
+ this.configMappingEditorContent.length );
+ var replContent=
+ this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}');
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+" replace done");
+
+ let data = this.utilityService.createPayLoadForSave("template_data", this.vnfType, action, fileName, this.templateVersionNo, replContent );
+
this.appDataObject.template.templateData = data;
- this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": initialise editor ...");
+ this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent);
}
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": "+methName+": finish.");
}
}
//========================== End of prepareAppData() Method============================================
prepareFileName(): any {
- let fileNameObject: any = this.mappingEditorService.latestAction;
+ let fileNameObject: any = this.mappingEditorService.newObject;
this.appDataObject = this.mappingEditorService.appDataObject;
this.downloadDataObject = this.mappingEditorService.downloadDataObject;
this.referenceData = fileNameObject;
var blob = new Blob([theJSON], {
type: "text/json"
});
- this.showTemplateVersionDiv = true;
let fileName: any;
var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
- let id = this.mappingEditorService.identifier;
- if (id) fileName = this.updateFileNameForConfigScaleOut(this.item.action, scopeName, this.templateVersionNo, id);
- else fileName = this.updateParamFileName(this.item.action, scopeName, this.templateVersionNo);
-
+ fileName = this.paramArtifactName;
this.downloadDataObject.template.nameValueData = theJSON;
this.downloadDataObject.template.nameValueFileName = fileName;
}
else {
- this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
+ this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen", this.options);
}
}
//========================== End of onDownloadParameter() Method============================================
- updateParamFileName(action: any, scopeName: any, versionNo: any) {
- let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V.json';
- this.downloadedParamFileName = fileName;
- return fileName;
- }
- //========================== End of updateParamFileName() Method============================================
- updateFileNameForConfigScaleOut(action: any, scopeName: any, versionNo: any, id: any) {
- let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V_' + id + '.json';
- this.downloadedParamFileName = fileName;
- return fileName;
- }
- //========================== End of updateFileNameForConfigScaleOut() Method============================================
public onDownloadTemplate(artifact: string) {
+ var methName= "onDownloadTemplate";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": start: artifact:["+artifact+"] fileType:["+
+ this.fileType+"]");
let actualContent = this.configMappingEditorContent;
var textToSaveAsBlob: any;
var config_template_fileName: any
let refObj = this.refObj;
let versionandFileType: string;
if (artifact == 'Template' && this.artifactRequest && this.configMappingEditorContent && refObj) {
- this.showTemplateVersionDiv = true;
if (this.fileType === "text/xml") {
textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
type: "text/xml"
if (this.tempretrieveFlag) {
config_template_fileName = this.fileNameForTempSave;
var filextension = config_template_fileName.substring(config_template_fileName.indexOf("V") + 2, config_template_fileName.length);
-
textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
type: "text/" + filextension
});
else {
config_template_fileName = this.artifactName;
}
- this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": config_template_fileName:["+
+ config_template_fileName+"]");
+ this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": start replacements in content");
this.downloadDataObject.template.templateData = this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}');
this.downloadDataObject.template.templateFileName = config_template_fileName;
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": finish.");
}
-
}
//========================== End of onDownloadTemplate() Method============================================
- fileChange(input) {
+ fileChange( input) {
let self = this;
let refObj = this.refObj;
this.enableValidateTemplate = true;
if (refObj && refObj != undefined) {
+ // refObj = refObj[refObj.length - 1];
if (input.files && input.files[0]) {
- this.spinner.show();
+ //console.log("input files0" + JSON.stringify(input.files[0]))
this.myfileName = input.files[0].name;
this.fileName = input.files[0].name;
this.fileType = input.files[0].type;
+ // var fileExtension = this.myfileName.substr(this.myfileName.lastIndexOf('.') + 1);
+
let reader = new FileReader();
- this.readFile(input.files[0], reader, (result) => {
+ // if(this.validateUploadedFile(fileExtension))
+ //{
+ this.readFile( input.files[0], reader, (result) => {
if (this.fileType === 'text/xml') {
sessionStorage.setItem('fileType', 'text/xml');
}
sessionStorage.setItem('fileType', '');
}
-
if ('Generated Template' === this.selectedUploadType) {
this.configMappingEditorContent = result
this.artifactRequest.templateContent = this.configMappingEditorContent;
+ // console.log("editor content==" + JSON.stringify(this.configMappingEditorContent))
this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
if (this.artifactRequest.templateContent) {
- this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
+ this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent);
}
}
this.enableDownloadButtons = true;
this.saveTemplate();
this.templateeditor.getEditor().$enableBlockSelect = false;
this.templateeditor.getEditor().$enableMultiselect = false;
- setTimeout(() => {
- /** spinner ends after 3.5 seconds */
- this.spinner.hide();
- }, 3500);
+
});
+ // }
+ // else{
+ // this.nService.error("Error", "Incorrect File Format")
+ //this.configMappingEditorContent=''
+ //}
}
else {
- this.nService.error("Error", "Failed to read file");
+ this.nService.error("Error", "Failed to read file", this.options);
}
this.myInputVariable.nativeElement.value = "";
}
else {
- this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
+ this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen", this.options);
return false;
}
}
// callback with the results
callback(reader.result);
}
- this.notificationService.notifySuccessMessage('Uploading File ' + file.name + ':' + file.type + ':' + file.size);
// Read the file
reader.readAsText(file, "UTF-8");
}
}
//========================== End of appendSlashes() Method============================================
prepareDownloadData() {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.clName+": prepareDownloadData: start.");
this.onDownloadParameter();
this.onDownloadTemplate('Template');
}
//========================== End of prepareDownloadData() Method============================================
- syncTemplate() {
- this.mappingEditorService.replaceNamesWithBlankValues();
+ syncTemplate( callOrig: string ) {
+ var methName= "syncTemplate";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": start. callOrig:["+callOrig+"]");
+ if( callOrig == '0' ) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": this call is from HTML -start 1-st step.");
+ var ediContent= this.mappingEditorService.editor.session.getValue();
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": ediContent length="+ediContent.length );
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( methName+": ediContent(begin):["+
+ ediContent.substr(0,200)+"...]");
+ this.procOnSrvSideSvc.sendToSrv(
+ ediContent, this.mappingEditorService, this );
+ }
+ else
+ if( callOrig == '1' ) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": this call is from ProcOnSrvSideSvc -continue.");
+ // console.log( methName+": start replaceNamesWithBlankValues.");
+ // this.mappingEditorService.replaceNamesWithBlankValues();
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": start saveTemplate ...");
this.saveTemplate();
-
var templateData = this.mappingEditorService.paramData; //template data array
var pdData = this.paramShareService.getSessionParamData(); //PD data array
var paramsContent = localStorage["paramsContent"];
-
- if (paramsContent && paramsContent != undefined) {
- try {
- var paramTabData = JSON.parse(paramsContent);
- }
- catch (error) {
- console.log("error is : " + error)
- }
- }
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": paramsContent length="+paramsContent.length );
var resultArr = [];
var json = {};
var resultParamObj = {};
let checkNamesOnlyCondition: boolean = true;
if (templateData && templateData != undefined) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": templateData (params) are not empty.");
templateData.forEach(function (item) {
if (item.paramValue !== "" && item.paramValue != undefined && item.paramValue != null) {
checkNamesOnlyCondition = false;
}
-
- });
-
- templateData.forEach(function (item) {
resultParamObj[item.paramName] = item.paramValue;
});
- if (paramTabData && paramTabData != undefined) {
+ templateData = Array.from(new Set(templateData.map((itemInArray) => itemInArray.paramName)))
+ if( paramsContent && paramsContent != undefined) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": parse paramsContent ...");
+ try {
+ var paramTabData = JSON.parse(paramsContent);
+ }
+ catch (error) {
+ console.log( methName+": paramsContent parse error:" + error);
+ }
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": templateData length="+templateData.length );
templateData.forEach(function (item) {
for (var index in paramTabData) {
if (item.paramName === index) {
}
}
}
-
}
+ resultArr.push({
+ "name": item,
+ "type": null,
+ "description": null,
+ "required": null,
+ "default": null,
+ "source": "Manual",
+ "rule-type": null,
+ "request-keys": [{
+ "key-name": null,
+ "key-value": null
+ }, {
+ "key-name": null,
+ "key-value": null
+ }, {
+ "key-name": null,
+ "key-value": null
+ }],
+ "response-keys": [{
+ "key-name": null,
+ "key-value": null
+ }, {
+ "key-name": null,
+ "key-value": null
+ }, {
+ "key-name": null,
+ "key-value": null
+ }, {
+ "key-name": null,
+ "key-value": null
+ }, {
+ "key-name": null,
+ "key-value": null
+ }],
+ "ruleTypeValues": [null]
+ })
});
-
}
localStorage["paramsContent"] = JSON.stringify(resultParamObj);
- templateData = Array.from(new Set(templateData.map((itemInArray) => itemInArray.paramName)))
-
- //reformatting arr1 to match with PD
- templateData.forEach(function (item) {
-
- resultArr.push({
- "name": item,
- "type": null,
- "description": null,
- "required": null,
- "default": null,
- "source": "Manual",
- "rule-type": null,
- "request-keys": [{
- "key-name": null,
- "key-value": null
- }, {
- "key-name": null,
- "key-value": null
- }, {
- "key-name": null,
- "key-value": null
- }],
- "response-keys": [{
- "key-name": null,
- "key-value": null
- }, {
- "key-name": null,
- "key-value": null
- }, {
- "key-name": null,
- "key-value": null
- }, {
- "key-name": null,
- "key-value": null
- }, {
- "key-name": null,
- "key-value": null
- }],
- "ruleTypeValues": [null]
-
- })
- });
+ if (pdData && pdData != undefined) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+
+ ": have pdData, resultArr.length="+resultArr.length );
+ for (var i = 0; i < resultArr.length; i++) {
+ pdData.forEach(function (arr2item) {
+ if (resultArr[i].name === arr2item.name) {
+ var json = {
+ "name": arr2item.name,
+ "type": arr2item.type,
+ "description": arr2item.description,
+ "required": arr2item.required,
+ "default": arr2item.default,
+ "source": arr2item.source,
+ "rule-type": arr2item["rule-type"],
+ "request-keys": arr2item["request-keys"],
+ "response-keys": arr2item["response-keys"],
+ "ruleTypeValues": arr2item.ruleTypeValues
+ };
+ resultArr.splice(i, 1, json)
+ }
+ });
+ };
+ }
+ this.paramShareService.setSessionParamData(resultArr);
+ this.mappingEditorService.paramData = [];
+ //navigate to PD page after sync
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( methName+": navigate to PD page after sync ...");
+ this
+ .router
+ .navigate(['../../../vnfs/design/parameterDefinitions/create']);
}
- if (pdData && pdData != undefined) {
- for (var i = 0; i < resultArr.length; i++) {
-
- pdData.forEach(function (arr2item) {
- if (resultArr[i].name === arr2item.name) {
-
- var json = {
- "name": arr2item.name,
- "type": arr2item.type,
- "description": arr2item.description,
- "required": arr2item.required,
- "default": arr2item.default,
- "source": arr2item.source,
- "rule-type": arr2item["rule-type"],
- "request-keys": arr2item["request-keys"],
- "response-keys": arr2item["response-keys"],
- "ruleTypeValues": arr2item.ruleTypeValues
- };
- resultArr.splice(i, 1, json)
- }
-
- });
-
- };
-
}
- this.paramShareService.setSessionParamData(resultArr);
- this.mappingEditorService.paramData = [];
- //navigate to PD page after sync
- this
- .router
- .navigate(['../../../vnfs/design/parameterDefinitions/create']);
}
//========================== End of syncTemplate() Method============================================
mergeParams() {
this.mergeStatus = this.mappingEditorService.autoAnnotateDataForParams();
if (this.mergeStatus) {
- this.nService.success("Success", "Merge Successful");
+ this.nService.success("Success", "Merge Successful", this.options);
}
else {
- this.nService.error("Error", "Merge Unsuccessful");
+ this.nService.error("Error", "Merge Unsuccessful", this.options);
}
this.saveTemplate();
}
//========================== End of mergeParams() Method============================================
public handleAnnotation(modal) {
-
+ this.tempName = '';
this.selectedWord = this.templateeditor.getEditor().session.getTextRange(this.templateeditor.getEditor().selectionRange);
if (this.selectedWord && this.selectedWord != undefined) modal.open();
}
//========================== End of handleAnnotations() Method============================================
+ public handleUndo(modal) {
+ let markersList = this.templateeditor.getEditor().session.getMarkers();
+
+ let filteredObj = {};
+ let lastMarker = Object.keys(markersList).filter(function (key) {
+ if (markersList[key]['clazz'] != 'undoMarker') {
+ filteredObj[key] = markersList[key]
+ }
+ return filteredObj;
+ });
+ this.templateeditor.getEditor().session.getUndoManager().undo();
+ this.templateeditor.getEditor().getSelection().clearSelection();
+
+ this.templateeditor.getEditor().session.removeMarker(this.templateeditor.getEditor().getSelection().session.$markerId);
+ this.templateeditor.getEditor().session.addMarker(markersList[parseInt(lastMarker[lastMarker.length - 1])].range, 'undoMarker', 'text')
+ }
+ //========================== End of handleUndo() Method============================================
public submitNameValues() {
+ this.checkNameEntered = true;
+ this.checkSpace = true;
if (this.tempName) {
- this.checkNameEntered = true;
+ if (this.tempName.startsWith(' ') || this.tempName.endsWith(' ')) {
+ this.checkSpace = false
+ }
+ else {
+ this.checkNameEntered = true;
- if (this.selectedWord) {
- if (this.selectedWord.startsWith('${(')) {
- var replaceWord: any = this.replaceWord = this.selectedWord.substring(3, this.selectedWord.indexOf(')=(')) + this.tempName;
- this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
+ if (this.selectedWord) {
+ if (this.selectedWord.startsWith('${(')) {
+ var replaceWord: any = this.replaceWord = this.selectedWord.substring(3, this.selectedWord.indexOf(')=(')) + this.tempName;
+ this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
- } else {
- let mappingKey = this.mappingEditorService.getKeysForValues(this.selectedWord);
- var replaceWord: any = this.replaceWord = '${(' + this.selectedWord + ')=(' + this.tempName + ')}';
- this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
+ } else {
+ let mappingKey = this.mappingEditorService.getKeysForValues(this.selectedWord);
+ var replaceWord: any = this.replaceWord = '${(' + this.selectedWord + ')=(' + this.tempName + ')}';
+ this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
+ }
}
+ this.mappingEditorService.refreshEditor();
+ this.tempName = '';
+ this.modal.close();
}
- this.mappingEditorService.refreshEditor();
- this.tempName = '';
- this.modal.close();
-
}
else {
this.checkNameEntered = false;
}
-
}
//========================== End of submitNameValues() Method============================================
}
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
table.table th,
table.table td {
padding: 0rem;
-}
\ No newline at end of file
+}
+.error-message {
+ color: red;
+}
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
- <div class="table-responsive" style="height:auto; overflow: auto;">
+ <div class="table-responsive" style="height:600px; overflow: auto;">
<table class="table">
<thead>
<tr>
<tr *ngFor="let item of vnfData | orderBy:sortBy:sortOrder | tableFilter:filterQuery:filter">
<td>{{item['vnf-type']}}</td>
<td>{{item['vnfc-type']}}</td>
+ <!--td>{{defineData(item)}}</td-->
<!-- <td>{{item.incart}}</td> -->
<!-- <td>{{item.protocol}}</td>
<td>{{item.action}}</td> -->
</div>
</div>
<div class="col-lg-12-ln2">
+ <!-- <button type="button" (click)="buildNewDesign(content)" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">Create New
+ VNF Type
+ </button> -->
<button type="button" (click)="createVnfcModal.open()" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">
Create New VNF Type
</button>
<!-- <ng-template #content let-c="close" let-d="dismiss">
<form ngNativeValidate (ngSubmit)="c('yes')">
<div class="modal-header">
- <h4 class="modal-title">Enter VNF type and VNFC to proceed</h4>
+ <h4 class="modal-title">Enter VNF Type</h4>
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<span aria-hidden="true">×</span>
</button>
<div class="form-group row">
<label for="example-text-input" class="col-12 col-form-label">Enter Vnf Type</label>
<div class="col-12">
- <input required name="vnfType" class="form-control" [(ngModel)]="vnfType" type="text" id="vnfType">
+ <input pattern=".*[^ ].*" required name="vnfType" class="form-control" (ngModelChange)="validateVnfName($event)" [(ngModel)]="vnfType" type="text" id="vnfType">
+ <span class="error-message">{{errorMessage}}</span>
</div>
+
</div>
<div class="form-check">
<label class="form-check-label">
- <input name="vnfcRequired" class="form-check-input" [(ngModel)]="vnfcRequired" type="checkbox"
+ <input name="vnfcRequired" class="form-check-input" [(ngModel)]="vnfcRequired" type="checkbox"
id="vnfcRequired">
- Enter vnfc info
+ This VNF has VNFC templates
</label>
</div>
- <div class="form-group row" *ngIf="vnfcRequired">
- <label for="example-search-input" class="col-12 col-form-label">Enter Vnfc Type</label>
- <div class="col-12">
- <input required name="vnfcType" class="form-control" [(ngModel)]="vnfcType" type="text" id="vnfcType">
- </div>
- </div>
</div>
<div class="modal-footer">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent
- " (click)="c('yes')">Proceed anyway
+ " (click)="c('no')">Proceed To Upload
</button>
- <button type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">Next
+ <button type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" [disabled]="invalid">Next
</button>
</div>
</button>
</modal-footer>
</form>
-</modal>
+</modal>
\ No newline at end of file
}
subscription: Subscription;
- constructor(private paramShareService: ParamShareService, private ngProgress: NgProgress, private httpUtil: HttpUtilService, private router: Router, private activeROute: ActivatedRoute,
- private mappingEditorService: MappingEditorService, private modalService: NgbModal, private nService: NotificationsService) {
+ constructor (private paramShareService: ParamShareService, private ngProgress: NgProgress, private httpUtil: HttpUtilService, private router: Router, private activeROute: ActivatedRoute,
+ private mappingEditorService: MappingEditorService, private modalService: NgbModal) {
}
ngOnInit() {
getArtifacts(data) {
let tempObj: any;
this.ngProgress.start();
- //this.subscription = this.httpUtil.post({
this.httpUtil.post({
url: environment.getDesigns,
data: data
})
- .subscribe( resp => {
+ .subscribe(resp => {
if (resp.output.data.block !== undefined && resp.output.data.block !== null && resp.output.data.block.length !== 0) {
- console.log("getArtifacts: resp:", resp.output.data.block);
- tempObj = JSON.parse(resp.output.data.block);
- this.vnfData = tempObj.designInfo;
+ tempObj = JSON.parse(resp.output.data.block);
+ this.vnfData = tempObj.designInfo;
}
- if (this.vnfData == undefined || this.vnfData == null || this.vnfData.length == 0) {
+ if (this.vnfData === undefined || this.vnfData === null || this.vnfData.length === 0) {
this.noData = true;
- // this.noDataMsg = resp.output.data.status.message;
+ // this.noDataMsg = resp.output.status.message;
} else {
this.noData = false;
}
- console.log("getArtifacts: noData:"+this.noData);
this.ngProgress.done();
- },
- error => {
- this.nService.error(appConstants.errors.error, appConstants.errors.connectionError)
});
this.filter = ['vnf-type', 'vnfc-type', 'artifact-name'];
getData() {
}
- buildNewDesign( response) {
- // this.modalService.open(content).result.then(res => {
- // this.mappingEditorService.referenceNameObjects = undefined;
- // sessionStorage.setItem('vnfParams', JSON.stringify({ vnfType: this.vnfType, vnfcType: this.vnfcType }));
- // this.router.navigate([
- // 'vnfs', 'design', 'references'
- // ]);
- // });
+ buildNewDesign(response) {
+
+ // this.modalService.open(content).result.then(res => {
+ // if(res=='yes'){
+ // sessionStorage.setItem('vnfParams', JSON.stringify({ vnfType: this.vnfType}));
+ // sessionStorage.setItem("vnfcSelectionFlag",''+this.vnfcRequired+'')
+ // } else{
+ // sessionStorage.setItem('vnfParams',"")
+ // }
+
+ // this.mappingEditorService.referenceNameObjects = undefined;
+ // this.mappingEditorService.identifier = '';
+ // //this.mappingEditorService.newObject = {};
+ // this.router.navigate([
+ // 'vnfs', 'design', 'references'
+ // ]);
+
+ // });
+
if (response == 'yes') {
sessionStorage.setItem('vnfParams', JSON.stringify({ vnfType: this.vnfType }));
sessionStorage.setItem("vnfcSelectionFlag", '' + this.vnfcRequired + '')
clearCache() {
// get the value and save the userid and persist it.
- sessionStorage.setItem("vnfcSelectionFlag", '' + this.vnfcRequired + '');
+ sessionStorage.setItem("vnfcSelectionFlag", '' + this.vnfcRequired + '')
this.mappingEditorService.setTemplateMappingDataFromStore(undefined);
localStorage['paramsContent'] = '{}';
this.mappingEditorService.setParamContent(undefined);
this.mappingEditorService.changeNavAppData(appData);
this.mappingEditorService.changeNavDownloadData(downloadData);
}
-}
+ defineData(item) {
+ let artVnfc = item['artifact-name'].substring(this.lastIndexofEnd("AllAction_", item['artifact-name']), item['artifact-name'].lastIndexOf("_"))
+ if (item['vnf-type'] == artVnfc && item['vnfc-type'] == 'null') {
+
+ return item['vnfc-type']
+ } else {
+ return ""
+ }
+
+ }
+ lastIndexofEnd(str, originlStr) {
+ var io = originlStr.lastIndexOf(str);
+ return io == -1 ? -1 : io + str.length;
+ }
+
+
+}
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
-/* .error-msg{
-
- color: red
-} */
\ No newline at end of file
+.error-message {
+ color: red;
+}
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
-->
<form #userForm="ngForm" (ngSubmit)="getData()">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input placeholder="Enter user Id" class="mdl-textfield__input" id="userId" required
- [(ngModel)]="userId" name="userId" value="" #user="ngModel">
+ [(ngModel)]="userId" name="userId" value="" #user="ngModel" (ngModelChange)="validateUserName()">
+ <span class="error-message">{{errorMessage}}</span>
</div>
+
<div class="form-group text-right">
- <button type="submit" [disabled]="!userForm.form.valid"
+ <button type="submit" [disabled]="invalid"
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary">
Submit
</button>
userId: string = '';
returnUrl:string
+ invalid = true;
+ errorMessage = '';
constructor(private router: Router, private utiltiy: UtilityService, private route: ActivatedRoute
) {
this.router.navigateByUrl(this.returnUrl);
}
+ validateUserName(){
+ if (!this.userId.trim() || this.userId.length < 1) {
+ this.errorMessage = '';
+ this.invalid = true;
+ }else if(this.userId.startsWith(' ') || this.userId.endsWith(' ')){
+ this.errorMessage = 'Leading and trailing space is not allowed';
+ this.invalid = true;
+ } else if(this.userId.includes(' ')){
+ this.errorMessage = 'More than one space is not allowed in username';
+ this.invalid = true;
+ } else if(this.userId.length > 50) {
+ this.errorMessage = 'Username should be of minimum one character and maximum 50 character';
+ this.invalid = true;
+ }else {
+ this.invalid = false;
+ this.errorMessage = '';
+ }
+ }
+
}
============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
-
-Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
-===================================================================
-Copyright (C) 2018 IBM.
===================================================================
Unless otherwise specified, all software contained herein is licensed
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
-import { NgModule } from '@angular/core';
-import { FormsModule } from '@angular/forms';
-import { CommonModule } from '@angular/common';
+import {NgModule} from '@angular/core';
+import {FormsModule} from '@angular/forms';
+import {CommonModule} from '@angular/common';
// modules
-import { VnfRoutingModule } from './vnf.routing';
-import { SharedModule } from '../shared/shared.module';
-import { NgxSpinnerModule } from 'ngx-spinner';
-import { AceEditorComponent } from 'ng2-ace-editor';
+import {VnfRoutingModule} from './vnf.routing';
+import {SharedModule} from '../shared/shared.module';
+
+import {AceEditorComponent} from 'ng2-ace-editor';
// components
-import { MyvnfsComponent } from './myvnfs/myvnfs.component';
-import { ReferenceDataformComponent } from './build-artifacts/reference-dataform/reference-dataform.component';
-import { GoldenConfigurationComponent } from './build-artifacts/template-holder/template-configuration/template-configuration.component';
-import { ParameterComponent } from './build-artifacts/parameter-definitions/parameter.component';
-import { ParameterHolderComponent } from './build-artifacts/parameter-holder/parameter-holder.component';
-import { BootstrapModalModule } from 'ng2-bootstrap-modal';
-import { BuildDesignComponent } from './build-artifacts/build-artifacts.component';
-import { userloginFormComponent } from './userlogin-form/userlogin-form.component';
-import { ReferenceDataHolderComponent } from './build-artifacts/reference-data-holder/reference-data-holder.component';
-import { ModalComponent } from '../shared/modal/modal.component';
-import { VnfsComponent } from './vnfs/vnfs.component';
-import { GoldenConfigurationHolderComponent } from './build-artifacts/template-holder/template-holder.component';
-import { GoldenConfigurationMappingComponent } from './build-artifacts/template-holder/param-name-value/param-name-value.component';
-import { Tab } from './build-artifacts/template-holder/param-name-value/tab';
-import { Tabs } from './build-artifacts/template-holder/param-name-value/tabs';
-import { Ng2Bs3ModalModule } from 'ng2-bs3-modal/ng2-bs3-modal';
-import { AuthGuardModalComponent } from './auth-guard-modal/auth-guard-modal';
-import { GCAuthGuardService } from './GCAuthGuard/gcauth-guard.service';
-import { LoginGuardService } from './LoginGuardService/Login-guard-service';
-import { SimpleNotificationsModule } from 'angular2-notifications';
+import {MyvnfsComponent} from './myvnfs/myvnfs.component';
+import {ReferenceDataformComponent} from './build-artifacts/reference-dataform/reference-dataform.component';
+import {GoldenConfigurationComponent} from './build-artifacts/template-holder/template-configuration/template-configuration.component';
+import {ParameterComponent} from './build-artifacts/parameter-definitions/parameter.component';
+import {ParameterHolderComponent} from './build-artifacts/parameter-holder/parameter-holder.component';
+import {BootstrapModalModule} from 'ng2-bootstrap-modal';
+import {BuildDesignComponent} from './build-artifacts/build-artifacts.component';
+import {userloginFormComponent} from './userlogin-form/userlogin-form.component';
+import {ReferenceDataHolderComponent} from './build-artifacts/reference-data-holder/reference-data-holder.component';
+import {VnfsComponent} from './vnfs/vnfs.component';
+import {ConfirmComponent} from '../shared/confirmModal/confirm.component';
+import {GoldenConfigurationHolderComponent} from './build-artifacts/template-holder/template-holder.component';
+import {GoldenConfigurationMappingComponent} from './build-artifacts/template-holder/param-name-value/param-name-value.component';
+import {Tab} from './build-artifacts/template-holder/param-name-value/tab';
+import {Tabs} from './build-artifacts/template-holder/param-name-value/tabs';
+import {Ng2Bs3ModalModule} from 'ng2-bs3-modal/ng2-bs3-modal';
+import {AuthGuardModalComponent} from './auth-guard-modal/auth-guard-modal';
+import {GCAuthGuardService} from './GCAuthGuard/gcauth-guard.service';
+import {LoginGuardService} from './LoginGuardService/Login-guard-service';
+import {SimpleNotificationsModule} from 'angular2-notifications';
+import { NgxSpinnerModule } from 'ngx-spinner';
+
+//import {SyncResultsComponent} from './build-artifacts/sync-results/sync-results.component';
export const components = [
VnfsComponent,
ReferenceDataformComponent,
ReferenceDataHolderComponent,
- ModalComponent,
GoldenConfigurationHolderComponent,
AceEditorComponent,
Tab,
Tabs,
- AuthGuardModalComponent,
-
+ ConfirmComponent,
+ AuthGuardModalComponent
+ // SyncResultsComponent
];
export const modules = [
CommonModule, VnfRoutingModule, SharedModule.forRoot(),
- FormsModule, BootstrapModalModule, Ng2Bs3ModalModule, SimpleNotificationsModule.forRoot(),NgxSpinnerModule
+ FormsModule, BootstrapModalModule, Ng2Bs3ModalModule, NgxSpinnerModule, SimpleNotificationsModule.forRoot()
];
providers: [GCAuthGuardService, LoginGuardService],
- entryComponents: [AuthGuardModalComponent]
+ entryComponents: [ConfirmComponent, AuthGuardModalComponent]
})
export class VnfsModule {
-}
+}
\ No newline at end of file
--- /dev/null
+{
+ "source": "INSTAR",
+ "CONTACT_US": {
+ "CONTACT_US_EMAIL": "appc@list.onap.org",
+ "CONTACT_US_SUBJECT": "CDT Query/Feedback"
+ },
+ "username": "admin",
+ "password": "admin",
+ "displayConfigScaleout": true,
+ "Actions": {
+ "ConfigScaleOut": "ConfigScaleOut",
+ "Configure": "Configure"
+ },
+ "versionNoForApiCall": "0.0.1"
+}
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================ */
input[type=text],
margin: 0;
}
+
/* Disable ugly boxes around images in IE10 */
a img {
z-index: 20
}
+.undoMarker {
+ position: absolute;
+ background: #272822;
+ z-index: 30
+}
+
.noKeyedMarker {
position: absolute;
background: orange;
z-index: 20
}
+.ace_editor .ace_marker-layer .ace_selection {
+ background:blue !important;
+}
+
.defaultMarker {
position: absolute;
background: lightgreen;
z-index: 20;
}
+.ace_cursor{
+ background-color: transparent;
+
+}
+.ace-monokai{
+ color: greenyellow;
+
+}
.android-header {
overflow: visible;
width: 800px;
}
-.android-search-box.is-focused + .android-navigation-container {
+.android-search-box.is-focused+.android-navigation-container {
opacity: 0;
width: 100px;
}
padding-bottom: 24px;
}
-.android-card-container {
-}
-
.android-card-container .mdl-card__media {
overflow: hidden;
background: transparent;
cursor: pointer;
}
+
/**** Mobile layout ****/
@media (max-width: 900px) {
.android-navigation-container {
display: none;
}
-
.android-title {
display: none !important;
}
-
.android-mobile-title {
display: block !important;
position: absolute;
top: 12px;
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
-
/* WebViews in iOS 9 break the "~" operator, and WebViews in OS X 10.10 break
consecutive "+" operators in some cases. Therefore, we need to use both
here to cover all the bases. */
- .android.android-search-box.is-focused ~ .android-mobile-title,
- .android-search-box.is-focused + .android-navigation-container + .android-mobile-title {
+ .android.android-search-box.is-focused~.android-mobile-title,
+ .android-search-box.is-focused+.android-navigation-container+.android-mobile-title {
opacity: 0;
}
-
.android-more-button {
display: none;
}
-
.android-search-box.is-focused {
width: calc(100% - 48px);
}
-
.android-search-box .mdl-textfield__expandable-holder {
width: 100%;
}
-
.android-be-together-section {
height: 350px;
}
-
.android-slogan {
font-size: 26px;
margin: 0 16px;
padding-top: 24px;
}
-
.android-sub-slogan {
font-size: 16px;
margin: 0 16px;
padding-top: 8px;
}
-
.android-create-character {
padding-top: 200px;
font-size: 16px;
}
-
.android-create-character img {
height: 12px;
}
-
.android-fab {
display: none;
}
-
.android-wear-band-text {
margin-left: 0;
padding: 16px;
}
-
.android-footer .mdl-mega-footer--bottom-section {
display: none;
}
}
-input[type=text]:readonly {
- background: #e0dada;
+input[type=text]:read-only {
+ background: #d8d4d4;
+}
+
+.nav-tabs .nav-item .nav-link {
+ color: #000000;
+}
+
+#versionLog .modal-dialog {
+ width: 100%;
+ max-width: 800px;
+}
+
+/* Overriding Ng2-Bs3-Modal css */
+.modal-header {
+ flex-direction: row-reverse;
+}
+
+/* Overriding ng2-bootstrap-modal css ( Confirmation Modal ) */
+dialog-wrapper .modal {
+ background-color: rgba(0, 0, 0, 0.288);
+}
+
+dialog-wrapper .modal-dialog .modal-content {
+ box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);
}
\ No newline at end of file