diff --git a/web/src/pages/System/Cluster/Step.js b/web/src/pages/System/Cluster/Step.js
index df2dac03..ff2b36f4 100644
--- a/web/src/pages/System/Cluster/Step.js
+++ b/web/src/pages/System/Cluster/Step.js
@@ -151,6 +151,14 @@ const ClusterStep = ({ dispatch, history, query }) => {
username: clusterConfig.username || "",
password: clusterConfig.password || "",
},
+ agent_credential_id:
+ values.agent_credential_id !== MANUAL_VALUE
+ ? values.agent_credential_id
+ : undefined,
+ agent_basic_auth: {
+ username: values.agent_username,
+ password: values.agent_password,
+ },
description: values.description,
enabled: true,
monitored: values.monitored,
@@ -196,7 +204,7 @@ const ClusterStep = ({ dispatch, history, query }) => {
if (current === 0) {
return ;
} else if (current === 1) {
- return ;
+ return ;
} else if (current === 2) {
return (
{
+ const { dispatch, form, initialValue } = this.props;
+ if (this.state.needAuth) {
+ this.setState({
+ ...this.state,
+ agentCredentialRequired: true,
+ });
+ }
+ const fieldNames = [
+ "agent_credential_id",
+ "agent_username",
+ "agent_password",
+ ];
+ setTimeout(() => {
+ form.validateFields(
+ fieldNames,
+ { force: true },
+ async (errors, values) => {
+ if (errors) {
+ return false;
+ }
+ if (!initialValue) {
+ return;
+ }
+ let newVals = {
+ host: initialValue.host,
+ schema: initialValue.isTLS === true ? "https" : "http",
+ };
+ newVals = {
+ ...newVals,
+ ...{
+ credential_id:
+ values.agent_credential_id !== MANUAL_VALUE
+ ? values.agent_credential_id
+ : undefined,
+ basic_auth: {
+ username: values.agent_username,
+ password: values.agent_password,
+ },
+ },
+ };
+ this.setState({ btnLoadingAgent: true });
+
+ const res = await dispatch({
+ type: "clusterConfig/doTryConnect",
+ payload: newVals,
+ });
+ if (res) {
+ message.success(
+ formatMessage({
+ id: "app.message.connect.success",
+ })
+ );
+ }
+ this.setState({ btnLoadingAgent: false });
+ }
+ );
+ }, 200);
+ };
+
render() {
const {
form: { getFieldDecorator },
@@ -141,15 +215,21 @@ export class ExtraStep extends React.Component {
initialValue: "",
})()}
- {/*
- {getFieldDecorator('enabled', {
- valuePropName: 'checked',
- initialValue: true,
- })(}
- unCheckedChildren={}
- />)}
- */}
+