- // TODO: show pending action indicator
- this.acXappService.getPolicy().subscribe((res: ACAdmissionIntervalControl) => {
- this.acForm.controls['enforce'].setValue(res.enforce);
- this.acForm.controls['window_length'].setValue(res.window_length);
- this.acForm.controls['blocking_rate'].setValue(res.blocking_rate);
- this.acForm.controls['trigger_threshold'].setValue(res.trigger_threshold);
- // TODO: clear pending action indicator
- },
- (error: HttpErrorResponse) => {
- // TODO: clear pending action indicator
- this.errorDialogService.displayError(error.message);
- });
+
+ this.instanceChange = this.instanceSelectorService.getSelectedInstancekey().subscribe((instanceKey: string) => {
+ if (instanceKey) {
+ // TODO: show pending action indicator
+ this.instanceKey = instanceKey;
+ this.acXappService.getPolicy(instanceKey).subscribe((res: ACAdmissionIntervalControl) => {
+ this.acForm.controls['enforce'].setValue(res.enforce);
+ this.acForm.controls['window_length'].setValue(res.window_length);
+ this.acForm.controls['blocking_rate'].setValue(res.blocking_rate);
+ this.acForm.controls['trigger_threshold'].setValue(res.trigger_threshold);
+ // TODO: clear pending action indicator
+ },
+ (error: HttpErrorResponse) => {
+ // TODO: clear pending action indicator
+ this.errorDialogService.displayError(error.message);
+ });
+ }
+ })
+ }
+
+ ngOnDestroy() {
+ this.instanceChange.unsubscribe();