Compare commits
6 Commits
2.0-beta.3
...
2.0-beta.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e51df363b | ||
|
|
608ab4e588 | ||
|
|
518880fa5c | ||
|
|
f043c41e12 | ||
|
|
0277de76c4 | ||
|
|
ffc3211ff9 |
@@ -93,7 +93,15 @@ function insertPropertyFromNode(nodeId, ancestors, order){
|
|||||||
_id: nodeId,
|
_id: nodeId,
|
||||||
removed: {$ne: true},
|
removed: {$ne: true},
|
||||||
});
|
});
|
||||||
if (!node) throw `Node not found for nodeId: ${nodeId}`;
|
if (!node) {
|
||||||
|
if (Meteor.isClient) return;
|
||||||
|
else {
|
||||||
|
throw new Meteor.Error(
|
||||||
|
'Insert property from library failed',
|
||||||
|
`No library document with id '${nodeId}' was found`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
let oldParent = node.parent;
|
let oldParent = node.parent;
|
||||||
let nodes = LibraryNodes.find({
|
let nodes = LibraryNodes.find({
|
||||||
'ancestors.id': nodeId,
|
'ancestors.id': nodeId,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
|||||||
import '/imports/api/library/methods/index.js';
|
import '/imports/api/library/methods/index.js';
|
||||||
import { updateReferenceNodeWork } from '/imports/api/library/methods/updateReferenceNode.js';
|
import { updateReferenceNodeWork } from '/imports/api/library/methods/updateReferenceNode.js';
|
||||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||||
|
import { restore } from '/imports/api/parenting/softRemove.js';
|
||||||
|
|
||||||
let LibraryNodes = new Mongo.Collection('libraryNodes');
|
let LibraryNodes = new Mongo.Collection('libraryNodes');
|
||||||
|
|
||||||
@@ -186,6 +187,25 @@ const softRemoveLibraryNode = new ValidatedMethod({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const restoreLibraryNode = new ValidatedMethod({
|
||||||
|
name: 'libraryNodes.restore',
|
||||||
|
validate: new SimpleSchema({
|
||||||
|
_id: SimpleSchema.RegEx.Id
|
||||||
|
}).validator(),
|
||||||
|
mixins: [RateLimiterMixin],
|
||||||
|
rateLimit: {
|
||||||
|
numRequests: 5,
|
||||||
|
timeInterval: 5000,
|
||||||
|
},
|
||||||
|
run({_id}){
|
||||||
|
// Permissions
|
||||||
|
let node = LibraryNodes.findOne(_id);
|
||||||
|
assertNodeEditPermission(node, this.userId);
|
||||||
|
// Do work
|
||||||
|
restore({_id, collection: LibraryNodes});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default LibraryNodes;
|
export default LibraryNodes;
|
||||||
export {
|
export {
|
||||||
LibraryNodeSchema,
|
LibraryNodeSchema,
|
||||||
@@ -194,4 +214,5 @@ export {
|
|||||||
pullFromLibraryNode,
|
pullFromLibraryNode,
|
||||||
pushToLibraryNode,
|
pushToLibraryNode,
|
||||||
softRemoveLibraryNode,
|
softRemoveLibraryNode,
|
||||||
|
restoreLibraryNode,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ Meteor.startup(() => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes all soft removed documents that were removed more than 30 minutes ago
|
* Deletes all soft removed documents that were removed more than 1 day ago
|
||||||
* and were not restored
|
* and were not restored
|
||||||
* @return {Number} Number of documents removed
|
* @return {Number} Number of documents removed
|
||||||
*/
|
*/
|
||||||
const deleteOldSoftRemovedDocs = function(){
|
const deleteOldSoftRemovedDocs = function(){
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const thirtyMinutesAgo = new Date(now.getTime() - 30*60000);
|
const yesterday = new Date(now.getTime() - (24 * 60 * 60 * 1000));
|
||||||
collections.forEach(collection => {
|
collections.forEach(collection => {
|
||||||
collection.remove({
|
collection.remove({
|
||||||
removed: true,
|
removed: true,
|
||||||
removedAt: {$lt: thirtyMinutesAgo} // dates *before* 30 minutes ago
|
removedAt: {$lt: yesterday} // dates *before* yesterday
|
||||||
}, function(error){
|
}, function(error){
|
||||||
if (error){
|
if (error){
|
||||||
console.error(JSON.stringify(error, null, 2));
|
console.error(JSON.stringify(error, null, 2));
|
||||||
|
|||||||
@@ -69,6 +69,28 @@ Meteor.publish('libraryNodes', function(libraryId){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Meteor.publish('softRemovedLibraryNodes', function(libraryId){
|
||||||
|
if (!libraryId) return [];
|
||||||
|
libraryIdSchema.validate({libraryId});
|
||||||
|
this.autorun(function (){
|
||||||
|
let userId = this.userId;
|
||||||
|
let library = Libraries.findOne(libraryId);
|
||||||
|
try { assertViewPermission(library, userId) }
|
||||||
|
catch(e){
|
||||||
|
return this.error(e);
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
LibraryNodes.find({
|
||||||
|
'ancestors.0.id': libraryId,
|
||||||
|
removed: true,
|
||||||
|
removedWith: {$exists: false},
|
||||||
|
}, {
|
||||||
|
sort: {order: 1},
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Meteor.publish('descendantLibraryNodes', function(nodeId){
|
Meteor.publish('descendantLibraryNodes', function(nodeId){
|
||||||
let node = LibraryNodes.findOne(nodeId);
|
let node = LibraryNodes.findOne(nodeId);
|
||||||
let libraryId = node?.ancestors[0]?.id;
|
let libraryId = node?.ancestors[0]?.id;
|
||||||
|
|||||||
@@ -1,6 +1,42 @@
|
|||||||
import { check } from 'meteor/check';
|
import { check } from 'meteor/check';
|
||||||
import Libraries from '/imports/api/library/Libraries.js';
|
import Libraries from '/imports/api/library/Libraries.js';
|
||||||
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
||||||
|
import { assertViewPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||||
|
|
||||||
|
Meteor.publish('selectedLibraryNodes', function(selectedNodeIds){
|
||||||
|
console.log('attempting selectedLibraryNodes')
|
||||||
|
check(selectedNodeIds, Array);
|
||||||
|
// Limit to 20 selected nodes
|
||||||
|
if (selectedNodeIds.length > 20){
|
||||||
|
selectedNodeIds = selectedNodeIds.slice(0, 20);
|
||||||
|
}
|
||||||
|
let libraryViewPermissions = {};
|
||||||
|
// Check view permissions of all libraries
|
||||||
|
for (let id of selectedNodeIds){
|
||||||
|
let node = LibraryNodes.findOne(id);
|
||||||
|
if (!node) continue;
|
||||||
|
let libraryId = node.ancestors[0].id;
|
||||||
|
if (libraryViewPermissions[id]){
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
let library = Libraries.findOne(libraryId, {fields: {
|
||||||
|
owner: 1,
|
||||||
|
readers: 1,
|
||||||
|
writers: 1,
|
||||||
|
public: 1,
|
||||||
|
}});
|
||||||
|
assertViewPermission(library, this.userId);
|
||||||
|
libraryViewPermissions[id] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Return all nodes and their children
|
||||||
|
return [LibraryNodes.find({
|
||||||
|
$or: [
|
||||||
|
{_id: {$in: selectedNodeIds}},
|
||||||
|
{'ancestors.id': {$in: selectedNodeIds}},
|
||||||
|
],
|
||||||
|
})];
|
||||||
|
});
|
||||||
|
|
||||||
Meteor.publish('searchLibraryNodes', function(){
|
Meteor.publish('searchLibraryNodes', function(){
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
|||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import getSlotFillFilter from '/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js'
|
import getSlotFillFilter from '/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js'
|
||||||
|
|
||||||
Meteor.publish('slotFillers', function(slotId){
|
Meteor.publish('slotFillers', function(slotId, searchTerm){
|
||||||
|
if (searchTerm) check(searchTerm, String);
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
this.autorun(function (){
|
this.autorun(function (){
|
||||||
let userId = this.userId;
|
let userId = this.userId;
|
||||||
@@ -42,21 +44,17 @@ Meteor.publish('slotFillers', function(slotId){
|
|||||||
var limit = self.data('limit') || 50;
|
var limit = self.data('limit') || 50;
|
||||||
check(limit, Number);
|
check(limit, Number);
|
||||||
|
|
||||||
// Get the search term
|
|
||||||
let searchTerm = self.data('searchTerm') || '';
|
|
||||||
check(searchTerm, String);
|
|
||||||
|
|
||||||
let options = undefined;
|
let options = undefined;
|
||||||
if (searchTerm){
|
if (searchTerm){
|
||||||
filter.$text = {$search: searchTerm};
|
filter.$text = {$search: searchTerm};
|
||||||
options = {
|
options = {
|
||||||
// relevant documents have a higher score.
|
// relevant documents have a higher score.
|
||||||
fields: {
|
fields: {
|
||||||
score: { $meta: 'textScore' }
|
_score: { $meta: 'textScore' }
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
// `score` property specified in the projection fields above.
|
// `score` property specified in the projection fields above.
|
||||||
score: { $meta: 'textScore' },
|
_score: { $meta: 'textScore' },
|
||||||
name: 1,
|
name: 1,
|
||||||
order: 1,
|
order: 1,
|
||||||
}
|
}
|
||||||
@@ -74,6 +72,7 @@ Meteor.publish('slotFillers', function(slotId){
|
|||||||
self.setData('countAll', LibraryNodes.find(filter).count());
|
self.setData('countAll', LibraryNodes.find(filter).count());
|
||||||
});
|
});
|
||||||
self.autorun(function () {
|
self.autorun(function () {
|
||||||
|
Meteor._sleepForMs(1000);
|
||||||
return [LibraryNodes.find(filter, options), libraries];
|
return [LibraryNodes.find(filter, options), libraries];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -79,17 +79,18 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
editValue: 0,
|
editValue: this.value,
|
||||||
operation: 'set',
|
operation: 'set',
|
||||||
hover: false,
|
hover: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
open(newValue){
|
open: {
|
||||||
if (newValue){
|
immediate: true,
|
||||||
this.resetData();
|
handler(isOpen) {
|
||||||
}
|
if (isOpen) this.resetData();
|
||||||
}
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resetData(){
|
resetData(){
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
import { getHighestOrder } from '/imports/api/parenting/order.js';
|
import { getHighestOrder } from '/imports/api/parenting/order.js';
|
||||||
import insertProperty from '/imports/api/creature/creatureProperties/methods/insertProperty.js';
|
import insertProperty from '/imports/api/creature/creatureProperties/methods/insertProperty.js';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
|
import Creatures from '/imports/api/creature/creatures/Creatures.js';
|
||||||
import PROPERTIES from '/imports/constants/PROPERTIES.js';
|
import PROPERTIES from '/imports/constants/PROPERTIES.js';
|
||||||
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
||||||
import fetchDocByRef from '/imports/api/parenting/fetchDocByRef.js';
|
import fetchDocByRef from '/imports/api/parenting/fetchDocByRef.js';
|
||||||
@@ -119,7 +120,11 @@
|
|||||||
return this.$route.params.id;
|
return this.$route.params.id;
|
||||||
},
|
},
|
||||||
tabNumber(){
|
tabNumber(){
|
||||||
return this.$store.getters.tabById(this.creatureId);
|
let tabNumber = this.$store.getters.tabById(this.creatureId);
|
||||||
|
if (this.hideSpellsTab && tabNumber > 2){
|
||||||
|
tabNumber += 1;
|
||||||
|
}
|
||||||
|
return tabNumber;
|
||||||
},
|
},
|
||||||
speedDials(){
|
speedDials(){
|
||||||
return this.speedDialsByTab[tabs[this.tabNumber]];
|
return this.speedDialsByTab[tabs[this.tabNumber]];
|
||||||
@@ -136,6 +141,12 @@
|
|||||||
return PROPERTIES;
|
return PROPERTIES;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
meteor: {
|
||||||
|
hideSpellsTab(){
|
||||||
|
let creature = Creatures.findOne(this.creatureId);
|
||||||
|
return creature?.settings?.hideSpellsTab;
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPropertyLabel(type){
|
getPropertyLabel(type){
|
||||||
if (type === 'buff') return 'Buff or Condition';
|
if (type === 'buff') return 'Buff or Condition';
|
||||||
|
|||||||
@@ -298,6 +298,9 @@
|
|||||||
meteor: {
|
meteor: {
|
||||||
'$subscribe':{
|
'$subscribe':{
|
||||||
'searchLibraryNodes': [],
|
'searchLibraryNodes': [],
|
||||||
|
'selectedLibraryNodes'(){
|
||||||
|
return [this.selectedNodeIds];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
showPropertyHelp(){
|
showPropertyHelp(){
|
||||||
let user = Meteor.user();
|
let user = Meteor.user();
|
||||||
|
|||||||
@@ -8,14 +8,17 @@
|
|||||||
{{ model.name }}
|
{{ model.name }}
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<text-field
|
<v-text-field
|
||||||
|
v-model="searchInput"
|
||||||
prepend-inner-icon="mdi-magnify"
|
prepend-inner-icon="mdi-magnify"
|
||||||
regular
|
regular
|
||||||
|
clearable
|
||||||
hide-details
|
hide-details
|
||||||
:value="searchValue"
|
class="flex-grow-0"
|
||||||
:debounce="300"
|
style="flex-basis: 300px;"
|
||||||
@change="searchChanged"
|
:loading="searchLoading"
|
||||||
@keyup.enter="insert"
|
@change="searchValue = searchInput || undefined"
|
||||||
|
@click:clear="searchValue = undefined"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<property-description
|
<property-description
|
||||||
@@ -88,7 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
<div
|
<div
|
||||||
v-if="libraryNode.slotQuantityFilled && libraryNode.slotQuantityFilled !== 1"
|
v-if="libraryNode.slotQuantityFilled !== undefined && libraryNode.slotQuantityFilled !== 1"
|
||||||
class="text-overline flex-grow-0 text-no-wrap"
|
class="text-overline flex-grow-0 text-no-wrap"
|
||||||
:class="{
|
:class="{
|
||||||
'error--text': isDisabled(libraryNode) &&
|
'error--text': isDisabled(libraryNode) &&
|
||||||
@@ -115,7 +118,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
<v-layout
|
<v-layout
|
||||||
v-if="!$subReady.slotFillers || currentLimit < countAll"
|
v-if="(!$subReady.slotFillers && !searchValue) || currentLimit < countAll"
|
||||||
column
|
column
|
||||||
align-center
|
align-center
|
||||||
justify-center
|
justify-center
|
||||||
@@ -216,6 +219,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data(){return {
|
data(){return {
|
||||||
selectedNodeIds: [],
|
selectedNodeIds: [],
|
||||||
|
searchInput: undefined,
|
||||||
searchValue: undefined,
|
searchValue: undefined,
|
||||||
showDisabled: false,
|
showDisabled: false,
|
||||||
disabledNodeCount: undefined,
|
disabledNodeCount: undefined,
|
||||||
@@ -250,21 +254,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
searchChanged(val, ack){
|
|
||||||
this._subs['slotFillers'].setData('searchTerm', val);
|
|
||||||
this._subs['slotFillers'].setData('limit', undefined);
|
|
||||||
this.selectedNode = undefined;
|
|
||||||
this.searchValue = val;
|
|
||||||
setTimeout(ack, 200);
|
|
||||||
},
|
|
||||||
loadMore(){
|
loadMore(){
|
||||||
if (this.currentLimit >= this.countAll) return;
|
if (this.currentLimit >= this.countAll) return;
|
||||||
this._subs['slotFillers'].setData('limit', this.currentLimit + 50);
|
this._subs['slotFillers'].setData('limit', this.currentLimit + 50);
|
||||||
},
|
},
|
||||||
insert(){
|
|
||||||
if (!this.selectedNode) return;
|
|
||||||
this.$store.dispatch('popDialogStack', this.selectedNode);
|
|
||||||
},
|
|
||||||
openPropertyDetails(id){
|
openPropertyDetails(id){
|
||||||
this.$store.commit('pushDialogStack', {
|
this.$store.commit('pushDialogStack', {
|
||||||
component: 'library-node-dialog',
|
component: 'library-node-dialog',
|
||||||
@@ -281,14 +274,17 @@ export default {
|
|||||||
node._disabledByQuantityFilled &&
|
node._disabledByQuantityFilled &&
|
||||||
!this.selectedNodeIds.includes(node._id)
|
!this.selectedNodeIds.includes(node._id)
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
$subscribe: {
|
$subscribe: {
|
||||||
'slotFillers'(){
|
'slotFillers'(){
|
||||||
return [this.slotId]
|
return [this.slotId, this.searchValue || undefined]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
searchLoading(){
|
||||||
|
return !!this.searchValue && !this.$subReady.slotFillers;
|
||||||
|
},
|
||||||
model(){
|
model(){
|
||||||
if (this.slotId){
|
if (this.slotId){
|
||||||
return CreatureProperties.findOne(this.slotId);
|
return CreatureProperties.findOne(this.slotId);
|
||||||
@@ -359,8 +355,6 @@ export default {
|
|||||||
sort: {name: 1, order: 1}
|
sort: {name: 1, order: 1}
|
||||||
}).fetch();
|
}).fetch();
|
||||||
let disabledNodeCount = 0;
|
let disabledNodeCount = 0;
|
||||||
let activeNodeCount = 0;
|
|
||||||
let lastActiveNodeId = undefined;
|
|
||||||
// Mark slotFillers whose condition isn't met or are too big to fit
|
// Mark slotFillers whose condition isn't met or are too big to fit
|
||||||
// the quantity to fill
|
// the quantity to fill
|
||||||
nodes.forEach(node => {
|
nodes.forEach(node => {
|
||||||
@@ -384,23 +378,8 @@ export default {
|
|||||||
if (this.alreadyAdded.has(node._id)){
|
if (this.alreadyAdded.has(node._id)){
|
||||||
node._disabledByAlreadyAdded = true;
|
node._disabledByAlreadyAdded = true;
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
!node._disabledBySlotFillerCondition &&
|
|
||||||
!node._disabledByQuantityFilled &&
|
|
||||||
!node._disabledByAlreadyAdded
|
|
||||||
){
|
|
||||||
activeNodeCount += 1;
|
|
||||||
lastActiveNodeId = node._id;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.disabledNodeCount = disabledNodeCount;
|
this.disabledNodeCount = disabledNodeCount;
|
||||||
if (
|
|
||||||
activeNodeCount === 1 &&
|
|
||||||
this.$subReady.slotFillers &&
|
|
||||||
this.currentLimit >= this.countAll
|
|
||||||
) {
|
|
||||||
this.selectedNodeIds = [lastActiveNodeId]
|
|
||||||
}
|
|
||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,35 @@
|
|||||||
@change="updateName"
|
@change="updateName"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="removedDocs.length">
|
||||||
|
<h3>Recently Deleted Properties</h3>
|
||||||
|
<v-list>
|
||||||
|
<v-list-item
|
||||||
|
v-for="model in removedDocs"
|
||||||
|
:key="model._id"
|
||||||
|
>
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-list-item-title>
|
||||||
|
<tree-node-view :model="model" />
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
<v-list-item-action>
|
||||||
|
<v-btn
|
||||||
|
color="accent"
|
||||||
|
text
|
||||||
|
@click="restore(model._id)"
|
||||||
|
>
|
||||||
|
Restore
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</template>
|
||||||
|
<v-progress-circular
|
||||||
|
v-if="!$subReady.softRemovedLibraryNodes"
|
||||||
|
indeterminate
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -43,10 +72,13 @@
|
|||||||
<script lang="js">
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import Libraries, { updateLibraryName, removeLibrary } from '/imports/api/library/Libraries.js';
|
import Libraries, { updateLibraryName, removeLibrary } from '/imports/api/library/Libraries.js';
|
||||||
|
import LibraryNodes, { restoreLibraryNode } from '/imports/api/library/LibraryNodes.js';
|
||||||
|
import TreeNodeView from '/imports/ui/properties/treeNodeViews/TreeNodeView.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
DialogBase,
|
DialogBase,
|
||||||
|
TreeNodeView,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
_id: String,
|
_id: String,
|
||||||
@@ -90,11 +122,28 @@ export default {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
restore(_id){
|
||||||
|
restoreLibraryNode.call({_id});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
|
'$subscribe':{
|
||||||
|
softRemovedLibraryNodes(){
|
||||||
|
return [this._id];
|
||||||
|
},
|
||||||
|
},
|
||||||
model(){
|
model(){
|
||||||
return Libraries.findOne(this._id);
|
return Libraries.findOne(this._id);
|
||||||
},
|
},
|
||||||
|
removedDocs(){
|
||||||
|
return LibraryNodes.find({
|
||||||
|
'ancestors.0.id': this._id,
|
||||||
|
removed: true,
|
||||||
|
removedWith: {$exists: false},
|
||||||
|
}, {
|
||||||
|
sort: {order: 1},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
pushToLibraryNode,
|
pushToLibraryNode,
|
||||||
pullFromLibraryNode,
|
pullFromLibraryNode,
|
||||||
softRemoveLibraryNode,
|
softRemoveLibraryNode,
|
||||||
|
restoreLibraryNode,
|
||||||
} from '/imports/api/library/LibraryNodes.js';
|
} from '/imports/api/library/LibraryNodes.js';
|
||||||
import duplicateLibraryNode from '/imports/api/library/methods/duplicateLibraryNode.js';
|
import duplicateLibraryNode from '/imports/api/library/methods/duplicateLibraryNode.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
@@ -86,6 +87,8 @@
|
|||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import { assertDocEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
import { assertDocEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||||
import { organizeDoc } from '/imports/api/parenting/organizeMethods.js';
|
import { organizeDoc } from '/imports/api/parenting/organizeMethods.js';
|
||||||
|
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
import getPropertyTitle from '/imports/ui/properties/shared/getPropertyTitle.js';
|
||||||
|
|
||||||
let formIndex = {};
|
let formIndex = {};
|
||||||
for (let key in propertyFormIndex){
|
for (let key in propertyFormIndex){
|
||||||
@@ -212,12 +215,20 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove(){
|
remove(){
|
||||||
softRemoveLibraryNode.call({_id: this.currentId});
|
let _id = this.currentId;
|
||||||
|
softRemoveLibraryNode.call({_id});
|
||||||
if (this.embedded){
|
if (this.embedded){
|
||||||
this.$emit('removed');
|
this.$emit('removed');
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('popDialogStack');
|
this.$store.dispatch('popDialogStack');
|
||||||
}
|
}
|
||||||
|
snackbar({
|
||||||
|
text: `Deleted ${getPropertyTitle(this.model)}`,
|
||||||
|
callbackName: 'undo',
|
||||||
|
callback(){
|
||||||
|
restoreLibraryNode.call({_id});
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,19 +4,32 @@
|
|||||||
column
|
column
|
||||||
align-center
|
align-center
|
||||||
>
|
>
|
||||||
<div
|
<v-layout v-if="model.value !== undefined">
|
||||||
v-if="model.value !== undefined"
|
|
||||||
class="text-h4"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
v-if="model.damage !== undefined"
|
class="text-h4 mr-3"
|
||||||
>
|
>
|
||||||
{{ model.value - model.damage }} / {{ model.value }}
|
<div
|
||||||
|
v-if="model.damage !== undefined"
|
||||||
|
>
|
||||||
|
{{ model.value - model.damage }} / {{ model.value }}
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
{{ model.value }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
|
||||||
{{ model.value }}
|
<increment-button
|
||||||
</div>
|
v-if="context.creatureId"
|
||||||
</div>
|
icon
|
||||||
|
large
|
||||||
|
outlined
|
||||||
|
color="primary"
|
||||||
|
:value="model.value - (model.damage || 0)"
|
||||||
|
@change="damageProperty"
|
||||||
|
>
|
||||||
|
<v-icon>$vuetify.icons.abacus</v-icon>
|
||||||
|
</increment-button>
|
||||||
|
</v-layout>
|
||||||
<div
|
<div
|
||||||
v-if="model.modifier !== undefined"
|
v-if="model.modifier !== undefined"
|
||||||
class="text-h6"
|
class="text-h6"
|
||||||
@@ -68,15 +81,18 @@
|
|||||||
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
||||||
import AttributeEffect from '/imports/ui/properties/components/attributes/AttributeEffect.vue';
|
import AttributeEffect from '/imports/ui/properties/components/attributes/AttributeEffect.vue';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
|
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
||||||
|
import IncrementButton from '/imports/ui/components/IncrementButton.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
AttributeEffect,
|
||||||
|
IncrementButton,
|
||||||
|
},
|
||||||
|
mixins: [propertyViewerMixin],
|
||||||
inject: {
|
inject: {
|
||||||
context: { default: {} }
|
context: { default: {} }
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
AttributeEffect,
|
|
||||||
},
|
|
||||||
mixins: [propertyViewerMixin],
|
|
||||||
computed: {
|
computed: {
|
||||||
reset(){
|
reset(){
|
||||||
let reset = this.model.reset
|
let reset = this.model.reset
|
||||||
@@ -96,6 +112,13 @@
|
|||||||
elementId: `${id}`,
|
elementId: `${id}`,
|
||||||
data: {_id: id},
|
data: {_id: id},
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
damageProperty({type, value}) {
|
||||||
|
damageProperty.call({
|
||||||
|
_id: this.model._id,
|
||||||
|
operation: type,
|
||||||
|
value: value
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
v-if="model.quantity > 1 || model.showIncrement"
|
v-if="model.quantity > 1 || model.showIncrement"
|
||||||
class="layout justify-center align-center wrap"
|
class="layout justify-center align-center wrap"
|
||||||
>
|
>
|
||||||
<div class="text-h4">
|
<div class="text-h4 mr-3">
|
||||||
{{ model.quantity }}
|
{{ model.quantity }}
|
||||||
</div>
|
</div>
|
||||||
<increment-button
|
<increment-button
|
||||||
|
|||||||
2
app/package-lock.json
generated
2
app/package-lock.json
generated
@@ -2735,7 +2735,7 @@
|
|||||||
},
|
},
|
||||||
"signal-exit": {
|
"signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "",
|
"resolved": false,
|
||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
||||||
},
|
},
|
||||||
"simpl-schema": {
|
"simpl-schema": {
|
||||||
|
|||||||
Reference in New Issue
Block a user