Rate limits fix close null bug

This commit is contained in:
Artem Babak 2022-07-21 13:31:00 +03:00
parent 9ada3562d5
commit acadd0f827
3 changed files with 9 additions and 8 deletions

View File

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

View File

@ -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();
}

View File

@ -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'],