zahmis 4 лет назад
Родитель
Сommit
2fd6765c41

+ 3 - 6
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettings.jsx

@@ -43,10 +43,6 @@ const CustomBotWithoutProxySettings = (props) => {
     }
   };
 
-  const inputTestChannelHandler = (channel) => {
-    setTestChannel(channel);
-  };
-
   useEffect(() => {
     const siteName = appContainer.config.crowi.title;
     setSiteName(siteName);
@@ -77,11 +73,12 @@ const CustomBotWithoutProxySettings = (props) => {
         <CustomBotWithoutProxySettingsAccordion
           {...props}
           activeStep={botInstallationStep.CREATE_BOT}
-          onTestConnection={testConnection}
-          onInputTestChannelHandler={inputTestChannelHandler}
           connectionMessage={connectionMessage}
           connectionErrorCode={connectionErrorCode}
           testChannel={testChannel}
+          onTestConnection={testConnection}
+          onSetTestChannel={setTestChannel}
+
         />
       </div>
       <DeleteSlackBotSettingsModal

+ 12 - 3
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettingsAccordion.jsx

@@ -19,7 +19,7 @@ const CustomBotWithoutProxySettingsAccordion = ({
   appContainer, activeStep, fetchSlackIntegrationData, connectionMessage, connectionErrorCode, testChannel,
   slackSigningSecret, slackSigningSecretEnv, slackBotToken, slackBotTokenEnv,
   isRegisterSlackCredentials, isSendTestMessage,
-  onSetSlackSigningSecret, onSetSlackBotToken, onTestConnection, onInputTestChannelHandler,
+  onSetSlackSigningSecret, onSetSlackBotToken, onTestConnection, onSetTestChannel,
 }) => {
   const { t } = useTranslation();
   // TODO: GW-5644 Store default open accordion
@@ -59,9 +59,18 @@ const CustomBotWithoutProxySettingsAccordion = ({
     }
   };
 
+  const inputTestChannelHandler = (channel) => {
+    if (onSetTestChannel != null) {
+      onSetTestChannel(channel);
+    }
+  };
 
   const submitForm = (e) => {
     e.preventDefault();
+
+    if (onTestConnection == null) {
+      return;
+    }
     onTestConnection();
   };
 
@@ -146,7 +155,7 @@ const CustomBotWithoutProxySettingsAccordion = ({
                 type="text"
                 value={testChannel}
                 placeholder="Slack Channel"
-                onChange={e => onInputTestChannelHandler(e.target.value)}
+                onChange={e => inputTestChannelHandler(e.target.value)}
               />
             </div>
             <button
@@ -201,8 +210,8 @@ CustomBotWithoutProxySettingsAccordion.propTypes = {
   onSetSlackSigningSecret: PropTypes.func,
   onSetSlackBotToken: PropTypes.func,
   onSetIsRegisterSlackCredentials: PropTypes.func,
-  onInputTestChannelHandler: PropTypes.func,
   onTestConnection: PropTypes.func,
+  onSetTestChannel:  PropTypes.func,
   connectionMessage: PropTypes.string,
   connectionErrorCode: PropTypes.string,
   adminAppContainer: PropTypes.instanceOf(AdminAppContainer).isRequired,