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: improve codes #183

Merged
merged 3 commits into from
Oct 16, 2024
Merged

feat: improve codes #183

merged 3 commits into from
Oct 16, 2024

Conversation

MrWindlike
Copy link
Collaborator

  1. 原 Table 组件重命名为 InternalBaseTable,这个组件只是内部使用,外部可传入自定义的表格组件进行使用。然后封装一个更上层的 Table 组件方便外部编写 field 使用
  2. EditField 允许在提交时返回 false 来阻止表单提交,用于校验场景
  3. PVC 编辑分配量表单添加校验
  4. 添加新的状态

};
const resourceStateMap: Record<string, Record<string, StatusCapsuleColor | 'loading'>> = {};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

如果资源有单独的状态定义可写在这里,现在暂时没有用上,先保留为空对象

import { TableProps as BaseTableProps, RequiredColumnProps, Table as BaseTable, Pagination, Loading } from '@cloudtower/eagle';
import { css, cx } from '@linaria/core';
import React, { useMemo, useRef } from 'react';
import { cx } from '@linaria/core';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

由于文件重命名的关系,这里的 diff 不准确,可以只看新增的内容即可

@@ -0,0 +1,149 @@
import { TableProps as BaseTableProps, RequiredColumnProps, Table as BaseTable, Pagination, Loading } from '@cloudtower/eagle';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

由 Table 重命名为 InternalBaseTable,内容无变化


return (
<Button
prefixIcon={<PlusAddCreateNew16BoldOntintIcon />}
type="primary"
onClick={openForm}
>
{t('dovetail.create_resource', { resource: resource?.meta?.kind })}
{t('dovetail.create_resource', { resource: /^[a-zA-Z]/.test(label) ? ` ${label}` : label })}
Copy link
Member

Choose a reason for hiding this comment

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

这个判断是为了防什么?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

判断是否为英文开头,是则加上空格

@@ -12,8 +12,8 @@
"fetch_schema_fail": "获取 schema 失败。",
"obtain_data_error": "Having trouble getting data.",
"retry": "Retry",
"create_resource": "Create {{resource}}",
Copy link
Member

Choose a reason for hiding this comment

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

英文文案应该要有空格吧?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

对,现在改成用 JS 动态判断加上空格

1. add the new Table component
2. allow EditField to stop submit when the form is invalid
3. add validators for pvc storage form
4. add new states for StateTag
@tanbowensg tanbowensg merged commit 2ac606e into main Oct 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants