Skip to content

Commit

Permalink
Integrate the System status API
Browse files Browse the repository at this point in the history
  • Loading branch information
Harminder Singh committed May 3, 2019
1 parent 1cb76e9 commit a9ca673
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ <h1 class="title-text">{{pageTitle}}</h1>
</div>
<div class="container no-shrink">
<div class="system-container flex-center flex flex-col flex-align-center">
<div class="flex flex-col flex-align-center outer-box w-100 ">
<div class='loader' *ngIf='showPageLoader==1'></div>
<app-error-message class='error_msg' [selectedValue]="errorMessage" *ngIf='showPageLoader == -1'></app-error-message>
<div class="flex flex-col flex-align-center outer-box w-100 " *ngIf='showPageLoader==0'>
<div class="flex each-item flex-between no-shrink">
<div class="rules">
<div class="left-header">Rules</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class SystemManagementComponent implements OnInit, OnDestroy {
OpenModal = false;
selectedValue;
showLoader = false;
showPageLoader = 1;
errorMessage = '';
errorMsg = 'apiResponseError';
errorVal = 0;
modalTitle = 'Confirmation Required';
Expand All @@ -50,17 +52,20 @@ export class SystemManagementComponent implements OnInit, OnDestroy {
) { }

getJobStatus() {
const url = 'https://internal-pacbot-43782189.us-east-1.elb.amazonaws.com/api/admin/operations';
const url = environment.systemJobStatus.url;
const method = environment.systemJobStatus.method;

this.systemStatusSubscription = this.commonResponseService
.getData(url, method, {}, {}).subscribe(
response => {
this.isCheckedRules = response[0].status;
this.isCheckedJobs = response[1].status;
if(!response) return;
this.isCheckedRules = response.rule === 'ENABLED' ? false : true;
this.isCheckedJobs = response.job === 'ENABLED' ? false : true;
this.showPageLoader = 0;
},
error => {

this.showPageLoader = -1;
this.errorMessage = error;
}
)
}
Expand Down Expand Up @@ -102,7 +107,7 @@ export class SystemManagementComponent implements OnInit, OnDestroy {
this.systemSubscription.unsubscribe();
this.systemStatusSubscription.unsubscribe();
}
const url = 'https://internal-pacbot-43782189.us-east-1.elb.amazonaws.com/api/admin/operations';
const url = environment.systemOperations.url;
const method = environment.systemOperations.method;
let operation;
operation = jobAction ? 'enable' : 'disable';
Expand Down Expand Up @@ -142,14 +147,17 @@ export class SystemManagementComponent implements OnInit, OnDestroy {
}

ngOnInit() {
// this.getJobStatus();
this.getJobStatus();
}

ngOnDestroy() {
try {
if (this.systemSubscription) {
this.systemSubscription.unsubscribe();
}
if (this.systemStatusSubscription) {
this.systemStatusSubscription.unsubscribe();
}
} catch (error) {
this.logger.log('error', '--- Error while unsubscribing ---');
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/config/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const CONFIGURATIONS = {
APP_NAME: 'PacBot',
domains: {
PROD_BASE_URL: '', // Expected values: domain where the API is deployed, ex: http://beta.pacbot.com/api
STG_BASE_URL: 'https://internal-pacbot-43782189.us-east-1.elb.amazonaws.com/api', // Expected values: domain where the API is deployed, ex: http://stgbeta.pacbot.com/api
STG_BASE_URL: '', // Expected values: domain where the API is deployed, ex: http://stgbeta.pacbot.com/api
DEV_BASE_URL: '', // Expected values: domain where the API is deployed, ex: http://devbeta.pacbot.com/api
CLOUD_BASE_URL: '', // Expected values: domain where the API is deployed
},
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,8 @@ export const environment = {
method: 'POST'
},
systemJobStatus: {
url: '{{baseUrl}}/admin/operations',
method: 'POST'
url: '{{baseUrl}}/admin/system/status',
method: 'GET'
}

};
4 changes: 2 additions & 2 deletions webapp/src/environments/environment.stg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ export const environment = {
method: 'POST'
},
systemJobStatus: {
url: '{{baseUrl}}/admin/operations',
method: 'POST'
url: '{{baseUrl}}/admin/system/status',
method: 'GET'
}
};
4 changes: 2 additions & 2 deletions webapp/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ export const environment = {
method: 'POST'
},
systemJobStatus: {
url: '{{baseUrl}}/admin/operations',
method: 'POST'
url: '{{baseUrl}}/admin/system/status',
method: 'GET'
}
};

0 comments on commit a9ca673

Please sign in to comment.