From 4b9802d6a0e739d3aa3fdbc7809669ae68f76431 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 14 Jun 2023 20:11:00 +0200 Subject: [PATCH] Removed slotFillers from every part of the app --- .../buildComputation/linkTypeDependencies.js | 1 - .../tests/computeSlotQuantityFilled.testFn.js | 2 +- app/imports/api/properties/Folders.js | 4 - app/imports/api/properties/SlotFillers.js | 26 ----- .../computedOnlyPropertySchemasIndex.js | 2 - .../computedPropertySchemasIndex.js | 2 - .../api/properties/propertySchemasIndex.js | 2 - .../ui/properties/InsertPropertyDialog.vue | 4 - .../folders/propertyComponentIndex.js | 3 - .../client/ui/properties/forms/FolderForm.vue | 103 +++++++++--------- .../ui/properties/forms/SlotFillerForm.vue | 24 ---- .../forms/shared/propertyFormIndex.js | 2 - .../ui/properties/viewers/FolderViewer.vue | 7 +- .../viewers/shared/propertyViewerIndex.js | 2 - app/imports/constants/PROPERTIES.js | 11 -- app/imports/migrations/server/dbv2/dbv2.js | 18 ++- 16 files changed, 71 insertions(+), 142 deletions(-) delete mode 100644 app/imports/api/properties/SlotFillers.js delete mode 100644 app/imports/client/ui/properties/forms/SlotFillerForm.vue diff --git a/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js b/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js index 826eaaee..0a856386 100644 --- a/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js +++ b/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js @@ -218,7 +218,6 @@ function getDefaultCalculationField(prop) { case 'roll': return 'roll'; case 'savingThrow': return 'dc'; case 'skill': return 'baseValue'; - case 'slotFiller': return null; case 'slot': return 'quantityExpected'; case 'spellList': return 'attackRollBonus'; case 'spell': return null; diff --git a/app/imports/api/engine/computation/buildComputation/tests/computeSlotQuantityFilled.testFn.js b/app/imports/api/engine/computation/buildComputation/tests/computeSlotQuantityFilled.testFn.js index 79abf23b..b2c80f9a 100644 --- a/app/imports/api/engine/computation/buildComputation/tests/computeSlotQuantityFilled.testFn.js +++ b/app/imports/api/engine/computation/buildComputation/tests/computeSlotQuantityFilled.testFn.js @@ -18,7 +18,7 @@ var testProperties = [ // Children clean({ _id: 'slotFillerId', - type: 'slotFiller', + type: 'folder', slotQuantityFilled: 3, slotFillerType: 'item', ancestors: [{ id: 'charId' }, { id: 'slotId' }], diff --git a/app/imports/api/properties/Folders.js b/app/imports/api/properties/Folders.js index 0d15f840..626b07ed 100644 --- a/app/imports/api/properties/Folders.js +++ b/app/imports/api/properties/Folders.js @@ -39,10 +39,6 @@ let FolderSchema = createPropertySchema({ }); const ComputedOnlyFolderSchema = createPropertySchema({ - summary: { - type: 'computedOnlyInlineCalculationField', - optional: true, - }, description: { type: 'computedOnlyInlineCalculationField', optional: true, diff --git a/app/imports/api/properties/SlotFillers.js b/app/imports/api/properties/SlotFillers.js deleted file mode 100644 index 42a2f820..00000000 --- a/app/imports/api/properties/SlotFillers.js +++ /dev/null @@ -1,26 +0,0 @@ -import SimpleSchema from 'simpl-schema'; -import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js'; - -// SlotFiller fillers specifically fill a slot with a bit more control than -// other properties -let SlotFillerSchema = new SimpleSchema({ - name: { - type: String, - optional: true, - max: STORAGE_LIMITS.name, - }, - picture: { - type: String, - optional: true, - max: STORAGE_LIMITS.url, - }, - description: { - type: String, - optional: true, - max: STORAGE_LIMITS.description, - }, -}); - -const ComputedOnlySlotFillerSchema = new SimpleSchema({}); - -export { SlotFillerSchema, ComputedOnlySlotFillerSchema }; diff --git a/app/imports/api/properties/computedOnlyPropertySchemasIndex.js b/app/imports/api/properties/computedOnlyPropertySchemasIndex.js index 93f3793a..89cb21e4 100644 --- a/app/imports/api/properties/computedOnlyPropertySchemasIndex.js +++ b/app/imports/api/properties/computedOnlyPropertySchemasIndex.js @@ -23,7 +23,6 @@ import { ComputedOnlyRollSchema } from '/imports/api/properties/Rolls.js'; import { ComputedOnlySavingThrowSchema } from '/imports/api/properties/SavingThrows.js'; import { ComputedOnlySkillSchema } from '/imports/api/properties/Skills.js'; import { ComputedOnlySlotSchema } from '/imports/api/properties/Slots.js'; -import { ComputedOnlySlotFillerSchema } from '/imports/api/properties/SlotFillers.js'; import { ComputedOnlySpellSchema } from '/imports/api/properties/Spells.js'; import { ComputedOnlySpellListSchema } from '/imports/api/properties/SpellLists.js'; import { ComputedOnlyToggleSchema } from '/imports/api/properties/Toggles.js'; @@ -54,7 +53,6 @@ const propertySchemasIndex = { roll: ComputedOnlyRollSchema, savingThrow: ComputedOnlySavingThrowSchema, skill: ComputedOnlySkillSchema, - slotFiller: ComputedOnlySlotFillerSchema, spellList: ComputedOnlySpellListSchema, spell: ComputedOnlySpellSchema, toggle: ComputedOnlyToggleSchema, diff --git a/app/imports/api/properties/computedPropertySchemasIndex.js b/app/imports/api/properties/computedPropertySchemasIndex.js index 01fc3f44..b6adaaa2 100644 --- a/app/imports/api/properties/computedPropertySchemasIndex.js +++ b/app/imports/api/properties/computedPropertySchemasIndex.js @@ -23,7 +23,6 @@ import { ComputedRollSchema } from '/imports/api/properties/Rolls.js'; import { ComputedSavingThrowSchema } from '/imports/api/properties/SavingThrows.js'; import { ComputedSkillSchema } from '/imports/api/properties/Skills.js'; import { ComputedSlotSchema } from '/imports/api/properties/Slots.js'; -import { SlotFillerSchema } from '/imports/api/properties/SlotFillers.js'; import { ComputedSpellSchema } from '/imports/api/properties/Spells.js'; import { ComputedSpellListSchema } from '/imports/api/properties/SpellLists.js'; import { ComputedToggleSchema } from '/imports/api/properties/Toggles.js'; @@ -52,7 +51,6 @@ const propertySchemasIndex = { roll: ComputedRollSchema, savingThrow: ComputedSavingThrowSchema, skill: ComputedSkillSchema, - slotFiller: SlotFillerSchema, spellList: ComputedSpellListSchema, spell: ComputedSpellSchema, toggle: ComputedToggleSchema, diff --git a/app/imports/api/properties/propertySchemasIndex.js b/app/imports/api/properties/propertySchemasIndex.js index fdccedc9..ed0a3a22 100644 --- a/app/imports/api/properties/propertySchemasIndex.js +++ b/app/imports/api/properties/propertySchemasIndex.js @@ -21,7 +21,6 @@ import { RollSchema } from '/imports/api/properties/Rolls.js'; import { SavingThrowSchema } from '/imports/api/properties/SavingThrows.js'; import { SkillSchema } from '/imports/api/properties/Skills.js'; import { SlotSchema } from '/imports/api/properties/Slots.js'; -import { SlotFillerSchema } from '/imports/api/properties/SlotFillers.js'; import { SpellListSchema } from '/imports/api/properties/SpellLists.js'; import { SpellSchema } from '/imports/api/properties/Spells.js'; import { ToggleSchema } from '/imports/api/properties/Toggles.js'; @@ -52,7 +51,6 @@ const propertySchemasIndex = { roll: RollSchema, savingThrow: SavingThrowSchema, skill: SkillSchema, - slotFiller: SlotFillerSchema, spellList: SpellListSchema, spell: SpellSchema, toggle: ToggleSchema, diff --git a/app/imports/client/ui/properties/InsertPropertyDialog.vue b/app/imports/client/ui/properties/InsertPropertyDialog.vue index 7e090ad2..d346c19a 100644 --- a/app/imports/client/ui/properties/InsertPropertyDialog.vue +++ b/app/imports/client/ui/properties/InsertPropertyDialog.vue @@ -320,10 +320,6 @@ export default { this._subs.searchLibraryNodes.setData('limit', this.currentLimit + 32); }, changeType(type){ - if (type == 'slotFiller') { - type = 'folder'; - this.type = 'folder'; - } this._subs.searchLibraryNodes.setData('type', type); if (!type) return; this.tab = 1; diff --git a/app/imports/client/ui/properties/components/folders/propertyComponentIndex.js b/app/imports/client/ui/properties/components/folders/propertyComponentIndex.js index c6f866e8..8676d317 100644 --- a/app/imports/client/ui/properties/components/folders/propertyComponentIndex.js +++ b/app/imports/client/ui/properties/components/folders/propertyComponentIndex.js @@ -22,12 +22,10 @@ import propertySlot from '/imports/client/ui/properties/components/folders/folde //import roll from ''; //import savingThrow from ''; import skill from '/imports/client/ui/properties/components/skills/SkillListTile.vue'; -//import slotFiller from ''; import spellList from '/imports/client/ui/properties/components/spells/SpellListCard.vue'; import spell from '/imports/client/ui/properties/components/spells/SpellListTile.vue'; import toggle from '/imports/client/ui/properties/components/toggles/ToggleCard.vue'; //import trigger from ''; -import FolderGroupChildren from '/imports/client/ui/properties/components/folders/folderGroupComponents/FolderGroupChildren.vue'; export default { action, @@ -54,7 +52,6 @@ export default { //roll, //savingThrow, skill, - slotFiller: FolderGroupChildren, spellList, spell, toggle, diff --git a/app/imports/client/ui/properties/forms/FolderForm.vue b/app/imports/client/ui/properties/forms/FolderForm.vue index 3baab232..7263f1d7 100644 --- a/app/imports/client/ui/properties/forms/FolderForm.vue +++ b/app/imports/client/ui/properties/forms/FolderForm.vue @@ -1,54 +1,59 @@ diff --git a/app/imports/client/ui/properties/forms/SlotFillerForm.vue b/app/imports/client/ui/properties/forms/SlotFillerForm.vue deleted file mode 100644 index 90af79fd..00000000 --- a/app/imports/client/ui/properties/forms/SlotFillerForm.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/app/imports/client/ui/properties/forms/shared/propertyFormIndex.js b/app/imports/client/ui/properties/forms/shared/propertyFormIndex.js index 28cf4172..def2dba2 100644 --- a/app/imports/client/ui/properties/forms/shared/propertyFormIndex.js +++ b/app/imports/client/ui/properties/forms/shared/propertyFormIndex.js @@ -22,7 +22,6 @@ import RollForm from '/imports/client/ui/properties/forms/RollForm.vue'; import SavingThrowForm from '/imports/client/ui/properties/forms/SavingThrowForm.vue'; import SkillForm from '/imports/client/ui/properties/forms/SkillForm.vue'; import SlotForm from '/imports/client/ui/properties/forms/SlotForm.vue'; -import SlotFillerForm from '/imports/client/ui/properties/forms/SlotFillerForm.vue'; import SpellListForm from '/imports/client/ui/properties/forms/SpellListForm.vue'; import SpellForm from '/imports/client/ui/properties/forms/SpellForm.vue'; import ToggleForm from '/imports/client/ui/properties/forms/ToggleForm.vue'; @@ -53,7 +52,6 @@ export default { roll: RollForm, savingThrow: SavingThrowForm, skill: SkillForm, - slotFiller: SlotFillerForm, spellList: SpellListForm, spell: SpellForm, toggle: ToggleForm, diff --git a/app/imports/client/ui/properties/viewers/FolderViewer.vue b/app/imports/client/ui/properties/viewers/FolderViewer.vue index b1adbcb3..dc0c979d 100644 --- a/app/imports/client/ui/properties/viewers/FolderViewer.vue +++ b/app/imports/client/ui/properties/viewers/FolderViewer.vue @@ -2,14 +2,15 @@
+
diff --git a/app/imports/client/ui/properties/viewers/shared/propertyViewerIndex.js b/app/imports/client/ui/properties/viewers/shared/propertyViewerIndex.js index 456bdbf5..29753094 100644 --- a/app/imports/client/ui/properties/viewers/shared/propertyViewerIndex.js +++ b/app/imports/client/ui/properties/viewers/shared/propertyViewerIndex.js @@ -22,7 +22,6 @@ import RollViewer from '/imports/client/ui/properties/viewers/RollViewer.vue'; import SkillViewer from '/imports/client/ui/properties/viewers/SkillViewer.vue'; import SavingThrowViewer from '/imports/client/ui/properties/viewers/SavingThrowViewer.vue'; import SlotViewer from '/imports/client/ui/properties/viewers/SlotViewer.vue'; -import SlotFillerViewer from '/imports/client/ui/properties/viewers/SlotFillerViewer.vue'; import SpellListViewer from '/imports/client/ui/properties/viewers/SpellListViewer.vue'; import SpellViewer from '/imports/client/ui/properties/viewers/SpellViewer.vue'; import ToggleViewer from '/imports/client/ui/properties/viewers/ToggleViewer.vue'; @@ -52,7 +51,6 @@ export default { roll: RollViewer, reference: ReferenceViewer, savingThrow: SavingThrowViewer, - slotFiller: SlotFillerViewer, skill: SkillViewer, spellList: SpellListViewer, spell: SpellViewer, diff --git a/app/imports/constants/PROPERTIES.js b/app/imports/constants/PROPERTIES.js index 5a15ab5c..4686082c 100644 --- a/app/imports/constants/PROPERTIES.js +++ b/app/imports/constants/PROPERTIES.js @@ -170,17 +170,6 @@ const PROPERTIES = Object.freeze({ helpText: 'A slot in the character sheet is used to specify that a property needs to be selected from a library to fill the slot. The slot can determine what tags it is looking for, and any subscribed library property with matching tags can fill the slot', suggestedParents: [], }, - /* Deprecated - * Slot fillers are no longer suggested as possible property types, - * but existing slot fillers are still supported for backwards compatibility - slotFiller: { - icon: 'mdi-power-plug-outline', - name: 'Slot filler', - docsPath: 'property/slot-filler', - helpText: 'A slot filler allows for more advanced logic when it attempts to fill a slot. It can masquarade as any property type, and calculate whether it should fill a slot or not.', - suggestedParents: ['propertySlot'], - }, - */ spellList: { icon: '$vuetify.icons.spell_list', name: 'Spell list', diff --git a/app/imports/migrations/server/dbv2/dbv2.js b/app/imports/migrations/server/dbv2/dbv2.js index 770f1975..6796aab8 100644 --- a/app/imports/migrations/server/dbv2/dbv2.js +++ b/app/imports/migrations/server/dbv2/dbv2.js @@ -16,13 +16,16 @@ Migrations.add({ up() { console.log('migrating up library nodes 1 -> 2'); migrateCollection(LibraryNodes, migratePropUp); + console.log('migrating up creature props 1 -> 2'); migrateCollection(CreatureProperties, migratePropUp); + console.log('Migrating up libraries and collections to count subscribers'); countSubscribers(); }, down() { console.log('Migrating down library nodes 2 -> 1'); migrateCollection(LibraryNodes, migratePropDown); + console.log('Migrating down creature props 2 -> 1'); migrateCollection(CreatureProperties, migratePropDown); }, @@ -36,11 +39,15 @@ function migrateCollection(collection, migrateDoc) { export function migratePropUp(bulk, prop) { let update; - // If the prop is a slot filler with an image, move it - if (prop.type === 'slotFiller' && typeof prop.picture === 'string') { - update = { $set: {} }; - update.$set.slotFillImage = prop.picture; - update.$unset = { picture: 1 }; + if (prop.type === 'slotFiller') { + update = update || { $set: {} }; + // Change the type to folder, slotFiller is deprecated + update.$set.type = 'folder' + // If the slot filler has an image set, move it + if (typeof prop.picture === 'string') { + update.$set.slotFillImage = prop.picture; + update.$unset = { picture: 1 }; + } } // If there are tags, copy them to libraryTags and set findable flags if (Array.isArray(prop.tags) && prop.tags.length) { @@ -74,7 +81,6 @@ export function migratePropDown(bulk, prop) { } function countSubscribers() { - console.log('Migrating up libraries and collections to count subscribers'); const bulkLib = Libraries.rawCollection().initializeUnorderedBulkOp(); Libraries.find({}, { fields: { _id: 1 }