aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/vnfs/build-artifacts/template-holder/param-name-value
diff options
context:
space:
mode:
authorasgar <ma926a@us.att.com>2019-03-01 15:32:47 +0530
committerTakamune Cho <takamune.cho@att.com>2019-03-04 19:52:20 +0000
commit611c9da62c2e266f9facd97dc9f340ce311060a3 (patch)
treee471d6c851cefd46ed83380c6e41d20f54fe2666 /src/app/vnfs/build-artifacts/template-holder/param-name-value
parent9ccb0353f1c59bd7d49ff17c54e5d00c0960ea82 (diff)
multiple asible servers support
multiple asible servers support for CDT Issue-ID: APPC-1510 Change-Id: Id1b1b02274487cfbf6f108a57211a192924a6b08 Signed-off-by: Mohamed Asgar Samiulla <ma926a@us.att.com>
Diffstat (limited to 'src/app/vnfs/build-artifacts/template-holder/param-name-value')
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html23
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts106
2 files changed, 49 insertions, 80 deletions
diff --git a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html
index 26cbf27..dc5e812 100644
--- a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html
+++ b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html
@@ -69,13 +69,12 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<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}}" />
@@ -108,14 +107,24 @@ vnfcType"
</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
diff --git a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts
index 40a5291..a4e0539 100644
--- a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts
@@ -44,6 +44,7 @@ import { NgProgress } from 'ngx-progressbar';
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;
@@ -101,14 +102,13 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
@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,
@@ -122,7 +122,9 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
private nService: NotificationsService,
private ngProgress: NgProgress,
private spinner: NgxSpinnerService,
- private utilityService: UtilityService,
+ private apiService:APIService,
+ private utilityService: UtilityService
+
) {
this.artifactRequest.action = '';
this.artifactRequest.version = '';
@@ -132,29 +134,27 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
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 = {
@@ -170,18 +170,9 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
'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============================================
@@ -190,25 +181,20 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
}
//========================== 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;
}
@@ -234,13 +220,11 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
// 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(() => {
@@ -278,7 +262,6 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
// 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');
}
@@ -290,44 +273,23 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
}
//========================== 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;
@@ -362,7 +324,6 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
}
//========================== End of retrieveNameValueFromAppc() Method============================================
-
formatNameValuePairs(namevaluePairs: string) {
var string = namevaluePairs.substring(1, namevaluePairs.length - 1);
var stringArr = string.split(',');
@@ -456,7 +417,7 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
'ruleTypeValues': arr2item.ruleTypeValues
};
pdDataArrayForSession.splice(i, 1, json);
-
+
}
});
@@ -471,9 +432,8 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
}
}
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