Files
KnowStreaming/km-console/packages/layout-clusters-fe/src/pages/BrokerDetail/config.tsx
2022-08-18 17:04:05 +08:00

107 lines
2.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Utils, IconFont, Tooltip } from 'knowdesign';
export const getConfigurationColmns = (arg: any) => {
const columns: any = [
{
title: '',
dataIndex: 'readOnly',
key: 'readOnly',
align: 'right',
// eslint-disable-next-line react/display-name
render: (t: string, r: any) => {
return t ? (
<Tooltip title="该配置无法修改" visible={r.name === arg?.readOnlyRecord?.name && arg?.readOnlyVisible}>
<IconFont style={{ color: '#556EE6', fontSize: '16px' }} type="icon-suoding" />
</Tooltip>
) : null;
},
width: 56,
className: 'table-suoding',
},
{
title: '配置名',
dataIndex: 'name',
key: 'name',
width: 250,
},
{
title: '描述',
dataIndex: 'documentation',
key: 'documentation',
width: 300,
lineClampTwo: true,
needTooltip: true,
},
{
title: '配置值',
dataIndex: 'value',
key: 'value',
width: 250,
lineClampTwo: true,
},
{
title: '状态',
dataIndex: 'state',
key: 'state',
// eslint-disable-next-line react/display-name
render: (t: string, r: any) => {
return r.differentiated ? (
<div className="differ"></div>
) : r.exclusive ? (
<div className="unique"></div>
) : (
<div className="normal"></div>
);
},
},
];
if (arg.allowEdit) {
columns.push({
title: '操作',
dataIndex: 'options',
key: 'options',
// eslint-disable-next-line react/display-name
render: (_t: any, r: any) => {
return !r.readOnly ? <a onClick={() => arg.setEditOp(r)}></a> : '-';
},
});
}
return columns;
};
export const getDataLogsColmns = () => {
const columns = [
{
title: 'Folder',
dataIndex: 'dir',
key: 'dir',
},
{
title: 'Topic',
dataIndex: 'topicName',
key: 'topicName',
},
{
title: 'Partition',
dataIndex: 'partitionId',
key: 'partitionId',
},
{
title: 'Offset Lag',
dataIndex: 'offsetLag',
key: 'offsetLag',
},
{
title: 'SizeMB',
dataIndex: 'logSizeUnitB',
key: 'logSizeUnitB',
render: (t: number, r: any) => {
return t || t === 0 ? Utils.transBToMB(t) : '-';
},
},
];
return columns;
};