summaryrefslogtreecommitdiffstats
path: root/src/app/shared
diff options
context:
space:
mode:
authorPatrick Brady <patrick.brady@att.com>2019-03-06 12:11:34 -0800
committerPatrick Brady <patrick.brady@att.com>2019-03-06 12:12:36 -0800
commiteedac3e312c66499ca5ff9d72388c31b25813225 (patch)
tree4cc2f22a0a36ba97823b70fe27ed667383173f0a /src/app/shared
parent611c9da62c2e266f9facd97dc9f340ce311060a3 (diff)
Revert "multiple asible servers support"
Some functionality was accidentally removed This reverts commit 611c9da62c2e266f9facd97dc9f340ce311060a3. Change-Id: I1aefbbc0ede8cdda59acc8bdf7b047e506aad813 Signed-off-by: Patrick Brady <patrick.brady@att.com> Issue-ID: APPC-1510
Diffstat (limited to 'src/app/shared')
-rw-r--r--src/app/shared/components/navigation/navigation.component.ts11
-rw-r--r--src/app/shared/confirmModal/confirm.component.ts22
-rw-r--r--src/app/shared/pipes/vm-filtering.pipe.ts24
-rw-r--r--src/app/shared/services/cdt.apicall.ts52
-rw-r--r--src/app/shared/services/httpUtil/http-util.service.ts9
-rw-r--r--src/app/shared/services/mapping-editor.service.ts57
-rw-r--r--src/app/shared/services/procOnSrvSide.service.ts343
-rw-r--r--src/app/shared/shared.module.ts31
8 files changed, 58 insertions, 491 deletions
diff --git a/src/app/shared/components/navigation/navigation.component.ts b/src/app/shared/components/navigation/navigation.component.ts
index af80749..522b11a 100644
--- a/src/app/shared/components/navigation/navigation.component.ts
+++ b/src/app/shared/components/navigation/navigation.component.ts
@@ -24,15 +24,14 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-import {Component, Input, OnInit} from '@angular/core';
-import {Router} from '@angular/router';
-import {EmitterService} from '../../services/emitter.service';
+import { Component, Input, OnInit, OnDestroy } from '@angular/core';
+import { Router } from '@angular/router';
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 {
+@Component({ selector: 'app-navigation', templateUrl: './navigation.component.html', styleUrls: ['./navigation.component.css'] })
+export class NavigationComponent implements OnInit, OnDestroy {
navigationTabs: Array<Object> = [];
//@ViewChild(GoldenConfigurationComponent) goldenConfig: GoldenConfigurationComponent;
@Input() id: string;
diff --git a/src/app/shared/confirmModal/confirm.component.ts b/src/app/shared/confirmModal/confirm.component.ts
index 9da7991..5fbf4b3 100644
--- a/src/app/shared/confirmModal/confirm.component.ts
+++ b/src/app/shared/confirmModal/confirm.component.ts
@@ -28,6 +28,8 @@ import { DialogComponent, DialogService } from 'ng2-bootstrap-modal';
export interface ConfirmModel {
title: string;
message: string;
+ cancelButtonText: string;
+ confirmButtonText: string;
}
@Component({
@@ -36,15 +38,15 @@ export interface ConfirmModel {
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
- <button type="button" class="close" (click)="close()">&times;</button>
- <h6 class="modal-title">{{title || 'Save all changes for current action to APPC database.'}}</h6>
+ <h4 class="modal-title">{{title}}</h4>
+ <button type="button" class="close" (click)="cancel()">&times;</button>
</div>
<div class="modal-body">
- <p>{{message || 'Do you want to save the changes?'}}</p>
+ <p>{{message}}</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)="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>
+ <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>
</div>
</div>
</div>`
@@ -52,20 +54,22 @@ export interface ConfirmModel {
export class ConfirmComponent extends DialogComponent<ConfirmModel, boolean> implements ConfirmModel {
title: string;
message: string;
+ cancelButtonText: string;
+ confirmButtonText: string;
constructor(dialogService: DialogService) {
super(dialogService);
}
- onConfirm() {
- // we set dialog result as true on click on Yes button,
+ confirm() {
+ // we set dialog result as true on click on confirm button,
// then we can get dialog result from caller code
this.result = true;
this.close();
}
- onCancel() {
- // we set dialog result as false on click on Yes button,
+ cancel() {
+ // we set dialog result as false on click on cancel/close button,
// then we can get dialog result from caller code
this.result = false;
this.close();
diff --git a/src/app/shared/pipes/vm-filtering.pipe.ts b/src/app/shared/pipes/vm-filtering.pipe.ts
index a036799..c20397b 100644
--- a/src/app/shared/pipes/vm-filtering.pipe.ts
+++ b/src/app/shared/pipes/vm-filtering.pipe.ts
@@ -19,33 +19,19 @@ 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, 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'] == filterValue;
- });
+ transform(value: any, action: any, templateId): any {
-
- return x;
- } else if( action == 'Configure' || action == 'ConfigModify'){
+ if (action == 'ConfigScaleOut') {
let x = value.filter(obj => {
//return value
- return ( obj['vnfcType-id'] == filterValue || obj['vnfcType-id'] == undefined);
+ return obj['template-id'] == templateId;
});
-
return x;
} else {
return value;
diff --git a/src/app/shared/services/cdt.apicall.ts b/src/app/shared/services/cdt.apicall.ts
deleted file mode 100644
index 9d7fbc2..0000000
--- a/src/app/shared/services/cdt.apicall.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-============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.
-
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
-============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))*/
- }
-
-
-
-}
diff --git a/src/app/shared/services/httpUtil/http-util.service.ts b/src/app/shared/services/httpUtil/http-util.service.ts
index 688f3ea..43e6d4f 100644
--- a/src/app/shared/services/httpUtil/http-util.service.ts
+++ b/src/app/shared/services/httpUtil/http-util.service.ts
@@ -28,22 +28,23 @@ import { Http, Response, Headers, RequestOptions } from '@angular/http';
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) {
+ 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)
diff --git a/src/app/shared/services/mapping-editor.service.ts b/src/app/shared/services/mapping-editor.service.ts
index cb47687..b9e2b53 100644
--- a/src/app/shared/services/mapping-editor.service.ts
+++ b/src/app/shared/services/mapping-editor.service.ts
@@ -68,11 +68,11 @@ export class MappingEditorService {
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();
@@ -106,20 +106,12 @@ export class MappingEditorService {
}
selectedObj(data) {
this.newObject = data;
-
}
+
saveLatestIdentifier(identifier) {
this.identifier = identifier;
}
- setSelectedVNFCType(vnfcType) {
- this.selectedVNFCType = vnfcType;
- }
-
- getSelectedVNFCType() {
- return this.selectedVNFCType;
- }
-
public getParamContent() {
return this.paramContent;
}
@@ -137,15 +129,15 @@ export class MappingEditorService {
}
- public initialise(editor: any, editorContent: string): void {
+ public initialise(editor: any, editorContent: string, modal: any): 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();
}
@@ -206,7 +198,7 @@ export class MappingEditorService {
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) {
@@ -269,8 +261,8 @@ export class MappingEditorService {
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(',')
@@ -321,7 +313,7 @@ export class MappingEditorService {
}
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++) {
@@ -370,25 +362,19 @@ export class MappingEditorService {
}
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);
- // 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)) {
+ if (selectedWord && this.checkAppliedForNamesOnly(selectedRange) && !specialKeys) {
let replaceWord: any = this.KEY_START + '' + this.KEY_MID + selectedWord.substring(2, selectedWord.length - 1) + this.KEY_END;
this.editor.session.replace(selectedRange, replaceWord);
}
- // }
+
}
}
}
@@ -402,8 +388,7 @@ export class MappingEditorService {
this.hasErrorCode = false;
for (var r = 0; r < ranges.length; r++) {
let keyValue: string = this.editor.session.getTextRange(ranges[r]);
- //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)) {
+ if (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);
@@ -413,7 +398,7 @@ export class MappingEditorService {
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);
@@ -423,7 +408,7 @@ export class MappingEditorService {
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;
@@ -464,13 +449,13 @@ export class MappingEditorService {
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 (this.checkComments(ranges[r]) && keyValue && keyValue.startsWith(this.KEY_START) && keyValue.endsWith(this.KEY_END) && keyValue.includes(this.KEY_MID)) {
+ if (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);
@@ -523,7 +508,7 @@ export class MappingEditorService {
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++) {
@@ -547,7 +532,7 @@ export class MappingEditorService {
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('{}');
@@ -608,4 +593,4 @@ export class MappingEditorService {
}
-} \ No newline at end of file
+}
diff --git a/src/app/shared/services/procOnSrvSide.service.ts b/src/app/shared/services/procOnSrvSide.service.ts
deleted file mode 100644
index 17666d3..0000000
--- a/src/app/shared/services/procOnSrvSide.service.ts
+++ /dev/null
@@ -1,343 +0,0 @@
-//.. 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);
- });
- }
-}
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index 54b9c1b..8959587 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -43,44 +43,31 @@ import {NotificationService} from './services/notification.service';
import {ParamShareService} from './services/paramShare.service';
import {TidyTableModule} from './modules/tidy-table/tidy-table.module';
import {UtilityService} from './services/utilityService/utility.service';
-import {ProcOnSrvSideSvc} from './services/procOnSrvSide.service';
-
+import {VmFilteringPipe} from '../pipes/vm-filtering.pipe';
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,
- // HttpClient, HttpHeaders,
- NgProgressModule, NgbModule, SimpleNotificationsModule.forRoot()],
+ CommonModule, HttpModule, RouterModule, TidyTableModule, 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,APIService, ProcOnSrvSideSvc,
- ParamShareService, MappingEditorService
- ]
+ providers: [HttpUtilService, EmitterService, NotificationService,
+ UtilityService,
+ ParamShareService, MappingEditorService]
};
}
-}
+} \ No newline at end of file