mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 05:57:13 -04: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'}}
|
||||
|
||||
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
|
||||
| URL
|
||||
if integration.enabled
|
||||
input.js-outgoing-webhooks-url(type="text" value=integration.url autofocus)
|
||||
else
|
||||
input.js-outgoing-webhooks-url(type="text" autofocus)
|
||||
input.js-outgoing-webhooks-url(type="text" name="url" autofocus)
|
||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||
|
|
|
@ -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();
|
||||
|
|
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.",
|
||||
"outgoing-webhooks": "Outgoing Webhooks",
|
||||
"outgoingWebhooksPopup-title": "Outgoing Webhooks",
|
||||
"new-integration": "New integration",
|
||||
"no-name": "(Unknown)",
|
||||
"Wekan_version": "Wekan version",
|
||||
"Node_version": "Node version",
|
||||
"OS_Arch": "OS Arch",
|
||||
|
|
|
@ -50,6 +50,9 @@ Integrations.allow({
|
|||
update(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
remove(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
fetch: ['boardId'],
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue