]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cluster / mgr-modules / mgr-module-form / mgr-module-form.component.ts
index 4810c5f8f8fbdb4da9ba7fdcdada4e8a10d7f518..c40af28031e4fe8afb8f50a366d3609c1b11b2a9 100644 (file)
@@ -2,57 +2,57 @@ import { Component, OnInit } from '@angular/core';
 import { ValidatorFn, Validators } from '@angular/forms';
 import { ActivatedRoute, Router } from '@angular/router';
 
-import { I18n } from '@ngx-translate/i18n-polyfill';
-import * as _ from 'lodash';
+import _ from 'lodash';
 import { forkJoin as observableForkJoin } from 'rxjs';
 
-import { MgrModuleService } from '../../../../shared/api/mgr-module.service';
-import { NotificationType } from '../../../../shared/enum/notification-type.enum';
-import { CdFormBuilder } from '../../../../shared/forms/cd-form-builder';
-import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
-import { CdValidators } from '../../../../shared/forms/cd-validators';
-import { NotificationService } from '../../../../shared/services/notification.service';
+import { MgrModuleService } from '~/app/shared/api/mgr-module.service';
+import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
+import { NotificationType } from '~/app/shared/enum/notification-type.enum';
+import { CdForm } from '~/app/shared/forms/cd-form';
+import { CdFormBuilder } from '~/app/shared/forms/cd-form-builder';
+import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
+import { CdValidators } from '~/app/shared/forms/cd-validators';
+import { NotificationService } from '~/app/shared/services/notification.service';
 
 @Component({
   selector: 'cd-mgr-module-form',
   templateUrl: './mgr-module-form.component.html',
   styleUrls: ['./mgr-module-form.component.scss']
 })
-export class MgrModuleFormComponent implements OnInit {
+export class MgrModuleFormComponent extends CdForm implements OnInit {
   mgrModuleForm: CdFormGroup;
-  error = false;
-  loading = false;
   moduleName = '';
   moduleOptions: any[] = [];
 
   constructor(
+    public actionLabels: ActionLabelsI18n,
     private route: ActivatedRoute,
     private router: Router,
     private formBuilder: CdFormBuilder,
     private mgrModuleService: MgrModuleService,
-    private notificationService: NotificationService,
-    private i18n: I18n
-  ) {}
+    private notificationService: NotificationService
+  ) {
+    super();
+  }
 
   ngOnInit() {
     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]);
+          this.loadingReady();
         },
         (_error) => {
-          this.error = true;
+          this.loadingError();
         }
       );
     });
@@ -129,7 +129,7 @@ export class MgrModuleFormComponent implements OnInit {
       () => {
         this.notificationService.show(
           NotificationType.success,
-          this.i18n('Updated options for module "{{name}}".', { name: this.moduleName })
+          $localize`Updated options for module '${this.moduleName}'.`
         );
         this.goToListView();
       },