mirror of
https://github.com/wekan/wekan.git
synced 2026-01-29 12:46:09 +01:00
Fix and update easysearch
This commit is contained in:
parent
3ddb97c8c9
commit
339e044a30
11 changed files with 40 additions and 45 deletions
|
|
@ -20,7 +20,7 @@ cfs:standard-packages
|
||||||
cottz:publish-relations
|
cottz:publish-relations
|
||||||
dburles:collection-helpers
|
dburles:collection-helpers
|
||||||
idmontie:migrations
|
idmontie:migrations
|
||||||
matteodem:easy-search
|
easy:search
|
||||||
mongo@1.15.0
|
mongo@1.15.0
|
||||||
mquandalle:collection-mutations
|
mquandalle:collection-mutations
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,10 @@ ddp-server@2.5.0
|
||||||
deps@1.0.12
|
deps@1.0.12
|
||||||
diff-sequence@1.1.1
|
diff-sequence@1.1.1
|
||||||
dynamic-import@0.7.2
|
dynamic-import@0.7.2
|
||||||
|
easy:search@2.2.1
|
||||||
easylogic:summernote@0.8.8
|
easylogic:summernote@0.8.8
|
||||||
|
easysearch:components@2.2.2
|
||||||
|
easysearch:core@2.2.2
|
||||||
ecmascript@0.16.2
|
ecmascript@0.16.2
|
||||||
ecmascript-runtime@0.8.0
|
ecmascript-runtime@0.8.0
|
||||||
ecmascript-runtime-client@0.12.1
|
ecmascript-runtime-client@0.12.1
|
||||||
|
|
@ -82,7 +85,6 @@ lmieulet:meteor-coverage@1.1.4
|
||||||
localstorage@1.2.0
|
localstorage@1.2.0
|
||||||
logging@1.3.1
|
logging@1.3.1
|
||||||
matb33:collection-hooks@1.1.2
|
matb33:collection-hooks@1.1.2
|
||||||
matteodem:easy-search@1.6.4
|
|
||||||
mdg:validation-error@0.5.1
|
mdg:validation-error@0.5.1
|
||||||
meteor@1.10.0
|
meteor@1.10.0
|
||||||
meteor-autosize@5.0.1
|
meteor-autosize@5.0.1
|
||||||
|
|
|
||||||
|
|
@ -1811,13 +1811,7 @@ Template.cardAssigneesPopup.helpers({
|
||||||
|
|
||||||
Template.cardAssigneePopup.helpers({
|
Template.cardAssigneePopup.helpers({
|
||||||
userData() {
|
userData() {
|
||||||
// We need to handle a special case for the search results provided by the
|
return Users.findOne(this.userId, {
|
||||||
// `matteodem:easy-search` package. Since these results gets published in a
|
|
||||||
// separate collection, and not in the standard Meteor.Users collection as
|
|
||||||
// expected, we use a component parameter ("property") to distinguish the
|
|
||||||
// two cases.
|
|
||||||
const userCollection = this.esSearch ? ESSearchResults : Users;
|
|
||||||
return userCollection.findOne(this.userId, {
|
|
||||||
fields: {
|
fields: {
|
||||||
profile: 1,
|
profile: 1,
|
||||||
username: 1,
|
username: 1,
|
||||||
|
|
|
||||||
|
|
@ -56,17 +56,17 @@ template(name="importMapMembersAddPopup")
|
||||||
p
|
p
|
||||||
| {{_ 'import-user-select'}}
|
| {{_ 'import-user-select'}}
|
||||||
.js-map-member
|
.js-map-member
|
||||||
+esInput(index="users")
|
+EasySearch.Input(index=searchIndex)
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
+esEach(index="users")
|
+EasySearch.Each(index=searchIndex)
|
||||||
li.item.js-member-item
|
li.item.js-member-item
|
||||||
a.name.js-select-import(title="{{profile.fullname}} ({{username}})" data-id="{{_id}}")
|
a.name.js-select-import(title="{{profile.fullname}} ({{username}})" data-id="{{__originalId}}")
|
||||||
+userAvatar(userId=_id esSearch=true)
|
+userAvatar(userId=__originalId)
|
||||||
span.full-name
|
span.full-name
|
||||||
= profile.fullname
|
= profile.fullname
|
||||||
| (<span class="username">{{username}}</span>)
|
| (<span class="username">{{username}}</span>)
|
||||||
+ifEsIsSearching(index='users')
|
+EasySearch.IfSearching(index=searchIndex)
|
||||||
+spinner
|
+spinner
|
||||||
+ifEsHasNoResults(index="users")
|
+EasySearch.IfNoResults(index=searchIndex)
|
||||||
.manage-member-section
|
.manage-member-section
|
||||||
p.quiet {{_ 'no-results'}}
|
p.quiet {{_ 'no-results'}}
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectUser() {
|
onSelectUser() {
|
||||||
Popup.getOpenerComponent().mapSelectedMember(this.currentData()._id);
|
Popup.getOpenerComponent(5).mapSelectedMember(this.currentData().__originalId);
|
||||||
Popup.back();
|
Popup.back();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -309,3 +309,7 @@ BlazeComponent.extendComponent({
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
}).register('importMapMembersAddPopup');
|
}).register('importMapMembersAddPopup');
|
||||||
|
|
||||||
|
Template.importMapMembersAddPopup.helpers({
|
||||||
|
searchIndex: () => Users.search_index,
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -190,22 +190,19 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.orgRow.helpers({
|
Template.orgRow.helpers({
|
||||||
orgData() {
|
orgData() {
|
||||||
const orgCollection = this.esSearch ? ESSearchResults : Org;
|
return Org.findOne(this.orgId);
|
||||||
return orgCollection.findOne(this.orgId);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.teamRow.helpers({
|
Template.teamRow.helpers({
|
||||||
teamData() {
|
teamData() {
|
||||||
const teamCollection = this.esSearch ? ESSearchResults : Team;
|
return Team.findOne(this.teamId);
|
||||||
return teamCollection.findOne(this.teamId);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.peopleRow.helpers({
|
Template.peopleRow.helpers({
|
||||||
userData() {
|
userData() {
|
||||||
const userCollection = this.esSearch ? ESSearchResults : Users;
|
return Users.findOne(this.userId);
|
||||||
return userCollection.findOne(this.userId);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -561,7 +561,7 @@ template(name="removeBoardTeamPopup")
|
||||||
|
|
||||||
template(name="addMemberPopup")
|
template(name="addMemberPopup")
|
||||||
.js-search-member
|
.js-search-member
|
||||||
+esInput(index="users")
|
+EasySearch.Input(index=searchIndex)
|
||||||
|
|
||||||
if loading.get
|
if loading.get
|
||||||
+spinner
|
+spinner
|
||||||
|
|
@ -569,20 +569,20 @@ template(name="addMemberPopup")
|
||||||
.warning {{_ error.get}}
|
.warning {{_ error.get}}
|
||||||
else
|
else
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
+esEach(index="users")
|
+EasySearch.Each(index=searchIndex)
|
||||||
li.item.js-member-item(class="{{#if isBoardMember}}disabled{{/if}}")
|
li.item.js-member-item(class="{{#if isBoardMember}}disabled{{/if}}")
|
||||||
a.name.js-select-member(title="{{profile.fullname}} ({{username}})")
|
a.name.js-select-member(title="{{profile.fullname}} ({{username}})")
|
||||||
+userAvatar(userId=_id esSearch=true)
|
+userAvatar(userId=__originalId)
|
||||||
span.full-name
|
span.full-name
|
||||||
= profile.fullname
|
= profile.fullname
|
||||||
| (<span class="username">{{username}}</span>)
|
| (<span class="username">{{username}}</span>)
|
||||||
if isBoardMember
|
if isBoardMember
|
||||||
.quiet ({{_ 'joined'}})
|
.quiet ({{_ 'joined'}})
|
||||||
|
|
||||||
+ifEsIsSearching(index='users')
|
+EasySearch.IfSearching(index=searchIndex)
|
||||||
+spinner
|
+spinner
|
||||||
|
|
||||||
+ifEsHasNoResults(index="users")
|
+EasySearch.IfNoResults(index=searchIndex)
|
||||||
.manage-member-section
|
.manage-member-section
|
||||||
p.quiet {{_ 'no-results'}}
|
p.quiet {{_ 'no-results'}}
|
||||||
button.js-email-invite.primary.full {{_ 'email-invite'}}
|
button.js-email-invite.primary.full {{_ 'email-invite'}}
|
||||||
|
|
|
||||||
|
|
@ -1333,7 +1333,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isBoardMember() {
|
isBoardMember() {
|
||||||
const userId = this.currentData()._id;
|
const userId = this.currentData().__originalId;
|
||||||
const user = Users.findOne(userId);
|
const user = Users.findOne(userId);
|
||||||
return user && user.isBoardMember();
|
return user && user.isBoardMember();
|
||||||
},
|
},
|
||||||
|
|
@ -1373,7 +1373,7 @@ BlazeComponent.extendComponent({
|
||||||
this.setError('');
|
this.setError('');
|
||||||
},
|
},
|
||||||
'click .js-select-member'() {
|
'click .js-select-member'() {
|
||||||
const userId = this.currentData()._id;
|
const userId = this.currentData().__originalId;
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
if (!currentBoard.hasMember(userId)) {
|
if (!currentBoard.hasMember(userId)) {
|
||||||
this.inviteUser(userId);
|
this.inviteUser(userId);
|
||||||
|
|
@ -1390,6 +1390,10 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
}).register('addMemberPopup');
|
}).register('addMemberPopup');
|
||||||
|
|
||||||
|
Template.addMemberPopup.helpers({
|
||||||
|
searchIndex: () => Users.search_index,
|
||||||
|
})
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.error = new ReactiveVar('');
|
this.error = new ReactiveVar('');
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,7 @@ import { formatFleURL } from 'meteor/ostrio:files/lib';
|
||||||
|
|
||||||
Template.userAvatar.helpers({
|
Template.userAvatar.helpers({
|
||||||
userData() {
|
userData() {
|
||||||
// We need to handle a special case for the search results provided by the
|
return Users.findOne(this.userId, {
|
||||||
// `matteodem:easy-search` package. Since these results gets published in a
|
|
||||||
// separate collection, and not in the standard Meteor.Users collection as
|
|
||||||
// expected, we use a component parameter ("property") to distinguish the
|
|
||||||
// two cases.
|
|
||||||
const userCollection = this.esSearch ? ESSearchResults : Users;
|
|
||||||
return userCollection.findOne(this.userId, {
|
|
||||||
fields: {
|
fields: {
|
||||||
profile: 1,
|
profile: 1,
|
||||||
username: 1,
|
username: 1,
|
||||||
|
|
@ -95,8 +89,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.boardOrgRow.helpers({
|
Template.boardOrgRow.helpers({
|
||||||
orgData() {
|
orgData() {
|
||||||
const orgCollection = this.esSearch ? ESSearchResults : Org;
|
return Org.findOne(this.orgId);
|
||||||
return orgCollection.findOne(this.orgId);
|
|
||||||
},
|
},
|
||||||
currentUser(){
|
currentUser(){
|
||||||
return Meteor.user();
|
return Meteor.user();
|
||||||
|
|
@ -158,8 +151,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.boardTeamRow.helpers({
|
Template.boardTeamRow.helpers({
|
||||||
teamData() {
|
teamData() {
|
||||||
const teamCollection = this.esSearch ? ESSearchResults : Team;
|
return Team.findOne(this.teamId);
|
||||||
return teamCollection.findOne(this.teamId);
|
|
||||||
},
|
},
|
||||||
currentUser(){
|
currentUser(){
|
||||||
return Meteor.user();
|
return Meteor.user();
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ window.Popup = new (class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getOpenerComponent() {
|
getOpenerComponent(n=4) {
|
||||||
const { openerElement } = Template.parentData(4);
|
const { openerElement } = Template.parentData(n);
|
||||||
return BlazeComponent.getComponentForElement(openerElement);
|
return BlazeComponent.getComponentForElement(openerElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import { SyncedCron } from 'meteor/percolate:synced-cron';
|
import { SyncedCron } from 'meteor/percolate:synced-cron';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
import ImpersonatedUsers from './impersonatedUsers';
|
import ImpersonatedUsers from './impersonatedUsers';
|
||||||
|
import { Index, MongoDBEngine } from 'meteor/easy:search'
|
||||||
|
|
||||||
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
|
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
|
||||||
// in the package definition.
|
// in the package definition.
|
||||||
|
|
@ -537,9 +538,10 @@ Users.allow({
|
||||||
// Search a user in the complete server database by its name, username or emails adress. This
|
// Search a user in the complete server database by its name, username or emails adress. This
|
||||||
// is used for instance to add a new user to a board.
|
// is used for instance to add a new user to a board.
|
||||||
const searchInFields = ['username', 'profile.fullname', 'emails.address'];
|
const searchInFields = ['username', 'profile.fullname', 'emails.address'];
|
||||||
Users.initEasySearch(searchInFields, {
|
Users.search_index = new Index({
|
||||||
use: 'mongo-db',
|
collection: Users,
|
||||||
returnFields: [...searchInFields, 'profile.avatarUrl'],
|
fields: searchInFields,
|
||||||
|
engine: new MongoDBEngine(),
|
||||||
});
|
});
|
||||||
|
|
||||||
Users.safeFields = {
|
Users.safeFields = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue