From 4ef3ee778fc944cdfe28146d4eed360ce096e5ee Mon Sep 17 00:00:00 2001 From: Yoav Schneiderman Date: Wed, 8 Jan 2020 14:46:14 +0200 Subject: Upgrade to Angular 8 Issue-ID: VID-742 Change-Id: Ic4b3aae71d4c946e23d854847a49aa7e020c465d Signed-off-by: Yoav Schneiderman --- .../integration/iFrames/drawingBoard.e2e.ts | 2 +- vid-webpack-master/package.json | 41 ++-- vid-webpack-master/pom.xml | 4 +- .../src/app/drawingBoard/drawingBoard.module.ts | 9 +- .../available-models-tree.component.ts | 2 +- .../drawing-board-header.component.ts | 2 +- .../drawing-board-header.service.spec.ts | 1 + .../dragAndDrop/dragAndDrop.service.ts | 2 - .../drawing-board-tree.component.ts | 8 +- .../duplicate/duplicate.service.spec.ts | 6 +- .../duplicate/duplicate.service.ts | 7 +- .../models/network/network.model.info.ts | 4 +- .../objectsToTree/models/vnf/vnf.model.info.ts | 3 +- .../objectToInstanceTree.service.spec.ts | 8 +- .../objectToModelTree.service.spec.ts | 4 + .../objectsToTree/objectToTree.service.ts | 6 +- .../objectsToTree/shared.tree.service.spec.ts | 4 + .../service-planning/service-planning.component.ts | 4 +- .../instantiationStatus.component.ts | 2 +- .../auditInfoModal/auditInfoModal.component.ts | 2 +- .../customButton/custom-button.component.html | 16 ++ .../customButton/custom-button.component.scss | 273 +++++++++++++++++++++ .../customButton/custom-button.component.ts | 65 +++++ .../components/customButton/models/mode.model.ts | 10 + .../modalButton/modal-button.component.html | 16 ++ .../modalButton/modal-button.component.scss | 273 +++++++++++++++++++++ .../modalButton/modal-button.component.ts | 28 +++ .../modal-close-button.component.ts | 36 +++ .../directives/ripple-click.animation.directive.ts | 47 ++++ .../components/customModal/modal.component.html | 46 ++++ .../components/customModal/modal.component.ts | 166 +++++++++++++ .../components/customModal/models/button.type.ts | 8 + .../customModal/models/modal-button.model.ts | 15 ++ .../components/customModal/models/modal.model.ts | 26 ++ .../customModal/models/modal.placement.ts | 6 + .../components/customModal/models/modal.size.ts | 7 + .../components/customModal/models/modal.type.ts | 10 + .../services/create-dynamic-component.service.ts | 107 ++++++++ .../customModal/services/modal.service.ts | 64 +++++ .../component/file/file.formControl.component.ts | 2 +- .../component/input/input.formControl.component.ts | 2 +- .../basic.popup.service.spec.ts | 4 +- .../network/network.popup.service.spec.ts | 3 +- .../service/service.popup.service.spec.ts | 4 +- .../vfModule/vfModule.popup.service.spec.ts | 4 +- .../vfModule.upgrade.popup.service.spec.ts | 3 +- .../components/messageBox/messageBox.component.ts | 6 +- .../search-elements-modal.component.ts | 2 +- .../app/shared/services/aaiService/aai.epics.ts | 12 +- vid-webpack-master/src/app/shared/shared.module.ts | 30 ++- vid-webpack-master/src/app/shared/store/module.ts | 0 .../vlanTagging/form-async/form-async.component.ts | 2 +- .../network-selector/network-selector.component.ts | 2 +- .../src/app/vlanTagging/vlan-tagging.component.ts | 11 +- 54 files changed, 1343 insertions(+), 84 deletions(-) mode change 100644 => 100755 vid-webpack-master/package.json create mode 100644 vid-webpack-master/src/app/shared/components/customButton/custom-button.component.html create mode 100644 vid-webpack-master/src/app/shared/components/customButton/custom-button.component.scss create mode 100644 vid-webpack-master/src/app/shared/components/customButton/custom-button.component.ts create mode 100644 vid-webpack-master/src/app/shared/components/customButton/models/mode.model.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.html create mode 100644 vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.scss create mode 100644 vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/components/modalCloseButton/modal-close-button.component.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/directives/ripple-click.animation.directive.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/modal.component.html create mode 100644 vid-webpack-master/src/app/shared/components/customModal/modal.component.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/models/button.type.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/models/modal-button.model.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/models/modal.model.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/models/modal.placement.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/models/modal.size.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/models/modal.type.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/services/create-dynamic-component.service.ts create mode 100644 vid-webpack-master/src/app/shared/components/customModal/services/modal.service.ts mode change 100644 => 100755 vid-webpack-master/src/app/shared/services/aaiService/aai.epics.ts mode change 100644 => 100755 vid-webpack-master/src/app/shared/store/module.ts diff --git a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts index cf870b7b9..078e5578b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts @@ -350,7 +350,7 @@ describe('Drawing board', function () { cy.drawingBoardTreeClickOnContextMenuOptionByName('Remove'); cy.get('.title').contains('Remove VNF'); - cy.get('.sdc-button').contains('Remove VNF').click(); + cy.get('.custom-button').contains('Remove VNF').click(); // assert vfModules are disabled after remove parent vnf cy.get('.tree-node-disabled div[data-tests-id="node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1"]') .should('be.visible'); diff --git a/vid-webpack-master/package.json b/vid-webpack-master/package.json old mode 100644 new mode 100755 index ee04de10d..1843de030 --- a/vid-webpack-master/package.json +++ b/vid-webpack-master/package.json @@ -30,24 +30,23 @@ "private": true, "dependencies": { "@angular-redux/store": "9.0.0", - "@angular/animations": "7.1.4", + "@angular/animations": "8.2.14", "@angular/cdk": "7.2.2", - "@angular/common": "7.1.4", - "@angular/compiler": "7.1.4", - "@angular/core": "7.1.4", - "@angular/forms": "7.1.4", - "@angular/http": "7.1.4", + "@angular/common": "8.2.14", + "@angular/compiler": "8.2.14", + "@angular/core": "8.2.14", + "@angular/forms": "8.2.14", "@angular/material": "7.2.2", - "@angular/platform-browser": "7.1.4", - "@angular/platform-browser-dynamic": "7.1.4", - "@angular/platform-server": "7.1.4", - "@angular/router": "7.1.4", + "@angular/platform-browser": "8.2.14", + "@angular/platform-browser-dynamic": "8.2.14", + "@angular/platform-server": "8.2.14", + "@angular/router": "8.2.14", "@harmowatch/ngx-redux-core": "0.2.2", - "@nicky-lenaers/ngx-scroll-to": "^0.6.1", + "@nicky-lenaers/ngx-scroll-to": "3.0.1", "@turf/turf": "5.1.6", "@types/lodash": "4.14.121", "angular-svg-icon": "5.0.0", - "angular-tree-component": "8.4.0", + "angular-tree-component": "8.5.2", "angular2-datatable": "0.6.0", "angular2-multiselect-dropdown": "2.5.0", "angular5-csv": "^0.2.10", @@ -65,6 +64,7 @@ "ngx-datatable": "1.0.3", "ngx-moment": "^2.0.0-rc.0", "ngx-tooltip": "0.0.9", + "node-sass": "^4.13.0", "npm": "^6.4.1", "redux": "4.0.1", "redux-observable": "^1.0.0", @@ -72,14 +72,14 @@ "rxjs-compat": "^6.3.3", "slnodejs": "^2.1.124", "tslib": "1.9.x", - "zone.js": "^0.8.26" + "zone.js": "~0.9.1" }, "devDependencies": { "@angular-builders/jest": "7.3.1", - "@angular-devkit/build-angular": "0.13.1", - "@angular/cli": "7.3.1", - "@angular/compiler-cli": "7.2.5", - "@angular/language-service": "7.2.5", + "@angular-devkit/build-angular": "~0.803.21", + "@angular/cli": "8.3.21", + "@angular/compiler-cli": "8.2.14", + "@angular/language-service": "8.2.14", "@babel/preset-env": "7.3.1", "@bahmutov/add-typescript-to-cypress": "2.0.0", "@types/chai": "4.1.7", @@ -88,7 +88,7 @@ "@types/node": "^10.12.18", "angular2-template-loader": "0.6.2", "babel-jest": "24.1.0", - "codelyzer": "4.5.0", + "codelyzer": "^5.0.1", "cypress": "3.6.1", "hammerjs": "2.0.8", "husky": "^1.3.1", @@ -99,14 +99,15 @@ "jest-sonar-reporter": "2.0.0", "ngx-wallaby-jest": "0.0.1", "npm-run-all": "^4.1.5", - "onap-ui-angular": "5.2.4", + "onap-ui-angular": "5.2.7", "onap-ui-common": "1.0.105", "prettier": "1.16.4", "pretty-quick": "^1.10.0", + "redux-observable-es6-compat": "^1.2.1", "ts-mockito": "2.3.1", "ts-node": "~5.0.1", "tslint": "^5.12.0", - "typescript": "3.1.6", + "typescript": "3.5.3", "wallaby-webpack": "^3.9.11", "webpack": "^4.28.2" }, diff --git a/vid-webpack-master/pom.xml b/vid-webpack-master/pom.xml index 6cc56aae6..b632b9f1c 100644 --- a/vid-webpack-master/pom.xml +++ b/vid-webpack-master/pom.xml @@ -135,8 +135,8 @@ - v8.9.4 - 5.6.0 + v10.15.3 + 6.9.0 diff --git a/vid-webpack-master/src/app/drawingBoard/drawingBoard.module.ts b/vid-webpack-master/src/app/drawingBoard/drawingBoard.module.ts index 25d170320..7e59f1741 100644 --- a/vid-webpack-master/src/app/drawingBoard/drawingBoard.module.ts +++ b/vid-webpack-master/src/app/drawingBoard/drawingBoard.module.ts @@ -36,6 +36,8 @@ import {ComponentInfoComponent} from './service-planning/component-info/componen import {ComponentInfoService} from "./service-planning/component-info/component-info.service"; import {NetworkStepService} from "./service-planning/objectsToTree/models/vrf/vrfModal/networkStep/network.step.service"; import {VpnStepService} from "./service-planning/objectsToTree/models/vrf/vrfModal/vpnStep/vpn.step.service"; +import {ModalModule} from "onap-ui-angular/dist/modals/modal.module"; +import {ModalService} from "../shared/components/customModal/services/modal.service"; @NgModule({ @@ -48,7 +50,8 @@ import {VpnStepService} from "./service-planning/objectsToTree/models/vrf/vrfMod CommonModule, SdcUiComponentsModule, SharedModule.forRoot(), - FeatureFlagModule.forRoot()], + FeatureFlagModule.forRoot(), + ModalModule], providers: [ AaiService, ObjectToTreeService, @@ -64,7 +67,7 @@ import {VpnStepService} from "./service-planning/objectsToTree/models/vrf/vrfMod DynamicInputsService, InstanceTreeGenerator, SharedTreeService, - SdcUiServices.ModalService, + ModalService, SdcUiServices.LoaderService, CreateDynamicComponentService, ComponentInfoService, @@ -83,7 +86,7 @@ import {VpnStepService} from "./service-planning/objectsToTree/models/vrf/vrfMod SearchComponent, ComponentInfoComponent], entryComponents: [DuplicateVnfComponent], - exports: [AvailableModelsTreeComponent, DrawingBoardTreeComponent, DrawingBoardHeader, TreeNodeHeaderPropertiesComponent, SearchComponent] + exports: [AvailableModelsTreeComponent, DrawingBoardTreeComponent, DrawingBoardHeader, TreeNodeHeaderPropertiesComponent, SearchComponent, DuplicateVnfComponent] }) export class DrawingBoardModule { diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts index 13147b7e5..7475c77c7 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts @@ -88,7 +88,7 @@ export class AvailableModelsTreeComponent { @Output() highlightInstances: EventEmitter = new EventEmitter(); - @ViewChild('tree') tree: TreeComponent; + @ViewChild('tree', {static: false}) tree: TreeComponent; nodes = []; service = {name: ''}; diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts index 8228f9531..395b5f3bf 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts @@ -80,7 +80,7 @@ export class DrawingBoardHeader { } - @ViewChild(ContextMenuComponent) public contextMenu: ContextMenuComponent; + @ViewChild(ContextMenuComponent, {static: false}) public contextMenu: ContextMenuComponent; editViewEdit(): void { window.parent.location.assign(this._drawingBoardHeaderService.generateOldViewEditPath()); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts index 7e28b2a65..8ecb3963a 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.spec.ts @@ -26,6 +26,7 @@ class MockAppStore{ } } +class MockDragAndDropService {} describe('Generate path to old View/Edit ', () => { let injector; let service: DrawingBoardHeaderService; diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts index 96e50178b..2daaaaf71 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts @@ -1,9 +1,7 @@ import {Injectable} from "@angular/core"; import {NgRedux} from "@angular-redux/store"; import {AppState} from "../../../../shared/store/reducers"; -import {DragAndDropModel} from "./dragAndDrop.model"; import {FeatureFlagsService, Features} from "../../../../shared/services/featureFlag/feature-flags.service"; -import * as _ from 'lodash'; @Injectable() export class DragAndDropService { diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts index 4ad1b06cf..a195cf019 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts @@ -13,7 +13,6 @@ import {DrawingBoardTreeService, TreeNodeContextMenuModel} from "./drawing-board import {NetworkPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/network/network.popup.service"; import {VfModulePopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service"; import {VnfPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service"; -import {SdcUiServices} from "onap-ui-angular"; import {HighlightPipe} from "../../../shared/pipes/highlight/highlight-filter.pipe"; import {VnfGroupPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service"; import {ObjectToInstanceTreeService} from "../objectsToTree/objectToInstanceTree/objectToInstanceTree.service"; @@ -29,6 +28,7 @@ import {ComponentInfoModel} from "../component-info/component-info-model"; import {ObjectToModelTreeService} from "../objectsToTree/objectToModelTree/objectToModelTree.service"; import {DrawingBoardModes} from "../drawing-board.modes"; import {ServiceInstanceActions} from "../../../shared/models/serviceInstanceActions"; +import {ModalService} from "../../../shared/components/customModal/services/modal.service"; @Component({ selector: 'drawing-board-tree', @@ -52,7 +52,7 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { static triggerDeleteActionService: Subject = new Subject(); static triggerUndoDeleteActionService: Subject = new Subject(); static triggerreCalculateIsDirty: Subject = new Subject(); - @ViewChild(ContextMenuComponent) public contextMenu: ContextMenuComponent; + @ViewChild(ContextMenuComponent, {static: false}) public contextMenu: ContextMenuComponent; constructor(private _contextMenuService: ContextMenuService, private _iframeService: IframeService, @@ -60,7 +60,7 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { private store: NgRedux, private route: ActivatedRoute, private _duplicateService: DuplicateService, - private modalService: SdcUiServices.ModalService, + private modalService: ModalService, private _drawingBoardTreeService: DrawingBoardTreeService, private _networkPopupService: NetworkPopupService, private _vfModulePopuopService: VfModulePopupService, @@ -120,7 +120,7 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { @Output() highlightNode: EventEmitter = new EventEmitter(); - @ViewChild('tree') tree: TreeComponent; + @ViewChild('tree', {static: false}) tree: TreeComponent; missingDataTooltip: string = Constants.Error.MISSING_VNF_DETAILS; currentNode: ITreeNode = null; flags: any; diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.spec.ts index 6423e8ad1..2f8ece283 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.spec.ts @@ -2,12 +2,12 @@ import {DuplicateService} from './duplicate.service'; import {LogService} from '../../../shared/utils/log/log.service'; import {NgRedux} from '@angular-redux/store'; import {ITreeNode} from "angular-tree-component/dist/defs/api"; -import {SdcUiServices} from "onap-ui-angular"; -import {IModalConfig} from 'onap-ui-angular/dist/components/common'; import {AppState} from "../../../shared/store/reducers"; import {getTestBed, TestBed} from "@angular/core/testing"; import {FeatureFlagsService} from "../../../shared/services/featureFlag/feature-flags.service"; import {SharedTreeService} from "../objectsToTree/shared.tree.service"; +import {IModalConfig} from "../../../shared/components/customModal/models/modal.model"; +import {ModalService} from "../../../shared/components/customModal/services/modal.service"; class MockAppStore { getState(){ @@ -73,7 +73,7 @@ describe('Drawing board tree service', () => { LogService, {provide: FeatureFlagsService, useClass: MockFeatureFlagsService}, {provide: NgRedux, useClass: MockAppStore}, - {provide: SdcUiServices.ModalService, useClass: MockModalService} + {provide: ModalService, useClass: MockModalService} ] }); await TestBed.compileComponents(); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.ts index c8338cbfc..c3a5a28c0 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/duplicate/duplicate.service.ts @@ -8,19 +8,20 @@ import {VfModuleMap} from "../../../shared/models/vfModulesMap"; import * as _ from "lodash"; import {DefaultDataGeneratorService} from "../../../shared/services/defaultDataServiceGenerator/default.data.generator.service"; import {TypeNodeInformation} from "../typeNodeInformation.model"; -import {SdcUiCommon, SdcUiServices} from "onap-ui-angular"; +import {SdcUiCommon} from "onap-ui-angular"; import {changeInstanceCounter, duplicateBulkInstances} from "../../../shared/storeUtil/utils/general/general.actions"; import {IModalConfig} from "onap-ui-angular/dist/modals/models/modal-config"; import {FeatureFlagsService} from "../../../shared/services/featureFlag/feature-flags.service"; import {Utils} from "../../../shared/utils/utils"; import {SharedTreeService} from "../objectsToTree/shared.tree.service"; +import {ModalService} from "../../../shared/components/customModal/services/modal.service"; @Injectable() export class DuplicateService { constructor(private _logService: LogService, private sharedTreeService : SharedTreeService, - private _store: NgRedux, modalService: SdcUiServices.ModalService) { + private _store: NgRedux, modalService: ModalService) { this.modalService = modalService; } @@ -35,7 +36,7 @@ export class DuplicateService { maxNumberOfDuplicate: number = 0; storeKey: string = null; padding = '0000'; - modalService: SdcUiServices.ModalService; + modalService: ModalService; store: NgRedux; existingNames: { [key: string]: any }; currentNode: ITreeNode = null; diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts index 486ac93c0..b03d37f50 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts @@ -16,7 +16,6 @@ import {AvailableNodeIcons} from "../../../available-models-tree/available-model import {DuplicateVnfComponent} from "../../../duplicate/duplicate-vnf.component"; import {changeInstanceCounter, removeInstance} from "../../../../../shared/storeUtil/utils/general/general.actions"; import {IframeService} from "../../../../../shared/utils/iframe.service"; -import {SdcUiServices} from "onap-ui-angular"; import {DuplicateService} from "../../../duplicate/duplicate.service"; import {ServiceInstanceActions} from "../../../../../shared/models/serviceInstanceActions"; import {deleteActionNetworkInstance, undoDeleteActionNetworkInstance, updateNetworkPosition} from "../../../../../shared/storeUtil/utils/network/network.actions"; @@ -24,6 +23,7 @@ import {IModalConfig} from "onap-ui-angular/dist/modals/models/modal-config"; import {ComponentInfoType} from "../../../component-info/component-info-model"; import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; +import {ModalService} from "../../../../../shared/components/customModal/services/modal.service"; export class NetworkModelInfo implements ILevelNodeInfo { constructor(private _dynamicInputsService: DynamicInputsService, @@ -31,7 +31,7 @@ export class NetworkModelInfo implements ILevelNodeInfo { private _dialogService: DialogService, private _networkPopupService: NetworkPopupService, private _duplicateService: DuplicateService, - private modalService: SdcUiServices.ModalService, + private modalService: ModalService, private _iframeService: IframeService, private _featureFlagsService: FeatureFlagsService, private _store: NgRedux) { diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts index 355b5c597..c3c33a1be 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts @@ -31,6 +31,7 @@ import {ComponentInfoService} from "../../../component-info/component-info.servi import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; +import {ModalService} from "../../../../../shared/components/customModal/services/modal.service"; export class VnfModelInfo implements ILevelNodeInfo { constructor(private _dynamicInputsService: DynamicInputsService, @@ -41,7 +42,7 @@ export class VnfModelInfo implements ILevelNodeInfo { private _vfModulePopupService: VfModulePopupService, private _vfModuleUpgradePopupService: VfModuleUpgradePopupService, private _duplicateService: DuplicateService, - private modalService: SdcUiServices.ModalService, + private modalService: ModalService, private _iframeService: IframeService, private _componentInfoService: ComponentInfoService, private _featureFlagsService: FeatureFlagsService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts index 1cec62b2c..1ba9a239c 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts @@ -27,13 +27,15 @@ import {VfModuleControlGenerator} from "../../../../shared/components/genericFor import {VnfGroupPopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service"; import {VnfGroupControlGenerator} from "../../../../shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator"; import {DuplicateService} from "../../duplicate/duplicate.service"; -import {SdcUiComponentsModule, SdcUiServices} from "onap-ui-angular"; +import {SdcUiComponentsModule} from "onap-ui-angular"; import {ErrorMsgService} from "../../../../shared/components/error-msg/error-msg.service"; import {ComponentInfoService} from "../../component-info/component-info.service"; import {NetworkStepService} from "../models/vrf/vrfModal/networkStep/network.step.service"; import {VpnStepService} from "../models/vrf/vrfModal/vpnStep/vpn.step.service"; import {VfModuleUpgradePopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; import {SharedControllersService} from "../../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../../shared/components/customModal/services/modal.service"; +import {CreateDynamicComponentService} from "../../../../shared/components/customModal/services/create-dynamic-component.service"; class MockAppStore { getState() { @@ -86,9 +88,11 @@ describe('Model Tree Generator service', () => { DialogService, ErrorMsgService, ComponentInfoService, - SdcUiServices.ModalService, + ModalService, NetworkStepService, VpnStepService, + ModalService, + CreateDynamicComponentService, { provide: NgRedux, useClass: MockAppStore }, MockNgRedux] }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts index 0f7bf9a61..ec6f2a4c5 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts @@ -37,6 +37,8 @@ import {VpnStepService} from "../models/vrf/vrfModal/vpnStep/vpn.step.service"; import {NetworkStepService} from "../models/vrf/vrfModal/networkStep/network.step.service"; import {VfModuleUpgradePopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; import {SharedControllersService} from "../../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../../shared/components/customModal/services/modal.service"; +import {CreateDynamicComponentService} from "../../../../shared/components/customModal/services/create-dynamic-component.service"; class MockAppStore { getState() { @@ -112,6 +114,8 @@ describe('Model Tree Generator service', () => { ComponentInfoService, NetworkStepService, VpnStepService, + ModalService, + CreateDynamicComponentService, SharedControllersService, {provide: NgRedux, useClass: MockAppStore}, MockNgRedux ] diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts index 9b68627e2..8eef4a08d 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts @@ -15,7 +15,6 @@ import {VfModulePopupService} from "../../../shared/components/genericFormPopup/ import {VnfGroupingModelInfo} from "./models/vnfGrouping/vnfGrouping.model.info"; import {VnfGroupPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service"; import {DuplicateService} from "../duplicate/duplicate.service"; -import {SdcUiServices} from "onap-ui-angular"; import {IframeService} from "../../../shared/utils/iframe.service"; import {ComponentInfoService} from "../component-info/component-info.service"; import {PnfModelInfo} from "./models/pnf/pnf.model.info"; @@ -26,6 +25,7 @@ import {NetworkStepService} from "./models/vrf/vrfModal/networkStep/network.step import {VpnStepService} from "./models/vrf/vrfModal/vpnStep/vpn.step.service"; import { VfModuleUpgradePopupService } from "../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; import {FeatureFlagsService} from "../../../shared/services/featureFlag/feature-flags.service"; +import {ModalService} from "../../../shared/components/customModal/services/modal.service"; @Injectable() export class ObjectToTreeService { @@ -39,7 +39,7 @@ export class ObjectToTreeService { private _vfModuleUpgradePopupService : VfModuleUpgradePopupService, private _vnfGroupPopupService : VnfGroupPopupService, private _duplicateService : DuplicateService, - private _modalService: SdcUiServices.ModalService, + private _modalService: ModalService, private _iframeService : IframeService, private _componentInfoService : ComponentInfoService, private _networkStepService : NetworkStepService, @@ -50,8 +50,6 @@ export class ObjectToTreeService { } - - /*********************************************************** * return all first optional first level of the model tree ************************************************************/ diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts index 3a65b93ef..f89950c61 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts @@ -42,6 +42,8 @@ import {VpnStepService} from "./models/vrf/vrfModal/vpnStep/vpn.step.service"; import {NetworkStepService} from "./models/vrf/vrfModal/networkStep/network.step.service"; import {VfModuleUpgradePopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; import {SharedControllersService} from "../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../shared/components/customModal/services/modal.service"; +import {CreateDynamicComponentService} from "../../../shared/components/customModal/services/create-dynamic-component.service"; class MockAppStore { getState() { @@ -114,6 +116,8 @@ describe('Shared Tree Service', () => { ComponentInfoService, NetworkStepService, VpnStepService, + ModalService, + CreateDynamicComponentService, {provide: NgRedux, useClass: MockAppStore} ] }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/service-planning.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/service-planning.component.ts index cbe8445ca..59988f7c3 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/service-planning.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/service-planning.component.ts @@ -26,8 +26,8 @@ export class ServicePlanningComponent implements OnInit { } pageMode: DrawingBoardModes = DrawingBoardModes.CREATE; - @ViewChild(DrawingBoardTreeComponent) drawingModelTree; - @ViewChild(AvailableModelsTreeComponent) availableModelTree; + @ViewChild(DrawingBoardTreeComponent, {static: false}) drawingModelTree; + @ViewChild(AvailableModelsTreeComponent, {static: false}) availableModelTree; isShowTree(): boolean { return true; diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts index 4f84b7125..f27faac60 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts @@ -39,7 +39,7 @@ export class InstantiationStatusComponent implements OnInit { instantiationStatusComponentService: InstantiationStatusComponentService; configurationService : ConfigurationService; serviceInfoData: ServiceInfoModel[] = null; - @ViewChild(ContextMenuComponent) public contextMenu: ContextMenuComponent; + @ViewChild(ContextMenuComponent, {static: false}) public contextMenu: ContextMenuComponent; public contextMenuActions: Array = [ { diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts index 95e9825da..665b8d13f 100644 --- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts +++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts @@ -19,7 +19,7 @@ import {AuditInfoModalComponentService} from "./auditInfoModal.component.service export class AuditInfoModalComponent { static openModal: Subject = new Subject(); static openInstanceAuditInfoModal: Subject<{instanceId , type, model, instance}> = new Subject<{instanceId , type, model, instance}>(); - @ViewChild('auditInfoModal') public auditInfoModal: ModalDirective; + @ViewChild('auditInfoModal', {static: false}) public auditInfoModal: ModalDirective; title: string = 'Service Instantiation Information'; modelInfoItems: ModelInformationItem[] = []; serviceModel: ServiceModel; diff --git a/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.html b/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.html new file mode 100644 index 000000000..753a3923b --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.html @@ -0,0 +1,16 @@ +
+ + +
diff --git a/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.scss b/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.scss new file mode 100644 index 000000000..89f90d44d --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.scss @@ -0,0 +1,273 @@ +.custom-button { + order: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: inline-flex; + align-items: center; + justify-content: center; + flex-direction: row; + outline: none; + border-radius: 2px; + padding: 0 12px; + height: 36px; + line-height: 36px; + width: 120px; + min-width: 90px; + cursor: pointer; + text-align: center; + text-transform: uppercase; + font-family: OpenSans-Regular, Arial, sans-serif; + font-style: normal; + font-weight: 400; + font-size: 14px; + /*** Sizes ***/ + /*** Sizes ***/ + /*** Buttons with icons ***/ +} + +.custom-button:disabled { + cursor: default; +} + +.custom-button.sdc-button__primary { + border: 1px solid transparent; + background-color: #009fdb; + color: #ffffff; +} + +.custom-button.sdc-button__primary:not(:disabled):hover, .custom-button.sdc-button__primary:not(:disabled):active { + background-color: #1eb9f3; +} + +.custom-button.sdc-button__primary:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #1eb9f3; + box-shadow: 0px 0px 0px 1px #1eb9f3; +} + +.custom-button.sdc-button__primary:disabled { + background: #9dd9ef; +} + +.custom-button.sdc-button__secondary { + border: 1px solid #009fdb; + background-color: transparent; + color: #009fdb; +} + +.custom-button.sdc-button__secondary:not(:disabled):hover, .custom-button.sdc-button__secondary:not(:disabled):active { + background-color: #1eb9f3; + color: #ffffff; +} + +.custom-button.sdc-button__secondary:not(:disabled):focus:not(:active) { + color: #1eb9f3; + box-shadow: inset 0px 0px 0px 0px #0568ae, 0px 0px 0px 1px #009fdb; +} + +.custom-button.sdc-button__secondary:not(:disabled):focus:not(:active):hover { + color: #ffffff; +} + +.custom-button.sdc-button__secondary:disabled { + color: #9dd9ef; + border-color: #9dd9ef; +} + +.custom-button.sdc-button__link { + background-color: transparent; + color: #009fdb; + fill: #009fdb; + border: none; +} + +.custom-button.sdc-button__link:not(:disabled):hover, .custom-button.sdc-button__link:not(:disabled):active { + color: #1eb9f3; +} + +.custom-button.sdc-button__link:not(:disabled):focus:not(:active) { + border: 1px solid #0568ae; + color: #1eb9f3; +} + +.custom-button.sdc-button__link:disabled { + color: #9dd9ef; +} + +.custom-button.sdc-button__success { + border: 1px solid transparent; + background-color: #4ca90c; + color: #ffffff; +} + +.custom-button.sdc-button__success:not(:disabled):hover, .custom-button.sdc-button__success:not(:disabled):active { + background-color: #57c00e; +} + +.custom-button.sdc-button__success:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #57c00e; + box-shadow: 0px 0px 0px 1px #57c00e; +} + +.custom-button.sdc-button__success:disabled { + background: #a5d485; +} + +.custom-button.sdc-button__error, .custom-button.sdc-button__alert { + border: 1px solid transparent; + background-color: #cf2a2a; + color: #ffffff; +} + +.custom-button.sdc-button__error:not(:disabled):hover, .custom-button.sdc-button__error:not(:disabled):active, .custom-button.sdc-button__alert:not(:disabled):hover, .custom-button.sdc-button__alert:not(:disabled):active { + background-color: #ed4141; +} + +.custom-button.sdc-button__error:not(:disabled):focus:not(:active), .custom-button.sdc-button__alert:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #ed4141; + box-shadow: 0px 0px 0px 1px #ed4141; +} + +.custom-button.sdc-button__error:disabled, .custom-button.sdc-button__alert:disabled { + background: #f4adad; +} + +.custom-button.sdc-button__warning { + border: 1px solid transparent; + background-color: #ffb81c; + color: #ffffff; +} + +.custom-button.sdc-button__warning:not(:disabled):hover, .custom-button.sdc-button__warning:not(:disabled):active { + background-color: #f6c632; +} + +.custom-button.sdc-button__warning:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #f6c632; + box-shadow: 0px 0px 0px 1px #f6c632; +} + +.custom-button.sdc-button__warning:disabled { + background: #ffdb8d; +} + +.custom-button.sdc-button__info { + border: 1px solid transparent; + background-color: #009fdb; + color: #ffffff; +} + +.custom-button.sdc-button__info:not(:disabled):hover, .custom-button.sdc-button__info:not(:disabled):active { + background-color: #1eb9f3; +} + +.custom-button.sdc-button__info:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #1eb9f3; + box-shadow: 0px 0px 0px 1px #1eb9f3; +} + +.custom-button.sdc-button__info:disabled { + background: #9dd9ef; +} + +.custom-button.sdc-button__file-opener input[type=file] { + height: 36px; + opacity: 0; + position: absolute; + cursor: pointer; +} + +.custom-button.btn-xx-large { + width: 350px; +} + +.custom-button.btn-xx-large input[type=file] { + width: 350px; +} + +.custom-button.btn-x-large { + width: 250px; +} + +.custom-button.btn-x-large input[type=file] { + width: 250px; +} + +.custom-button.btn-large { + width: 180px; +} + +.custom-button.btn-large input[type=file] { + width: 180px; +} + +.custom-button.btn-medium { + width: 140px; +} + +.custom-button.btn-medium input[type=file] { + width: 140px; +} + +.custom-button.btn-small { + width: 110px; +} + +.custom-button.btn-small input[type=file] { + width: 110px; +} + +.custom-button.btn-x-small { + width: 90px; +} + +.custom-button.btn-x-small input[type=file] { + width: 90px; +} + +.custom-button.btn-default { + width: auto; +} + +.custom-button.btn-default input[type=file] { + width: auto; +} + +.custom-button.sdc-icon-right { + flex-direction: row-reverse; +} + +.custom-button.sdc-icon-right .svg-icon { + margin-left: 15px; +} + +.custom-button.sdc-icon-left { + flex-direction: row; +} + +.custom-button.sdc-icon-left .svg-icon { + margin-right: 15px; +} + +.custom-button svg { + display: inline-block; + vertical-align: middle; +} + +.sdc-button__wrapper { + display: inline-flex; +} + +.sdc-button__spinner { + padding-top: 6px; + margin: 0 2px; +} + +.sdc-button__spinner.left { + order: 2; +} diff --git a/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.ts b/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.ts new file mode 100644 index 000000000..61fa02832 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customButton/custom-button.component.ts @@ -0,0 +1,65 @@ +import {Component, HostBinding, Input, OnInit} from "@angular/core"; +import {IButtonComponent} from "../customModal/models/modal-button.model"; +import {ButtonType} from "../customModal/models/button.type"; +import {Mode} from "./models/mode.model"; +import {Placement} from "../customModal/models/modal.placement"; + + +@Component({ + selector: "sdc-button", + templateUrl: './custom-button.component.html', + styleUrls: ['./custom-button.component.scss'] + +}) + +export class CustomButtonComponent implements OnInit, IButtonComponent { + @Input() public text: string; + @Input() public disabled: boolean; + @Input() public type: ButtonType; + @Input() public icon_mode: Mode; + @Input() public size: string; + @Input() public preventDoubleClick: boolean; + @Input() public icon_name: string; + @Input() public icon_position: string; + @Input() public show_spinner: boolean; + @Input() public spinner_position: Placement; + @Input() public testId: string; + + public placement = Placement; + private lastClick: Date; + public iconPositionClass: string; + + @HostBinding('class.sdc-button__wrapper') true; + + constructor() { + this.type = ButtonType.primary; + this.size = "default"; + this.disabled = false; + } + + public ngOnInit(): void { + this.iconPositionClass = this.icon_position ? 'sdc-icon-' + this.icon_position : ''; + } + + public onClick = (e): void => { + const now: Date = new Date(); + if (this.preventDoubleClick && this.lastClick && (now.getTime() - this.lastClick.getTime()) <= 500) { + e.preventDefault(); + e.stopPropagation(); + } + this.lastClick = now; + } + + public disableButton = () => { + if (!this.disabled) { + this.disabled = true; + } + } + + public enableButton = () => { + if (this.disabled) { + this.disabled = false; + } + } + +} diff --git a/vid-webpack-master/src/app/shared/components/customButton/models/mode.model.ts b/vid-webpack-master/src/app/shared/components/customButton/models/mode.model.ts new file mode 100644 index 000000000..c8a7ddef3 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customButton/models/mode.model.ts @@ -0,0 +1,10 @@ +export enum Mode { + primary = 'primary', + primary2 = 'primary2', + secondary = 'secondary', + success = 'success', + error = 'error', + warning = 'warning', + info = 'info', + white = 'white' +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.html b/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.html new file mode 100644 index 000000000..753a3923b --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.html @@ -0,0 +1,16 @@ +
+ + +
diff --git a/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.scss b/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.scss new file mode 100644 index 000000000..89f90d44d --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.scss @@ -0,0 +1,273 @@ +.custom-button { + order: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: inline-flex; + align-items: center; + justify-content: center; + flex-direction: row; + outline: none; + border-radius: 2px; + padding: 0 12px; + height: 36px; + line-height: 36px; + width: 120px; + min-width: 90px; + cursor: pointer; + text-align: center; + text-transform: uppercase; + font-family: OpenSans-Regular, Arial, sans-serif; + font-style: normal; + font-weight: 400; + font-size: 14px; + /*** Sizes ***/ + /*** Sizes ***/ + /*** Buttons with icons ***/ +} + +.custom-button:disabled { + cursor: default; +} + +.custom-button.sdc-button__primary { + border: 1px solid transparent; + background-color: #009fdb; + color: #ffffff; +} + +.custom-button.sdc-button__primary:not(:disabled):hover, .custom-button.sdc-button__primary:not(:disabled):active { + background-color: #1eb9f3; +} + +.custom-button.sdc-button__primary:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #1eb9f3; + box-shadow: 0px 0px 0px 1px #1eb9f3; +} + +.custom-button.sdc-button__primary:disabled { + background: #9dd9ef; +} + +.custom-button.sdc-button__secondary { + border: 1px solid #009fdb; + background-color: transparent; + color: #009fdb; +} + +.custom-button.sdc-button__secondary:not(:disabled):hover, .custom-button.sdc-button__secondary:not(:disabled):active { + background-color: #1eb9f3; + color: #ffffff; +} + +.custom-button.sdc-button__secondary:not(:disabled):focus:not(:active) { + color: #1eb9f3; + box-shadow: inset 0px 0px 0px 0px #0568ae, 0px 0px 0px 1px #009fdb; +} + +.custom-button.sdc-button__secondary:not(:disabled):focus:not(:active):hover { + color: #ffffff; +} + +.custom-button.sdc-button__secondary:disabled { + color: #9dd9ef; + border-color: #9dd9ef; +} + +.custom-button.sdc-button__link { + background-color: transparent; + color: #009fdb; + fill: #009fdb; + border: none; +} + +.custom-button.sdc-button__link:not(:disabled):hover, .custom-button.sdc-button__link:not(:disabled):active { + color: #1eb9f3; +} + +.custom-button.sdc-button__link:not(:disabled):focus:not(:active) { + border: 1px solid #0568ae; + color: #1eb9f3; +} + +.custom-button.sdc-button__link:disabled { + color: #9dd9ef; +} + +.custom-button.sdc-button__success { + border: 1px solid transparent; + background-color: #4ca90c; + color: #ffffff; +} + +.custom-button.sdc-button__success:not(:disabled):hover, .custom-button.sdc-button__success:not(:disabled):active { + background-color: #57c00e; +} + +.custom-button.sdc-button__success:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #57c00e; + box-shadow: 0px 0px 0px 1px #57c00e; +} + +.custom-button.sdc-button__success:disabled { + background: #a5d485; +} + +.custom-button.sdc-button__error, .custom-button.sdc-button__alert { + border: 1px solid transparent; + background-color: #cf2a2a; + color: #ffffff; +} + +.custom-button.sdc-button__error:not(:disabled):hover, .custom-button.sdc-button__error:not(:disabled):active, .custom-button.sdc-button__alert:not(:disabled):hover, .custom-button.sdc-button__alert:not(:disabled):active { + background-color: #ed4141; +} + +.custom-button.sdc-button__error:not(:disabled):focus:not(:active), .custom-button.sdc-button__alert:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #ed4141; + box-shadow: 0px 0px 0px 1px #ed4141; +} + +.custom-button.sdc-button__error:disabled, .custom-button.sdc-button__alert:disabled { + background: #f4adad; +} + +.custom-button.sdc-button__warning { + border: 1px solid transparent; + background-color: #ffb81c; + color: #ffffff; +} + +.custom-button.sdc-button__warning:not(:disabled):hover, .custom-button.sdc-button__warning:not(:disabled):active { + background-color: #f6c632; +} + +.custom-button.sdc-button__warning:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #f6c632; + box-shadow: 0px 0px 0px 1px #f6c632; +} + +.custom-button.sdc-button__warning:disabled { + background: #ffdb8d; +} + +.custom-button.sdc-button__info { + border: 1px solid transparent; + background-color: #009fdb; + color: #ffffff; +} + +.custom-button.sdc-button__info:not(:disabled):hover, .custom-button.sdc-button__info:not(:disabled):active { + background-color: #1eb9f3; +} + +.custom-button.sdc-button__info:not(:disabled):focus:not(:active) { + border: 1px solid #ffffff; + background-color: #1eb9f3; + box-shadow: 0px 0px 0px 1px #1eb9f3; +} + +.custom-button.sdc-button__info:disabled { + background: #9dd9ef; +} + +.custom-button.sdc-button__file-opener input[type=file] { + height: 36px; + opacity: 0; + position: absolute; + cursor: pointer; +} + +.custom-button.btn-xx-large { + width: 350px; +} + +.custom-button.btn-xx-large input[type=file] { + width: 350px; +} + +.custom-button.btn-x-large { + width: 250px; +} + +.custom-button.btn-x-large input[type=file] { + width: 250px; +} + +.custom-button.btn-large { + width: 180px; +} + +.custom-button.btn-large input[type=file] { + width: 180px; +} + +.custom-button.btn-medium { + width: 140px; +} + +.custom-button.btn-medium input[type=file] { + width: 140px; +} + +.custom-button.btn-small { + width: 110px; +} + +.custom-button.btn-small input[type=file] { + width: 110px; +} + +.custom-button.btn-x-small { + width: 90px; +} + +.custom-button.btn-x-small input[type=file] { + width: 90px; +} + +.custom-button.btn-default { + width: auto; +} + +.custom-button.btn-default input[type=file] { + width: auto; +} + +.custom-button.sdc-icon-right { + flex-direction: row-reverse; +} + +.custom-button.sdc-icon-right .svg-icon { + margin-left: 15px; +} + +.custom-button.sdc-icon-left { + flex-direction: row; +} + +.custom-button.sdc-icon-left .svg-icon { + margin-right: 15px; +} + +.custom-button svg { + display: inline-block; + vertical-align: middle; +} + +.sdc-button__wrapper { + display: inline-flex; +} + +.sdc-button__spinner { + padding-top: 6px; + margin: 0 2px; +} + +.sdc-button__spinner.left { + order: 2; +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.ts b/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.ts new file mode 100644 index 000000000..d93c67851 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.ts @@ -0,0 +1,28 @@ +import {Component, EventEmitter, HostListener, Input, Output} from "@angular/core"; +import {CustomButtonComponent} from "../../../customButton/custom-button.component"; + +@Component({ + selector: "custom-modal-button", + templateUrl: './modal-button.component.html', + styleUrls: ['./modal-button.component.scss'] +}) +export class CustomModalButtonComponent extends CustomButtonComponent { + + @Input() public id?: string; + @Input() public callback: Function; + @Input() public closeModal: boolean; + @Output() closeModalEvent: EventEmitter = new EventEmitter(); + @HostListener('click') invokeCallback = (): void => { + if (this.callback) { + this.callback(); + } + if (this.closeModal) { + this.closeModalEvent.emit(); + } + } + + constructor() { + super(); + this.closeModal = false; + } +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/components/modalCloseButton/modal-close-button.component.ts b/vid-webpack-master/src/app/shared/components/customModal/components/modalCloseButton/modal-close-button.component.ts new file mode 100644 index 000000000..a3e741a32 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/components/modalCloseButton/modal-close-button.component.ts @@ -0,0 +1,36 @@ +import {Component, ComponentRef, Input} from "@angular/core"; +import {ModalComponent} from "../../modal.component"; +import {CustomButtonComponent} from "../../../customButton/custom-button.component"; +import {RippleAnimationAction} from "../../directives/ripple-click.animation.directive"; + + +@Component({ + selector: "sdc-modal-close-button", + template: ` +
+ +
+ ` +}) +export class ModalCloseButtonComponent extends CustomButtonComponent { + + @Input() testId: string; + @Input() disabled: boolean; + @Input() modalInstanceRef: ComponentRef; + + public rippleAnimationAction: RippleAnimationAction = RippleAnimationAction.MOUSE_ENTER; + + constructor() { + super(); + } + + public closeModal = (btnName: string): void => { + this.modalInstanceRef.instance.closeModal(btnName); + } +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/directives/ripple-click.animation.directive.ts b/vid-webpack-master/src/app/shared/components/customModal/directives/ripple-click.animation.directive.ts new file mode 100644 index 000000000..d343d5dc2 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/directives/ripple-click.animation.directive.ts @@ -0,0 +1,47 @@ +import { Directive, Input, HostBinding, HostListener } from "@angular/core"; + +export enum RippleAnimationAction { + CLICK = 0, + MOUSE_ENTER = 1 +} + +@Directive({ + selector: `[customRippleClickAnimation]` +}) +export class CustomRippleClickAnimationDirective { + private animated: boolean; + + @Input() rippleClickDisabled: boolean; + @Input() rippleOnAction:RippleAnimationAction = RippleAnimationAction.CLICK; + + @HostBinding('class.sdc-ripple-click__animated') animationClass: string; + + @HostListener('click') onClick() { + if(this.rippleOnAction === RippleAnimationAction.CLICK){ + this.animateStart(); + } + } + + @HostListener('mouseenter') onMouseEnter() { + //console.log("Mouseenter!", this.rippleOnAction); + if(this.rippleOnAction === RippleAnimationAction.MOUSE_ENTER){ + this.animateStart(); + } + } + + private animateStart():void{ + if (!this.rippleClickDisabled) { + this.animated = true; + this.animationClass = 'sdc-ripple-click__animated'; + } + } + @HostListener('animationend') onAnimationComplete() { + this.animated = false; + this.animationClass = ''; + } + + constructor() { + this.rippleClickDisabled = false; + this.animated = false; + } +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/modal.component.html b/vid-webpack-master/src/app/shared/components/customModal/modal.component.html new file mode 100644 index 000000000..11455bc32 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/modal.component.html @@ -0,0 +1,46 @@ +
+ +
+
+ +
+
+ +
+ {{ title }} + + +
+ +
+ +
+
+
+
+
+ + + +
+
+
+ diff --git a/vid-webpack-master/src/app/shared/components/customModal/modal.component.ts b/vid-webpack-master/src/app/shared/components/customModal/modal.component.ts new file mode 100644 index 000000000..eb001c068 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/modal.component.ts @@ -0,0 +1,166 @@ +import { + Component, + ComponentRef, + EventEmitter, + Input, + OnInit, + Output, + Renderer, + ViewChild, + ViewContainerRef +} from "@angular/core"; +import {animate, style, transition, trigger} from "@angular/animations"; +import {TitleIconDetails} from "./models/modal.model"; +import {ModalType} from "./models/modal.type"; +import {DomSanitizer, SafeHtml} from "@angular/platform-browser"; +import {ModalCloseButtonComponent} from "./components/modalCloseButton/modal-close-button.component"; +import {CustomModalButtonComponent} from "./components/modalButton/modal-button.component"; + +@Component({ + selector: 'sdc-modal', + templateUrl: './modal.component.html', + animations: [ + trigger('toggleBackground', [ + transition('* => 1', [style({ opacity: 0 }), animate('.45s cubic-bezier(0.23, 1, 0.32, 1)')]), + transition('1 => *', [animate('.35s cubic-bezier(0.23, 1, 0.32, 1)', style({ opacity: 0 }))]) + ]), + trigger('toggleModal', [ + transition('* => 1', [style({ opacity: 0, transform: 'translateY(-80px)' }), animate('.45s cubic-bezier(0.23, 1, 0.32, 1)')]), + transition('1 => *', [style({ opacity: 1, transform: 'translateY(0px)' }), animate('.35s ease-in-out', style({ opacity: 0, transform: 'translateY(-80px)' }))]) + ]) + ] +}) + +export class ModalComponent implements OnInit { + + @Input() size: string; 'xl|l|md|sm|xsm'; + @Input() title: string; + @Input() titleIcon: TitleIconDetails; + @Input() message: string; + @Input() buttons: CustomModalButtonComponent[]; + @Input() type: ModalType; + @Input() testId: string; + @Input() isDisabled: boolean; + @Input() instanceRef: ComponentRef; // the component ref is injected to the component in order to destroy the componet from itself + + @Output() onClose : EventEmitter = new EventEmitter(); + + @ViewChild('modalCloseButton', {static: false}) + set refCloseButton(_modalCloseButton: ModalCloseButtonComponent) { + this.modalCloseButton = _modalCloseButton; + } + + modalVisible: boolean; + // Allows for custom component as body instead of simple message. + @ViewChild('dynamicContentContainer', { read: ViewContainerRef, static: true }) dynamicContentContainer: ViewContainerRef; + innerModalContent: ComponentRef; + + public calculatedTestId: string; + public modalCloseButton: ModalCloseButtonComponent; + public svgIconContentSafeHtml: SafeHtml; + + + private infoSvg = ` + + `; + private warningSvg = ``; + private errorSvg = ` + `; + private successSvg = ``; + private noSvg = ``; + + constructor(private renderer: Renderer, + private domSanitizer: DomSanitizer) { + this.modalVisible = true; + } + + ngOnInit() { + + switch (this.type) { + case ModalType.info: + this.svgIconContentSafeHtml = this.domSanitizer.bypassSecurityTrustHtml(this.infoSvg); + break; + case ModalType.warning: + this.svgIconContentSafeHtml = this.domSanitizer.bypassSecurityTrustHtml(this.warningSvg); + break; + case ModalType.error: + this.svgIconContentSafeHtml = this.domSanitizer.bypassSecurityTrustHtml(this.errorSvg); + break; + case ModalType.success: + this.svgIconContentSafeHtml = this.domSanitizer.bypassSecurityTrustHtml(this.successSvg); + break; + default: + this.svgIconContentSafeHtml = this.domSanitizer.bypassSecurityTrustHtml(this.noSvg); + } + } + + public modalToggled = (toggleEvent: any) => { + if (!toggleEvent.toState) { + this.instanceRef.destroy(); + } + } + + public getCloseButton = (): ModalCloseButtonComponent => { + return this.modalCloseButton; + } + + public getButtonById = (id: string): CustomModalButtonComponent => { + // Support ES5 + // return this.buttons.find((button) => { + return this.buttons.filter((button) => { + return button.id && button.id === id; + })[0]; + } + + public getButtons = (): CustomModalButtonComponent[] => { + return this.buttons; + } + + public setButtons = (_buttons: CustomModalButtonComponent[]): void => { + this.buttons = _buttons; + } + + public getTitle = (): string => { + return this.title; + } + + public setTitle = (_title: string): void => { + this.title = _title; + } + + public hoverAnimation(evn: MouseEvent) { + this.renderer.setElementClass(evn.target as HTMLElement, 'sdc-ripple-click__animated', true); + // evn.taregt.classList.add('sdc-ripple-click__animated'); + } + + public closeModal = (btnName : string): void => { + this.onClose.emit(btnName); + this.modalVisible = false; + } + + public disabledModal = (isDisabled: boolean): void => { + this.isDisabled = isDisabled; + this.buttons.forEach((button: CustomModalButtonComponent) => { + button.disabled = isDisabled; + }); + this.modalCloseButton.disabled = false; + } +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/models/button.type.ts b/vid-webpack-master/src/app/shared/components/customModal/models/button.type.ts new file mode 100644 index 000000000..a0673013d --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/models/button.type.ts @@ -0,0 +1,8 @@ +export enum ButtonType { + primary = 'primary', + secondary = 'secondary', + success = 'success', + error = 'error', + warning = 'warning', + info = 'info' +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/models/modal-button.model.ts b/vid-webpack-master/src/app/shared/components/customModal/models/modal-button.model.ts new file mode 100644 index 000000000..5e1f4a4a8 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/models/modal-button.model.ts @@ -0,0 +1,15 @@ +import {ButtonType} from "onap-ui-angular/dist/dist/common"; +import {Placement} from "./modal.placement"; + +export interface IButtonComponent { + text: string; + disabled?: boolean; + type?: ButtonType; + testId?: string; + preventDoubleClick?: boolean; + icon_name?: string; + icon_position?: string; + show_spinner?: boolean; + spinner_position?: Placement; + size?: string; +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/models/modal.model.ts b/vid-webpack-master/src/app/shared/components/customModal/models/modal.model.ts new file mode 100644 index 000000000..4b814f0aa --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/models/modal.model.ts @@ -0,0 +1,26 @@ +import {ModalType} from "./modal.type"; +import {IButtonComponent} from "./modal-button.model"; + +export interface IModalConfig { + size?: string; // xl|l|md|sm|xsm + title?: string; + titleIcon?: TitleIconDetails; + message?: string; + buttons?: IModalButtonComponent[]; + testId?: string; + type?: ModalType; +} + +export interface IModalButtonComponent extends IButtonComponent { + id?: string; + callback?: () => void; + closeModal?: boolean; +} + +export interface TitleIconDetails { + iconName?: string; + iconMode?: string; + iconSize?: string; +} + + diff --git a/vid-webpack-master/src/app/shared/components/customModal/models/modal.placement.ts b/vid-webpack-master/src/app/shared/components/customModal/models/modal.placement.ts new file mode 100644 index 000000000..f7f229cd4 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/models/modal.placement.ts @@ -0,0 +1,6 @@ +export enum Placement { + left = 'left', + right = 'right', + top = 'top', + bottom = 'bottom' +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/models/modal.size.ts b/vid-webpack-master/src/app/shared/components/customModal/models/modal.size.ts new file mode 100644 index 000000000..0a96810c7 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/models/modal.size.ts @@ -0,0 +1,7 @@ +export enum ModalSize { + xlarge = "xl", + large = "l", + medium = "md", + small = "sm", + xsmall = "xsm" +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/models/modal.type.ts b/vid-webpack-master/src/app/shared/components/customModal/models/modal.type.ts new file mode 100644 index 000000000..ca987ebba --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/models/modal.type.ts @@ -0,0 +1,10 @@ +export enum ModalType { + info = 'info', + warning = 'warning', + error = 'error', + success = 'success', + action = 'action', + custom = 'custom' +} + + diff --git a/vid-webpack-master/src/app/shared/components/customModal/services/create-dynamic-component.service.ts b/vid-webpack-master/src/app/shared/components/customModal/services/create-dynamic-component.service.ts new file mode 100644 index 000000000..64fe66ce6 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/services/create-dynamic-component.service.ts @@ -0,0 +1,107 @@ +import { + ApplicationRef, + ComponentFactoryResolver, + ComponentRef, + EmbeddedViewRef, + Injectable, + Injector, Type, ViewContainerRef +} from "@angular/core"; + +@Injectable() +export class CreateDynamicComponentService { + + constructor(private componentFactoryResolver: ComponentFactoryResolver, + private applicationRef: ApplicationRef, + private injector: Injector) { + } + + /** + * Gets the root view container to inject the component to. + * + * @returns {ComponentRef} + * + * @memberOf InjectionService + */ + private getRootViewContainer(): ComponentRef { + const rootComponents = this.applicationRef['components']; + if (rootComponents.length) { + return rootComponents[0]; + } + throw new Error('View Container not found! ngUpgrade needs to manually set this via setRootViewContainer.'); + } + + /** + * Gets the html element for a component ref. + * + * @param {ComponentRef} componentRef + * @returns {HTMLElement} + * + * @memberOf InjectionService + */ + private getComponentRootNode(componentRef: ComponentRef): HTMLElement { + return (componentRef.hostView as EmbeddedViewRef).rootNodes[0] as HTMLElement; + } + + /** + * Gets the root component container html element. + * + * @returns {HTMLElement} + * + * @memberOf InjectionService + */ + private getRootViewContainerNode(): HTMLElement { + return this.getComponentRootNode(this.getRootViewContainer()); + } + + /** + * Projects the inputs onto the component + * + * @param {ComponentRef} component + * @param {*} options + * @returns {ComponentRef} + * + * @memberOf InjectionService + */ + private projectComponentInputs(component: ComponentRef, options: any): ComponentRef { + if (options) { + const props = Object.getOwnPropertyNames(options); + for (const prop of props) { + component.instance[prop] = options[prop]; + } + } + + return component; + } + + public createComponentDynamically(componentClass: Type, options: any = {}, location: Element = this.getRootViewContainerNode()): ComponentRef { + const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass); + const componentRef = componentFactory.create(this.injector); + const componentRootNode = this.getComponentRootNode(componentRef); + + // project the options passed to the component instance + this.projectComponentInputs(componentRef, options); + this.applicationRef.attachView(componentRef.hostView); + + componentRef.onDestroy(() => { + this.applicationRef.detachView(componentRef.hostView); + }); + + location.appendChild(componentRootNode); + return componentRef; + } + + /** + * Inserts a component into an existing viewContainer + * @param componentType - type of component to create + * @param options - Inputs to project on new component + * @param vcRef - viewContainerRef in which to insert the newly created component + */ + public insertComponentDynamically(componentType: Type, options: any = {}, vcRef: ViewContainerRef): ComponentRef { + const factory = this.componentFactoryResolver.resolveComponentFactory(componentType); + const dynamicComponent = factory.create(vcRef.parentInjector); + this.projectComponentInputs(dynamicComponent, options); + vcRef.insert(dynamicComponent.hostView); + return dynamicComponent; + } + +} diff --git a/vid-webpack-master/src/app/shared/components/customModal/services/modal.service.ts b/vid-webpack-master/src/app/shared/components/customModal/services/modal.service.ts new file mode 100644 index 000000000..f46ee4896 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customModal/services/modal.service.ts @@ -0,0 +1,64 @@ +import {ComponentRef, Injectable, Type} from "@angular/core"; +import {CreateDynamicComponentService} from "./create-dynamic-component.service"; +import {ModalType} from "../models/modal.type"; +import {ButtonType} from "../models/button.type"; +import {ModalButtonComponent} from "onap-ui-angular/dist/modals/modal-button.component"; +import {ModalSize} from "../models/modal.size"; +import {IModalConfig} from "../models/modal.model"; +import {ModalComponent} from "../modal.component"; + + +@Injectable() +export class ModalService { + + constructor(private createDynamicComponentService: CreateDynamicComponentService) { + } + + private getBaseModal = (type: ModalType | ButtonType, title: string, message: string, testId: string, buttons?: ModalButtonComponent[]): ModalComponent => { + const modalConfig = { + size: ModalSize.small, + title: title, + message: message, + testId: testId, + buttons: buttons ? buttons : [{text: 'OK', type: type, closeModal: true}], + type: type + } as IModalConfig; + const modalInstance: ComponentRef = this.openModal(modalConfig); + return modalInstance.instance; + }; + + /* Shortcut method to open basic modals with title, message, and OK button that simply closes the modal. */ + public openInfoModal = (title: string, message: string, testId: string, buttons?: ModalButtonComponent[]): ModalComponent => { + + return this.getBaseModal(ModalType.info, title, message, testId, buttons); + }; + + public openWarningModal = (title: string, message: string, testId: string, buttons?: ModalButtonComponent[]): ModalComponent => { + return this.getBaseModal(ModalType.warning, title, message, testId, buttons); + }; + + public openErrorModal = (title: string, message: string, testId: string, buttons?: ModalButtonComponent[]): ModalComponent => { + return this.getBaseModal(ModalType.error, title, message, testId, buttons); + }; + + public openSuccessModal = (title: string, message: string, testId: string, buttons?: ModalButtonComponent[]): ModalComponent => { + return this.getBaseModal(ModalType.success, title, message, testId, buttons); + }; + + public openCustomModal = (modalConfig: IModalConfig, dynamicComponentType: Type, dynamicComponentInput?: any) => { + const modalInstance: ComponentRef = this.openModal(modalConfig); + this.createInnnerComponent(modalInstance, dynamicComponentType, dynamicComponentInput); + return modalInstance.instance; + }; + + public createInnnerComponent = (modalInstance: ComponentRef, dynamicComponentType: Type, dynamicComponentInput?: any): void => { + modalInstance.instance.innerModalContent = this.createDynamicComponentService.insertComponentDynamically(dynamicComponentType, dynamicComponentInput, modalInstance.instance.dynamicContentContainer); + }; + + public openModal = (customModalData: IModalConfig): ComponentRef => { + let modalInstance: ComponentRef = this.createDynamicComponentService.createComponentDynamically(ModalComponent, customModalData); + modalInstance.instance.instanceRef = modalInstance; + return modalInstance; + } + +} diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts b/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts index 2c2172005..aadf13ebe 100644 --- a/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts +++ b/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts @@ -11,7 +11,7 @@ import {FileFormControl} from "../../../../models/formControlModels/fileFormCont export class FileFormControlComponent { @Input() data: FileFormControl = null; @Input() form: FormGroup; - @ViewChild('fileUploader') + @ViewChild('fileUploader', {static: false}) fileUploader:ElementRef ; onDelete(event, data, form) { diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/input/input.formControl.component.ts b/vid-webpack-master/src/app/shared/components/formControls/component/input/input.formControl.component.ts index 1e8c28104..7a7ab72d0 100644 --- a/vid-webpack-master/src/app/shared/components/formControls/component/input/input.formControl.component.ts +++ b/vid-webpack-master/src/app/shared/components/formControls/component/input/input.formControl.component.ts @@ -9,7 +9,7 @@ import {FormGroup} from "@angular/forms"; }) export class InputFormControlComponent{ - @ViewChild('customInput') element:ElementRef; + @ViewChild('customInput', {static: false}) element:ElementRef; @Input() data: InputFormControl = null; @Input() form: FormGroup; diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.spec.ts index 9bcc02d73..13438929b 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.spec.ts @@ -11,9 +11,9 @@ import {IframeService} from "../../../utils/iframe.service"; import {DefaultDataGeneratorService} from "../../../services/defaultDataServiceGenerator/default.data.generator.service"; import {FormControlModel} from "../../../models/formControlModels/formControl.model"; import {BasicPopupService} from "./basic.popup.service"; -import {SdcUiServices} from "onap-ui-angular"; import {FeatureFlagsService} from "../../../services/featureFlag/feature-flags.service"; import {getTestBed, TestBed} from "@angular/core/testing"; +import {ModalService} from "../../customModal/services/modal.service"; class MockAppStore {} @@ -1996,7 +1996,7 @@ describe('Basic popup service', () => { {provide:FeatureFlagsService, useClass: MockFeatureFlagsService}, {provide: NgRedux, useClass: MockReduxStore}, {provide: HttpClient, useClass: MockAppStore}, - {provide: SdcUiServices.ModalService, useClass: MockModalService} + {provide: ModalService, useClass: MockModalService} ] }); await TestBed.compileComponents(); diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/network/network.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/network/network.popup.service.spec.ts index 34d6850eb..a32320ea4 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/network/network.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/network/network.popup.service.spec.ts @@ -14,6 +14,7 @@ import {BasicPopupService} from "../basic.popup.service"; import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service"; import {getTestBed, TestBed} from "@angular/core/testing"; import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../customModal/services/modal.service"; class MockAppStore {} @@ -2001,7 +2002,7 @@ describe('Network popup service', () => { {provide:FeatureFlagsService, useClass: MockFeatureFlagsService}, {provide: NgRedux, useClass: MockReduxStore}, {provide: HttpClient, useClass: MockAppStore}, - {provide: SdcUiServices.ModalService, useClass: MockModalService} + {provide: ModalService, useClass: MockModalService} ] }); await TestBed.compileComponents(); diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts index 3a106ec93..6d996930a 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts @@ -11,10 +11,10 @@ import {BasicPopupService} from "../basic.popup.service"; import {ServicePopupService} from "./service.popup.service"; import {ServiceControlGenerator} from "../../../genericForm/formControlsServices/service.control.generator"; import {FormControlModel} from "../../../../models/formControlModels/formControl.model"; -import {SdcUiServices} from "onap-ui-angular"; import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service"; import {getTestBed, TestBed} from "@angular/core/testing"; import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../customModal/services/modal.service"; class MockModalService {} @@ -2067,7 +2067,7 @@ describe('Service popup service', () => { {provide:FeatureFlagsService, useClass: MockFeatureFlagsService}, {provide: NgRedux, useClass: MockReduxStore}, {provide: HttpClient, useClass: MockAppStore}, - {provide: SdcUiServices.ModalService, useClass: MockModalService} + {provide: ModalService, useClass: MockModalService} ] }); await TestBed.compileComponents(); diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts index b16c5bdc0..85626528b 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts @@ -10,10 +10,10 @@ import {DefaultDataGeneratorService} from "../../../../services/defaultDataServi import {BasicPopupService} from "../basic.popup.service"; import {VfModulePopupService} from "./vfModule.popup.service"; import {VfModuleControlGenerator} from "../../../genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator"; -import {SdcUiServices} from "onap-ui-angular"; import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service"; import {getTestBed, TestBed} from "@angular/core/testing"; import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../customModal/services/modal.service"; class MockModalService {} @@ -1996,7 +1996,7 @@ describe('VFModule popup service', () => { {provide:FeatureFlagsService, useClass: MockFeatureFlagsService}, {provide: NgRedux, useClass: MockReduxStore}, {provide: HttpClient, useClass: MockAppStore}, - {provide: SdcUiServices.ModalService, useClass: MockModalService} + {provide: ModalService, useClass: MockModalService} ] }); await TestBed.compileComponents(); diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts index 2ca992f08..94def926a 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts @@ -26,6 +26,7 @@ import {ServiceActions} from "../../../../storeUtil/utils/service/service.action import {FormControlModel} from "../../../../models/formControlModels/formControl.model"; import * as _ from "lodash"; import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {ModalService} from "../../../customModal/services/modal.service"; class MockModalService {} @@ -87,7 +88,7 @@ describe('VFModule popup service', () => { {provide: FeatureFlagsService, useClass: MockFeatureFlagsService}, {provide: NgRedux, useClass: MockReduxStore}, {provide: HttpClient, useClass: MockAppStore}, - {provide: SdcUiServices.ModalService, useClass: MockModalService} + {provide: ModalService, useClass: MockModalService} ] }); await TestBed.compileComponents(); diff --git a/vid-webpack-master/src/app/shared/components/messageBox/messageBox.component.ts b/vid-webpack-master/src/app/shared/components/messageBox/messageBox.component.ts index c610110fd..5251a0aae 100644 --- a/vid-webpack-master/src/app/shared/components/messageBox/messageBox.component.ts +++ b/vid-webpack-master/src/app/shared/components/messageBox/messageBox.component.ts @@ -30,7 +30,7 @@ import { Component } from '@angular/core'; import { MessageBoxData} from './messageBox.data'; import { MessageBoxService } from './messageBox.service'; -import { SdcUiServices} from "onap-ui-angular"; +import {ModalService} from "../customModal/services/modal.service"; @Component({ selector: 'message-box', @@ -38,9 +38,9 @@ import { SdcUiServices} from "onap-ui-angular"; }) export class MessageBoxComponent { - modalService: SdcUiServices.ModalService; + modalService: ModalService; isOpened : boolean = false; - constructor(modalService: SdcUiServices.ModalService, private _messageBoxService : MessageBoxService) { + constructor(modalService: ModalService, private _messageBoxService : MessageBoxService) { this.modalService = modalService; MessageBoxService.openModal.subscribe((messageBoxData: MessageBoxData) => { diff --git a/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts b/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts index 47f849059..7d9561c9a 100644 --- a/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts +++ b/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts @@ -44,7 +44,7 @@ export class SearchElementsModalComponent extends DialogComponent<{ modalInforma }) } - @ViewChild('ElementsTableComponent') membersTable; + @ViewChild('ElementsTableComponent', {static: false}) membersTable; ngOnInit(selectedRowsIds?: string[]): void { const genericModalHelper = this._store.getState().global.genericModalHelper; diff --git a/vid-webpack-master/src/app/shared/services/aaiService/aai.epics.ts b/vid-webpack-master/src/app/shared/services/aaiService/aai.epics.ts old mode 100644 new mode 100755 index a850d55da..3a05157ae --- a/vid-webpack-master/src/app/shared/services/aaiService/aai.epics.ts +++ b/vid-webpack-master/src/app/shared/services/aaiService/aai.epics.ts @@ -22,7 +22,6 @@ import { updateProductFamilies, updateUserId } from "../../storeUtil/utils/general/general.actions"; import {createServiceInstance} from "../../storeUtil/utils/service/service.actions"; -import {delay, mapTo} from "rxjs/operators"; const notFetchedAlready = (state: AppState): boolean => state.service.productFamilies !== null; @@ -30,7 +29,6 @@ const notFetchedAlready = (state: AppState): boolean => state.service.productFam export class AAIEpics { constructor(private aaiService: AaiService) { } - public createEpic() { return combineEpics( this.loadProductFamiliesEpic @@ -49,7 +47,11 @@ export class AAIEpics { private loadProductFamiliesEpic = (action$, store) => action$ .ofType(LOAD_PRODUCT_FAMILIES) - .switchMap(() => this.aaiService.getProductFamilies().map(data => updateProductFamilies(data))); + .switchMap(() => + this.aaiService.getProductFamilies() + .map(data => + updateProductFamilies(data) + )); private loadCategoryParameters = (action$, store) => action$ .ofType(LOAD_CATEGORY_PARAMETERS) @@ -64,7 +66,9 @@ export class AAIEpics { private loadServiceAccordingToUuid = (action$, store) => action$ .ofType(LOAD_SERVICE_MDOEL_BY_UUID) .switchMap((action) => this.aaiService.getServiceModelById(action.modelId) - .map(data => createServiceInstance(action.uuid, data))); + .map(data => + createServiceInstance(action.uuid, data)) + ); private loadUserId = (action$, store) => action$ .ofType(LOAD_USER_ID) diff --git a/vid-webpack-master/src/app/shared/shared.module.ts b/vid-webpack-master/src/app/shared/shared.module.ts index f95f86149..98db41d41 100644 --- a/vid-webpack-master/src/app/shared/shared.module.ts +++ b/vid-webpack-master/src/app/shared/shared.module.ts @@ -80,6 +80,15 @@ import {SearchFilterPipe} from "./pipes/searchFilter/search-filter.pipe"; import {RecreateResolver} from "./resolvers/recreate/recreate.resolver"; import {InstantiationTemplatesService} from "./services/templateService/instantiationTemplates.service"; import {SharedControllersService} from "./components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {DuplicateVnfComponent} from "../drawingBoard/service-planning/duplicate/duplicate-vnf.component"; +import {ModalService} from "./components/customModal/services/modal.service"; +import {CreateDynamicComponentService} from "./components/customModal/services/create-dynamic-component.service"; +import {ModalComponent} from "./components/customModal/modal.component"; +import {ModalCloseButtonComponent} from './components/customModal/components/modalCloseButton/modal-close-button.component'; +import {CustomButtonComponent} from "./components/customButton/custom-button.component"; +import {CustomModalButtonComponent} from "./components/customModal/components/modalButton/modal-button.component"; +import {CustomRippleClickAnimationDirective} from "./components/customModal/directives/ripple-click.animation.directive"; + @NgModule({ @@ -110,6 +119,7 @@ import {SharedControllersService} from "./components/genericForm/formControlsSer NumberFormControlComponent, InputPreventionPatternDirective, ClickOutsideDirective, + CustomRippleClickAnimationDirective, FormGeneralErrorsComponent, SpinnerComponent, NoContentMessageAndIconComponent, @@ -133,7 +143,11 @@ import {SharedControllersService} from "./components/genericForm/formControlsSer ErrorMsgComponent, DynamicInputsComponent, DynamicInputLabelPipe, - InstantiationTemplatesModalComponent + InstantiationTemplatesModalComponent, + ModalComponent, + ModalCloseButtonComponent, + CustomButtonComponent, + CustomModalButtonComponent ], exports: [ PopoverComponent, @@ -142,6 +156,7 @@ import {SharedControllersService} from "./components/genericForm/formControlsSer FormControlErrorComponent, DropdownFormControlComponent, InputPreventionPatternDirective, + CustomRippleClickAnimationDirective, ClickOutsideDirective, FormGeneralErrorsComponent, SpinnerComponent, @@ -165,17 +180,24 @@ import {SharedControllersService} from "./components/genericForm/formControlsSer ErrorMsgComponent, SvgComponent, DynamicInputsComponent, - DynamicInputLabelPipe + DynamicInputLabelPipe, + ModalComponent, + ModalCloseButtonComponent, + CustomButtonComponent, + CustomModalButtonComponent ], entryComponents : [ GenericFormPopupComponent, SearchElementsModalComponent, - InstantiationTemplatesModalComponent + InstantiationTemplatesModalComponent, + DuplicateVnfComponent, + ModalComponent ], providers: [ ServiceInfoService, MessageBoxService, - SdcUiServices.ModalService, + CreateDynamicComponentService, + ModalService, SdcUiServices.LoaderService, HttpInterceptorService, IframeService, diff --git a/vid-webpack-master/src/app/shared/store/module.ts b/vid-webpack-master/src/app/shared/store/module.ts old mode 100644 new mode 100755 diff --git a/vid-webpack-master/src/app/vlanTagging/form-async/form-async.component.ts b/vid-webpack-master/src/app/vlanTagging/form-async/form-async.component.ts index 623a4f42f..aa381684c 100644 --- a/vid-webpack-master/src/app/vlanTagging/form-async/form-async.component.ts +++ b/vid-webpack-master/src/app/vlanTagging/form-async/form-async.component.ts @@ -27,7 +27,7 @@ export class Formasync implements OnInit { constructor(private store: NgRedux, private _formAsyncService: FormAsyncService) { } - @ViewChild('form') form: NgForm; + @ViewChild('form', {static: false}) form: NgForm; @Input() set params(params: any) { if (params) { diff --git a/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts b/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts index c0aeb0b51..b7961ea38 100644 --- a/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts +++ b/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts @@ -21,7 +21,7 @@ export class NetworkSelectorComponent implements OnInit { @select(['service', 'networkFunctions']) readonly networkFunctions: Observable; - @ViewChild('form') form: NgForm; + @ViewChild('form', {static: false}) form: NgForm; constructor(store: NgRedux) { this.localStore = store; diff --git a/vid-webpack-master/src/app/vlanTagging/vlan-tagging.component.ts b/vid-webpack-master/src/app/vlanTagging/vlan-tagging.component.ts index 87f117202..43e14e922 100644 --- a/vid-webpack-master/src/app/vlanTagging/vlan-tagging.component.ts +++ b/vid-webpack-master/src/app/vlanTagging/vlan-tagging.component.ts @@ -71,11 +71,8 @@ export class VlanTaggingComponent implements OnInit { readonly userIdObs: Observable; - @ViewChild(NetworkSelectorComponent) - public networkSelectorComponent: NetworkSelectorComponent; - @ViewChild(Formasync) - public formAsync: Formasync; - + @ViewChild(NetworkSelectorComponent, {static: false}) networkSelectorComponent: NetworkSelectorComponent; + @ViewChild(Formasync, {static: false}) formAsync: Formasync; deploySubInterface() { @@ -186,9 +183,9 @@ export class VlanTaggingComponent implements OnInit { isNextButtonDisabled() { switch (this.currentStep) { case WizardSteps.one: - return !this.formAsync.form.valid; + return this.formAsync ? !this.formAsync.form.valid : false; case WizardSteps.two: - return !this.networkSelectorComponent.form.valid; + return this.networkSelectorComponent ? !this.networkSelectorComponent.form.valid : false; } } -- cgit 1.2.3-korg