zahmis 4 лет назад
Родитель
Сommit
6c0542bbe6

+ 18 - 14
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySecretTokenSection.jsx

@@ -4,17 +4,21 @@ import PropTypes from 'prop-types';
 import AdminUpdateButtonRow from '../Common/AdminUpdateButtonRow';
 
 const CustomBotWithoutProxySecretTokenSection = (props) => {
+  const {
+    slackSigningSecret, slackSigningSecretEnv, slackBotToken, slackBotTokenEnv,
+    onSigningSecretChanged, onBotTokenChanged,
+  } = props;
   const { t } = useTranslation();
 
-  const onChangeSigningSecretHandler = (signingSecretInput) => {
-    if (props.onChangeSigningSecretHandler != null) {
-      props.onChangeSigningSecretHandler(signingSecretInput);
+  const signingSecretChanged = (signingSecretInput) => {
+    if (onSigningSecretChanged != null) {
+      onSigningSecretChanged(signingSecretInput);
     }
   };
 
-  const onChangeBotTokenHandler = (botTokenInput) => {
-    if (props.onChangeBotTokenHandler != null) {
-      props.onChangeBotTokenHandler(botTokenInput);
+  const botTokenChanged = (botTokenInput) => {
+    if (onBotTokenChanged != null) {
+      onBotTokenChanged(botTokenInput);
     }
   };
 
@@ -35,8 +39,8 @@ const CustomBotWithoutProxySecretTokenSection = (props) => {
           <input
             className="form-control"
             type="text"
-            value={props.slackSigningSecret || ''}
-            onChange={e => onChangeSigningSecretHandler(e.target.value)}
+            value={slackSigningSecret || ''}
+            onChange={e => signingSecretChanged(e.target.value)}
           />
         </div>
 
@@ -45,7 +49,7 @@ const CustomBotWithoutProxySecretTokenSection = (props) => {
           <input
             className="form-control"
             type="text"
-            value={props.slackSigningSecretEnv || ''}
+            value={slackSigningSecretEnv || ''}
             readOnly
           />
           <p className="form-text text-muted">
@@ -64,8 +68,8 @@ const CustomBotWithoutProxySecretTokenSection = (props) => {
           <input
             className="form-control"
             type="text"
-            value={props.slackBotToken || ''}
-            onChange={e => onChangeBotTokenHandler(e.target.value)}
+            value={slackBotToken || ''}
+            onChange={e => botTokenChanged(e.target.value)}
           />
         </div>
 
@@ -74,7 +78,7 @@ const CustomBotWithoutProxySecretTokenSection = (props) => {
           <input
             className="form-control"
             type="text"
-            value={props.slackBotTokenEnv || ''}
+            value={slackBotTokenEnv || ''}
             readOnly
           />
           <p className="form-text text-muted">
@@ -93,8 +97,8 @@ const CustomBotWithoutProxySecretTokenSection = (props) => {
 
 CustomBotWithoutProxySecretTokenSection.propTypes = {
   updateSecretTokenHandler: PropTypes.func,
-  onChangeSigningSecretHandler: PropTypes.func,
-  onChangeBotTokenHandler: PropTypes.func,
+  onSigningSecretChanged: PropTypes.func,
+  onBotTokenChanged: PropTypes.func,
   slackSigningSecret: PropTypes.string,
   slackSigningSecretEnv: PropTypes.string,
   slackBotToken: PropTypes.string,

+ 2 - 2
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -151,8 +151,8 @@ const SlackIntegration = (props) => {
           slackSigningSecretEnv={slackSigningSecretEnv}
           slackSigningSecret={slackSigningSecret}
           slackWSNameInWithoutProxy={slackWSNameInWithoutProxy}
-          onSetSlackSigningSecret={setSlackSigningSecret}
-          onSetSlackBotToken={setSlackBotToken}
+          onSigningSecretChanged={setSlackSigningSecret}
+          onBotTokenChanged={setSlackBotToken}
           onResetSettings={resetWithOutSettings}
           fetchSlackIntegrationData={fetchSlackIntegrationData}
           connectionStatuses={connectionStatuses}