mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-24 23:10:13 +08:00
refactor(ui): clean code
This commit is contained in:
@@ -50,13 +50,11 @@ const AccessConfigFormFieldsProviderSSH = ({ disabled }: { disabled?: boolean })
|
||||
label={t("access.form.ssh_auth_method.label")}
|
||||
rules={[formRule]}
|
||||
>
|
||||
<Radio.Group
|
||||
options={[AUTH_METHOD_NONE, AUTH_METHOD_PASSWORD, AUTH_METHOD_KEY].map((s) => ({
|
||||
key: s,
|
||||
label: t(`access.form.ssh_auth_method.option.${s}.label`),
|
||||
value: s,
|
||||
}))}
|
||||
/>
|
||||
<Radio.Group block>
|
||||
<Radio.Button value={AUTH_METHOD_NONE}>{t("access.form.ssh_auth_method.option.none.label")}</Radio.Button>
|
||||
<Radio.Button value={AUTH_METHOD_PASSWORD}>{t("access.form.ssh_auth_method.option.password.label")}</Radio.Button>
|
||||
<Radio.Button value={AUTH_METHOD_KEY}>{t("access.form.ssh_auth_method.option.key.label")}</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name={[parentNamePath, "username"]} initialValue={initialValues.username} label={t("access.form.ssh_username.label")} rules={[formRule]}>
|
||||
|
||||
@@ -111,13 +111,9 @@ const WorkflowGraphExportBox = ({ className, style, data }: WorkflowGraphExportB
|
||||
return (
|
||||
<Form className={className} style={style} layout="vertical">
|
||||
<Form.Item className="mb-4" label={t("workflow.detail.design.action.export.form.format.label")}>
|
||||
<Radio.Group className="w-full" value={format} onChange={(e) => setFormat(e.target.value)}>
|
||||
<Radio.Button className="w-1/2 text-center" value="yaml">
|
||||
YAML
|
||||
</Radio.Button>
|
||||
<Radio.Button className="w-1/2 text-center" value="json">
|
||||
JSON
|
||||
</Radio.Button>
|
||||
<Radio.Group block value={format} onChange={(e) => setFormat(e.target.value)}>
|
||||
<Radio.Button value="yaml">YAML</Radio.Button>
|
||||
<Radio.Button value="json">JSON</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -229,13 +229,9 @@ const WorkflowGraphImportInputBox = forwardRef<WorkflowGraphImportInputBoxInstan
|
||||
return (
|
||||
<Form className={className} style={style} {...formProps} clearOnDestroy={true} form={formInst} layout="vertical" preserve={false} scrollToFirstError>
|
||||
<Form.Item className="mb-4" name="format" label={t("workflow.detail.design.action.import.form.format.label")} rules={[formRule]}>
|
||||
<Radio.Group className="w-full" onChange={(e) => handleFormatChange(e.target.value)}>
|
||||
<Radio.Button className="w-1/2 text-center" value="yaml">
|
||||
YAML
|
||||
</Radio.Button>
|
||||
<Radio.Button className="w-1/2 text-center" value="json">
|
||||
JSON
|
||||
</Radio.Button>
|
||||
<Radio.Group block onChange={(e) => handleFormatChange(e.target.value)}>
|
||||
<Radio.Button value="yaml">YAML</Radio.Button>
|
||||
<Radio.Button value="json">JSON</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ const AccessList = () => {
|
||||
<Table<AccessModel>
|
||||
columns={tableColumns}
|
||||
dataSource={tableData}
|
||||
loading={!loadedAtOnce || loading}
|
||||
loading={loading}
|
||||
locale={{
|
||||
emptyText: loading ? (
|
||||
<Skeleton />
|
||||
@@ -415,12 +415,18 @@ const AccessList = () => {
|
||||
<Empty
|
||||
className="py-24"
|
||||
title={t("access.nodata.title")}
|
||||
description={t("access.nodata.description")}
|
||||
description={!loadedAtOnce ? getErrMsg("Network error.") : t("access.nodata.description")}
|
||||
icon={<IconFingerprint size={24} />}
|
||||
extra={
|
||||
<Button icon={<IconCirclePlus size="1.25em" />} type="primary" onClick={handleCreateClick}>
|
||||
{t("access.action.create.button")}
|
||||
</Button>
|
||||
!loadedAtOnce ? (
|
||||
<Button ghost icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
{t("common.button.reload")}
|
||||
</Button>
|
||||
) : (
|
||||
<Button icon={<IconCirclePlus size="1.25em" />} type="primary" onClick={handleCreateClick}>
|
||||
{t("access.nodata.button")}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
/>
|
||||
),
|
||||
|
||||
@@ -417,7 +417,7 @@ const CertificateList = () => {
|
||||
icon={<IconCertificate size={24} />}
|
||||
extra={
|
||||
loadError ? (
|
||||
<Button icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
<Button ghost icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
{t("common.button.reload")}
|
||||
</Button>
|
||||
) : (
|
||||
|
||||
@@ -383,7 +383,7 @@ const WorkflowRunHistoryTable = ({ className, style }: { className?: string; sty
|
||||
icon={<IconHistory size={24} />}
|
||||
extra={
|
||||
loadError ? (
|
||||
<Button icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
<Button ghost icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
{t("common.button.reload")}
|
||||
</Button>
|
||||
) : (
|
||||
|
||||
@@ -48,7 +48,7 @@ const SettingsAppearanceTheme = ({ className, style }: { className?: string; sty
|
||||
<div className={className} style={style}>
|
||||
<Form layout="vertical">
|
||||
<Form.Item extra={themeChanged ? t("settings.appearance.theme.form.value.extra") : void 0}>
|
||||
<Radio.Group className="w-full" value={themeMode} onChange={handleChange}>
|
||||
<Radio.Group block value={themeMode} onChange={handleChange}>
|
||||
<div className="flex w-full items-center gap-4 max-md:flex-wrap">
|
||||
{themeItems.map((item) => (
|
||||
<div className="relative max-w-44 flex-1/3 max-md:flex-1/2 max-sm:flex-1" key={item.key}>
|
||||
|
||||
@@ -495,7 +495,7 @@ const WorkflowList = () => {
|
||||
icon={<IconHierarchy3 size={24} />}
|
||||
extra={
|
||||
loadError ? (
|
||||
<Button icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
<Button ghost icon={<IconReload size="1.25em" />} type="primary" onClick={handleReloadClick}>
|
||||
{t("common.button.reload")}
|
||||
</Button>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user