|
@@ -18,14 +18,31 @@ class GithubSecurityManagement extends React.Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
+ this.state = {
|
|
|
|
|
+ retrieveError: null,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
this.onClickSubmit = this.onClickSubmit.bind(this);
|
|
this.onClickSubmit = this.onClickSubmit.bind(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ async componentDidMount() {
|
|
|
|
|
+ const { adminGithubSecurityContainer } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await adminGithubSecurityContainer.retrieveSecurityData();
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ toastError(err);
|
|
|
|
|
+ this.setState({ retrieveError: err });
|
|
|
|
|
+ logger.error(err);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async onClickSubmit() {
|
|
async onClickSubmit() {
|
|
|
- const { t } = this.props;
|
|
|
|
|
|
|
+ const { t, adminGithubSecurityContainer } = this.props;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- await this.props.adminGithubSecurityContainer.updateGitHubSetting();
|
|
|
|
|
|
|
+ await adminGithubSecurityContainer.updateGitHubSetting();
|
|
|
toastSuccess(t('security_setting.OAuth.GitHub.updated_github'));
|
|
toastSuccess(t('security_setting.OAuth.GitHub.updated_github'));
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
@@ -44,6 +61,12 @@ class GithubSecurityManagement extends React.Component {
|
|
|
{ t('security_setting.OAuth.GitHub.name') } { t('security_setting.configuration') }
|
|
{ t('security_setting.OAuth.GitHub.name') } { t('security_setting.configuration') }
|
|
|
</h2>
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
+ {this.state.retrieveError != null && (
|
|
|
|
|
+ <div className="alert alert-danger">
|
|
|
|
|
+ <p>{t('Error occurred')} : {this.state.err}</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
<div className="row mb-5">
|
|
<div className="row mb-5">
|
|
|
<strong className="col-xs-3 text-right">{ t('security_setting.OAuth.GitHub.name') }</strong>
|
|
<strong className="col-xs-3 text-right">{ t('security_setting.OAuth.GitHub.name') }</strong>
|
|
|
<div className="col-xs-6 text-left">
|
|
<div className="col-xs-6 text-left">
|
|
@@ -110,7 +133,7 @@ class GithubSecurityManagement extends React.Component {
|
|
|
className="form-control"
|
|
className="form-control"
|
|
|
type="text"
|
|
type="text"
|
|
|
name="githubClientSecret"
|
|
name="githubClientSecret"
|
|
|
- value={adminGithubSecurityContainer.state.githubClientSecret}
|
|
|
|
|
|
|
+ defaultValue={adminGithubSecurityContainer.state.githubClientSecret}
|
|
|
onChange={e => adminGithubSecurityContainer.changeGithubClientSecret(e.target.value)}
|
|
onChange={e => adminGithubSecurityContainer.changeGithubClientSecret(e.target.value)}
|
|
|
/>
|
|
/>
|
|
|
<p className="help-block">
|
|
<p className="help-block">
|
|
@@ -144,7 +167,7 @@ class GithubSecurityManagement extends React.Component {
|
|
|
|
|
|
|
|
<div className="row my-3">
|
|
<div className="row my-3">
|
|
|
<div className="col-xs-offset-4 col-xs-5">
|
|
<div className="col-xs-offset-4 col-xs-5">
|
|
|
- <div className="btn btn-primary" onClick={this.onClickSubmit}>{ t('Update') }</div>
|
|
|
|
|
|
|
+ <div className="btn btn-primary" disabled={this.state.retrieveError != null} onClick={this.onClickSubmit}>{ t('Update') }</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|