) {}
ngOnInit() {
- this.route.params.subscribe(
- (params: { name: string }) => {
- this.moduleName = decodeURIComponent(params.name);
- this.loading = true;
- const observables = [];
- observables.push(this.mgrModuleService.getOptions(this.moduleName));
- observables.push(this.mgrModuleService.getConfig(this.moduleName));
- observableForkJoin(observables).subscribe(
- (resp: object) => {
- this.loading = false;
- this.moduleOptions = resp[0];
- // Create the form dynamically.
- this.createForm();
- // Set the form field values.
- this.mgrModuleForm.setValue(resp[1]);
- },
- (error) => {
- this.error = error;
- }
- );
- },
- (error) => {
- this.error = error;
- }
- );
+ this.route.params.subscribe((params: { name: string }) => {
+ this.moduleName = decodeURIComponent(params.name);
+ this.loading = true;
+ const observables = [
+ this.mgrModuleService.getOptions(this.moduleName),
+ this.mgrModuleService.getConfig(this.moduleName)
+ ];
+ observableForkJoin(observables).subscribe(
+ (resp: object) => {
+ this.loading = false;
+ this.moduleOptions = resp[0];
+ // Create the form dynamically.
+ this.createForm();
+ // Set the form field values.
+ this.mgrModuleForm.setValue(resp[1]);
+ },
+ (_error) => {
+ this.error = true;
+ }
+ );
+ });
}
getValidators(moduleOption): ValidatorFn[] {
-<cd-loading-panel *ngIf="editing && loading && !error"
+<cd-loading-panel *ngIf="editing && loading"
i18n>Loading bucket data...</cd-loading-panel>
-<cd-error-panel *ngIf="editing && error"
- (backAction)="goToListView()"
- i18n>The bucket data could not be loaded.</cd-error-panel>
<div class="col-sm-12 col-lg-6"
- *ngIf="!loading && !error">
+ *ngIf="!loading">
<form name="bucketForm"
#frm="ngForm"
[formGroup]="bucketForm"
}
// Process route parameters.
- this.route.params.subscribe(
- (params: { bid: string }) => {
- if (!params.hasOwnProperty('bid')) {
- return;
- }
- const bid = decodeURIComponent(params.bid);
- this.loading = true;
-
- this.rgwBucketService.get(bid).subscribe((resp: object) => {
- this.loading = false;
- // Get the default values.
- const defaults = _.clone(this.bucketForm.value);
- // Extract the values displayed in the form.
- let value = _.pick(resp, _.keys(this.bucketForm.value));
- value['placement-target'] = resp['placement_rule'];
- // Append default values.
- value = _.merge(defaults, value);
- // Update the form.
- this.bucketForm.setValue(value);
- });
- },
- (error) => {
- this.error = error;
+ this.route.params.subscribe((params: { bid: string }) => {
+ if (!params.hasOwnProperty('bid')) {
+ return;
}
- );
+ const bid = decodeURIComponent(params.bid);
+ this.loading = true;
+
+ this.rgwBucketService.get(bid).subscribe((resp: object) => {
+ this.loading = false;
+ // Get the default values.
+ const defaults = _.clone(this.bucketForm.value);
+ // Extract the values displayed in the form.
+ let value = _.pick(resp, _.keys(this.bucketForm.value));
+ value['placement-target'] = resp['placement_rule'];
+ // Append default values.
+ value = _.merge(defaults, value);
+ // Update the form.
+ this.bucketForm.setValue(value);
+ });
+ });
}
goToListView() {