From 46eecf63731034ff7b3e60a407d45fa795198eff Mon Sep 17 00:00:00 2001 From: yuyu Date: Wed, 18 Oct 2023 10:14:15 +0800 Subject: [PATCH] fix:Updating crd resource on ks-console page loses status information (#3866) Signed-off-by: yaozhenxiu <946666800@qq.com> --- src/stores/crd.resource.js | 2 +- src/utils/object.mapper.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/stores/crd.resource.js b/src/stores/crd.resource.js index 74ed0c7a9e7..ae0ae0ea5c3 100644 --- a/src/stores/crd.resource.js +++ b/src/stores/crd.resource.js @@ -38,7 +38,7 @@ export default class CRDResourceStore { } get mapper() { - return ObjectMapper.default + return ObjectMapper.customresourcedefinitionsedit } getPath({ cluster, namespace } = {}) { diff --git a/src/utils/object.mapper.js b/src/utils/object.mapper.js index 6033b8e283f..31914c54c0b 100644 --- a/src/utils/object.mapper.js +++ b/src/utils/object.mapper.js @@ -96,6 +96,23 @@ const DefaultMapper = item => ({ _originData: getOriginData(item), }) +const CRDEditMapper = item => { + return { + ...getBaseInfo(item), + namespace: get(item, 'metadata.namespace'), + spec: get(item, 'spec'), + _originData: omit(item, [ + 'metadata.uid', + 'metadata.selfLink', + 'metadata.generation', + 'metadata.ownerReferences', + 'metadata.resourceVersion', + 'metadata.creationTimestamp', + 'metadata.managedFields', + ]), + } +} + const WorkspaceMapper = item => { const overrides = get(item, 'spec.overrides', []) const template = get(item, 'spec.template', {}) @@ -1504,6 +1521,7 @@ export default { dashboards: DashboardMapper, clusterdashboards: DashboardMapper, customresourcedefinitions: CRDMapper, + customresourcedefinitionsedit: CRDEditMapper, pipelines: PipelinesMapper, networkpolicies: NetworkPoliciesMapper, namespacenetworkpolicies: NetworkPoliciesMapper,