@mongoosejs/studio
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -28,3 +28,4 @@ 'use strict'; | ||
shouldExport: {}, | ||
sortBy: {} | ||
sortBy: {}, | ||
query: {} | ||
}), | ||
@@ -39,2 +40,3 @@ created() { | ||
} | ||
this.query = Object.assign({}, this.$route.query); // important that this is here before the if statements | ||
if (this.$route.query?.search) { | ||
@@ -45,2 +47,8 @@ this.searchText = this.$route.query.search; | ||
} | ||
if (this.$route.query?.sort) { | ||
const sort = eval(`(${this.$route.query.sort})`); | ||
const path = Object.keys(sort)[0]; | ||
const num = Object.values(sort)[0]; | ||
this.sortDocs(num, path); | ||
} | ||
@@ -58,2 +66,4 @@ if (this.currentModel != null) { | ||
sorted = true; | ||
delete this.query.sort; | ||
this.$router.push({ query: this.query }); | ||
} | ||
@@ -65,2 +75,4 @@ for (const key in this.sortBy) { | ||
this.sortBy[path] = num; | ||
this.query.sort = `{${path}:${num}}` | ||
this.$router.push({ query: this.query }); | ||
} | ||
@@ -73,6 +85,8 @@ await this.getDocuments(); | ||
this.filter = EJSON.stringify(this.filter); | ||
this.$router.push({ path: this.$route.path, query: { search: this.searchText }}) | ||
this.query.search = this.searchText; | ||
this.$router.push({ path: this.$route.path, query: this.query }) | ||
} else { | ||
this.filter = {}; | ||
this.$router.push({ path: this.$route.path }); | ||
delete this.query.search; | ||
this.$router.push({ path: this.$route.path, query: this.query }); | ||
} | ||
@@ -79,0 +93,0 @@ await this.getDocuments(); |
{ | ||
"name": "@mongoosejs/studio", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "archetype": "0.13.0", |
87816
1448
3