Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cluster remove, choose dir #185

Merged
merged 1 commit into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions src/pages/ServiceManage/LeaderDistribution/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,27 @@
display: flex;
flex-wrap: wrap;
overflow: auto;
>pre{
margin:0 5px;
div {
margin:5px 0;
white-space: break-spaces;
word-break: break-all;
}
}
}
}
.content-overview{
display: flex;
padding: 20px 30px 20px 0;
justify-content: space-between;

.table-overview{
flex: 1;
margin-top: 20px;
}

.ant-empty-normal{
margin: 0;
}
}
.overview-header{
display: block;
Expand Down Expand Up @@ -54,15 +69,4 @@
.ant-empty-normal{
margin: 0;
}
.content-overview{
display: flex;
padding: 20px 30px 20px 0;
.table-overview{
flex: 1;
margin-top: 20px;
}
.ant-empty-normal{
margin: 0;
}
}
}
54 changes: 28 additions & 26 deletions src/pages/ServiceManage/LeaderDistribution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const mapState = (state: IRootState) => ({

interface IProps
extends ReturnType<typeof mapState>,
ReturnType<typeof mapDispatch> {
ReturnType<typeof mapDispatch> {
isOverview?: boolean;
baseRouter?: string;
cluster?: ICluster;
Expand Down Expand Up @@ -63,7 +63,7 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {
const getStorageInfo = async () => {
const res = await props.asyncGetHostsInfo();
const data = res.map((item: any) => ({
name: item.Host+':'+item.Port,
name: item.Host + ':' + item.Port,
count: item['Leader count'],
distribution: item['Leader distribution'],
})).sort((a, b) => a.name > b.name ? 1 : -1);
Expand Down Expand Up @@ -110,29 +110,31 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {
}
};

const columns = [
{
title: intl.get('common.service'),
dataIndex: 'name',
},
{
title: intl.get('service.leaderNumber'),
dataIndex: 'count',
},
{
title: intl.get('service.leaderDistribute'),
dataIndex: 'distribution',
render: distribution => (
<div className="distribution-table">
{distribution.split(',').map(each => <pre>{each.trim(' ')}</pre>)}
</div>
),
},
];
const columns = useMemo(() => (
[
{
title: intl.get('common.service'),
dataIndex: 'name',
},
{
title: intl.get('service.leaderNumber'),
dataIndex: 'count',
},
{
title: intl.get('service.leaderDistribute'),
dataIndex: 'distribution',
render: distribution => (
<div className="distribution-table">
{distribution.split(',').map(each => <div className="leader-item">{each.trim()}</div>)}
</div>
),
},
]
), []);

const options = useMemo(
() =>
isOverview ? { width: 350, height: 226 } : { width: 500, height: 286 },
isOverview ? { width: 320, height: 226 } : { width: 500, height: 286 },
[isOverview],
);

Expand Down Expand Up @@ -165,10 +167,10 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {
})}
>
{data.length > 0 ? (
<PieChart options={options} renderChart={renderChart} />
) : (
<Empty description={intl.get('common.noData')} />
)}
<PieChart options={options} renderChart={renderChart} />
) : (
<Empty description={intl.get('common.noData')} />
)}
<Table
className={classnames('leader-table', {
'table-overview': isOverview,
Expand Down