mirror of
https://github.com/wekan/wekan.git
synced 2025-12-29 13:48:49 +01:00
Allow delete from client. List all integrations in web UI
This commit is contained in:
parent
f566022aa4
commit
5bc95511e5
5 changed files with 39 additions and 16 deletions
|
|
@ -241,39 +241,44 @@ BlazeComponent.extendComponent({
|
|||
}).register('boardChangeWatchPopup');
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
integration() {
|
||||
integrations() {
|
||||
const boardId = Session.get('currentBoard');
|
||||
return Integrations.findOne({ boardId: `${boardId}` });
|
||||
return Integrations.find({ boardId: `${boardId}` }).fetch();
|
||||
},
|
||||
|
||||
integration(id) {
|
||||
const boardId = Session.get('currentBoard');
|
||||
return Integrations.findOne({ _id: id, boardId: `${boardId}` });
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'submit'(evt) {
|
||||
evt.preventDefault();
|
||||
const url = this.find('.js-outgoing-webhooks-url').value.trim();
|
||||
const url = evt.target.url.value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const integration = this.integration();
|
||||
if (integration) {
|
||||
let id = null;
|
||||
let integration = null;
|
||||
if (evt.target.id) {
|
||||
id = evt.target.id.value;
|
||||
integration = this.integration(id);
|
||||
if (url) {
|
||||
Integrations.update(integration._id, {
|
||||
$set: {
|
||||
enabled: true,
|
||||
url: `${url}`,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
Integrations.update(integration._id, {
|
||||
$set: {
|
||||
enabled: false,
|
||||
},
|
||||
});
|
||||
Integrations.remove(integration._id);
|
||||
}
|
||||
} else if (url) {
|
||||
Integrations.insert({
|
||||
userId: Meteor.userId(),
|
||||
enabled: true,
|
||||
type: 'outgoing-webhooks',
|
||||
url: `${url}`,
|
||||
boardId: `${boardId}`,
|
||||
activities: ['all'],
|
||||
});
|
||||
}
|
||||
Popup.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue