|
@@ -177,22 +177,21 @@ const GeneratingTokensAndRegisteringProxyServiceProcess = withUnstatedContainers
|
|
|
const TestProcess = ({ apiv3Post, slackAppIntegrationId }) => {
|
|
const TestProcess = ({ apiv3Post, slackAppIntegrationId }) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const [testChannel, setTestChannel] = useState('');
|
|
const [testChannel, setTestChannel] = useState('');
|
|
|
- const [connectionError, setConnectionError] = useState(null);
|
|
|
|
|
|
|
+ const [connectionMessage, setConnectionMessage] = useState(null);
|
|
|
|
|
|
|
|
let value = '';
|
|
let value = '';
|
|
|
- if (connectionError != null) {
|
|
|
|
|
- value = [connectionError.code, connectionError.message];
|
|
|
|
|
|
|
+ if (connectionMessage != null) {
|
|
|
|
|
+ value = [connectionMessage.code, connectionMessage.message];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const submitForm = async(e) => {
|
|
const submitForm = async(e) => {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
- setConnectionError(null);
|
|
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
await apiv3Post('/slack-integration-settings/with-proxy/relation-test', { slackAppIntegrationId, channel: testChannel });
|
|
await apiv3Post('/slack-integration-settings/with-proxy/relation-test', { slackAppIntegrationId, channel: testChannel });
|
|
|
|
|
+ setConnectionMessage('');
|
|
|
}
|
|
}
|
|
|
catch (error) {
|
|
catch (error) {
|
|
|
- setConnectionError(error[0]);
|
|
|
|
|
|
|
+ setConnectionMessage(error[0]);
|
|
|
logger.error(error);
|
|
logger.error(error);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -223,10 +222,15 @@ const TestProcess = ({ apiv3Post, slackAppIntegrationId }) => {
|
|
|
</button>
|
|
</button>
|
|
|
</form>
|
|
</form>
|
|
|
</div>
|
|
</div>
|
|
|
- {connectionError == null
|
|
|
|
|
- ? <p className="text-info text-center my-4">{t('admin:slack_integration.accordion.send_message_to_slack_work_space')}</p>
|
|
|
|
|
- : <p className="text-danger text-center my-4">{t('admin:slack_integration.accordion.error_check_logs_below')}</p>
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ {connectionMessage == null
|
|
|
|
|
+ ? <p></p>
|
|
|
|
|
+ : (
|
|
|
|
|
+ <>{connectionMessage === ''
|
|
|
|
|
+ ? <p className="text-info text-center my-4">{t('admin:slack_integration.accordion.send_message_to_slack_work_space')}</p>
|
|
|
|
|
+ : <p className="text-danger text-center my-4">{t('admin:slack_integration.accordion.error_check_logs_below')}</p>
|
|
|
|
|
+ }
|
|
|
|
|
+ </>
|
|
|
|
|
+ )}
|
|
|
<form>
|
|
<form>
|
|
|
<div className="row my-3 justify-content-center">
|
|
<div className="row my-3 justify-content-center">
|
|
|
<div className="form-group slack-connection-log col-md-4">
|
|
<div className="form-group slack-connection-log col-md-4">
|