Commit de596869 authored by leadream's avatar leadream

add webhook tip

parent 14570562
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -26,6 +26,7 @@ export default class Settings extends React.Component<Props> { ...@@ -26,6 +26,7 @@ export default class Settings extends React.Component<Props> {
currentVersionTip: '', currentVersionTip: '',
resultTip: '', resultTip: '',
prUrl: '', prUrl: '',
isSending: false,
webhookData: null webhookData: null
} }
getVersion = async (githubData) => { getVersion = async (githubData) => {
...@@ -108,9 +109,6 @@ export default class Settings extends React.Component<Props> { ...@@ -108,9 +109,6 @@ export default class Settings extends React.Component<Props> {
await this.changeVersion(branchName) await this.changeVersion(branchName)
const { html_url } = await this.createCommitAndPR(branchName) const { html_url } = await this.createCommitAndPR(branchName)
const { version, message, webhookData } = this.state
webhookData && sendNotification(webhookData, html_url, version, message)
this.setState({ this.setState({
version: '', version: '',
message: '', message: '',
...@@ -118,6 +116,13 @@ export default class Settings extends React.Component<Props> { ...@@ -118,6 +116,13 @@ export default class Settings extends React.Component<Props> {
resultTip: 'Pushing successfully! You can now go to Github and merge this PR. Then your icons will be published to NPM automatically.', resultTip: 'Pushing successfully! You can now go to Github and merge this PR. Then your icons will be published to NPM automatically.',
prUrl: html_url prUrl: html_url
}) })
const { version, message, webhookData } = this.state
if (webhookData) {
this.setState({isSending: true})
await sendNotification(webhookData, html_url, version, message)
this.setState({isSending: false})
}
}) })
} }
onCancel = () => { onCancel = () => {
...@@ -130,7 +135,10 @@ export default class Settings extends React.Component<Props> { ...@@ -130,7 +135,10 @@ export default class Settings extends React.Component<Props> {
} }
render () { render () {
const { visible, webhookData } = this.props const { visible, webhookData } = this.props
const { isPushing, version, message, versionTip, messageTip, currentVersionTip, resultTip, prUrl } = this.state const {
isPushing, version, message, versionTip, messageTip,
currentVersionTip, resultTip, prUrl, webhookData: whd, isSending
} = this.state
return ( return (
<div className={'updator ' + (!visible ? 'hide' : '')}> <div className={'updator ' + (!visible ? 'hide' : '')}>
<div className="form-item"> <div className="form-item">
...@@ -146,10 +154,14 @@ export default class Settings extends React.Component<Props> { ...@@ -146,10 +154,14 @@ export default class Settings extends React.Component<Props> {
resultTip && resultTip &&
<div className="type type--pos-medium-bold alert alert-success"> <div className="type type--pos-medium-bold alert alert-success">
<h3>Congratulations!</h3> <h3>Congratulations!</h3>
{resultTip} {resultTip}<br/>
Click <a href={prUrl} target="_blank">here</a> to open the PR link. Click <a href={prUrl} target="_blank">here</a> to open the PR link.
</div> </div>
} }
{
whd && isSending &&
<p className="type type--pos-medium-normal">Sending notification, please wait for a minute……</p>
}
</div> </div>
<div className={'form-item '+(resultTip ? 'hide' : '')}> <div className={'form-item '+(resultTip ? 'hide' : '')}>
<input <input
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment