diff --git a/modules/api/pkg/resource/configmap/detail.go b/modules/api/pkg/resource/configmap/detail.go index 5ea0c37a04e9..d0bcdffe0554 100644 --- a/modules/api/pkg/resource/configmap/detail.go +++ b/modules/api/pkg/resource/configmap/detail.go @@ -35,7 +35,7 @@ type ConfigMapDetail struct { // BinaryData contains the configuration binary data. // Each key must be a valid DNS_SUBDOMAIN with an optional leading dot. - BinaryData map[string][]byte `json:"binaryData,omitempty"` + BinaryData map[string]int `json:"binaryData,omitempty"` } // GetConfigMapDetail returns detailed information about a config map @@ -55,6 +55,16 @@ func getConfigMapDetail(rawConfigMap *v1.ConfigMap) *ConfigMapDetail { return &ConfigMapDetail{ ConfigMap: toConfigMap(rawConfigMap.ObjectMeta), Data: rawConfigMap.Data, - BinaryData: rawConfigMap.BinaryData, + BinaryData: getBinaryDataKeySize(rawConfigMap.BinaryData), } } + +func getBinaryDataKeySize(binaryData map[string][]byte) map[string]int { + converted := make(map[string]int) + + for key, value := range binaryData { + converted[key] = len(string(value)) + } + + return converted +} diff --git a/modules/api/schema/swagger.json b/modules/api/schema/swagger.json index 320c9867166d..a9ccc2aec7ab 100644 --- a/modules/api/schema/swagger.json +++ b/modules/api/schema/swagger.json @@ -10006,7 +10006,7 @@ "binaryData": { "type": "object", "additionalProperties": { - "type": "string" + "type": "integer" } }, "data": { diff --git a/modules/web/src/resource/config/configmap/detail/component.ts b/modules/web/src/resource/config/configmap/detail/component.ts index 0ac56cd09504..0aca6eacd8cd 100644 --- a/modules/web/src/resource/config/configmap/detail/component.ts +++ b/modules/web/src/resource/config/configmap/detail/component.ts @@ -75,9 +75,9 @@ export class ConfigMapDetailComponent implements OnInit, OnDestroy { return []; } - return Object.entries(cm.binaryData).map(([name, value]) => ({ + return Object.entries(cm.binaryData).map(([name, size]) => ({ name, - size: atob(value).length, + size, })); } diff --git a/modules/web/src/typings/root.api.ts b/modules/web/src/typings/root.api.ts index 87bbf046ab96..abb144273108 100644 --- a/modules/web/src/typings/root.api.ts +++ b/modules/web/src/typings/root.api.ts @@ -603,7 +603,7 @@ export interface IngressClassDetail extends ResourceDetail { export interface ConfigMapDetail extends ResourceDetail { data: StringMap; - binaryData: StringMap; + binaryData: Record; } export interface CRDDetail extends ResourceDetail {