summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-07-30 15:16:54 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-07-30 15:17:03 +0530
commit2066d644125287c4b9f2128376e59ce15ab8a194 (patch)
treed74cdee70aeeee40db9b89b53a5cb0c9456e2f7d /src/app
parent8d88775216d3eaabc8b48ce7f6b371c17b0c7b14 (diff)
UtilityService: Removed hard coded values
Moved the hard coded values from utility service file to app-contants file as variables. Issue-ID: APPC-1054 Change-Id: Iac62da47deeeb66402f413e90ee0ab50130ca185 Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/shared/services/utilityService/utility.service.ts45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/app/shared/services/utilityService/utility.service.ts b/src/app/shared/services/utilityService/utility.service.ts
index f22f2ab..a683f33 100644
--- a/src/app/shared/services/utilityService/utility.service.ts
+++ b/src/app/shared/services/utilityService/utility.service.ts
@@ -26,19 +26,20 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
import {Injectable} from '@angular/core';
import {NotificationsService} from 'angular2-notifications';
import { saveAs } from 'file-saver';
+import { appConstants } from '../../../../constants/app-constants';
@Injectable()
export class UtilityService {
- public putAction = 'uploadArtifact';
- public getAction = 'getArtifact';
- private retrievalSuccessMessage = 'Retrieved artifact successfully';
- private retrievalFailureMessage = 'There is no artifact saved in APPC for the selected action';
- private saveSuccessMessage = 'Successfully uploaded the ';
- private saveFailureMessage = 'Error in saving the ';
- public connectionErrorMessage = 'Error in connecting to the APPC Server';
+ public putAction = appConstants.messages.artifactUploadAction;
+ public getAction = appConstants.messages.artifactgetAction;
+ private retrievalSuccessMessage = appConstants.messages.retrievalSuccessMessage;
+ private retrievalFailureMessage = appConstants.messages.retrievalFailureMessage;
+ private saveSuccessMessage = appConstants.messages.saveSuccessMessage;
+ private saveFailureMessage = appConstants.messages.saveFailureMessage;
+ public connectionErrorMessage = appConstants.errors.connectionError;
- private successMessage = 'Retrieved artifact successfully';
- private failureMessage = 'There is no artifact saved in APPC for the selected action!';
+ private successMessage = appConstants.messages.artifactRetrivalsuccessMessage;
+ private failureMessage = appConstants.messages.artifactRetrivalfailureMessage;
constructor(private notificationService: NotificationsService) {
}
@@ -56,12 +57,12 @@ export class UtilityService {
public checkResult(result: any) {
- if (result.output.status.code == '401') {
- this.notificationService.info('Information', this.failureMessage);
+ if (result.output.status.code == appConstants.errorCode["401"]) {
+ this.notificationService.info(appConstants.notifications.titles.information, this.failureMessage);
return false;
}
- else if (result.output.status.code == '400') {
- this.notificationService.success('Success', this.successMessage);
+ else if (result.output.status.code == appConstants.errorCode["400"]) {
+ this.notificationService.success(appConstants.notifications.titles.success, this.successMessage);
return true;
}
@@ -69,24 +70,24 @@ export class UtilityService {
public processApiSubscribe(result: any, action, artifactType) {
- if (result.output.status.code == '401' && action == this.getAction) {
- this.notificationService.info('Information', this.retrievalFailureMessage);
+ if (result.output.status.code == appConstants.errorCode["401"] && action == this.getAction) {
+ this.notificationService.info(appConstants.notifications.titles.information, this.retrievalFailureMessage);
}
- else if (result.output.status.code == '400' && action == this.getAction) {
- this.notificationService.success('Success', this.retrievalSuccessMessage);
+ else if (result.output.status.code == appConstants.errorCode["400"] && action == this.getAction) {
+ this.notificationService.success(appConstants.notifications.titles.success, this.retrievalSuccessMessage);
}
- if (result.output.status.code == '401' && action == this.putAction) {
- this.notificationService.warn('Error', this.saveFailureMessage + artifactType);
+ if (result.output.status.code == appConstants.errorCode["401"] && action == this.putAction) {
+ this.notificationService.warn(appConstants.notifications.titles.error, this.saveFailureMessage + artifactType);
}
- else if (result.output.status.code == '400' && action == this.putAction) {
- this.notificationService.success('Success', this.saveSuccessMessage + artifactType);
+ else if (result.output.status.code == appConstants.errorCode["400"] && action == this.putAction) {
+ this.notificationService.success(appConstants.notifications.titles.success, this.saveSuccessMessage + artifactType);
}
}
public processApiError()
{
- this.notificationService.error('Error', this.connectionErrorMessage);
+ this.notificationService.error(appConstants.notifications.titles.error, this.connectionErrorMessage);
}