diff --git a/.gitignore b/.gitignore index 58d66eec..66500543 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ yarn-error.log* *.njsproj *.sln *.sw* + +bundle.zip \ No newline at end of file diff --git a/package.json b/package.json index 80134d70..92d77e27 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "serve": "vue-cli-service serve", "build": "rm -rf dist && vue-cli-service build --modern", + "build:qnet7": "VUE_APP_ROUTER_MODE=hash VUE_APP_PUBLIC_PATH=/elasticvue/ npm run build && rm -rf bundle.zip && zip -r bundle.zip dist/", "test:unit": "vue-cli-service test:unit", "test:e2e": "vue-cli-service test:e2e", "lint": "vue-cli-service lint", diff --git a/src/mixins/TestConnection.js b/src/mixins/TestConnection.js index 79d94785..1fedb2eb 100644 --- a/src/mixins/TestConnection.js +++ b/src/mixins/TestConnection.js @@ -32,13 +32,14 @@ export const useTestConnection = () => { const validName = name => ((name && name.length > 0) || 'Invalid name') const validUri = uri => { - try { - // eslint-disable-next-line no-new - new URL(uri) - if (/^https?:\/\/.*/.test(uri)) return true - } catch (e) { - } - return 'Invalid uri' + return true; + // try { + // // eslint-disable-next-line no-new + // new URL(uri) + // if (/^https?:\/\/.*/.test(uri)) return true + // } catch (e) { + // } + // return 'Invalid uri' } const resetElasticsearchHost = () => { diff --git a/src/models/clients/DefaultClient.js b/src/models/clients/DefaultClient.js index 74cdb9c3..0238775e 100644 --- a/src/models/clients/DefaultClient.js +++ b/src/models/clients/DefaultClient.js @@ -165,7 +165,11 @@ export class DefaultClient { } request (path, method, params) { - const url = new URL(this.host + path) + let host = this.host; + if (!host.startsWith("http")) { + host = window.location.origin + host; + } + const url = new URL(host + path) if (method === 'GET' && typeof params === 'object') { Object.keys(params).forEach(key => url.searchParams.append(key, params[key])) diff --git a/src/store/modules/connection.js b/src/store/modules/connection.js index 25e6ffdd..8fee843b 100644 --- a/src/store/modules/connection.js +++ b/src/store/modules/connection.js @@ -2,7 +2,15 @@ export const connection = { namespaced: true, state: { activeInstanceIdx: null, - instances: [], + instances: [ + { + name: "Local ES", + username: "", + password: "", + status: "unknown", + uri: "/api/stat", + } + ], elasticsearchAdapter: null }, mutations: { diff --git a/vue.config.js b/vue.config.js index 0e2f975f..6615f2eb 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,7 +1,7 @@ const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin') module.exports = { - publicPath: process.env.VUE_APP_PUBLIC_PATH || '/', + publicPath: process.env.VUE_APP_PUBLIC_PATH || '/elasticvue', assetsDir: 'assets', productionSourceMap: false, lintOnSave: false,