summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java8
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json2
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts6
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts4
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts6
-rw-r--r--vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts27
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts4
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts5
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts6
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts5
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts4
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html6
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts6
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts2
-rw-r--r--vid-webpack-master/src/app/shared/models/InstantiationBase.ts (renamed from vid-webpack-master/src/app/shared/models/serviceBase.ts)0
-rw-r--r--vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts2
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/global/global.actions.ts13
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.spec.ts39
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.ts15
21 files changed, 126 insertions, 38 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
index 2c954b297..29041839a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
@@ -30,6 +30,7 @@ import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import static org.onap.vid.services.AAIServiceTree.AAI_TREE_PATHS;
+import static org.onap.vid.testUtils.TestUtils.initMockitoMocks;
import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
@@ -52,7 +53,6 @@ import java.util.concurrent.Executors;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship;
@@ -66,7 +66,7 @@ import org.onap.vid.utils.Logging;
import org.onap.vid.utils.Tree;
import org.onap.vid.utils.Unchecked;
import org.springframework.http.HttpMethod;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -82,9 +82,9 @@ public class AAITreeNodeBuilderTest {
private static final ObjectMapper mapper = new ObjectMapper();
- @BeforeClass
+ @BeforeMethod
public void initMocks() {
- MockitoAnnotations.initMocks(this);
+ initMockitoMocks(this);
aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClientMock, logging);
executorService = MoreExecutors.newDirectExecutorService();
}
diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json
index 2846baa54..f6373bfb4 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json
@@ -292,4 +292,4 @@
"orchStatus": "Active",
"modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450",
"testApi": "VNF_API"
-} \ No newline at end of file
+}
diff --git a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
index 4eb5445ad..1fcc82802 100644
--- a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
@@ -22,7 +22,7 @@ describe('Drawing board', function () {
const vnfNodeName = 'node-2017-488_PASQUALE-vPE 0';
cy.drawingBoardPressAddButtonByElementName(vnfNodeName).get('i').should('have.class', 'fa-plus-circle');
cy.drawingBoardPressAddButtonByElementName(vnfNodeName).click({force: true});
- cy.fillVnfPopup(true).then(() => {
+ cy.fillVnfPopup().then(() => {
cy.drawingBoardPressAddButtonByElementName(vnfNodeName).click({force: true});
cy.fillVnfPopup().then(() => {
cy.drawingBoardPressAddButtonByElementName(vnfNodeName).click({force: true});
@@ -41,7 +41,7 @@ describe('Drawing board', function () {
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
- cy.fillVnfPopup(true).then(() => {
+ cy.fillVnfPopup().then(() => {
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
cy.fillVnfPopup().then(() => {
cy.drawingBoardNumberOfExistingElementsShouldContains(2);
@@ -66,7 +66,7 @@ describe('Drawing board', function () {
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle')
.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
- cy.fillVnfPopup(true).then(() => {
+ cy.fillVnfPopup().then(() => {
cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0')
.drawingBoardTreeClickOnContextMenuOptionByName('Duplicate')
.get('.quantity-select option').should('have.length', 9)
diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts
index d5b851ddc..a81270cb0 100644
--- a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts
@@ -71,7 +71,7 @@ describe('Delete vnf instance', function () {
// add a vnf on update mode
cy.drawingBoardPressAddButtonByElementName('node-2017-388_PASQUALE-vPE 0').click({force: true});
cy.selectDropdownOptionByText('rollback', 'Rollback');
- cy.fillVnfPopup(true);
+ cy.fillVnfPopup();
// delete VNF
cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0', 0)
@@ -85,7 +85,7 @@ describe('Delete vnf instance', function () {
cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json').then((expectedResult) => {
expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].trackById = vnf.trackById;
- expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].platformName = 'platform,xxx1';
+ expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].instanceName = '2017-388_PASQUALE-vPE';
cy.deepCompare(expectedResult, xhr.request.body);
});
});
diff --git a/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts
index 3e91f7719..29166f67d 100644
--- a/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts
+++ b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts
@@ -7,14 +7,12 @@ declare namespace Cypress {
duplicateVnf: typeof DuplicateVnf,
}
}
-function FillVnfPopup(changePlatformValue?: boolean): Chainable<any> {
+function FillVnfPopup(): Chainable<any> {
cy.selectDropdownOptionByText('productFamily', 'Emanuel');
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
- if(changePlatformValue === true){
- cy.selectPlatformValue('xxx1')
- }
+ cy.selectPlatformValue('xxx1');
return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{
return done;
});
diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts
index 229beb443..3c45632ee 100644
--- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts
+++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts
@@ -13,7 +13,7 @@ import {Router, UrlTree} from "@angular/router";
import {of} from "rxjs";
import {MsoService} from "../shared/services/msoService/mso.service";
import {ServiceAction} from "../shared/models/serviceInstanceActions";
-import {InstantiationBase} from "../shared/models/serviceBase";
+import {InstantiationBase} from "../shared/models/InstantiationBase";
export let PENDING : string = "pending";
export let INPROGRESS : string = "in_progress";
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts
index 077d849e6..7e2d3f942 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts
@@ -1,9 +1,10 @@
import {getTestBed, TestBed} from '@angular/core/testing';
import {AaiService} from "../../../services/aaiService/aai.service";
-import {FormControlModel, ValidatorModel, ValidatorOptions} from "../../../models/formControlModels/formControl.model";
+import {FormControlModel} from "../../../models/formControlModels/formControl.model";
import {FeatureFlagsService} from "../../../services/featureFlag/feature-flags.service";
import {BasicControlGenerator} from "./basic.control.generator";
import {NgRedux} from '@angular-redux/store';
+import each from "jest-each";
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import {FileFormControl} from "../../../models/formControlModels/fileFormControl.model";
@@ -81,5 +82,27 @@ describe('Basic Control Generator', () => {
"supplementaryFile_hidden_content"
]);
});
-});
+ each([
+ [null, false],
+ [{}, true]
+ ]).
+ test('retrieveInstanceIfUpdateMode returns %s if update mode is %s', (expected, isUpdateModalMode) => {
+ //given
+ const store= <any>{
+ getState() {
+ return {
+ global: {
+ isUpdateModalMode
+ }
+ }}};
+ const instance = {};
+
+ //when
+ let retrievedInstance = service.retrieveInstanceIfUpdateMode (store, instance);
+ //then
+ expect(retrievedInstance).toEqual(expected);
+
+ });
+
+});
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts
index 7ab64753a..aff33982f 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts
@@ -280,6 +280,10 @@ export class BasicControlGenerator {
})
};
+ retrieveInstanceIfUpdateMode(store: NgRedux<AppState>, instance: any): any{
+ return store.getState().global.isUpdateModalMode ? instance : null;
+ }
+
private getOnDeleteForSupplementaryFile() {
return (form: FormGroup) => {
form.controls[SUPPLEMENTARY_FILE + "_hidden"].setValue(null);
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts
index 11c4561c2..19c85a1ff 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts
@@ -73,8 +73,7 @@ export class NetworkControlGenerator {
this._logService.error('should provide serviceId, networkName, networkStoreKey', serviceId);
return [];
}
-
- const networkInstance = this.getNetworkInstance(serviceId, networkStoreKey, isUpdateMode);
+ const networkInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getNetworkInstance(serviceId, networkStoreKey, isUpdateMode));
const networkModel = new NetworkModel(this.store.getState().service.serviceHierarchy[serviceId].networks[networkName]);
let result: FormControlModel[] = [];
@@ -99,7 +98,7 @@ export class NetworkControlGenerator {
}
let result: FormControlModel[] = [];
- const networkInstance = this.getNetworkInstance(serviceId, networkStoreKey, isUpdateMode);
+ const networkInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getNetworkInstance(serviceId, networkStoreKey, isUpdateMode));
const networkModel = new NetworkModel(this.store.getState().service.serviceHierarchy[serviceId].networks[networkName]);
if (!_.isNil(networkModel)) {
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
index 8919c0419..011f43447 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
@@ -92,7 +92,7 @@ export class VfModuleControlGenerator {
}
}
- const vfModuleInstance = this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode);
+ const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
const vfModuleModel = this.vfModuleModel;
const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey];
const vnfModelName: string = vnf.originalName;
@@ -126,11 +126,11 @@ export class VfModuleControlGenerator {
return [];
}
}
- const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey];
+ const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey] ;
const vnfModelName: string = vnf.originalName;
const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfModelName]);
- const vfModuleInstance = this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode);
+ const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
let result: FormControlModel[] = [];
this.pushInstanceAndVGToForm(result, vfModuleInstance, serviceId, vnfModel, true);
result.push(this.getLcpRegionControl(serviceId, vfModuleInstance, result));
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
index ff0a525b5..c45fa968f 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
@@ -73,8 +73,7 @@ export class VnfControlGenerator {
this._logService.error('should provide serviceId, vnfName, vnfStoreKey', serviceId);
return [];
}
-
- const vnfInstance = this.getVnfInstance(serviceId, vnfStoreKey);
+ const vnfInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store,this.getVnfInstance(serviceId, vnfStoreKey));
const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfName]);
let result: FormControlModel[] = [];
const flags = this.store.getState().global.flags;
@@ -99,7 +98,7 @@ export class VnfControlGenerator {
}
let result: FormControlModel[] = [];
- const vnfInstance = this.getVnfInstance(serviceId, vnfStoreKey);
+ const vnfInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store,this.getVnfInstance(serviceId, vnfStoreKey));
const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfName]);
if (!_.isNil(vnfModel)) {
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts
index e503f4d2a..45f5ffa63 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts
@@ -52,7 +52,7 @@ export class VnfGroupControlGenerator {
return [];
}
- const vnfGroupInstance = this.getVnfGroupInstance(serviceId, vnfGroupStoreKey);
+ const vnfGroupInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVnfGroupInstance(serviceId, vnfGroupStoreKey));
const vnfGroupModel = new VnfGroupModel(this.store.getState().service.serviceHierarchy[serviceId].vnfGroups[vnfGroupName]);
let result: FormControlModel[] = [];
@@ -70,7 +70,7 @@ export class VnfGroupControlGenerator {
}
let result: FormControlModel[] = [];
- const vnfGroupInstance = this.getVnfGroupInstance(serviceId, vnfGroupStoreKey);
+ const vnfGroupInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVnfGroupInstance(serviceId, vnfGroupStoreKey));
const vnfGroupModel = new VnfGroupModel(this.store.getState().service.serviceHierarchy[serviceId].vnfGroups[vnfGroupName]);
if (!_.isNil(vnfGroupModel)) {
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
index f9a11eab1..2b2c2a75d 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
@@ -3,7 +3,7 @@
<div class="modal-header">
<button type="button"
class="close"
- (click)="formPopupDetails?.onCancel(formPopupDetails.that,dynamicForm)">&times;
+ (click)="formPopupDetails?.onCancel(formPopupDetails.that,dynamicForm);clearModalIsUpdateMode()">&times;
</button>
<span [attr.data-tests-id]="'create-modal-title'"
class="modal-title">{{formPopupDetails?.title}}
@@ -70,14 +70,14 @@
<button
[attr.data-tests-id]="'cancelButton'"
type="button" class="btn btn-default cancel"
- (click)="formPopupDetails.onCancel(formPopupDetails.that, dynamicForm)"><span>Cancel</span></button>
+ (click)="formPopupDetails.onCancel(formPopupDetails.that, dynamicForm); clearModalIsUpdateMode()"><span>Cancel</span></button>
<input type="submit"
value="Set"
data-tests-id="form-set"
class="btn btn-success submit"
[disabled]="!dynamicForm?.valid"
- (click)="formPopupDetails.onSubmit(formPopupDetails.that, dynamicForm, servicesQty)">
+ (click)="formPopupDetails.onSubmit(formPopupDetails.that, dynamicForm, servicesQty);clearModalIsUpdateMode()">
</div>
</div>
</div>
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
index 3939e44ff..3cd633de6 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
@@ -15,6 +15,7 @@ import {FormControlModel} from "../../models/formControlModels/formControl.model
import {FormGeneralErrorsService} from "../formGeneralErrors/formGeneralErrors.service";
import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service";
import {InstantiationTemplatesModalComponent} from "./instantiationTemplatesModal/instantiation.templates.modal.component";
+import {updateCurrentModalModeAction} from "../../storeUtil/utils/global/global.actions";
export interface PopupModel {
@@ -80,7 +81,12 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
return this.formPopupDetails && this.formPopupDetails.UUIDData['bulkSize'] > 1
}
+ clearModalIsUpdateMode() : void {
+ this._store.dispatch(updateCurrentModalModeAction(null));
+ }
+
ngOnInit(): void {
+ this._store.dispatch(updateCurrentModalModeAction(this.isUpdateMode));
this._route
.queryParams
.subscribe(params => {
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html
index 86c46ab3b..fe08bf086 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html
@@ -148,7 +148,7 @@
</div>
<div class="col-md-6" style="padding: 15px;padding-right: 35px;">
<button
- [disabled]="selectedInstantiation && selectedInstantiation.jobId === null"
+ [disabled]="selectedInstantiation === null"
[attr.data-tests-id]="'LoadTemplateButton'"
type="button" class="btn btn-primary submit"
(click)="loadTemplate()"><span>Load Template</span>
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts
index f4609ee35..e68c34b85 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts
@@ -1,6 +1,6 @@
import * as moment from 'moment';
import * as _ from 'lodash';
-import {InstantiationBase} from "../../../models/serviceBase";
+import {InstantiationBase} from "../../../models/InstantiationBase";
export class InstantiationTemplatesRowModel extends InstantiationBase{
readonly userId ?: string;
diff --git a/vid-webpack-master/src/app/shared/models/serviceBase.ts b/vid-webpack-master/src/app/shared/models/InstantiationBase.ts
index afa8a8136..afa8a8136 100644
--- a/vid-webpack-master/src/app/shared/models/serviceBase.ts
+++ b/vid-webpack-master/src/app/shared/models/InstantiationBase.ts
diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts
index fa26a61a6..5a2b37a7d 100644
--- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts
+++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts
@@ -1,6 +1,6 @@
import {ServiceStatus} from '../../../instantiationStatus/instantiationStatus.component.service';
import {ServiceAction} from "../../models/serviceInstanceActions";
-import {InstantiationBase} from "../../models/serviceBase";
+import {InstantiationBase} from "../../models/InstantiationBase";
export class ServiceInfoModel extends InstantiationBase{
id: number;
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.actions.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.actions.ts
index 4af0243e6..d4e6cf287 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.actions.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.actions.ts
@@ -11,9 +11,15 @@ export enum GlobalActions {
UPDATE_GENERIC_MODAL_TABLE_DATA_HELPER = 'UPDATE_GENERIC_MODAL_TABLE_DATA_HELPER',
DELETE_GENERIC_MODAL_TABLE_DATA_HELPER = 'DELETE_GENERIC_MODAL_TABLE_DATA_HELPER',
UPDATE_GENERIC_CURRNT_VRF_HELPER = 'UPDATE_GENERIC_CURRNT_VRF_HELPER',
- DELETE_GENERIC_CURRNT_VRF_HELPER = 'DELETE_GENERIC_CURRNT_VRF_HELPER'
+ DELETE_GENERIC_CURRNT_VRF_HELPER = 'DELETE_GENERIC_CURRNT_VRF_HELPER',
+ UPDATE_CURRENT_MODAL_MODE = 'UPDATE_CURRENT_MODAL_MODE'
}
+export interface UpdateCurrentModalModeAction extends Action {
+ isUpdateModalMode?: boolean;
+}
+
+
export interface UpdateGlobalAction extends Action {
name?: string;
}
@@ -106,3 +112,8 @@ export const deleteGenericModalTableDataHelper: ActionCreator<DeleteGenericModal
export const clearAllGenericModalhelper: ActionCreator<ClearGenericModalHelper> = (field, uniqObjectField) => ({
type : GlobalActions.CLEAR_ALL_GENERIC_MODAL_HELPER
});
+
+export const updateCurrentModalModeAction: ActionCreator<UpdateCurrentModalModeAction> = (isUpdateModalMode? :boolean) => ({
+ type : GlobalActions.UPDATE_CURRENT_MODAL_MODE,
+ isUpdateModalMode
+});
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.spec.ts
index c8aecdd57..47b5e09c5 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.spec.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.spec.ts
@@ -7,7 +7,7 @@ import {
UpdateGenericModalHelper,
DeleteGenericModalHelper,
ClearGenericModalHelper,
- UpdateGenericModalTableDataHelper
+ UpdateGenericModalTableDataHelper, UpdateCurrentModalModeAction
} from "./global.actions";
import {globalReducer} from "./global.reducers";
@@ -142,6 +142,43 @@ describe('globalReducer', () => {
expect(globalDrawingBoardState.genericModalHelper[keyName]).toBeUndefined();
});
+
+
+ test('#UPDATE_CURRENT_MODAL_MODE : should update current modal mode: true', ()=> {
+ let globalDrawingBoardState = globalReducer(<any>{global : {},genericModalHelper : {
+ isUpdateModalMode : null
+ }},
+ <UpdateCurrentModalModeAction>{
+ type: GlobalActions.UPDATE_CURRENT_MODAL_MODE,
+ isUpdateModalMode : true
+ });
+ expect(globalDrawingBoardState.isUpdateModalMode).toBeTruthy();
+ });
+
+
+ test('#UPDATE_CURRENT_MODAL_MODE : should update current modal mode: false', ()=> {
+ let globalDrawingBoardState = globalReducer(<any>{global : {},genericModalHelper : {
+ isUpdateModalMode : true
+ }},
+ <UpdateCurrentModalModeAction>{
+ type: GlobalActions.UPDATE_CURRENT_MODAL_MODE,
+ isUpdateModalMode : false
+ });
+ expect(globalDrawingBoardState.isUpdateModalMode).toBeFalsy();
+ });
+
+ test('#UPDATE_CURRENT_MODAL_MODE : should delete modal mode if value is null', ()=> {
+ let globalDrawingBoardState = globalReducer(<any>{global : {},genericModalHelper : {
+ isUpdateModalMode : true
+ }},
+ <UpdateCurrentModalModeAction>{
+ type: GlobalActions.UPDATE_CURRENT_MODAL_MODE,
+ isUpdateModalMode : null
+ });
+ expect(globalDrawingBoardState.isUpdateModalMode).toBeUndefined();
+ });
+
+
});
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.ts
index aedcce24b..49df2088a 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/global/global.reducers.ts
@@ -8,7 +8,7 @@ import {
UpdateGenericModalHelper,
DeleteGenericModalHelper,
DeleteGenericModalTabelDataHelper,
- UpdateGenericModalTableDataHelper
+ UpdateGenericModalTableDataHelper, UpdateCurrentModalModeAction
} from "./global.actions";
import * as _ from "lodash";
@@ -18,6 +18,7 @@ export interface GlobalState {
drawingBoardStatus : string;
genericModalCriteria : { [key: string]: any };
genericModalHelper : { [key: string]: any };
+ isUpdateModalMode?: boolean;
}
@@ -28,7 +29,8 @@ const initialState: GlobalState = {
genericModalCriteria : {
roles : []
},
- genericModalHelper : {}
+ genericModalHelper : {},
+ isUpdateModalMode : null
};
export const globalReducer =
@@ -81,6 +83,15 @@ export const globalReducer =
newState.genericModalHelper[(<UpdateGenericModalTableDataHelper>action).field] = (<UpdateGenericModalTableDataHelper>action).values ;
return newState;
}
+ case GlobalActions.UPDATE_CURRENT_MODAL_MODE : {
+ let newState = {...state};
+ if ((<UpdateCurrentModalModeAction>action).isUpdateModalMode === null){
+ delete newState.isUpdateModalMode;
+ } else {
+ newState.isUpdateModalMode = (<UpdateCurrentModalModeAction>action).isUpdateModalMode;
+ }
+ return newState;
+ }
default:
return state;
}