mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Move every Lists.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory client/)
This commit is contained in:
parent
c2139662cd
commit
4a8dcde8ee
6 changed files with 14 additions and 14 deletions
|
|
@ -61,7 +61,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
// fix lists sort field if there are null values
|
// fix lists sort field if there are null values
|
||||||
const nullSortLists = currentBoardData.nullSortLists();
|
const nullSortLists = currentBoardData.nullSortLists();
|
||||||
if (nullSortLists.count() > 0) {
|
if (nullSortLists.length > 0) {
|
||||||
const lists = currentBoardData.lists();
|
const lists = currentBoardData.lists();
|
||||||
let count = 0;
|
let count = 0;
|
||||||
lists.forEach(l => {
|
lists.forEach(l => {
|
||||||
|
|
@ -215,7 +215,7 @@ BlazeComponent.extendComponent({
|
||||||
// If there is no data in the board (ie, no lists) we autofocus the list
|
// If there is no data in the board (ie, no lists) we autofocus the list
|
||||||
// creation form by clicking on the corresponding element.
|
// creation form by clicking on the corresponding element.
|
||||||
const currentBoard = Utils.getCurrentBoard();
|
const currentBoard = Utils.getCurrentBoard();
|
||||||
if (Utils.canModifyBoard() && currentBoard.lists().count() === 0) {
|
if (Utils.canModifyBoard() && currentBoard.lists().length === 0) {
|
||||||
boardComponent.openNewListForm();
|
boardComponent.openNewListForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,8 @@ BlazeComponent.extendComponent({
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
boardLists(boardId) {
|
boardLists(boardId) {
|
||||||
const lists = Lists.find({ 'boardId': boardId, 'archived': false },{sort: ['sort','asc']});
|
|
||||||
/* Bug Board icons random dance https://github.com/wekan/wekan/issues/4214
|
/* Bug Board icons random dance https://github.com/wekan/wekan/issues/4214
|
||||||
|
const lists = ReactiveCache.getLists({ 'boardId': boardId, 'archived': false },{sort: ['sort','asc']});
|
||||||
const ret = lists.map(list => {
|
const ret = lists.map(list => {
|
||||||
let cardCount = ReactiveCache.getCards({ 'boardId': boardId, 'listId': list._id }).length;
|
let cardCount = ReactiveCache.getCards({ 'boardId': boardId, 'listId': list._id }).length;
|
||||||
return `${list.title}: ${cardCount}`;
|
return `${list.title}: ${cardCount}`;
|
||||||
|
|
|
||||||
|
|
@ -479,14 +479,14 @@ BlazeComponent.extendComponent({
|
||||||
if (!this.selectedBoardId.get()) {
|
if (!this.selectedBoardId.get()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const lists = Lists.find(
|
const lists = ReactiveCache.getLists(
|
||||||
{
|
{
|
||||||
boardId: this.selectedBoardId.get()
|
boardId: this.selectedBoardId.get()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: { sort: 1 },
|
sort: { sort: 1 },
|
||||||
});
|
});
|
||||||
if (lists.count()) this.selectedListId.set(lists.fetch()[0]._id);
|
if (lists.length) this.selectedListId.set(lists[0]._id);
|
||||||
return lists;
|
return lists;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -740,7 +740,7 @@ BlazeComponent.extendComponent({
|
||||||
} else if (this.isListTemplateSearch) {
|
} else if (this.isListTemplateSearch) {
|
||||||
element.sort = ReactiveCache.getSwimlane(this.swimlaneId)
|
element.sort = ReactiveCache.getSwimlane(this.swimlaneId)
|
||||||
.lists()
|
.lists()
|
||||||
.count();
|
.length;
|
||||||
element.type = 'list';
|
element.type = 'list';
|
||||||
_id = element.copy(this.boardId, this.swimlaneId);
|
_id = element.copy(this.boardId, this.swimlaneId);
|
||||||
} else if (this.isSwimlaneTemplateSearch) {
|
} else if (this.isSwimlaneTemplateSearch) {
|
||||||
|
|
|
||||||
|
|
@ -799,7 +799,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
return Lists.find(
|
return ReactiveCache.getLists(
|
||||||
{
|
{
|
||||||
boardId: this.currentBoard._id,
|
boardId: this.currentBoard._id,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
@ -811,7 +811,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
hasLists() {
|
hasLists() {
|
||||||
return this.lists().count() > 0;
|
return this.lists().length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
isListSelected() {
|
isListSelected() {
|
||||||
|
|
@ -998,7 +998,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
return Lists.find(
|
return ReactiveCache.getLists(
|
||||||
{
|
{
|
||||||
boardId: this.currentBoard._id,
|
boardId: this.currentBoard._id,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
@ -1010,7 +1010,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
hasLists() {
|
hasLists() {
|
||||||
return this.lists().count() > 0;
|
return this.lists().length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
isListSelected() {
|
isListSelected() {
|
||||||
|
|
@ -1346,7 +1346,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
return Lists.find(
|
return ReactiveCache.getLists(
|
||||||
{
|
{
|
||||||
boardId: this.currentBoard._id,
|
boardId: this.currentBoard._id,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
@ -1358,7 +1358,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
hasLists() {
|
hasLists() {
|
||||||
return this.lists().count() > 0;
|
return this.lists().length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
isListSelected() {
|
isListSelected() {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
archivedLists() {
|
archivedLists() {
|
||||||
return Lists.find(
|
return ReactiveCache.getLists(
|
||||||
{
|
{
|
||||||
archived: true,
|
archived: true,
|
||||||
boardId: Session.get('currentBoard'),
|
boardId: Session.get('currentBoard'),
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ function getCardsBetween(idA, idB) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getListsStrictlyBetween(id1, id2) {
|
function getListsStrictlyBetween(id1, id2) {
|
||||||
return Lists.find({
|
return ReactiveCache.getLists({
|
||||||
$and: [
|
$and: [
|
||||||
{ sort: { $gt: ReactiveCache.getList(id1).sort } },
|
{ sort: { $gt: ReactiveCache.getList(id1).sort } },
|
||||||
{ sort: { $lt: ReactiveCache.getList(id2).sort } },
|
{ sort: { $lt: ReactiveCache.getList(id2).sort } },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue