Displayed proper token on integration creation confirmation (#3991)
Этот коммит содержится в:
коммит произвёл
enahum
родитель
47f92441ac
Коммит
faf944f47a
@@ -166,7 +166,7 @@ export default class AddCommand extends React.Component {
|
|||||||
AsyncClient.addCommand(
|
AsyncClient.addCommand(
|
||||||
command,
|
command,
|
||||||
(data) => {
|
(data) => {
|
||||||
browserHistory.push('/' + this.props.team.name + '/integrations/confirm?type=commands&id=' + data.token);
|
browserHistory.push('/' + this.props.team.name + '/integrations/confirm?type=commands&id=' + data.id);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export default class AddOutgoingWebhook extends React.Component {
|
|||||||
AsyncClient.addOutgoingHook(
|
AsyncClient.addOutgoingHook(
|
||||||
hook,
|
hook,
|
||||||
(data) => {
|
(data) => {
|
||||||
browserHistory.push('/' + this.props.team.name + '/integrations/confirm?type=outgoing_webhooks&id=' + data.token);
|
browserHistory.push('/' + this.props.team.name + '/integrations/confirm?type=outgoing_webhooks&id=' + data.id);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import BackstageHeader from 'components/backstage/components/backstage_header.jsx';
|
import BackstageHeader from 'components/backstage/components/backstage_header.jsx';
|
||||||
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
||||||
import {browserHistory, Link} from 'react-router/es6';
|
import {Link} from 'react-router/es6';
|
||||||
import SpinnerButton from 'components/spinner_button.jsx';
|
|
||||||
|
|
||||||
import UserStore from 'stores/user_store.jsx';
|
import UserStore from 'stores/user_store.jsx';
|
||||||
import IntegrationStore from 'stores/integration_store.jsx';
|
import IntegrationStore from 'stores/integration_store.jsx';
|
||||||
@@ -24,8 +23,6 @@ export default class ConfirmIntegration extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.handleDone = this.handleDone.bind(this);
|
|
||||||
|
|
||||||
this.handleIntegrationChange = this.handleIntegrationChange.bind(this);
|
this.handleIntegrationChange = this.handleIntegrationChange.bind(this);
|
||||||
|
|
||||||
const userId = UserStore.getCurrentId();
|
const userId = UserStore.getCurrentId();
|
||||||
@@ -55,13 +52,6 @@ export default class ConfirmIntegration extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDone() {
|
|
||||||
browserHistory.push('/' + this.props.team.name + '/integrations/' + this.state.type);
|
|
||||||
this.setState({
|
|
||||||
id: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let headerText = null;
|
let headerText = null;
|
||||||
let helpText = null;
|
let helpText = null;
|
||||||
@@ -87,7 +77,7 @@ export default class ConfirmIntegration extends React.Component {
|
|||||||
id='add_command.token'
|
id='add_command.token'
|
||||||
defaultMessage='<b>Token</b>: {token}'
|
defaultMessage='<b>Token</b>: {token}'
|
||||||
values={{
|
values={{
|
||||||
token: this.state.id
|
token: IntegrationStore.getCommand(this.props.team.id, this.state.id).token
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
@@ -139,7 +129,7 @@ export default class ConfirmIntegration extends React.Component {
|
|||||||
id='add_outgoing_webhook.token'
|
id='add_outgoing_webhook.token'
|
||||||
defaultMessage='<b>Token</b>: {token}'
|
defaultMessage='<b>Token</b>: {token}'
|
||||||
values={{
|
values={{
|
||||||
token: this.state.id
|
token: IntegrationStore.getOutgoingWebhook(this.props.team.id, this.state.id).token
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
@@ -233,16 +223,16 @@ export default class ConfirmIntegration extends React.Component {
|
|||||||
{helpText}
|
{helpText}
|
||||||
{tokenText}
|
{tokenText}
|
||||||
<div className='backstage-form__footer'>
|
<div className='backstage-form__footer'>
|
||||||
<SpinnerButton
|
<Link
|
||||||
className='btn btn-primary'
|
className='btn btn-primary'
|
||||||
type='submit'
|
type='submit'
|
||||||
onClick={this.handleDone}
|
to={'/' + this.props.team.name + '/integrations/' + this.state.type}
|
||||||
>
|
>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='integrations.done'
|
id='integrations.done'
|
||||||
defaultMessage='Done'
|
defaultMessage='Done'
|
||||||
/>
|
/>
|
||||||
</SpinnerButton>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ class IntegrationStore extends EventEmitter {
|
|||||||
return this.outgoingWebhooks.get(teamId) || [];
|
return this.outgoingWebhooks.get(teamId) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOutgoingWebhook(teamId, id) {
|
||||||
|
return this.getOutgoingWebhooks(teamId).filter((outgoingWebhook) => outgoingWebhook.id === id)[0];
|
||||||
|
}
|
||||||
|
|
||||||
setOutgoingWebhooks(teamId, outgoingWebhooks) {
|
setOutgoingWebhooks(teamId, outgoingWebhooks) {
|
||||||
this.outgoingWebhooks.set(teamId, outgoingWebhooks);
|
this.outgoingWebhooks.set(teamId, outgoingWebhooks);
|
||||||
}
|
}
|
||||||
@@ -116,6 +120,10 @@ class IntegrationStore extends EventEmitter {
|
|||||||
return this.commands.get(teamId) || [];
|
return this.commands.get(teamId) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCommand(teamId, id) {
|
||||||
|
return this.getCommands(teamId).filter((command) => command.id === id)[0];
|
||||||
|
}
|
||||||
|
|
||||||
setCommands(teamId, commands) {
|
setCommands(teamId, commands) {
|
||||||
this.commands.set(teamId, commands);
|
this.commands.set(teamId, commands);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user