From 16d14b5cf1956ea37432147abf3eb9b1d6d21a50 Mon Sep 17 00:00:00 2001 From: xusongfu Date: Thu, 2 Jun 2022 14:41:48 +0800 Subject: [PATCH] fix: Fix copyable and delete lb 1. Fix copyable in Paragraph 2. Rollback permission of delete loadbalancers Change-Id: I2621974d64e9c149c7138c0f2d3da301bdf0d73e --- src/components/DetailCard/index.jsx | 11 ++++++----- src/containers/TabDetail/index.jsx | 2 +- .../Certificate/Detail/Container/BaseDetail.jsx | 8 ++++++-- .../Certificate/Detail/Secret/BaseDetail.jsx | 4 +++- .../LoadBalancerInstance/actions/Delete.jsx | 3 +-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/components/DetailCard/index.jsx b/src/components/DetailCard/index.jsx index e81ddcd6..ef503fc9 100644 --- a/src/components/DetailCard/index.jsx +++ b/src/components/DetailCard/index.jsx @@ -15,7 +15,7 @@ import React from 'react'; import { Row, Col, Skeleton, Tooltip, Typography, Popover } from 'antd'; import { InfoCircleOutlined } from '@ant-design/icons'; -import { has, get, isNumber, isBoolean } from 'lodash'; +import { has, get, isNumber } from 'lodash'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { renderFilterMap } from 'utils/index'; @@ -39,9 +39,6 @@ const getContentValue = (value, dataIndex, data, copyable) => { (/_?id/g.test(dataIndex.toLowerCase()) && copyable !== false) || copyable ) { - if (isBoolean(copyable)) { - return {value}; - } return {value}; } } @@ -51,7 +48,11 @@ const getContentValue = (value, dataIndex, data, copyable) => { const getContent = (data, option) => { const { content, dataIndex, render, valueRender, copyable } = option; if (has(option, 'content')) { - return copyable ? {content} : content; + return copyable ? ( + {content} + ) : ( + content + ); } let value = get(data, dataIndex); if (!render) { diff --git a/src/containers/TabDetail/index.jsx b/src/containers/TabDetail/index.jsx index 1ad52647..9fb36b5d 100644 --- a/src/containers/TabDetail/index.jsx +++ b/src/containers/TabDetail/index.jsx @@ -356,7 +356,7 @@ export default class DetailBase extends React.Component { dataIndex.toLowerCase().indexOf('_id') >= 0 ) { desc = ( - + {desc} ); diff --git a/src/pages/network/containers/Certificate/Detail/Container/BaseDetail.jsx b/src/pages/network/containers/Certificate/Detail/Container/BaseDetail.jsx index bc1e407c..785f0f10 100644 --- a/src/pages/network/containers/Certificate/Detail/Container/BaseDetail.jsx +++ b/src/pages/network/containers/Certificate/Detail/Container/BaseDetail.jsx @@ -38,7 +38,9 @@ export class BaseDetail extends Base { const options = [ { content:
{secret_info.payload}
, - copyable: true, + copyable: { + text: secret_info.payload, + }, }, ]; return { @@ -56,7 +58,9 @@ export class BaseDetail extends Base { const options = [ { content:
{secret_info.payload}
, - copyable: true, + copyable: { + text: secret_info.payload, + }, }, ]; return { diff --git a/src/pages/network/containers/Certificate/Detail/Secret/BaseDetail.jsx b/src/pages/network/containers/Certificate/Detail/Secret/BaseDetail.jsx index 762240c9..6672f0d0 100644 --- a/src/pages/network/containers/Certificate/Detail/Secret/BaseDetail.jsx +++ b/src/pages/network/containers/Certificate/Detail/Secret/BaseDetail.jsx @@ -33,7 +33,9 @@ export class BaseDetail extends Base { const options = [ { content:
{payload}
, - copyable: true, + copyable: { + text: payload, + }, }, ]; return { diff --git a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/Delete.jsx b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/Delete.jsx index 810dd257..7c27ba42 100644 --- a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/Delete.jsx +++ b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/Delete.jsx @@ -55,8 +55,7 @@ export default class DeleteAction extends ConfirmAction { return true; } return ( - (this.isCurrentProject(item) && - ['ACTIVE', 'PENDING_UPDATE'].includes(item.provisioning_status)) || + (this.isCurrentProject(item) && item.provisioning_status === 'ACTIVE') || item.provisioning_status === 'ERROR' ); };