-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: improve codes #183
Conversation
MrWindlike
commented
Oct 16, 2024
- 原 Table 组件重命名为 InternalBaseTable,这个组件只是内部使用,外部可传入自定义的表格组件进行使用。然后封装一个更上层的 Table 组件方便外部编写 field 使用
- EditField 允许在提交时返回 false 来阻止表单提交,用于校验场景
- PVC 编辑分配量表单添加校验
- 添加新的状态
}; | ||
const resourceStateMap: Record<string, Record<string, StatusCapsuleColor | 'loading'>> = {}; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 })} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个判断是为了防什么?
There was a problem hiding this comment.
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}}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
英文文案应该要有空格吧?
There was a problem hiding this comment.
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
bd3856f
to
59ce74a
Compare