summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-07-16 14:30:26 +0530
committerTakamune Cho <tc012c@att.com>2018-07-16 14:40:38 +0000
commit675e8b8c14dafa82e3e771bfe3fd616e19475766 (patch)
treec79b8f120cb2aa8ead4fe9da2e91e46f0853637c /src/app
parent9c76707c6b1c261b90e4b0f65db6ff5606c7bee5 (diff)
Removed duplicate code.
The same variable values are set on file upload failure either due to wrong format or due to wrong content of the file being uploaded in uplaod() and uplaodedFileResult() methods of test component. Moved this duplicate code to a single method called setValuesOnFileUploadFailure() and called this method where required. Issue-ID: APPC-1082 Change-Id: If92d375e3cfa44479c2d7f54915a1b6461bdda89 Signed-off-by: Arundathi <arundpil@in.ibm.com>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/test/test.component.ts50
1 files changed, 20 insertions, 30 deletions
diff --git a/src/app/test/test.component.ts b/src/app/test/test.component.ts
index 3797c8c..7560e7b 100644
--- a/src/app/test/test.component.ts
+++ b/src/app/test/test.component.ts
@@ -215,21 +215,7 @@ export class TestComponent implements OnInit {
}
else {
this.nService.error('Error', 'Incorrect spreadsheet uploaded');
- this.flag = 1;
- this.oldListName1 = '';
- this.vmJson = {};
- this.vnfcJson = {};
- this.subPayload = {};
- this.vmPayload = [];
- this.payload = {};
- this.action = '';
- this.actionIdentifiers = {};
- this.apiRequest = '';
- this.apiResponse = '';
- this.enableCounterDiv = false;
- this.enableAbort = false;
- this.enableTestButton = false;
- this.enableDownload = false;
+ this.setValuesOnFileUploadFailure();
}
}
@@ -282,21 +268,7 @@ export class TestComponent implements OnInit {
this.nService.success('Success', 'SpreadSheet uploaded successfully');
}
else {
- this.flag = 1;
- this.oldListName1 = '';
- this.vmJson = {};
- this.vnfcJson = {};
- this.subPayload = {};
- this.vmPayload = [];
- this.payload = {};
- this.action = '';
- this.actionIdentifiers = {};
- this.apiRequest = '';
- this.apiResponse = '';
- this.enableCounterDiv = false;
- this.enableAbort = false;
- this.enableTestButton = false;
- this.enableDownload = false;
+ this.setValuesOnFileUploadFailure();
this.nService.error("Error", "Please check the contents of the file uploaded")
}
}
@@ -520,4 +492,22 @@ export class TestComponent implements OnInit {
}
+ setValuesOnFileUploadFailure() {
+ this.flag = 1;
+ this.oldListName1 = '';
+ this.vmJson = {};
+ this.vnfcJson = {};
+ this.subPayload = {};
+ this.vmPayload = [];
+ this.payload = {};
+ this.action = '';
+ this.actionIdentifiers = {};
+ this.apiRequest = '';
+ this.apiResponse = '';
+ this.enableCounterDiv = false;
+ this.enableAbort = false;
+ this.enableTestButton = false;
+ this.enableDownload = false;
+ }
+
}