itizawa 6 лет назад
Родитель
Сommit
c799dcb9c9

+ 10 - 5
src/client/js/components/Admin/Notification/SlackAppConfiguration.jsx

@@ -17,7 +17,7 @@ class SlackAppConfiguration extends React.Component {
     return (
     return (
       <React.Fragment>
       <React.Fragment>
         <div className="row mb-5">
         <div className="row mb-5">
-          <div className="col-xs-offset-3 col-xs-6 text-left">
+          <div className="col-xs-6 text-left">
             <div className="my-0 btn-group">
             <div className="my-0 btn-group">
               <div className="dropdown">
               <div className="dropdown">
                 <button className="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                 <button className="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@@ -79,7 +79,6 @@ class SlackAppConfiguration extends React.Component {
             <React.Fragment>
             <React.Fragment>
               <h2 className="border-bottom mb-5">Slack App Configuration</h2>
               <h2 className="border-bottom mb-5">Slack App Configuration</h2>
 
 
-
               <div className="well">
               <div className="well">
                 <i className="icon-fw icon-exclamation text-danger"></i><span className="text-danger">NOT RECOMMENDED</span>
                 <i className="icon-fw icon-exclamation text-danger"></i><span className="text-danger">NOT RECOMMENDED</span>
                 <br /><br />
                 <br /><br />
@@ -97,12 +96,18 @@ class SlackAppConfiguration extends React.Component {
                 instead.
                 instead.
               </div>
               </div>
 
 
-              <div className="form-group">
-                <label htmlFor="slackSetting[slack:token]" className="col-xs-3 control-label">OAuth Access Token</label>
+              <div className="row mb-5">
+                <label className="col-xs-3 text-right">OAuth Access Token</label>
                 <div className="col-xs-6">
                 <div className="col-xs-6">
-                  <input className="form-control" type="text" name="slackSetting[slack:token]" value="{{ slackSetting['slack:token'] || '' }}" />
+                  <input
+                    className="form-control"
+                    type="text"
+                    defaultValue={adminNotificationContainer.state.slackToken}
+                    onChange={e => adminNotificationContainer.changeSlackToken(e.target.value)}
+                  />
                 </div>
                 </div>
               </div>
               </div>
+
             </React.Fragment>
             </React.Fragment>
           )
           )
         }
         }

+ 10 - 2
src/client/js/services/AdminNotificationContainer.js

@@ -15,6 +15,7 @@ export default class AdminNotificationContainer extends Container {
       selectSlackOption: 'Incoming Webhooks',
       selectSlackOption: 'Incoming Webhooks',
       webhookUrl: '',
       webhookUrl: '',
       isIncomingWebhookPrioritized: false,
       isIncomingWebhookPrioritized: false,
+      slackToken: '',
     };
     };
 
 
   }
   }
@@ -36,8 +37,8 @@ export default class AdminNotificationContainer extends Container {
   /**
   /**
    * Change webhookUrl
    * Change webhookUrl
    */
    */
-  changeWebhookUrl(inputValue) {
-    this.setState({ webhookUrl: inputValue });
+  changeWebhookUrl(webhookUrl) {
+    this.setState({ webhookUrl });
   }
   }
 
 
   /**
   /**
@@ -47,4 +48,11 @@ export default class AdminNotificationContainer extends Container {
     this.setState({ isIncomingWebhookPrioritized: !this.state.isIncomingWebhookPrioritized });
     this.setState({ isIncomingWebhookPrioritized: !this.state.isIncomingWebhookPrioritized });
   }
   }
 
 
+  /**
+   * Change slackToken
+   */
+  changeSlackToken(slackToken) {
+    this.setState({ slackToken });
+  }
+
 }
 }