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

Fix:modify unit config #236

Merged
merged 5 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ahooks": "^3.7.8",
"antd": "^5.4.0",
"copy-to-clipboard": "^3.3.3",
"i18next": "^23.10.0",
"i18next": "^23.10.1",
"jsencrypt": "^3.3.2",
"lodash": "^4.17.21",
"moment": "^2.29.4"
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/TopoComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { deleteObcluster, deleteObzone, getClusterDetailReq } from '@/services';
import { getNSName } from '../../pages/Cluster/Detail/Overview/helper';
import { ReactNode, config } from './G6register';
import type { OperateTypeLabel } from './constants';
import { RESULT_STATUS } from '@/constants';
import {
clusterOperate,
clusterOperateOfTenant,
Expand Down Expand Up @@ -223,7 +224,7 @@ export default function TopoComponent({
useUpdateEffect(() => {
let checkStatusTimer: NodeJS.Timer;
//polling
if (originTopoData.topoData.status !== 'running') {
if (!RESULT_STATUS.includes(originTopoData.topoData.status)) {
if (!operateDisable) setOperateDisable(true);
checkStatusTimer = setInterval(() => {
getTopoData({ ns, name, useFor: 'topo', tenantReplicas });
Expand Down
88 changes: 48 additions & 40 deletions ui/src/components/customModal/AddZoneModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { intl } from '@/utils/intl';
import { Form, Input, InputNumber, message } from 'antd';

import { TZ_NAME_REG } from '@/constants';
import { getNSName } from '@/pages/Cluster/Detail/Overview/helper';
import { addObzone } from '@/services';
import type { CommonModalType } from '.';
Expand Down Expand Up @@ -71,6 +72,13 @@ export default function AddZoneModal({
defaultMessage: '请输入zone名称!',
}),
},
{
pattern: TZ_NAME_REG,
message: intl.formatMessage({
id: 'Dashboard.components.customModal.AddZoneModal.TheFirstCharacterMustBe',
defaultMessage: '首字符必须是字母或者下划线,不能包含 -',
}),
},
]}
>
<Input
Expand Down Expand Up @@ -105,46 +113,46 @@ export default function AddZoneModal({
</Form.Item>
{/* 如果不能为空的话应该需要添加默认值 */}
{/* <p>node-selector:</p>
<Form.List name="nodeSelector">
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }) => (
<Space
key={key}
style={{ display: 'flex', marginBottom: 8 }}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'key']}
rules={[{ required: true, message: '请输入key' }]}
>
<Input placeholder="key" />
</Form.Item>
:
<Form.Item
{...restField}
name={[name, 'value']}
rules={[{ required: true, message: '请输入value' }]}
>
<Input placeholder="value" />
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} />
</Space>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
block
icon={<PlusOutlined />}
>
添加node-selector
</Button>
</Form.Item>
</>
)}
</Form.List> */}
<Form.List name="nodeSelector">
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }) => (
<Space
key={key}
style={{ display: 'flex', marginBottom: 8 }}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'key']}
rules={[{ required: true, message: '请输入key' }]}
>
<Input placeholder="key" />
</Form.Item>
:
<Form.Item
{...restField}
name={[name, 'value']}
rules={[{ required: true, message: '请输入value' }]}
>
<Input placeholder="value" />
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} />
</Space>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
block
icon={<PlusOutlined />}
>
添加node-selector
</Button>
</Form.Item>
</>
)}
</Form.List> */}
<NodeSelector
showLabel={true}
formName="nodeSelector"
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/customModal/ModifyPasswordModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { changeTenantPassword } from '@/services/tenant';
import { intl } from '@/utils/intl';
import { Form, Input, message } from 'antd';
import type { CommonModalType } from '.';
import { usePublicKey, encryptText } from '@/hook/usePublicKey';
import CustomModal from '.';

type FieldType = {
Expand All @@ -15,6 +16,7 @@ export default function ModifyPasswordModal({
successCallback,
}: CommonModalType) {
const [form] = Form.useForm();
const publicKey = usePublicKey()

const handleSubmit = async () => {
try {
Expand All @@ -30,7 +32,7 @@ export default function ModifyPasswordModal({
ns: namespace,
name,
User: 'root',
Password: values.password,
Password: encryptText(values.password,publicKey) as string,
});
if (res.successful) {
message.success(res.message);
Expand Down
Loading
Loading