fix: Fix copyable and delete lb

1. Fix copyable in Paragraph
2. Rollback permission of delete loadbalancers

Change-Id: I2621974d64e9c149c7138c0f2d3da301bdf0d73e
This commit is contained in:
xusongfu 2022-06-02 14:41:48 +08:00
parent 339468d054
commit 16d14b5cf1
5 changed files with 17 additions and 11 deletions

View File

@ -15,7 +15,7 @@
import React from 'react'; import React from 'react';
import { Row, Col, Skeleton, Tooltip, Typography, Popover } from 'antd'; import { Row, Col, Skeleton, Tooltip, Typography, Popover } from 'antd';
import { InfoCircleOutlined } from '@ant-design/icons'; 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 PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { renderFilterMap } from 'utils/index'; import { renderFilterMap } from 'utils/index';
@ -39,9 +39,6 @@ const getContentValue = (value, dataIndex, data, copyable) => {
(/_?id/g.test(dataIndex.toLowerCase()) && copyable !== false) || (/_?id/g.test(dataIndex.toLowerCase()) && copyable !== false) ||
copyable copyable
) { ) {
if (isBoolean(copyable)) {
return <Paragraph copyable>{value}</Paragraph>;
}
return <Paragraph copyable={copyable}>{value}</Paragraph>; return <Paragraph copyable={copyable}>{value}</Paragraph>;
} }
} }
@ -51,7 +48,11 @@ const getContentValue = (value, dataIndex, data, copyable) => {
const getContent = (data, option) => { const getContent = (data, option) => {
const { content, dataIndex, render, valueRender, copyable } = option; const { content, dataIndex, render, valueRender, copyable } = option;
if (has(option, 'content')) { if (has(option, 'content')) {
return copyable ? <Paragraph copyable>{content}</Paragraph> : content; return copyable ? (
<Paragraph copyable={copyable}>{content}</Paragraph>
) : (
content
);
} }
let value = get(data, dataIndex); let value = get(data, dataIndex);
if (!render) { if (!render) {

View File

@ -356,7 +356,7 @@ export default class DetailBase extends React.Component {
dataIndex.toLowerCase().indexOf('_id') >= 0 dataIndex.toLowerCase().indexOf('_id') >= 0
) { ) {
desc = ( desc = (
<Paragraph style={{ margin: 0 }} copyable> <Paragraph style={{ margin: 0 }} copyable={copyable}>
{desc} {desc}
</Paragraph> </Paragraph>
); );

View File

@ -38,7 +38,9 @@ export class BaseDetail extends Base {
const options = [ const options = [
{ {
content: <pre>{secret_info.payload}</pre>, content: <pre>{secret_info.payload}</pre>,
copyable: true, copyable: {
text: secret_info.payload,
},
}, },
]; ];
return { return {
@ -56,7 +58,9 @@ export class BaseDetail extends Base {
const options = [ const options = [
{ {
content: <pre>{secret_info.payload}</pre>, content: <pre>{secret_info.payload}</pre>,
copyable: true, copyable: {
text: secret_info.payload,
},
}, },
]; ];
return { return {

View File

@ -33,7 +33,9 @@ export class BaseDetail extends Base {
const options = [ const options = [
{ {
content: <pre>{payload}</pre>, content: <pre>{payload}</pre>,
copyable: true, copyable: {
text: payload,
},
}, },
]; ];
return { return {

View File

@ -55,8 +55,7 @@ export default class DeleteAction extends ConfirmAction {
return true; return true;
} }
return ( return (
(this.isCurrentProject(item) && (this.isCurrentProject(item) && item.provisioning_status === 'ACTIVE') ||
['ACTIVE', 'PENDING_UPDATE'].includes(item.provisioning_status)) ||
item.provisioning_status === 'ERROR' item.provisioning_status === 'ERROR'
); );
}; };