Skip to content

Commit

Permalink
feat: add expiration tag in cluster list
Browse files Browse the repository at this point in the history
Signed-off-by: liuying <liu.ying@99cloud.net>
  • Loading branch information
lysign committed Sep 22, 2022
1 parent d7648f6 commit e704bf1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@
"Download": "Download",
"Update Cluster License": "Update Cluster License",
"License Expiration Time": "License Expiration Time",
"License Expiration": "License Expiration",
"Please keep the CPU architecture consistent!": "Please keep the CPU architecture consistent!",
"The selected node and schema are inconsistent": "The selected node and schema are inconsistent",
"The backup path needs to be created on each node and mounted to a shared file path (such as NFS)": "The backup path needs to be created on each node and mounted to a shared file path (such as NFS)",
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@
"Update Cluster License": "更新集群证书",
"View KubeConfig File": "查看 Kubeconfig 文件",
"License Expiration Time": "证书过期时间",
"License Expiration": "证书过期",
"Please keep the CPU architecture consistent!": "请保持 CPU 架构的一致性!",
"The selected node and schema are inconsistent": "选择的节点和架构不一致",
"The backup path needs to be created on each node and mounted to a shared file path (such as NFS)": "备份路径需要在每个节点上自行创建,并将路径该挂载到共享的文件路径(如 NFS)",
Expand Down
21 changes: 20 additions & 1 deletion src/resources/cluster.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { getRoles, nodeEnum } from 'resources/node';
import RenderOption from 'components/RenderOption';
import { Tag } from 'antd';
import { checkExpired } from 'utils';
import moment from 'moment';

export const clusterParams = {
offline: true,
Expand Down Expand Up @@ -266,7 +269,23 @@ export const columns = [
dataIndex: 'name',
isHideable: true,
copyable: true,
render: (name) => <Link to={`/cluster/${name}`}>{name}</Link>,
render: (name, data) => {
const date = moment(data.licenseExpirationTime)
.subtract(1, 'day')
.format();
const isExpired = !checkExpired(date);

return (
<>
<Link to={`/cluster/${name}`}>{name}</Link>
{isExpired ? (
<Tag style={{ marginLeft: '12px' }} color={'red'} key={name}>
{t('License Expiration')}
</Tag>
) : null}
</>
);
},
},
{
title: t('Region'),
Expand Down

0 comments on commit e704bf1

Please sign in to comment.