diff --git a/app/imports/api/creature/archive/methods/archiveCreatures.js b/app/imports/api/creature/archive/methods/archiveCreatures.js
index bc401d61..304cce11 100644
--- a/app/imports/api/creature/archive/methods/archiveCreatures.js
+++ b/app/imports/api/creature/archive/methods/archiveCreatures.js
@@ -12,9 +12,9 @@ import ArchivedCreatures from '/imports/api/creature/archive/ArchivedCreatures.j
function archiveCreature(creatureId){
// Build the archive document
const creature = Creatures.findOne(creatureId);
- const properties = CreatureProperties.find({'ancestors.id': creatureId});
- const experiences = Experiences.find({creatureId});
- const logs = CreatureLogs.find({creatureId});
+ const properties = CreatureProperties.find({'ancestors.id': creatureId}).fetch();
+ const experiences = Experiences.find({creatureId}).fetch();
+ const logs = CreatureLogs.find({creatureId}).fetch();
let archiveCreature = {
owner: creature.owner,
archiveDate: new Date(),
@@ -51,11 +51,11 @@ const archiveCreatures = new ValidatedMethod({
timeInterval: 5000,
},
run({creatureIds}) {
- for (let id in creatureIds){
+ for (let id of creatureIds){
assertOwnership(id, this.userId)
}
let archivedIds = [];
- for (let id in creatureIds){
+ for (let id of creatureIds){
let archivedId = archiveCreature(id);
archivedIds.push(archivedId);
}
diff --git a/app/imports/api/creature/archive/methods/restoreCreatures.js b/app/imports/api/creature/archive/methods/restoreCreatures.js
index e27093d8..b4ec2c44 100644
--- a/app/imports/api/creature/archive/methods/restoreCreatures.js
+++ b/app/imports/api/creature/archive/methods/restoreCreatures.js
@@ -7,6 +7,7 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur
import CreatureLogs from '/imports/api/creature/log/CreatureLogs.js';
import Experiences from '/imports/api/creature/experience/Experiences.js';
import ArchivedCreatures from '/imports/api/creature/archive/ArchivedCreatures.js';
+import { removeCreatureWork } from '/imports/api/creature/creatures/methods/removeCreature.js';
function restoreCreature(archiveId){
// Get the archive
@@ -15,15 +16,28 @@ function restoreCreature(archiveId){
// Insert the creature sub documents
// They still have their original _id's
Creatures.insert(archivedCreature.creature);
- CreatureProperties.batchInsert(archivedCreature.properties);
- Experiences.batchInsert(archivedCreature.experiences);
- CreatureLogs.batchInsert(archivedCreature.logs);
+ try {
+ // Add all the properties
+ if (archivedCreature.properties && archivedCreature.properties.length){
+ CreatureProperties.batchInsert(archivedCreature.properties);
+ }
+ if (archivedCreature.experiences && archivedCreature.experiences.length){
+ Experiences.batchInsert(archivedCreature.experiences);
+ }
+ if (archivedCreature.logs && archivedCreature.logs.length){
+ CreatureLogs.batchInsert(archivedCreature.logs);
+ }
+ // Remove the archived creature
+ ArchivedCreatures.remove(archiveId);
+ } catch (e) {
+ // If the above fails, delete the inserted creature
+ removeCreatureWork(archivedCreature.creature._id);
+ throw e;
+ }
+
// Do not recompute. The creature was in a computed and ordered state when
// we archived it, just restore everything as-is
- // Remove the archived creature
- ArchivedCreatures.remove(archiveId);
-
return archivedCreature.creature._id;
}
@@ -45,14 +59,14 @@ const restoreCreatures = new ValidatedMethod({
timeInterval: 5000,
},
run({archiveIds}) {
- for (let id in archiveIds){
+ for (let id of archiveIds){
let archivedCreature = ArchivedCreatures.findOne(id, {
fields: {owner: 1}
});
assertOwnership(archivedCreature, this.userId)
}
let creatureIds = [];
- for (let id in archiveIds){
+ for (let id of archiveIds){
let creatureId = restoreCreature(id);
creatureIds.push(creatureId);
}
diff --git a/app/imports/server/publications/archivedCreatures.js b/app/imports/server/publications/archivedCreatures.js
index 155a887b..93043407 100644
--- a/app/imports/server/publications/archivedCreatures.js
+++ b/app/imports/server/publications/archivedCreatures.js
@@ -11,6 +11,7 @@ Meteor.publish('archivedCreatures', function(){
}, {
fields: {
creature: 1,
+ owner: 1,
}
}
);
diff --git a/app/imports/ui/creature/archive/ArchiveDialog.vue b/app/imports/ui/creature/archive/ArchiveDialog.vue
index a9c8e8c5..03b687f2 100644
--- a/app/imports/ui/creature/archive/ArchiveDialog.vue
+++ b/app/imports/ui/creature/archive/ArchiveDialog.vue
@@ -1,26 +1,213 @@
-
- TODO
-
+
+
+ {{ mode === 'archive' ? 'Archive' : 'Restore' }}
+
+
+
+
+ Archive
+
+ mdi-archive-arrow-down
+
+
+
+ Restore
+
+ mdi-archive-arrow-up-outline
+
+
+
+
+ selectedCreature = id"
+ />
+
+ {{ mode === 'archive' ? 'Archive' : 'Restore' }}
+
+ {{ numSelected }} characters
+
+
+ character
+
+
- Done
+ Close
diff --git a/app/imports/ui/creature/creatureList/ArchiveButton.vue b/app/imports/ui/creature/creatureList/ArchiveButton.vue
new file mode 100644
index 00000000..4aa46887
--- /dev/null
+++ b/app/imports/ui/creature/creatureList/ArchiveButton.vue
@@ -0,0 +1,38 @@
+
+
+
+ Archive Characters
+
+
+ mdi-archive
+
+
+
+
+
+
+
diff --git a/app/imports/ui/creature/creatureList/CharacterListToolbarItems.vue b/app/imports/ui/creature/creatureList/CharacterListToolbarItems.vue
index c7669f15..5c678946 100644
--- a/app/imports/ui/creature/creatureList/CharacterListToolbarItems.vue
+++ b/app/imports/ui/creature/creatureList/CharacterListToolbarItems.vue
@@ -7,23 +7,19 @@
{{ characterSlots }}
-
-
- mdi-archive
-
-
+
diff --git a/app/imports/ui/creature/creatureList/CreatureFolderHeader.vue b/app/imports/ui/creature/creatureList/CreatureFolderHeader.vue
new file mode 100644
index 00000000..e146ec2f
--- /dev/null
+++ b/app/imports/ui/creature/creatureList/CreatureFolderHeader.vue
@@ -0,0 +1,102 @@
+
+
+
+
+
+ {{ model.name }}
+
+ {}"
+ />
+
+
+
+
+
+ mdi-check
+
+
+ mdi-pencil
+
+
+
+
+
+ mdi-delete
+
+
+
+
+
+
+
+
diff --git a/app/imports/ui/creature/creatureList/CreatureFolderList.vue b/app/imports/ui/creature/creatureList/CreatureFolderList.vue
new file mode 100644
index 00000000..1735458d
--- /dev/null
+++ b/app/imports/ui/creature/creatureList/CreatureFolderList.vue
@@ -0,0 +1,64 @@
+
+
+ $emit('creature-selected', id)"
+ />
+
+
+
+
+ $emit('creature-selected', id)"
+ />
+
+
+
+
+
+
+
diff --git a/app/imports/ui/creature/creatureList/CreatureList.vue b/app/imports/ui/creature/creatureList/CreatureList.vue
index 8b98d8d0..a2f30a33 100644
--- a/app/imports/ui/creature/creatureList/CreatureList.vue
+++ b/app/imports/ui/creature/creatureList/CreatureList.vue
@@ -1,25 +1,26 @@
-
-
-
-
-
+
+
+
diff --git a/app/imports/ui/creature/creatureList/CreatureListTile.vue b/app/imports/ui/creature/creatureList/CreatureListTile.vue
index d98825d3..e858a2a8 100644
--- a/app/imports/ui/creature/creatureList/CreatureListTile.vue
+++ b/app/imports/ui/creature/creatureList/CreatureListTile.vue
@@ -2,16 +2,31 @@
lang="html"
functional
>
-
-
-
-
- {{ model.initial }}
-
+
+
+
+
+ mdi-check
+
+
+
+
+ {{ model.initial }}
+
+
+
@@ -25,12 +40,8 @@
-
@@ -53,10 +64,7 @@ export default {
required: true,
},
selection: Boolean,
- selected: {
- type: Set,
- default: () => new Set(),
- },
+ isSelected: Boolean,
}
}
diff --git a/app/imports/ui/pages/CharacterList.vue b/app/imports/ui/pages/CharacterList.vue
index 04bd7720..69d2484d 100644
--- a/app/imports/ui/pages/CharacterList.vue
+++ b/app/imports/ui/pages/CharacterList.vue
@@ -1,107 +1,74 @@
-
- You have exceeded your maximum number of character slots, archive or delete
- some characters.
-
-
-
-
-
-
-
-
-
- {{ folder.name }}
-
- renameFolder(folder._id, value, ack)"
- @click.native.stop="()=>{}"
+
+
+
+
+ You have exceeded your maximum number of character slots, archive or delete
+ some characters.
+
+
+ You have hit your maximum number of characters.
+
+
+
+
+
+
-
- mdi-pencil
-
-
- mdi-check
-
+ add folder
-
- mdi-delete
-
-
-
-
-
-
-
-
-
-
- add folder
-
-
-
- mdi-plus
-
+
+
+ mdi-plus
+
+
+
+