Skip to content

Commit

Permalink
EPMRPP-55756 Integrations. Re-connect integration after auth settings…
Browse files Browse the repository at this point in the history
… update
  • Loading branch information
AmsterGet committed Sep 10, 2020
1 parent 8d588e0 commit 2e45aab
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class ConnectionSection extends Component {
intl: PropTypes.object.isRequired,
showModalAction: PropTypes.func.isRequired,
onRemoveIntegration: PropTypes.func.isRequired,
testConnection: PropTypes.func.isRequired,
blocked: PropTypes.bool,
failedConnectionMessage: PropTypes.string,
editAuthConfig: PropTypes.object,
Expand Down Expand Up @@ -95,6 +96,12 @@ export class ConnectionSection extends Component {
});
};

onEditAuth = () => {
const { editAuthConfig, testConnection } = this.props;

editAuthConfig.onClick(testConnection);
};

render() {
const {
intl: { formatMessage },
Expand Down Expand Up @@ -126,7 +133,7 @@ export class ConnectionSection extends Component {
{editAuthConfig.content}
</div>
{!blocked && (
<button className={cx('connection-block-button')} onClick={editAuthConfig.onClick}>
<button className={cx('connection-block-button')} onClick={this.onEditAuth}>
<span className={cx('button-icon')}>{Parser(EditIcon)}</span>
{formatMessage(messages.editAuthorizationTitle)}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class IntegrationSettings extends Component {
error: errorMessage,
})
}
testConnection={this.testIntegrationConnection}
onRemoveIntegration={this.removeIntegration}
editAuthConfig={editAuthConfig}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,28 @@ export class JiraSettings extends Component {
},
];

editAuthorizationClickHandler = () => {
getConfirmationFunc = (testConnection) => (data, metaData) => {
const { onUpdate } = this.props;

onUpdate(
data,
() => {
this.props.hideModalAction();
testConnection();
},
metaData,
);
};

editAuthorizationClickHandler = (testConnection) => {
const {
data: { name, integrationParameters, integrationType },
onUpdate,
} = this.props;

this.props.showModalAction({
id: 'addIntegrationModal',
data: {
onConfirm: (data, metaData) => onUpdate(data, this.props.hideModalAction, metaData),
onConfirm: this.getConfirmationFunc(testConnection),
instanceType: integrationType.name,
customProps: {
initialData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,28 @@ export class RallySettings extends Component {
},
];

editAuthorizationClickHandler = () => {
getConfirmationFunc = (testConnection) => (data, metaData) => {
const { onUpdate } = this.props;

onUpdate(
data,
() => {
this.props.hideModalAction();
testConnection();
},
metaData,
);
};

editAuthorizationClickHandler = (testConnection) => {
const {
data: { name, integrationParameters, integrationType },
onUpdate,
} = this.props;

this.props.showModalAction({
id: 'addIntegrationModal',
data: {
onConfirm: (data, metaData) => onUpdate(data, this.props.hideModalAction, metaData),
onConfirm: this.getConfirmationFunc(testConnection),
instanceType: integrationType.name,
customProps: {
initialData: {
Expand Down

0 comments on commit 2e45aab

Please sign in to comment.