aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts21
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts5
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts9
3 files changed, 28 insertions, 7 deletions
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 8705fa8ff..e97ed9ca3 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
@@ -53,5 +53,26 @@ describe('Basic Control Generator', () => {
expect(suppFileForInstance.hiddenFile.length).toBeGreaterThanOrEqual(1);
expect(suppFileForInstance.hiddenFile[0].validations[0].validatorName).toEqual("isFileTooBig");
});
+
+ test('concatSupplementaryFile add SupplementaryFile control and hidden file', () => {
+
+ //given
+ const instance = {};
+ const controls = [service.getLegacyRegion(instance)];
+ expect(controls).toHaveLength(1);
+
+ //when
+ const result = service.concatSupplementaryFile(controls, instance);
+
+ //then
+ expect(controls).toHaveLength(1); //original controls remain the same
+
+ expect(result.map((control) => {return control.controlName})).toEqual([
+ "legacyRegion",
+ "supplementaryFile",
+ "supplementaryFile_hidden",
+ "supplementaryFile_hidden_content"
+ ]);
+ });
});
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 0261a72a4..f7075e7d8 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
@@ -239,6 +239,11 @@ export class BasicControlGenerator {
return initialInstanceName;
}
+ concatSupplementaryFile(originalArray: FormControlModel[], vfModuleInstance): FormControlModel[] {
+ let suppFileInput: FileFormControl = <FileFormControl>(this.getSupplementaryFile(vfModuleInstance));
+ return originalArray.concat([suppFileInput], suppFileInput.hiddenFile);
+ }
+
getSupplementaryFile(instance: any): FileFormControl {
return new FileFormControl({
controlName: SUPPLEMENTARY_FILE,
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 a2dd52197..762cb41dd 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
@@ -105,9 +105,7 @@ export class VfModuleControlGenerator {
result = this.pushInstanceAndVGToForm(result, vfModuleInstance, serviceId, vnfModel, false);
}
if(this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
- let suppFileInput:FileFormControl = <FileFormControl>(this._basicControlGenerator.getSupplementaryFile(vfModuleInstance));
- result.push(suppFileInput);
- result = result.concat(suppFileInput.hiddenFile);
+ result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
}
return result;
}
@@ -142,12 +140,9 @@ export class VfModuleControlGenerator {
result.push(this.getRollbackOnFailureControl(vfModuleInstance, result));
result.push(this.getSDNCControl(vfModuleInstance, result));
if(this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
- let suppFileInput:FileFormControl = <FileFormControl>(this._basicControlGenerator.getSupplementaryFile(vfModuleInstance));
- result.push(suppFileInput);
- result = result.concat(suppFileInput.hiddenFile);
+ result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
}
return result;
-
}
getInstanceName(instance: any, serviceId: string, isEcompGeneratedNaming: boolean): FormControlModel {