help_outline {{ $t("are_you_sure") }}
-
@@ -218,36 +130,26 @@
diff --git a/helpers/fb.js b/helpers/fb.js
index 6fb20a65e..443470162 100644
--- a/helpers/fb.js
+++ b/helpers/fb.js
@@ -30,6 +30,7 @@ export class FirebaseInstance {
this.currentFeeds = []
this.currentSettings = []
this.currentHistory = []
+ this.currentGraphqlHistory = []
this.currentCollections = []
this.currentEnvironments = []
@@ -97,6 +98,19 @@ export class FirebaseInstance {
this.currentHistory = history
})
+ this.usersCollection
+ .doc(this.currentUser.uid)
+ .collection("graphqlHistory")
+ .onSnapshot((historyRef) => {
+ const history = []
+ historyRef.forEach((doc) => {
+ const entry = doc.data()
+ entry.id = doc.id
+ history.push(entry)
+ })
+ this.currentGraphqlHistory = history
+ })
+
this.usersCollection
.doc(this.currentUser.uid)
.collection("collections")
@@ -215,6 +229,17 @@ export class FirebaseInstance {
}
}
+ async writeGraphqlHistory(entry) {
+ const hs = entry
+
+ try {
+ await this.usersCollection.doc(this.currentUser.uid).collection("graphqlHistory").add(hs)
+ } catch (e) {
+ console.error("error inserting", hs, e)
+ throw e
+ }
+ }
+
async deleteHistory(entry) {
try {
await this.usersCollection
@@ -228,6 +253,19 @@ export class FirebaseInstance {
}
}
+ async deleteGraphqlHistory(entry) {
+ try {
+ await this.usersCollection
+ .doc(this.currentUser.uid)
+ .collection("graphqlHistory")
+ .doc(entry.id)
+ .delete()
+ } catch (e) {
+ console.error("error deleting", entry, e)
+ throw e
+ }
+ }
+
async clearHistory() {
const { docs } = await this.usersCollection
.doc(this.currentUser.uid)
@@ -237,6 +275,15 @@ export class FirebaseInstance {
await Promise.all(docs.map((e) => this.deleteHistory(e)))
}
+ async clearGraphqlHistory() {
+ const { docs } = await this.usersCollection
+ .doc(this.currentUser.uid)
+ .collection("graphqlHistory")
+ .get()
+
+ await Promise.all(docs.map((e) => this.deleteGraphqlHistory(e)))
+ }
+
async toggleStar(entry, value) {
try {
await this.usersCollection
@@ -251,6 +298,20 @@ export class FirebaseInstance {
}
}
+ async toggleGraphqlHistoryStar(entry, value) {
+ try {
+ await this.usersCollection
+ .doc(this.currentUser.uid)
+ .collection("graphqlHistory")
+ .doc(entry.id)
+ .update({ star: value })
+ } catch (e) {
+ console.error("error deleting", entry, e)
+
+ throw e
+ }
+ }
+
async writeCollections(collection) {
const cl = {
updatedOn: new Date(),
diff --git a/package-lock.json b/package-lock.json
index d768f6934..537b916db 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10947,6 +10947,12 @@
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
},
+ "nan": {
+ "version": "2.14.2",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
+ "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
+ "optional": true
+ },
"nanoid": {
"version": "3.1.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
@@ -16734,7 +16740,8 @@
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true,
"requires": {
- "bindings": "^1.5.0"
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1"
}
},
"glob-parent": {
diff --git a/pages/graphql.vue b/pages/graphql.vue
index 5720a4455..8f83da682 100644
--- a/pages/graphql.vue
+++ b/pages/graphql.vue
@@ -318,79 +318,102 @@