import { Component, OnInit } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-import * as _ from 'lodash';
-import { BsModalRef } from 'ngx-bootstrap/modal';
-
-import { ConfigurationService } from '../../../../shared/api/configuration.service';
-import { OsdService } from '../../../../shared/api/osd.service';
-import { ConfigOptionTypes } from '../../../../shared/components/config-option/config-option.types';
-import { NotificationType } from '../../../../shared/enum/notification-type.enum';
-import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
-import { Permissions } from '../../../../shared/models/permissions';
-import { AuthStorageService } from '../../../../shared/services/auth-storage.service';
-import { NotificationService } from '../../../../shared/services/notification.service';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import _ from 'lodash';
+
+import { ConfigurationService } from '~/app/shared/api/configuration.service';
+import { OsdService } from '~/app/shared/api/osd.service';
+import { ConfigOptionTypes } from '~/app/shared/components/config-option/config-option.types';
+import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
+import { NotificationType } from '~/app/shared/enum/notification-type.enum';
+import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
+import { Permissions } from '~/app/shared/models/permissions';
+import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
+import { NotificationService } from '~/app/shared/services/notification.service';
@Component({
selector: 'cd-osd-recv-speed-modal',
priorityAttrs = {};
constructor(
- public bsModalRef: BsModalRef,
+ public activeModal: NgbActiveModal,
+ public actionLabels: ActionLabelsI18n,
private authStorageService: AuthStorageService,
private configService: ConfigurationService,
private notificationService: NotificationService,
- private i18n: I18n,
private osdService: OsdService
) {
this.permissions = this.authStorageService.getPermissions();
});
this.priorityAttrs = {
osd_max_backfills: {
- text: this.i18n('Max Backfills'),
+ text: $localize`Max Backfills`,
desc: '',
patternHelpText: '',
maxValue: undefined,
minValue: undefined
},
osd_recovery_max_active: {
- text: this.i18n('Recovery Max Active'),
+ text: $localize`Recovery Max Active`,
desc: '',
patternHelpText: '',
maxValue: undefined,
minValue: undefined
},
osd_recovery_max_single_start: {
- text: this.i18n('Recovery Max Single Start'),
+ text: $localize`Recovery Max Single Start`,
desc: '',
patternHelpText: '',
maxValue: undefined,
minValue: undefined
},
osd_recovery_sleep: {
- text: this.i18n('Recovery Sleep'),
+ text: $localize`Recovery Sleep`,
desc: '',
patternHelpText: '',
maxValue: undefined,
if (Object.entries(configOptionValues).length === 4) {
this.osdRecvSpeedForm.controls.customizePriority.setValue(true);
return callbackFn(
- Object({ name: 'custom', text: this.i18n('Custom'), values: configOptionValues })
+ Object({ name: 'custom', text: $localize`Custom`, values: configOptionValues })
);
}
if (this.osdRecvSpeedForm.getValue('customizePriority')) {
const customPriority = {
name: 'custom',
- text: this.i18n('Custom'),
+ text: $localize`Custom`,
values: values
};
this.setPriority(customPriority);
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n('Updated OSD recovery speed priority "{{value}}"', {
- value: this.osdRecvSpeedForm.getValue('priority')
- })
+ $localize`Updated OSD recovery speed priority '${this.osdRecvSpeedForm.getValue(
+ 'priority'
+ )}'`
);
- this.bsModalRef.hide();
+ this.activeModal.close();
},
() => {
- this.bsModalRef.hide();
+ this.activeModal.close();
}
);
}