diff --git a/app/imports/server/publications/library.js b/app/imports/server/publications/library.js index 10553aab..778d08a8 100644 --- a/app/imports/server/publications/library.js +++ b/app/imports/server/publications/library.js @@ -3,6 +3,39 @@ import Libraries from '/imports/api/library/Libraries.js'; import LibraryNodes from '/imports/api/library/LibraryNodes.js'; import { assertViewPermission, assertDocViewPermission } from '/imports/api/sharing/sharingPermissions.js'; +const LIBRARY_NODE_TREE_FIELDS = { + _id: 1, + name: 1, + type: 1, + icon: 1, + color: 1, + order: 1, + parent: 1, + ancestors: 1, + // Effect + operation: 1, + targetTags: 1, + stats: 1, + // Item + quantity: 1, + plural: 1, + equipped: 1, + // Branch + branchType: 1, + // Damage: + damageType: 1, + stat: 1, + amount: 1, + // Class level + level: 1, + // Proficiency + value: 1, + // Reference + cache: 1, +} + +export { LIBRARY_NODE_TREE_FIELDS }; + Meteor.publish('libraries', function(){ this.autorun(function (){ let userId = this.userId; @@ -64,36 +97,7 @@ Meteor.publish('libraryNodes', function(libraryId){ 'ancestors.id': libraryId, }, { sort: { order: 1 }, - fields: { - _id: 1, - name: 1, - type: 1, - icon: 1, - color: 1, - order: 1, - parent: 1, - ancestors: 1, - // Effect - operation: 1, - targetTags: 1, - stats: 1, - // Item - quantity: 1, - plural: 1, - equipped: 1, - // Branch - branchType: 1, - // Damage: - damageType: 1, - stat: 1, - amount: 1, - // Class level - level: 1, - // Proficiency - value: 1, - // Reference - cache: 1, - } + fields: LIBRARY_NODE_TREE_FIELDS, }), ]; }); diff --git a/app/imports/server/publications/slotFillers.js b/app/imports/server/publications/slotFillers.js index c5b3397f..3dd6d141 100644 --- a/app/imports/server/publications/slotFillers.js +++ b/app/imports/server/publications/slotFillers.js @@ -3,6 +3,13 @@ import Libraries from '/imports/api/library/Libraries.js'; import LibraryNodes from '/imports/api/library/LibraryNodes.js'; import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js'; import getSlotFillFilter from '/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js' +import { LIBRARY_NODE_TREE_FIELDS } from '/imports/server/publications/library.js'; + +const FIELDS = { + ...LIBRARY_NODE_TREE_FIELDS, + slotFillerCondition: 1, + tags: 1, +} Meteor.publish('slotFillers', function(slotId, searchTerm){ if (searchTerm) check(searchTerm, String); @@ -50,7 +57,8 @@ Meteor.publish('slotFillers', function(slotId, searchTerm){ options = { // relevant documents have a higher score. fields: { - _score: { $meta: 'textScore' } + _score: { $meta: 'textScore' }, + ...FIELDS, }, sort: { // `score` property specified in the projection fields above. @@ -61,10 +69,13 @@ Meteor.publish('slotFillers', function(slotId, searchTerm){ } } else { delete filter.$text - options = {sort: { - name: 1, - order: 1, - }}; + options = { + sort: { + name: 1, + order: 1, + }, + fields: FIELDS, + }; } options.limit = limit; @@ -72,7 +83,6 @@ Meteor.publish('slotFillers', function(slotId, searchTerm){ self.setData('countAll', LibraryNodes.find(filter).count()); }); self.autorun(function () { - Meteor._sleepForMs(1000); return [LibraryNodes.find(filter, options), libraries]; }); }); diff --git a/app/imports/ui/creature/slots/SlotFillDialog.vue b/app/imports/ui/creature/slots/SlotFillDialog.vue index 0b63870f..497b0401 100644 --- a/app/imports/ui/creature/slots/SlotFillDialog.vue +++ b/app/imports/ui/creature/slots/SlotFillDialog.vue @@ -27,20 +27,18 @@ />

{{ slotPropertyTypeName }} with tags: - - + +