Merge "fix: Fix copy volume id in backup detail page && error hint"

This commit is contained in:
Zuul 2021-08-25 05:03:09 +00:00 committed by Gerrit Code Review
commit 542f0bc94b
4 changed files with 13 additions and 6 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 } from 'lodash'; import { has, get, isNumber, isBoolean } 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,8 +39,11 @@ 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>{value}</Paragraph>;
} }
return <Paragraph copyable={copyable}>{value}</Paragraph>;
}
} }
return value || '-'; return value || '-';
}; };

View File

@ -258,12 +258,13 @@ export default class BaseForm extends React.Component {
callback(true, false); callback(true, false);
} }
}, },
(err) => { (err = {}) => {
this.updateSumbitting(false); this.updateSumbitting(false);
this.responseError = err; this.responseError = err;
this.showNotice && Notify.errorWithDetail(err, this.errorText); const { response: { data } = {} } = err;
this.showNotice && Notify.errorWithDetail(data, this.errorText);
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log('err', err); console.log('err', err, data);
if (callback && isFunction(callback)) { if (callback && isFunction(callback)) {
callback(false, true); callback(false, true);
} }

View File

@ -244,7 +244,7 @@ class ActionButton extends Component {
return; return;
} }
const { submitErrorMsg } = this.props.action; const { submitErrorMsg } = this.props.action;
const { data: responseData } = error.response || error || {}; const { data: responseData } = (error || {}).response || error || {};
const realError = responseData || error; const realError = responseData || error;
const message = submitErrorMsg const message = submitErrorMsg
? submitErrorMsg(data, realError) ? submitErrorMsg(data, realError)

View File

@ -32,6 +32,9 @@ export default class BaseDetail extends Base {
{ {
label: t('Volume ID'), label: t('Volume ID'),
dataIndex: 'volume_id', dataIndex: 'volume_id',
copyable: {
text: this.detailData.volume_id,
},
render: (value) => ( render: (value) => (
<Link to={`${this.getUrl('/storage/volume')}/detail/${value}`}> <Link to={`${this.getUrl('/storage/volume')}/detail/${value}`}>
{value} {value}