mirror of
https://github.com/wekan/wekan.git
synced 2026-02-05 08:01:49 +01:00
Merge pull request #3459 from jrsupplee/new-search
Search All Boards: Added list of board, list and color names.
This commit is contained in:
commit
1df060b8f6
7 changed files with 198 additions and 9 deletions
|
|
@ -1343,6 +1343,26 @@ if (Meteor.isServer) {
|
|||
},
|
||||
});
|
||||
},
|
||||
myLabelNames() {
|
||||
let names = [];
|
||||
Boards.userBoards(Meteor.userId()).forEach(board => {
|
||||
names = names.concat(
|
||||
board.labels
|
||||
.filter(label => !!label.name)
|
||||
.map(label => {
|
||||
return label.name;
|
||||
}),
|
||||
);
|
||||
});
|
||||
return _.uniq(names).sort();
|
||||
},
|
||||
myBoardNames() {
|
||||
return _.uniq(
|
||||
Boards.userBoards(Meteor.userId()).map(board => {
|
||||
return board.title;
|
||||
}),
|
||||
).sort();
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
|
|
|
|||
|
|
@ -1954,6 +1954,18 @@ Cards.globalSearch = queryParams => {
|
|||
selector.listId.$in = queryLists;
|
||||
}
|
||||
|
||||
if (queryParams.dueAt !== null) {
|
||||
selector.dueAt = { $gte: new Date(queryParams.dueAt) };
|
||||
}
|
||||
|
||||
if (queryParams.createdAt !== null) {
|
||||
selector.createdAt = { $gte: new Date(queryParams.createdAt) };
|
||||
}
|
||||
|
||||
if (queryParams.modifiedAt !== null) {
|
||||
selector.modifiedAt = { $gte: new Date(queryParams.modifiedAt) };
|
||||
}
|
||||
|
||||
const queryMembers = [];
|
||||
const queryAssignees = [];
|
||||
if (queryParams.users.length) {
|
||||
|
|
@ -2079,7 +2091,7 @@ Cards.globalSearch = queryParams => {
|
|||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('selector:', selector);
|
||||
console.log('selector:', selector);
|
||||
const cards = Cards.find(selector, {
|
||||
fields: {
|
||||
_id: 1,
|
||||
|
|
@ -2094,13 +2106,15 @@ Cards.globalSearch = queryParams => {
|
|||
assignees: 1,
|
||||
colors: 1,
|
||||
dueAt: 1,
|
||||
createdAt: 1,
|
||||
modifiedAt: 1,
|
||||
labelIds: 1,
|
||||
},
|
||||
limit: 50,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('count:', cards.count());
|
||||
console.log('count:', cards.count());
|
||||
|
||||
return { cards, errors };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -362,6 +362,20 @@ Meteor.methods({
|
|||
const list = Lists.findOne({ _id: listId });
|
||||
list.toggleSoftLimit(!list.getWipLimit('soft'));
|
||||
},
|
||||
|
||||
myLists() {
|
||||
// my lists
|
||||
return _.uniq(
|
||||
Lists.find(
|
||||
{ boardId: { $in: Boards.userBoardIds(this.userId) } },
|
||||
{ fields: { title: 1 } },
|
||||
)
|
||||
.fetch()
|
||||
.map(list => {
|
||||
return list.title;
|
||||
}),
|
||||
).sort();
|
||||
},
|
||||
});
|
||||
|
||||
Lists.hookOptions.after.update = { fetchPrevious: false };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue