Browse Source

Rate limits fix close null bug

pull/6979/head
Artem Babak 4 years ago
parent
commit
acadd0f827
  1. 2
      ui-ngx/src/app/modules/home/components/profile/tenant/rate-limits/rate-limits-details-dialog.component.ts
  2. 11
      ui-ngx/src/app/modules/home/components/profile/tenant/rate-limits/rate-limits.component.ts
  3. 4
      ui-ngx/src/app/shared/models/rate-limits.models.ts

2
ui-ngx/src/app/modules/home/components/profile/tenant/rate-limits/rate-limits-details-dialog.component.ts

@ -72,7 +72,7 @@ export class RateLimitsDetailsDialogComponent extends DialogComponent<RateLimits
}
cancel(): void {
this.dialogRef.close(null);
this.dialogRef.close(false);
}
save(): void {

11
ui-ngx/src/app/modules/home/components/profile/tenant/rate-limits/rate-limits.component.ts

@ -30,11 +30,12 @@ import {
RateLimitsDetailsDialogData
} from '@home/components/profile/tenant/rate-limits/rate-limits-details-dialog.component';
import {
rateLimitDialogTitleTranslationMap,
rateLimitLabelTranslationMap,
rateLimitsDialogTitleTranslationMap,
rateLimitsLabelTranslationMap,
RateLimitsType,
stringToRateLimitsArray
} from '@shared/models/rate-limits.models';
import { isNull } from 'util';
@Component({
selector: 'tb-rate-limits',
@ -81,7 +82,7 @@ export class RateLimitsComponent implements ControlValueAccessor, OnInit, Valida
}
ngOnInit() {
this.label = rateLimitLabelTranslationMap.get(this.type);
this.label = rateLimitsLabelTranslationMap.get(this.type);
this.rateLimitsFormGroup = this.fb.group({
rateLimits: [null, []]
});
@ -109,7 +110,7 @@ export class RateLimitsComponent implements ControlValueAccessor, OnInit, Valida
if ($event) {
$event.stopPropagation();
}
const title = rateLimitDialogTitleTranslationMap.get(this.type);
const title = rateLimitsDialogTitleTranslationMap.get(this.type);
this.dialog.open<RateLimitsDetailsDialogComponent, RateLimitsDetailsDialogData,
string>(RateLimitsDetailsDialogComponent, {
disableClose: true,
@ -120,7 +121,7 @@ export class RateLimitsComponent implements ControlValueAccessor, OnInit, Valida
readonly: this.disabled
}
}).afterClosed().subscribe((result) => {
if (result) {
if (result || result === null) {
this.modelValue = result;
this.updateModel();
}

4
ui-ngx/src/app/shared/models/rate-limits.models.ts

@ -36,7 +36,7 @@ export enum RateLimitsType {
TENANT_ENTITY_IMPORT_RATE_LIMIT = 'TENANT_ENTITY_IMPORT_RATE_LIMIT'
}
export const rateLimitLabelTranslationMap = new Map<RateLimitsType, string>(
export const rateLimitsLabelTranslationMap = new Map<RateLimitsType, string>(
[
[RateLimitsType.TENANT_MESSAGES, 'tenant-profile.rate-limits.transport-tenant-msg'],
[RateLimitsType.TENANT_TELEMETRY_MESSAGES, 'tenant-profile.rate-limits.transport-tenant-telemetry-msg'],
@ -53,7 +53,7 @@ export const rateLimitLabelTranslationMap = new Map<RateLimitsType, string>(
]
);
export const rateLimitDialogTitleTranslationMap = new Map<RateLimitsType, string>(
export const rateLimitsDialogTitleTranslationMap = new Map<RateLimitsType, string>(
[
[RateLimitsType.TENANT_MESSAGES, 'tenant-profile.rate-limits.edit-transport-tenant-msg-title'],
[RateLimitsType.TENANT_TELEMETRY_MESSAGES, 'tenant-profile.rate-limits.edit-transport-tenant-telemetry-msg-title'],

Loading…
Cancel
Save