mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +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
|
|
@ -227,11 +227,21 @@ template(name="archiveBoardPopup")
|
||||||
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
||||||
|
|
||||||
template(name="outgoingWebhooksPopup")
|
template(name="outgoingWebhooksPopup")
|
||||||
form
|
each integrations
|
||||||
|
form.integration-form
|
||||||
|
if title
|
||||||
|
h4 {{title}}
|
||||||
|
else
|
||||||
|
h4 {{_ 'no-name'}}
|
||||||
|
label
|
||||||
|
| URL
|
||||||
|
input.js-outgoing-webhooks-url(type="text" name="url" value=url)
|
||||||
|
input(type="hidden" value=_id name="id")
|
||||||
|
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||||
|
form.integration-form
|
||||||
|
h4
|
||||||
|
| {{_ 'new-integration'}}
|
||||||
label
|
label
|
||||||
| URL
|
| URL
|
||||||
if integration.enabled
|
input.js-outgoing-webhooks-url(type="text" name="url" autofocus)
|
||||||
input.js-outgoing-webhooks-url(type="text" value=integration.url autofocus)
|
|
||||||
else
|
|
||||||
input.js-outgoing-webhooks-url(type="text" autofocus)
|
|
||||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||||
|
|
|
||||||
|
|
@ -241,39 +241,44 @@ BlazeComponent.extendComponent({
|
||||||
}).register('boardChangeWatchPopup');
|
}).register('boardChangeWatchPopup');
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
integration() {
|
integrations() {
|
||||||
const boardId = Session.get('currentBoard');
|
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() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
'submit'(evt) {
|
'submit'(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const url = this.find('.js-outgoing-webhooks-url').value.trim();
|
const url = evt.target.url.value;
|
||||||
const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
const integration = this.integration();
|
let id = null;
|
||||||
if (integration) {
|
let integration = null;
|
||||||
|
if (evt.target.id) {
|
||||||
|
id = evt.target.id.value;
|
||||||
|
integration = this.integration(id);
|
||||||
if (url) {
|
if (url) {
|
||||||
Integrations.update(integration._id, {
|
Integrations.update(integration._id, {
|
||||||
$set: {
|
$set: {
|
||||||
enabled: true,
|
|
||||||
url: `${url}`,
|
url: `${url}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Integrations.update(integration._id, {
|
Integrations.remove(integration._id);
|
||||||
$set: {
|
|
||||||
enabled: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (url) {
|
} else if (url) {
|
||||||
Integrations.insert({
|
Integrations.insert({
|
||||||
|
userId: Meteor.userId(),
|
||||||
enabled: true,
|
enabled: true,
|
||||||
type: 'outgoing-webhooks',
|
type: 'outgoing-webhooks',
|
||||||
url: `${url}`,
|
url: `${url}`,
|
||||||
boardId: `${boardId}`,
|
boardId: `${boardId}`,
|
||||||
|
activities: ['all'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Popup.close();
|
Popup.close();
|
||||||
|
|
|
||||||
3
client/components/boards/boardHeader.styl
Normal file
3
client/components/boards/boardHeader.styl
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
.integration-form
|
||||||
|
padding: 5px
|
||||||
|
border-bottom: 1px solid #ccc
|
||||||
|
|
@ -368,6 +368,8 @@
|
||||||
"error-notAuthorized": "You are not authorized to view this page.",
|
"error-notAuthorized": "You are not authorized to view this page.",
|
||||||
"outgoing-webhooks": "Outgoing Webhooks",
|
"outgoing-webhooks": "Outgoing Webhooks",
|
||||||
"outgoingWebhooksPopup-title": "Outgoing Webhooks",
|
"outgoingWebhooksPopup-title": "Outgoing Webhooks",
|
||||||
|
"new-integration": "New integration",
|
||||||
|
"no-name": "(Unknown)",
|
||||||
"Wekan_version": "Wekan version",
|
"Wekan_version": "Wekan version",
|
||||||
"Node_version": "Node version",
|
"Node_version": "Node version",
|
||||||
"OS_Arch": "OS Arch",
|
"OS_Arch": "OS Arch",
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ Integrations.allow({
|
||||||
update(userId, doc) {
|
update(userId, doc) {
|
||||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||||
},
|
},
|
||||||
|
remove(userId, doc) {
|
||||||
|
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||||
|
},
|
||||||
fetch: ['boardId'],
|
fetch: ['boardId'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue