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

SKS-3394 show true/false status in condition table #215

Merged
merged 1 commit into from
Feb 7, 2025
Merged
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
23 changes: 5 additions & 18 deletions packages/refine/src/components/ConditionsTable/ConditionsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { StatusCapsule, StatusCapsuleColor } from '@cloudtower/eagle';
import { cx } from '@linaria/core';
import { Condition } from 'kubernetes-types/meta/v1';
import { Condition } from 'kubernetes-types/meta/v1';
import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
import ErrorContent, { ErrorContentType } from 'src/components/ErrorContent';
import BaseTable from 'src/components/InternalBaseTable';
import ComponentContext from 'src/contexts/component';
import { addDefaultRenderToColumns } from 'src/hooks/useEagleTable';
import useTableData from 'src/hooks/useTableData';
import { StateTagStyle } from 'src/styles/tag';
import useTableData from 'src/hooks/useTableData';
import { WithId } from 'src/types';
import { addId } from '../../utils/addId';
import { Time } from '../Time';
Expand Down Expand Up @@ -36,21 +33,11 @@ export const ConditionsTable: React.FC<Props> = ({ conditions = [] }) => {
display: true,
dataIndex: 'status',
title: t('dovetail.state'),
render(value: string) {
const colorMap: Record<string, StatusCapsuleColor> = {
'True': 'green',
'False': 'red',
'Unknown': 'warning',
};

return (
<StatusCapsule color={colorMap[value || 'Unknown']} className={cx(StateTagStyle, 'no-background')}>
{t(`dovetail.${value.toLowerCase()}`)}
</StatusCapsule>
);
},
width: 120,
sortable: true,
render: (value: string) => {
return value;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里 render 应该不需要也可以?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行,这个render如果不要的话,在ui-components table里面会显示不出来,怀疑是ui-components table的bug

},
},
{
key: 'lastTransitionTime',
Expand Down
Loading