Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31c2580a9b | ||
|
|
e86a1269c9 | ||
|
|
a262d773c0 | ||
|
|
7ea972d476 |
@@ -60,6 +60,8 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
|
|||||||
nodeIds.forEach(nodeId => {
|
nodeIds.forEach(nodeId => {
|
||||||
// TODO: Check library view permission for each node before starting
|
// TODO: Check library view permission for each node before starting
|
||||||
node = insertPropertyFromNode(nodeId, ancestors, order);
|
node = insertPropertyFromNode(nodeId, ancestors, order);
|
||||||
|
// Increment order, slightly, to keep the nodes inserted in the given id order
|
||||||
|
order += 0.001;
|
||||||
});
|
});
|
||||||
|
|
||||||
// get one of the root inserted docs
|
// get one of the root inserted docs
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
timeout: {
|
timeout: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 6000000,
|
default: 15000,
|
||||||
},
|
},
|
||||||
pause: {
|
pause: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
v-if="libraryNode._disabledBySlotFillerCondition"
|
v-if="libraryNode._disabledBySlotFillerCondition"
|
||||||
class="error--text text-no-wrap text-truncate"
|
class="error--text text-no-wrap text-truncate"
|
||||||
>
|
>
|
||||||
{{ libraryNode.slotFillerCondition }}
|
{{ libraryNode._conditionError }}
|
||||||
</div>
|
</div>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
<div class="text-caption text-no-wrap text-truncate">
|
<div class="text-caption text-no-wrap text-truncate">
|
||||||
@@ -192,7 +192,7 @@ import getSlotFillFilter from '/imports/api/creature/creatureProperties/methods/
|
|||||||
import Libraries from '/imports/api/library/Libraries.js';
|
import Libraries from '/imports/api/library/Libraries.js';
|
||||||
import LibraryNodeExpansionContent from '/imports/client/ui/library/LibraryNodeExpansionContent.vue';
|
import LibraryNodeExpansionContent from '/imports/client/ui/library/LibraryNodeExpansionContent.vue';
|
||||||
import PropertyTags from '/imports/client/ui/properties/viewers/shared/PropertyTags.vue';
|
import PropertyTags from '/imports/client/ui/properties/viewers/shared/PropertyTags.vue';
|
||||||
import { clone, difference } from 'lodash';
|
import { clone, difference, isEqual } from 'lodash';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -250,25 +250,39 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedNodeIds(selectedIds, oldSelectedIds) {
|
selectedNodeIds(selectedIds, oldSelectedIds) {
|
||||||
// Skip if we didn't increase the length by adding a new Id
|
// Skip if we increased the length by adding a new Id, see if we need to backfill levels
|
||||||
if (oldSelectedIds.length >= selectedIds.length) return;
|
if (oldSelectedIds.length < selectedIds.length) {
|
||||||
// Find out which library node was added
|
// Find out which library node was added
|
||||||
const addedId = difference(selectedIds, oldSelectedIds)[0];
|
const addedId = difference(selectedIds, oldSelectedIds)[0];
|
||||||
if (!addedId) return;
|
if (!addedId) return;
|
||||||
const addedNode = LibraryNodes.findOne(addedId);
|
const addedNode = LibraryNodes.findOne(addedId);
|
||||||
if (!addedNode) return;
|
if (!addedNode) return;
|
||||||
// Tick any unchecked nodes of a lower level, but only one per level
|
// Tick any unchecked nodes of a lower level, but only one per level
|
||||||
const backFilledLevels = new Set();
|
const backFilledLevels = new Set();
|
||||||
this.libraryNodes.forEach(node => {
|
this.libraryNodes.forEach(node => {
|
||||||
if (
|
if (
|
||||||
!selectedIds.includes(node._id)
|
!selectedIds.includes(node._id)
|
||||||
&& node.level < addedNode.level
|
&& node.level < addedNode.level
|
||||||
&& !backFilledLevels.has(node.level)
|
&& !backFilledLevels.has(node.level)
|
||||||
) {
|
&& !this.isDisabled(node)
|
||||||
selectedIds.push(node._id);
|
) {
|
||||||
}
|
selectedIds.push(node._id);
|
||||||
});
|
backFilledLevels.add(node.level)
|
||||||
this.selectedNodeIds = selectedIds;
|
}
|
||||||
|
});
|
||||||
|
this.selectedNodeIds = sortedIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refetch the library nodes to sort them correctly
|
||||||
|
const sortedIds = LibraryNodes.find({
|
||||||
|
_id: { $in: selectedIds }
|
||||||
|
}, {
|
||||||
|
sort: { level: 1, name: 1, order: 1 }
|
||||||
|
}).map(node => node._id);
|
||||||
|
// Only update if the order changed
|
||||||
|
if (!isEqual(this.selectedNodeIds, sortedIds)) {
|
||||||
|
this.selectedNodeIds = sortedIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -377,7 +391,7 @@ export default {
|
|||||||
if (!this.libraryNodeFilter) return [];
|
if (!this.libraryNodeFilter) return [];
|
||||||
if (!this.$subReady.classFillers) return [];
|
if (!this.$subReady.classFillers) return [];
|
||||||
let nodes = LibraryNodes.find(this.libraryNodeFilter, {
|
let nodes = LibraryNodes.find(this.libraryNodeFilter, {
|
||||||
sort: { name: 1, order: 1 }
|
sort: { level: 1, name: 1, order: 1 }
|
||||||
}).fetch();
|
}).fetch();
|
||||||
let disabledNodeCount = 0;
|
let disabledNodeCount = 0;
|
||||||
// Mark classFillers whose condition isn't met or are too big to fit
|
// Mark classFillers whose condition isn't met or are too big to fit
|
||||||
@@ -390,18 +404,19 @@ export default {
|
|||||||
if (resultNode?.parseType === 'constant') {
|
if (resultNode?.parseType === 'constant') {
|
||||||
if (!resultNode.value) {
|
if (!resultNode.value) {
|
||||||
node._disabledBySlotFillerCondition = true;
|
node._disabledBySlotFillerCondition = true;
|
||||||
|
node._conditionError = node.slotFillerConditionNote || node.slotFillerCondition;
|
||||||
disabledNodeCount += 1;
|
disabledNodeCount += 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
node._disabledBySlotFillerCondition = true;
|
node._disabledBySlotFillerCondition = true;
|
||||||
node._conditionError = toString(resultNode);
|
node._conditionError = node.slotFillerConditionNote || toString(resultNode);
|
||||||
disabledNodeCount += 1;
|
disabledNodeCount += 1;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
let error = prettifyParseError(e);
|
let error = prettifyParseError(e);
|
||||||
node._disabledBySlotFillerCondition = true;
|
node._disabledBySlotFillerCondition = true;
|
||||||
node._conditionError = error;
|
node._conditionError = 'Condition error: ' + error;
|
||||||
disabledNodeCount += 1;
|
disabledNodeCount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dicecloud",
|
"name": "dicecloud",
|
||||||
"version": "2.0.54",
|
"version": "2.0.55",
|
||||||
"description": "Unofficial Online Realtime D&D 5e App",
|
"description": "Unofficial Online Realtime D&D 5e App",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user