From 512b67d65f45763fb28cff51c7f33535be5ce7f0 Mon Sep 17 00:00:00 2001 From: Stanislav Popov Date: Thu, 24 Dec 2020 17:22:59 +0500 Subject: [PATCH] fix(view): remove default json url from GET params --- nuxt.config.js | 2 +- pages/index.vue | 23 +++++++++++++++++++---- store/index.js | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index 22043bf..c621227 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -26,7 +26,7 @@ module.exports = { }, env: { - itemsJsonUrl: process.env.JSON_URL || 'http://localhost:3001/data.json', + itemsJsonUrl: process.env.JSON_URL, SERVER_URL: process.env.SERVER_URL }, diff --git a/pages/index.vue b/pages/index.vue index 590ad36..66e3ab1 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -21,10 +21,16 @@
-
-
Failed to load {{ itemsJsonUrl}}
+
+
+
Failed to load {{ itemsJsonUrl}}
+
+
Loading...
+
+
+ No reports, start Scan
-
Loading...
+
@@ -568,7 +574,10 @@ export default { if (this.q) query.q = this.q; if (updateFields) query.fields = this.columns.join(","); - query.url = this.itemsJsonUrl; + // don't add default json url + if (this.itemsJsonUrl !== process.env.itemsJsonUrl) { + query.url = this.itemsJsonUrl; + } let order = { column: false, ascending: true }; if (this.$refs.table && this.$refs.table.orderBy.column) { @@ -763,17 +772,23 @@ export default { this.$store.commit("tests", itemsJson.fields); this.$store.dispatch("items", itemsJson.items); + // filter const defaultFilter = itemsJson.filters.find(filter => filter.default); if (defaultFilter && !this.$route.query["q"]) { this.$route.query["q"] = defaultFilter.q; } + // q this.$store.dispatch("q", this.$route.query["q"]); + // columns if (forceDefaultColumns) { this.setDefaultFields(); } + // update url + this.updateUrlQuery(); + this.jsonLoadError = false; this.jsonLoading = false; } catch(e) { diff --git a/store/index.js b/store/index.js index dd81528..201069b 100644 --- a/store/index.js +++ b/store/index.js @@ -73,7 +73,7 @@ export const state = () => ({ filteredItems: [], // constants - itemsJsonUrl: process.env.itemsJsonUrl || 'http://localhost:3001/data.json', + itemsJsonUrl: process.env.itemsJsonUrl || '', jsonUrlHistory: {}, name: pjson.name, version: pjson.version, @@ -97,7 +97,7 @@ export const state = () => ({ user: false, uid: '', // only for anonymous url: 'https://blog.popstas.ru', - args: '-m 1000', + args: '-m 50', serverUrl: process.env.SERVER_URL || false });