|
@@ -16,10 +16,10 @@ export const botInstallationStep = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const CustomBotWithoutProxySettingsAccordion = ({
|
|
const CustomBotWithoutProxySettingsAccordion = ({
|
|
|
- appContainer,
|
|
|
|
|
- activeStep, slackSigningSecret, slackSigningSecretEnv, slackBotToken,
|
|
|
|
|
- slackBotTokenEnv, isRegisterSlackCredentials, isSendTestMessage,
|
|
|
|
|
- setSlackSigningSecret, setSlackBotToken, setIsSendTestMessage, setIsRegisterSlackCredentials,
|
|
|
|
|
|
|
+ appContainer, activeStep,
|
|
|
|
|
+ slackSigningSecret, slackSigningSecretEnv, slackBotToken, slackBotTokenEnv,
|
|
|
|
|
+ isRegisterSlackCredentials, isSendTestMessage,
|
|
|
|
|
+ onSetSlackSigningSecret, onSetSlackBotToken, onSetIsSendTestMessage, onSetIsRegisterSlackCredentials,
|
|
|
}) => {
|
|
}) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
// TODO: GW-5644 Store default open accordion
|
|
// TODO: GW-5644 Store default open accordion
|
|
@@ -39,26 +39,26 @@ const CustomBotWithoutProxySettingsAccordion = ({
|
|
|
currentBotType,
|
|
currentBotType,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- setIsRegisterSlackCredentials(true);
|
|
|
|
|
|
|
+ onSetIsRegisterSlackCredentials(true);
|
|
|
if (slackSigningSecret === '' || slackBotToken === '') {
|
|
if (slackSigningSecret === '' || slackBotToken === '') {
|
|
|
- setIsRegisterSlackCredentials(false);
|
|
|
|
|
- setIsSendTestMessage(false);
|
|
|
|
|
|
|
+ onSetIsRegisterSlackCredentials(false);
|
|
|
|
|
+ onSetIsSendTestMessage(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
|
|
toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
- setIsRegisterSlackCredentials(false);
|
|
|
|
|
|
|
+ onSetIsRegisterSlackCredentials(false);
|
|
|
toastError(err);
|
|
toastError(err);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const onChangeSigningSecretHandler = (signingSecretInput) => {
|
|
const onChangeSigningSecretHandler = (signingSecretInput) => {
|
|
|
- setSlackSigningSecret(signingSecretInput);
|
|
|
|
|
|
|
+ onSetSlackSigningSecret(signingSecretInput);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const onChangeBotTokenHandler = (botTokenInput) => {
|
|
const onChangeBotTokenHandler = (botTokenInput) => {
|
|
|
- setSlackBotToken(botTokenInput);
|
|
|
|
|
|
|
+ onSetSlackBotToken(botTokenInput);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const onTestConnectionHandler = async() => {
|
|
const onTestConnectionHandler = async() => {
|
|
@@ -70,10 +70,10 @@ const CustomBotWithoutProxySettingsAccordion = ({
|
|
|
channel: testChannel,
|
|
channel: testChannel,
|
|
|
});
|
|
});
|
|
|
setConnectionSuccessMessage(res.data.message);
|
|
setConnectionSuccessMessage(res.data.message);
|
|
|
- setIsSendTestMessage(true);
|
|
|
|
|
|
|
+ onSetIsSendTestMessage(true);
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
- setIsSendTestMessage(false);
|
|
|
|
|
|
|
+ onSetIsSendTestMessage(false);
|
|
|
setConnectionErrorCode(err[0].code);
|
|
setConnectionErrorCode(err[0].code);
|
|
|
setConnectionErrorMessage(err[0].message);
|
|
setConnectionErrorMessage(err[0].message);
|
|
|
}
|
|
}
|
|
@@ -209,10 +209,10 @@ CustomBotWithoutProxySettingsAccordion.propTypes = {
|
|
|
slackBotTokenEnv: PropTypes.string,
|
|
slackBotTokenEnv: PropTypes.string,
|
|
|
isRegisterSlackCredentials: PropTypes.bool,
|
|
isRegisterSlackCredentials: PropTypes.bool,
|
|
|
isSendTestMessage: PropTypes.bool,
|
|
isSendTestMessage: PropTypes.bool,
|
|
|
- setSlackSigningSecret: PropTypes.string,
|
|
|
|
|
- setSlackBotToken: PropTypes.string,
|
|
|
|
|
- setIsSendTestMessage: PropTypes.func,
|
|
|
|
|
- setIsRegisterSlackCredentials: PropTypes.func,
|
|
|
|
|
|
|
+ onSetSlackSigningSecret: PropTypes.string,
|
|
|
|
|
+ onSetSlackBotToken: PropTypes.string,
|
|
|
|
|
+ onSetIsSendTestMessage: PropTypes.func,
|
|
|
|
|
+ onSetIsRegisterSlackCredentials: PropTypes.func,
|
|
|
adminAppContainer: PropTypes.instanceOf(AdminAppContainer).isRequired,
|
|
adminAppContainer: PropTypes.instanceOf(AdminAppContainer).isRequired,
|
|
|
activeStep: PropTypes.oneOf(Object.values(botInstallationStep)).isRequired,
|
|
activeStep: PropTypes.oneOf(Object.values(botInstallationStep)).isRequired,
|
|
|
};
|
|
};
|