Removed slotFillers from every part of the app

This commit is contained in:
Stefan Zermatten
2023-06-14 20:11:00 +02:00
parent fad59f8674
commit 4b9802d6a0
16 changed files with 71 additions and 142 deletions

View File

@@ -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;

View File

@@ -18,7 +18,7 @@ var testProperties = [
// Children
clean({
_id: 'slotFillerId',
type: 'slotFiller',
type: 'folder',
slotQuantityFilled: 3,
slotFillerType: 'item',
ancestors: [{ id: 'charId' }, { id: 'slotId' }],

View File

@@ -39,10 +39,6 @@ let FolderSchema = createPropertySchema({
});
const ComputedOnlyFolderSchema = createPropertySchema({
summary: {
type: 'computedOnlyInlineCalculationField',
optional: true,
},
description: {
type: 'computedOnlyInlineCalculationField',
optional: true,

View File

@@ -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 };

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;

View File

@@ -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,

View File

@@ -1,54 +1,59 @@
<template lang="html">
<div class="folder-form">
<div class="layout wrap">
<form-sections type="folder">
<form-section name="Grouping">
<smart-switch
label="Group children on a card"
:value="model.groupStats"
:error-messages="errors.groupStats"
@change="change('groupStats', ...arguments)"
/>
<v-expand-transition>
<div v-if="model.groupStats">
<smart-switch
label="Hide children from their default locations"
:value="model.hideStatsGroup"
:error-messages="errors.hideStatsGroup"
@change="change('hideStatsGroup', ...arguments)"
/>
<smart-select
clearable
label="Tab"
:items="[
{ text: 'Stats Tab', value: 'stats' },
{ text: 'Features Tab', value: 'features' },
{ text: 'Actions Tab', value: 'actions' },
{ text: 'Spells Tab', value: 'spells' },
{ text: 'Inventory Tab', value: 'inventory' },
{ text: 'Journal Tab', value: 'journal' },
{ text: 'Build Tab', value: 'build' },
]"
:value="model.tab"
:error-messages="errors.tab"
:menu-props="{auto: true, lazy: true}"
@change="changeTab('tab', ...arguments)"
/>
<smart-select
clearable
label="Location"
:items="locationItems"
:value="model.location"
:error-messages="errors.location"
:menu-props="{auto: true, lazy: true}"
@change="change('location', ...arguments)"
/>
</div>
</v-expand-transition>
</form-section>
<slot />
</form-sections>
</div>
<inline-computation-field
label="Description"
:model="model.description"
:error-messages="errors['description.text']"
@change="({path, value, ack}) =>
$emit('change', {path: ['description', ...path], value, ack})"
/>
<form-sections type="folder">
<form-section name="Grouping">
<smart-switch
label="Group children on a card"
:value="model.groupStats"
:error-messages="errors.groupStats"
@change="change('groupStats', ...arguments)"
/>
<v-expand-transition>
<div v-if="model.groupStats">
<smart-switch
label="Hide children from their default locations"
:value="model.hideStatsGroup"
:error-messages="errors.hideStatsGroup"
@change="change('hideStatsGroup', ...arguments)"
/>
<smart-select
clearable
label="Tab"
:items="[
{ text: 'Stats Tab', value: 'stats' },
{ text: 'Features Tab', value: 'features' },
{ text: 'Actions Tab', value: 'actions' },
{ text: 'Spells Tab', value: 'spells' },
{ text: 'Inventory Tab', value: 'inventory' },
{ text: 'Journal Tab', value: 'journal' },
{ text: 'Build Tab', value: 'build' },
]"
:value="model.tab"
:error-messages="errors.tab"
:menu-props="{auto: true, lazy: true}"
@change="changeTab('tab', ...arguments)"
/>
<smart-select
clearable
label="Location"
:items="locationItems"
:value="model.location"
:error-messages="errors.location"
:menu-props="{auto: true, lazy: true}"
@change="change('location', ...arguments)"
/>
</div>
</v-expand-transition>
</form-section>
<slot />
</form-sections>
</div>
</template>

View File

@@ -1,24 +0,0 @@
<template lang="html">
<div class="slot-filler-form">
<text-area
label="Description"
:value="model.description"
:error-messages="errors['description.text']"
@change="change('description', ...arguments)"
/>
<form-sections
v-if="$slots.default"
type="slotFiller"
>
<slot />
</form-sections>
</div>
</template>
<script lang="js">
import propertyFormMixin from '/imports/client/ui/properties/forms/shared/propertyFormMixin.js';
export default {
mixins: [propertyFormMixin],
};
</script>

View File

@@ -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,

View File

@@ -2,14 +2,15 @@
<div class="folder-viewer">
<v-row
dense
align="stretch"
justify="center"
justify-sm="start"
>
<property-field
name="Name"
:value="model.name"
/>
<property-description
name="Description"
:model="model.description"
/>
</v-row>
</div>
</template>

View File

@@ -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,

View File

@@ -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',

View File

@@ -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 }