mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Import members: board import
This commit is contained in:
parent
f6f41270de
commit
dd0a6e1a82
6 changed files with 48 additions and 15 deletions
|
|
@ -12,6 +12,7 @@ babel-runtime@0.1.4
|
||||||
base64@1.0.4
|
base64@1.0.4
|
||||||
binary-heap@1.0.4
|
binary-heap@1.0.4
|
||||||
blaze@2.1.3
|
blaze@2.1.3
|
||||||
|
blaze-html-templates@1.0.1
|
||||||
blaze-tools@1.0.4
|
blaze-tools@1.0.4
|
||||||
boilerplate-generator@1.0.5-cdn-url
|
boilerplate-generator@1.0.5-cdn-url
|
||||||
caching-compiler@1.0.0
|
caching-compiler@1.0.0
|
||||||
|
|
@ -124,7 +125,7 @@ seriousm:emoji-continued@1.4.0
|
||||||
service-configuration@1.0.5
|
service-configuration@1.0.5
|
||||||
session@1.1.1
|
session@1.1.1
|
||||||
sha@1.0.4
|
sha@1.0.4
|
||||||
softwarerero:accounts-t9n@1.1.4
|
softwarerero:accounts-t9n@1.1.6
|
||||||
spacebars@1.0.7
|
spacebars@1.0.7
|
||||||
spacebars-compiler@1.0.7
|
spacebars-compiler@1.0.7
|
||||||
srp@1.0.4
|
srp@1.0.4
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ template(name="importPopup")
|
||||||
if membersMapping
|
if membersMapping
|
||||||
div
|
div
|
||||||
a.show-mapping
|
a.show-mapping
|
||||||
| {{_ 'show-mapping'}}
|
| {{_ 'import-show-user-mapping'}}
|
||||||
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
||||||
|
|
||||||
template(name="mapMembersPopup")
|
template(name="mapMembersPopup")
|
||||||
|
|
@ -35,7 +35,8 @@ template(name="mapMembersPopup")
|
||||||
|
|
||||||
template(name="mapMembersAddPopup")
|
template(name="mapMembersAddPopup")
|
||||||
.select-member
|
.select-member
|
||||||
p Hello world
|
p
|
||||||
|
| {{_ 'import-user-select'}}
|
||||||
.js-map-member
|
.js-map-member
|
||||||
+esInput(index="users")
|
+esInput(index="users")
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,12 @@ const ImportPopup = BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
onShowMapping(evt) {
|
onShowMapping(evt) {
|
||||||
// todo xxx make it work - currently we don't find the text
|
this._storeText(evt);
|
||||||
// this._storeText(evt);
|
|
||||||
Popup.open('mapMembers')(evt);
|
Popup.open('mapMembers')(evt);
|
||||||
},
|
},
|
||||||
|
|
||||||
_storeText(evt) {
|
_storeText(evt) {
|
||||||
const dataJson = $(evt.currentTarget).find('.js-import-json').val();
|
const dataJson = this.$('.js-import-json').val();
|
||||||
Session.set('import.text', dataJson);
|
Session.set('import.text', dataJson);
|
||||||
return dataJson;
|
return dataJson;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
10
client/components/import/import.styl
vendored
10
client/components/import/import.styl
vendored
|
|
@ -1,8 +1,9 @@
|
||||||
.map-members
|
.map-members
|
||||||
|
.mapping:first-of-type
|
||||||
|
border-top: solid 1px #999
|
||||||
.mapping
|
.mapping
|
||||||
margin-bottom: 10px
|
padding: 10px 0
|
||||||
margin-top: 10px
|
border-bottom: solid 1px #999
|
||||||
border-bottom: solid
|
|
||||||
.source
|
.source
|
||||||
display: inline-block
|
display: inline-block
|
||||||
width: 80%
|
width: 80%
|
||||||
|
|
@ -11,3 +12,6 @@
|
||||||
width: 35px
|
width: 35px
|
||||||
.member
|
.member
|
||||||
float: none
|
float: none
|
||||||
|
|
||||||
|
a.show-mapping
|
||||||
|
text-decoration underline
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@
|
||||||
"disambiguateMultiLabelPopup-title": "Disambiguate Label Action",
|
"disambiguateMultiLabelPopup-title": "Disambiguate Label Action",
|
||||||
"disambiguateMultiMemberPopup-title": "Disambiguate Member Action",
|
"disambiguateMultiMemberPopup-title": "Disambiguate Member Action",
|
||||||
"discard": "Discard",
|
"discard": "Discard",
|
||||||
|
"done": "Done",
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"edit-avatar": "Change Avatar",
|
"edit-avatar": "Change Avatar",
|
||||||
|
|
@ -141,7 +142,9 @@
|
||||||
"import-card": "Import a Trello card",
|
"import-card": "Import a Trello card",
|
||||||
"import-card-trello-instruction": "Go to a Trello card, select 'Share and more...' then 'Export JSON' and copy the resulting text",
|
"import-card-trello-instruction": "Go to a Trello card, select 'Share and more...' then 'Export JSON' and copy the resulting text",
|
||||||
"import-json-placeholder": "Paste your valid JSON data here",
|
"import-json-placeholder": "Paste your valid JSON data here",
|
||||||
"import-members-map": "Map the Trello members you want to import to Wekan members",
|
"import-members-map": "Your imported board has some members. Please map the members you want to import to Wekan users",
|
||||||
|
"import-show-user-mapping": "Review members mapping",
|
||||||
|
"import-user-select": "Pick the Wekan user you want to use as this member",
|
||||||
"info": "Infos",
|
"info": "Infos",
|
||||||
"initials": "Initials",
|
"initials": "Initials",
|
||||||
"joined": "joined",
|
"joined": "joined",
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,24 @@ class TrelloCreator {
|
||||||
stars: 0,
|
stars: 0,
|
||||||
title: trelloBoard.name,
|
title: trelloBoard.name,
|
||||||
};
|
};
|
||||||
|
// now add other members
|
||||||
|
if(trelloBoard.memberships) {
|
||||||
|
trelloBoard.memberships.forEach((trelloMembership) => {
|
||||||
|
const trelloId = trelloMembership.idMember;
|
||||||
|
// do we have a mapping?
|
||||||
|
if(this.members[trelloId]) {
|
||||||
|
const wekanId = this.members[trelloId];
|
||||||
|
// do we already have it in our list?
|
||||||
|
if(!boardToCreate.members.find((wekanMember) => {return (wekanMember.userId === wekanId);})) {
|
||||||
|
boardToCreate.members.push({
|
||||||
|
userId: wekanId,
|
||||||
|
isAdmin: false,
|
||||||
|
isActive: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
trelloBoard.labels.forEach((label) => {
|
trelloBoard.labels.forEach((label) => {
|
||||||
const labelToCreate = {
|
const labelToCreate = {
|
||||||
_id: Random.id(6),
|
_id: Random.id(6),
|
||||||
|
|
@ -197,10 +215,16 @@ class TrelloCreator {
|
||||||
if(card.idMembers) {
|
if(card.idMembers) {
|
||||||
const wekanMembers = [];
|
const wekanMembers = [];
|
||||||
// we can't just map, as some members may not have been mapped
|
// we can't just map, as some members may not have been mapped
|
||||||
card.idMembers.forEach((id) => {
|
card.idMembers.forEach((trelloId) => {
|
||||||
if(this.members[id]) {
|
if(this.members[trelloId]) {
|
||||||
wekanMembers.push(this.members[id]);
|
const wekanId = this.members[trelloId];
|
||||||
|
// we may map multiple Trello members to the same wekan user
|
||||||
|
// in which case we risk adding the same user multiple times
|
||||||
|
if(!wekanMembers.find((wId) => {return (wId === wekanId);})){
|
||||||
|
wekanMembers.push(wekanId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
if(wekanMembers.length>0) {
|
if(wekanMembers.length>0) {
|
||||||
cardToCreate.members = wekanMembers;
|
cardToCreate.members = wekanMembers;
|
||||||
|
|
@ -317,8 +341,9 @@ Meteor.methods({
|
||||||
|
|
||||||
// 1. check all parameters are ok from a syntax point of view
|
// 1. check all parameters are ok from a syntax point of view
|
||||||
try {
|
try {
|
||||||
// we don't use additional data - this should be an empty object
|
check(data, {
|
||||||
check(data, {});
|
membersMapping: Match.Optional(Object),
|
||||||
|
});
|
||||||
trelloCreator.checkActions(trelloBoard.actions);
|
trelloCreator.checkActions(trelloBoard.actions);
|
||||||
trelloCreator.checkBoard(trelloBoard);
|
trelloCreator.checkBoard(trelloBoard);
|
||||||
trelloCreator.checkLabels(trelloBoard.labels);
|
trelloCreator.checkLabels(trelloBoard.labels);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue