summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2018-08-29 17:01:32 +0300
committerIttay Stern <ittay.stern@att.com>2019-02-18 18:35:30 +0200
commit6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch)
tree936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts
parent67d99f816cc583643c35193197594cf78d8ce60a (diff)
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts76
1 files changed, 76 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts
new file mode 100644
index 000000000..dc72f8f12
--- /dev/null
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.service.ts
@@ -0,0 +1,76 @@
+import {Injectable} from '@angular/core';
+import {DefaultDataGeneratorService} from "../../../shared/services/defaultDataServiceGenerator/default.data.generator.service";
+import {NgRedux} from "@angular-redux/store";
+import {AppState} from "../../../shared/store/reducers";
+import {MessageBoxData} from "../../../shared/components/messageBox/messageBox.data";
+import {MessageBoxService} from "../../../shared/components/messageBox/messageBox.service";
+import * as _ from "lodash";
+import { SdcUiCommon} from "onap-ui-angular";
+import {SharedTreeService} from "../objectsToTree/shared.tree.service";
+
+export class AvailableNodeIcons {
+ addIcon: boolean;
+ vIcon: boolean;
+
+ constructor(addIcon: boolean, vIcon: boolean) {
+ this.addIcon = addIcon;
+ this.vIcon = vIcon;
+ }
+}
+
+@Injectable()
+export class AvailableModelsTreeService {
+ constructor(private _defaultDataGeneratorService: DefaultDataGeneratorService,
+ private store: NgRedux<AppState>,
+ public _shareTreeService : SharedTreeService) {
+ }
+
+
+
+ shouldOpenDialog(type: string, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean {
+ if (!isEcompGeneratedNaming || this._defaultDataGeneratorService.requiredFields[type].length > 0) {
+ return true;
+ }
+
+ if (dynamicInputs) {
+ for(let input of dynamicInputs) {
+ if (input.isRequired && _.isEmpty(input.value)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ getOptionalVNFs(serviceUUID: string, vnfOriginalModelName : string) : any[] {
+ let result = [];
+ if(!_.isNil(this.store.getState().service.serviceInstance) && !_.isNil(this.store.getState().service.serviceInstance[serviceUUID])){
+ const serviceVNFsInstances = this.store.getState().service.serviceInstance[serviceUUID].vnfs;
+ for(let vnfKey in serviceVNFsInstances){
+ if(serviceVNFsInstances[vnfKey].originalName === vnfOriginalModelName){
+ serviceVNFsInstances[vnfKey].vnfStoreKey = vnfKey;
+ result.push(serviceVNFsInstances[vnfKey]);
+ }
+ }
+ }
+
+
+ return result;
+ }
+
+
+
+ addingAlertAddingNewVfModuleModal() : void {
+ let messageBoxData : MessageBoxData = new MessageBoxData(
+ "Select a parent", // modal title
+ "There are multiple instances on the right side that can contain this vf-module Please select the VNF instance, to add this vf-module to, on the right side and then click the + sign",
+ SdcUiCommon.ModalType.warning,
+ SdcUiCommon.ModalSize.medium,
+ [
+ {text:"Close", size:"medium", closeModal:true}
+ ]);
+
+ MessageBoxService.openModal.next(messageBoxData);
+ }
+
+}