mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Merge pull request #3500 from jrsupplee/patch-5
Fix some bugs when importing Wekan JSON
This commit is contained in:
commit
f7cc1abc8e
5 changed files with 74 additions and 43 deletions
|
|
@ -13,38 +13,41 @@ template(name="import")
|
||||||
template(name="importTextarea")
|
template(name="importTextarea")
|
||||||
form
|
form
|
||||||
p: label(for='import-textarea') {{_ instruction}} {{_ 'import-board-instruction-about-errors'}}
|
p: label(for='import-textarea') {{_ instruction}} {{_ 'import-board-instruction-about-errors'}}
|
||||||
textarea.js-import-json(placeholder="{{_ importPlaceHolder}}" autofocus)
|
textarea.js-import-json(id='import-textarea' placeholder="{{_ importPlaceHolder}}" autofocus)
|
||||||
| {{jsonText}}
|
| {{jsonText}}
|
||||||
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
||||||
|
|
||||||
template(name="importMapMembers")
|
template(name="importMapMembers")
|
||||||
h2 {{_ 'import-map-members'}}
|
h2 {{_ 'import-map-members'}}
|
||||||
.map-members
|
if usersLoaded.get
|
||||||
p {{_ 'import-members-map'}}
|
.map-members
|
||||||
.mapping-list
|
p {{_ 'import-members-map'}}
|
||||||
each members
|
.mapping-list
|
||||||
a.mapping-item.js-select-member(class="{{#if wekanId}}filled{{/if}}")
|
each members
|
||||||
.profile-source
|
a.mapping-item.js-select-member(class="{{#if wekanId}}filled{{/if}}")
|
||||||
.full-name= fullName
|
.profile-source
|
||||||
.username
|
.full-name= fullName
|
||||||
| ({{username}})
|
.username
|
||||||
.wekan
|
| ({{username}})
|
||||||
if wekanId
|
.wekan
|
||||||
+userAvatar(userId=wekanId)
|
if wekanId
|
||||||
else
|
+userAvatar(userId=wekanId)
|
||||||
a.member.add-member
|
else
|
||||||
i.fa.fa-plus
|
a.member.add-member
|
||||||
//-
|
i.fa.fa-plus
|
||||||
Due to the way the flewbox layout is working, we need to set some
|
//-
|
||||||
invisible items so that the last row items have a consistent width.
|
Due to the way the flewbox layout is working, we need to set some
|
||||||
See http://jsfiddle.net/Ln4h3c4n/ for an minimal example of the issue.
|
invisible items so that the last row items have a consistent width.
|
||||||
.mapping-item.ghost-item
|
See http://jsfiddle.net/Ln4h3c4n/ for an minimal example of the issue.
|
||||||
.mapping-item.ghost-item
|
.mapping-item.ghost-item
|
||||||
.mapping-item.ghost-item
|
.mapping-item.ghost-item
|
||||||
.mapping-item.ghost-item
|
.mapping-item.ghost-item
|
||||||
.mapping-item.ghost-item
|
.mapping-item.ghost-item
|
||||||
form
|
.mapping-item.ghost-item
|
||||||
input.primary.wide(type="submit" value="{{_ 'done'}}")
|
form
|
||||||
|
input.primary.wide(type="submit" value="{{_ 'done'}}")
|
||||||
|
else
|
||||||
|
+spinner
|
||||||
|
|
||||||
template(name="importMapMembersAddPopup")
|
template(name="importMapMembersAddPopup")
|
||||||
.select-member
|
.select-member
|
||||||
|
|
|
||||||
|
|
@ -150,14 +150,39 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
|
this.usersLoaded = new ReactiveVar(false);
|
||||||
|
|
||||||
this.autorun(() => {
|
this.autorun(() => {
|
||||||
this.parentComponent()
|
const handle = this.subscribe(
|
||||||
.membersToMap.get()
|
'user-miniprofile',
|
||||||
.forEach(({ wekanId }) => {
|
this.members().map(member => {
|
||||||
if (wekanId) {
|
return member.username;
|
||||||
this.subscribe('user-miniprofile', wekanId);
|
}),
|
||||||
|
);
|
||||||
|
Tracker.nonreactive(() => {
|
||||||
|
Tracker.autorun(() => {
|
||||||
|
if (
|
||||||
|
handle.ready() &&
|
||||||
|
!this.usersLoaded.get() &&
|
||||||
|
this.members().length
|
||||||
|
) {
|
||||||
|
this._refreshMembers(
|
||||||
|
this.members().map(member => {
|
||||||
|
if (!member.wekanId) {
|
||||||
|
const user = Users.findOne({ username: member.username });
|
||||||
|
if (user) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('found username:', user.username);
|
||||||
|
member.wekanId = user._id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return member;
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
this.usersLoaded.set(handle.ready());
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,24 +69,28 @@ CustomFields.attachSchema(
|
||||||
* should we show on the cards this custom field
|
* should we show on the cards this custom field
|
||||||
*/
|
*/
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
automaticallyOnCard: {
|
automaticallyOnCard: {
|
||||||
/**
|
/**
|
||||||
* should the custom fields automatically be added on cards?
|
* should the custom fields automatically be added on cards?
|
||||||
*/
|
*/
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
alwaysOnCard: {
|
alwaysOnCard: {
|
||||||
/**
|
/**
|
||||||
* should the custom field be automatically added to all cards?
|
* should the custom field be automatically added to all cards?
|
||||||
*/
|
*/
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
showLabelOnMiniCard: {
|
showLabelOnMiniCard: {
|
||||||
/**
|
/**
|
||||||
* should the label of the custom field be shown on minicards?
|
* should the label of the custom field be shown on minicards?
|
||||||
*/
|
*/
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
createdAt: {
|
createdAt: {
|
||||||
type: Date,
|
type: Date,
|
||||||
|
|
|
||||||
|
|
@ -258,8 +258,9 @@ export class WekanCreator {
|
||||||
// now add other members
|
// now add other members
|
||||||
if (boardToImport.members) {
|
if (boardToImport.members) {
|
||||||
boardToImport.members.forEach(wekanMember => {
|
boardToImport.members.forEach(wekanMember => {
|
||||||
// do we already have it in our list?
|
// is it defined and do we already have it in our list?
|
||||||
if (
|
if (
|
||||||
|
wekanMember.wekanId &&
|
||||||
!boardToCreate.members.some(
|
!boardToCreate.members.some(
|
||||||
member => member.wekanId === wekanMember.wekanId,
|
member => member.wekanId === wekanMember.wekanId,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
Meteor.publish('user-miniprofile', function(userId) {
|
Meteor.publish('user-miniprofile', function(usernames) {
|
||||||
check(userId, String);
|
check(usernames, Array);
|
||||||
|
|
||||||
return Users.find(userId, {
|
// eslint-disable-next-line no-console
|
||||||
fields: {
|
// console.log('usernames:', usernames);
|
||||||
username: 1,
|
return Users.find(
|
||||||
'profile.fullname': 1,
|
{ username: { $in: usernames } },
|
||||||
'profile.avatarUrl': 1,
|
{ fields: Users.safeFields },
|
||||||
'profile.initials': 1,
|
);
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.publish('user-admin', function() {
|
Meteor.publish('user-admin', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue