Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
fix(hc): do not select inherited cfg if no global config is present
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGeraud committed Nov 19, 2018
1 parent 8fc5efd commit 4747b21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Expand Up @@ -22,6 +22,7 @@ class ApiHealthCheckConfigureController {
private timeUnits: string[];
private httpMethods: string[];
private endpoint: any;
private rootHealthcheckEnabled: boolean;

constructor (
private ApiService,
Expand All @@ -41,11 +42,15 @@ class ApiHealthCheckConfigureController {
let group = _.find(this.api.proxy.groups, { 'name': $stateParams.groupName});
this.endpoint = _.find(group.endpoints, { 'name': $stateParams.endpointName });
this.healthcheck = this.endpoint.healthcheck;
this.rootHealthcheckEnabled =
this.api.services &&
this.api.services['health-check'] &&
this.api.services['health-check'].enabled;
} else {
this.healthcheck = this.api.services && this.api.services['health-check'];
}

this.healthcheck = this.healthcheck || {enabled: false, trigger: {}};
this.healthcheck = this.healthcheck || {enabled: false, inherit: false, trigger: {}};
let inherit = (this.endpoint !== undefined) && this.healthcheck.inherit;
let enabled = this.healthcheck.enabled;

Expand Down
Expand Up @@ -46,11 +46,13 @@ <h2></h2>
<md-input-container class="md-block" ng-if="healthCheckCtrl.endpoint !== undefined">
<md-checkbox
ng-model="healthCheckCtrl.healthcheck.inherit"
ng-disabled="!healthCheckCtrl.rootHealthcheckEnabled"
aria-label="Inherit health-check"
class="md-align-top-left"
flex>
Inherit configuration
<span class="ipsum">Inherit health-check configuration from global health-check configuration.</span>
<span class="ipsum" ng-if="healthCheckCtrl.rootHealthcheckEnabled">Inherit health-check configuration from global health-check configuration.</span>
<span class="ipsum" ng-if="!healthCheckCtrl.rootHealthcheckEnabled">You must enable a global health-check to be able to inherit from it.</span>
</md-checkbox>
</md-input-container>
</md-content>
Expand Down

0 comments on commit 4747b21

Please sign in to comment.