Merge pull request #2584 from hmhealey/plt2054
PLT-2054 Add DisplayName and Description fields for integrations
Этот коммит содержится в:
@@ -18,12 +18,12 @@ export default class AddIncomingWebhook extends React.Component {
|
||||
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
|
||||
this.updateName = this.updateName.bind(this);
|
||||
this.updateDisplayName = this.updateDisplayName.bind(this);
|
||||
this.updateDescription = this.updateDescription.bind(this);
|
||||
this.updateChannelId = this.updateChannelId.bind(this);
|
||||
|
||||
this.state = {
|
||||
name: '',
|
||||
displayName: '',
|
||||
description: '',
|
||||
channelId: '',
|
||||
saving: false,
|
||||
@@ -60,7 +60,9 @@ export default class AddIncomingWebhook extends React.Component {
|
||||
}
|
||||
|
||||
const hook = {
|
||||
channel_id: this.state.channelId
|
||||
channel_id: this.state.channelId,
|
||||
display_name: this.state.displayName,
|
||||
description: this.state.description
|
||||
};
|
||||
|
||||
AsyncClient.addIncomingHook(
|
||||
@@ -70,15 +72,16 @@ export default class AddIncomingWebhook extends React.Component {
|
||||
},
|
||||
(err) => {
|
||||
this.setState({
|
||||
saving: false,
|
||||
serverError: err.message
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
updateName(e) {
|
||||
updateDisplayName(e) {
|
||||
this.setState({
|
||||
name: e.target.value
|
||||
displayName: e.target.value
|
||||
});
|
||||
}
|
||||
|
||||
@@ -112,20 +115,21 @@ export default class AddIncomingWebhook extends React.Component {
|
||||
<div className='form-group'>
|
||||
<label
|
||||
className='control-label col-sm-3'
|
||||
htmlFor='name'
|
||||
htmlFor='displayName'
|
||||
>
|
||||
<FormattedMessage
|
||||
id='add_incoming_webhook.name'
|
||||
defaultMessage='Name'
|
||||
id='add_incoming_webhook.displayName'
|
||||
defaultMessage='Display Name'
|
||||
/>
|
||||
</label>
|
||||
<div className='col-md-5 col-sm-9'>
|
||||
<input
|
||||
id='name'
|
||||
id='displayName'
|
||||
type='text'
|
||||
maxLength='64'
|
||||
className='form-control'
|
||||
value={this.state.name}
|
||||
onChange={this.updateName}
|
||||
value={this.state.displayName}
|
||||
onChange={this.updateDisplayName}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -143,6 +147,7 @@ export default class AddIncomingWebhook extends React.Component {
|
||||
<input
|
||||
id='description'
|
||||
type='text'
|
||||
maxLength='128'
|
||||
className='form-control'
|
||||
value={this.state.description}
|
||||
onChange={this.updateDescription}
|
||||
|
||||
@@ -18,14 +18,14 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
|
||||
this.updateName = this.updateName.bind(this);
|
||||
this.updateDisplayName = this.updateDisplayName.bind(this);
|
||||
this.updateDescription = this.updateDescription.bind(this);
|
||||
this.updateChannelId = this.updateChannelId.bind(this);
|
||||
this.updateTriggerWords = this.updateTriggerWords.bind(this);
|
||||
this.updateCallbackUrls = this.updateCallbackUrls.bind(this);
|
||||
|
||||
this.state = {
|
||||
name: '',
|
||||
displayName: '',
|
||||
description: '',
|
||||
channelId: '',
|
||||
triggerWords: '',
|
||||
@@ -80,7 +80,9 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
const hook = {
|
||||
channel_id: this.state.channelId,
|
||||
trigger_words: this.state.triggerWords.split('\n').map((word) => word.trim()),
|
||||
callback_urls: this.state.callbackUrls.split('\n').map((url) => url.trim())
|
||||
callback_urls: this.state.callbackUrls.split('\n').map((url) => url.trim()),
|
||||
display_name: this.state.displayName,
|
||||
description: this.state.description
|
||||
};
|
||||
|
||||
AsyncClient.addOutgoingHook(
|
||||
@@ -90,15 +92,16 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
},
|
||||
(err) => {
|
||||
this.setState({
|
||||
saving: false,
|
||||
serverError: err.message
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
updateName(e) {
|
||||
updateDisplayName(e) {
|
||||
this.setState({
|
||||
name: e.target.value
|
||||
displayName: e.target.value
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,20 +147,21 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
<div className='form-group'>
|
||||
<label
|
||||
className='control-label col-sm-3'
|
||||
htmlFor='name'
|
||||
htmlFor='displayName'
|
||||
>
|
||||
<FormattedMessage
|
||||
id='add_outgoing_webhook.name'
|
||||
defaultMessage='Name'
|
||||
id='add_outgoing_webhook.displayName'
|
||||
defaultMessage='Display Name'
|
||||
/>
|
||||
</label>
|
||||
<div className='col-md-5 col-sm-9'>
|
||||
<input
|
||||
id='name'
|
||||
id='displayName'
|
||||
type='text'
|
||||
maxLength='64'
|
||||
className='form-control'
|
||||
value={this.state.name}
|
||||
onChange={this.updateName}
|
||||
value={this.state.displayName}
|
||||
onChange={this.updateDisplayName}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -175,6 +179,7 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
<input
|
||||
id='description'
|
||||
type='text'
|
||||
maxLength='128'
|
||||
className='form-control'
|
||||
value={this.state.description}
|
||||
onChange={this.updateDescription}
|
||||
@@ -213,6 +218,7 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
<textarea
|
||||
id='triggerWords'
|
||||
rows='3'
|
||||
maxLength='1000'
|
||||
className='form-control'
|
||||
value={this.state.triggerWords}
|
||||
onChange={this.updateTriggerWords}
|
||||
@@ -233,6 +239,7 @@ export default class AddOutgoingWebhook extends React.Component {
|
||||
<textarea
|
||||
id='callbackUrls'
|
||||
rows='3'
|
||||
maxLength='1000'
|
||||
className='form-control'
|
||||
value={this.state.callbackUrls}
|
||||
onChange={this.updateCallbackUrls}
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class InstalledIncomingWebhook extends React.Component {
|
||||
<div className='item-details'>
|
||||
<div className='item-details__row'>
|
||||
<span className='item-details__name'>
|
||||
{channelName}
|
||||
{incomingWebhook.display_name || channelName}
|
||||
</span>
|
||||
<span className='item-details__type'>
|
||||
<FormattedMessage
|
||||
@@ -50,7 +50,19 @@ export default class InstalledIncomingWebhook extends React.Component {
|
||||
</div>
|
||||
<div className='item-details__row'>
|
||||
<span className='item-details__description'>
|
||||
{Utils.getWindowLocationOrigin() + '/hooks/' + incomingWebhook.id}
|
||||
{incomingWebhook.description}
|
||||
</span>
|
||||
</div>
|
||||
<div className='tem-details__row'>
|
||||
<span className='item-details__creation'>
|
||||
<FormattedMessage
|
||||
id='installed_integrations.creation'
|
||||
defaultMessage='Created by {creator} on {createAt, date, full}'
|
||||
values={{
|
||||
creator: Utils.displayUsername(incomingWebhook.user_id),
|
||||
createAt: incomingWebhook.create_at
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@ export default class InstalledOutgoingWebhook extends React.Component {
|
||||
<div className='item-details'>
|
||||
<div className='item-details__row'>
|
||||
<span className='item-details__name'>
|
||||
{channelName}
|
||||
{outgoingWebhook.display_name || channelName}
|
||||
</span>
|
||||
<span className='item-details__type'>
|
||||
<FormattedMessage
|
||||
@@ -58,9 +58,19 @@ export default class InstalledOutgoingWebhook extends React.Component {
|
||||
</div>
|
||||
<div className='item-details__row'>
|
||||
<span className='item-details__description'>
|
||||
{Utils.getWindowLocationOrigin() + '/hooks/' + outgoingWebhook.id}
|
||||
{' - '}
|
||||
{outgoingWebhook.token}
|
||||
{outgoingWebhook.description}
|
||||
</span>
|
||||
</div>
|
||||
<div className='item-details__row'>
|
||||
<span className='item-details__creation'>
|
||||
<FormattedMessage
|
||||
id='installed_integrations.creation'
|
||||
defaultMessage='Created by {creator} on {createAt, date, full}'
|
||||
values={{
|
||||
creator: Utils.displayUsername(outgoingWebhook.creator_id),
|
||||
createAt: outgoingWebhook.create_at
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -814,6 +814,7 @@
|
||||
"get_team_invite_link_modal.title": "Team Invite Link",
|
||||
"installed_integrations.add": "Add Integration",
|
||||
"installed_integrations.allFilter": "All ({count})",
|
||||
"installed_integrations.creation": "Created by {creator} on {createAt, date, full}",
|
||||
"installed_integrations.delete": "Delete",
|
||||
"installed_integrations.header": "Installed Integrations",
|
||||
"installed_integrations.incomingWebhookType": "(Incoming Webhook)",
|
||||
|
||||
@@ -196,7 +196,12 @@
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.list-item__actions {
|
||||
.item-details__creation {
|
||||
color: $dark-gray;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
flex-grow: 0;
|
||||
flex-shrink: 0;
|
||||
padding-left: 20px;
|
||||
|
||||
@@ -1182,10 +1182,10 @@ export function addIncomingHook(hook, success, error) {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
dispatchError(err, 'addIncomingHook');
|
||||
|
||||
if (error) {
|
||||
error(err);
|
||||
} else {
|
||||
dispatchError(err, 'addIncomingHook');
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -1205,10 +1205,10 @@ export function addOutgoingHook(hook, success, error) {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
dispatchError(err, 'addOutgoingHook');
|
||||
|
||||
if (error) {
|
||||
error(err);
|
||||
} else {
|
||||
dispatchError(err, 'addOutgoingHook');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Ссылка в новой задаче
Block a user