Explorar o código

case adjustment

kaori %!s(int64=5) %!d(string=hai) anos
pai
achega
30c07733e1

+ 21 - 3
src/client/js/components/Admin/SlackIntegration/BotTypeCard.jsx

@@ -10,7 +10,7 @@ const BotTypeCard = (props) => {
   switch (props.botType) {
     case 'customBotWithoutProxy':
       botDetails = {
-        botType: 'custom-bot-without-proxy',
+        botType: 'customBotWithoutProxy',
         botTypeCategory: 'custom_bot',
         supplementaryBotName: 'without_proxy',
         setUp: 'normal',
@@ -20,7 +20,7 @@ const BotTypeCard = (props) => {
       break;
     case 'customBotWithProxy':
       botDetails = {
-        botType: 'custom-bot-with-proxy',
+        botType: 'customBotWithProxy',
         botTypeCategory: 'custom_bot',
         supplementaryBotName: 'with_proxy',
         setUp: 'hard',
@@ -30,7 +30,7 @@ const BotTypeCard = (props) => {
       break;
     default:
       botDetails = {
-        botType: 'official-bot',
+        botType: 'officialBot',
         botTypeCategory: 'official_bot',
         setUp: 'easy',
         multiWSIntegration: 'possible',
@@ -39,6 +39,24 @@ const BotTypeCard = (props) => {
       break;
   }
 
+  // let settingsComponent = null;
+
+  // switch (props.isActive) {
+  //   case 'official-bot':
+  //     settingsComponent = <OfficialBotSettings />;
+  //     break;
+  //   case 'custom-bot-without-proxy':
+  //     settingsComponent = (
+  //       <CustomBotWithoutProxySettings />
+  //     );
+  //     break;
+  //   case 'custom-bot-with-proxy':
+  //     settingsComponent = <CustomBotWithProxySettings />;
+  //     break;
+  // }
+
+  console.log(props.isActive);
+
   return (
     <div
       className={`card admin-bot-card rounded border-radius-sm shadow ${props.isActive ? 'border-primary' : ''}`}

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

@@ -45,6 +45,7 @@ const SlackIntegration = (props) => {
       return;
     }
     setSelectedBotType(clickedBotType);
+    console.log(clickedBotType);
   };
 
   const cancelBotChangeHandler = () => {
@@ -91,20 +92,22 @@ const SlackIntegration = (props) => {
   let settingsComponent = null;
 
   switch (currentBotType) {
-    case 'official-bot':
+    case 'officialBot':
       settingsComponent = <OfficialBotSettings />;
       break;
-    case 'custom-bot-without-proxy':
+    case 'customBotWithoutProxy':
       settingsComponent = (
         <CustomBotWithoutProxySettings />
       );
       break;
-    case 'custom-bot-with-proxy':
+    case 'customBotWithProxy':
       settingsComponent = <CustomBotWithProxySettings />;
       break;
   }
 
+
   const botTypes = ['officialBot', 'customBotWithoutProxy', 'customBotWithProxy'];
+  // const botTypes = ['official-bot', 'custom-bot-without-proxy', 'custom-bot-with-proxy'];
 
   return (
     <>

+ 1 - 1
src/server/routes/apiv3/slack-integration.js

@@ -53,7 +53,7 @@ module.exports = (crowi) => {
     ],
     SlackIntegration: [
       body('currentBotType')
-        .isIn(['official-bot', 'custom-bot-without-proxy', 'custom-bot-with-proxy']),
+        .isIn(['officialBot', 'customBotWithoutProxy', 'customBotWithProxy']),
     ],
   };
 

+ 1 - 1
src/server/service/config-loader.js

@@ -418,7 +418,7 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
   },
   SLACK_BOT_TYPE: {
     ns:      'crowi',
-    key:     'slackbot:currentBotType', // 'official-bot' || 'custom-bot-without-proxy' || 'custom-bot-with-proxy'
+    key:     'slackbot:currentBotType', // 'officialBot' || 'customBotWithoutProxy' || 'customBotWithProxy'
     type:    TYPES.STRING,
     default: null,
   },