From eabff82366afdf464c593046f3b7a60434399880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E4=B8=96=E5=86=9B?= <30999793+AllForNothing@users.noreply.github.com> Date: Thu, 12 Aug 2021 10:08:49 +0800 Subject: [PATCH] Improve getChanges function for edit registries compoment (#15404) Signed-off-by: AllForNothing --- .../create-edit-endpoint/create-edit-endpoint.component.ts | 4 ++-- src/portal/src/app/shared/units/utils.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts index f418dc24c..b83aed9f4 100644 --- a/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts +++ b/src/portal/src/app/base/left-side-nav/registries/create-edit-endpoint/create-edit-endpoint.component.ts @@ -423,7 +423,7 @@ export class CreateEditEndpointComponent if (!this.target || !this.initVal) { return changes; } - for (let prop of Object.keys(this.target)) { + for (let prop of Object.keys(Object.assign({}, this.target, this.initVal))) { let field: any = this.initVal[prop]; if (typeof field !== "object") { if (!compareValue(field, this.target[prop])) { @@ -439,7 +439,7 @@ export class CreateEditEndpointComponent } } } else { - for (let pro of Object.keys(field)) { + for (let pro of Object.keys(Object.assign({}, field, this.target[prop]))) { if (!compareValue(field[pro], this.target[prop][pro])) { changes[pro] = this.target[prop][pro]; // Number diff --git a/src/portal/src/app/shared/units/utils.ts b/src/portal/src/app/shared/units/utils.ts index 32a339179..cda94a4ae 100644 --- a/src/portal/src/app/shared/units/utils.ts +++ b/src/portal/src/app/shared/units/utils.ts @@ -567,7 +567,7 @@ export const validateLimit = unitContrl => { }; export function formatSize(tagSize: string): string { - const size: number = Number.parseInt(tagSize); + const size: number = Number.parseInt(tagSize, 10); if (Math.pow(1024, 1) <= size && size < Math.pow(1024, 2)) { return (size / Math.pow(1024, 1)).toFixed(2) + "KiB"; } else if (Math.pow(1024, 2) <= size && size < Math.pow(1024, 3)) {