This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/main by this push:
     new da7a8a3a Fix console warnings in dev mod, and optimize `vite` 
configuration for proxy, and remove unused codes (#408)
da7a8a3a is described below

commit da7a8a3a82f4e52985aa2672416c95eb97745344
Author: Fine0830 <fanxue0...@gmail.com>
AuthorDate: Mon Mar 11 12:15:38 2024 +0800

    Fix console warnings in dev mod, and optimize `vite` configuration for 
proxy, and remove unused codes (#408)
---
 CHANGES.md                                     |  3 +-
 ui/.gitignore                                  |  1 +
 ui/src/components/Editor/index.vue             |  2 +-
 ui/src/components/Header/components/header.vue |  2 +-
 ui/src/components/Read/index.vue               | 20 ++------
 ui/vite.config.js                              | 64 ++++++++++++++------------
 6 files changed, 44 insertions(+), 48 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index e63ee3a3..dfe5b1e6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -58,7 +58,8 @@ Release Notes.
 - BanyanDB ui misses fields when creating a group
 - Fix data duplicate writing
 - Syncing metadata change events from etcd instead of a local channel.
-- Fix parse environment variables error
+- Fix parse environment variables error.
+- Fix console warnings in dev mod, and optimize `vite` configuration for proxy.
 
 ### Chores
 
diff --git a/ui/.gitignore b/ui/.gitignore
index ea47f4d9..1578e062 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -19,3 +19,4 @@
 dist
 node_modules
 ui-licenses
+.env.local
diff --git a/ui/src/components/Editor/index.vue 
b/ui/src/components/Editor/index.vue
index 4f5a4daa..ee2178b7 100644
--- a/ui/src/components/Editor/index.vue
+++ b/ui/src/components/Editor/index.vue
@@ -311,7 +311,7 @@ function initData() {
                     <el-input clearable v-model="data.form.name"></el-input>
                 </el-form-item>
                 <el-form-item v-if="data.type == 'measure'" label="interval" 
prop="interval">
-                    <el-input-number v-model="data.form.interval" min="1" />
+                    <el-input-number v-model="data.form.interval" :min="1" />
                     <el-select v-model="data.form.intervalUnit" style="width: 
100px; margin-left: 5px;">
                         <el-option v-for="item in options" :key="item.value" 
:label="item.label" :value="item.value" />
                     </el-select>
diff --git a/ui/src/components/Header/components/header.vue 
b/ui/src/components/Header/components/header.vue
index d5772791..433cf60c 100644
--- a/ui/src/components/Header/components/header.vue
+++ b/ui/src/components/Header/components/header.vue
@@ -103,7 +103,7 @@ initData()
         </div>
         <div class="navigation" style="margin-right: 20%">
             <el-menu active-text-color="#6E38F7" router :ellipsis="false" 
class="el-menu-demo" mode="horizontal"
-                :default-active="data.activeMenu" @select="handleSelect">
+                :default-active="data.activeMenu">
                 <el-menu-item 
index="/banyandb/dashboard">Dashboard</el-menu-item>
                 <el-menu-item index="/banyandb/stream">Stream</el-menu-item>
                 <el-menu-item index="/banyandb/measure">Measure</el-menu-item>
diff --git a/ui/src/components/Read/index.vue b/ui/src/components/Read/index.vue
index 9f3d16d5..908d8b80 100644
--- a/ui/src/components/Read/index.vue
+++ b/ui/src/components/Read/index.vue
@@ -183,17 +183,7 @@ watch(() => route, () => {
     immediate: true,
     deep: true
 })
-watch(() => data.code, () => {
-    let index = data.codeStorage.findIndex(item => {
-        return item.params.group == route.params.group && item.params.name == 
route.params.name
-    })
-    if (index >= 0) {
-        data.codeStorage[index].params.code = data.code
-    } else {
-        route.params.code = data.code
-        data.codeStorage.push(JSON.parse(JSON.stringify(route)))
-    }
-})
+
 function initCode() {
     let index = data.codeStorage.findIndex(item => {
         return item.params.group == route.params.group && item.params.name == 
route.params.name
@@ -437,12 +427,12 @@ function changeFields() {
                             type="datetimerange" :shortcuts="shortcuts" 
range-separator="to" start-placeholder="begin"
                             end-placeholder="end" align="right">
                         </el-date-picker>
-                        <el-button size="normal" :icon="Search" 
@click="searchTableData" color="#6E38F7" plain></el-button>
+                        <el-button :icon="Search" @click="searchTableData" 
color="#6E38F7" plain></el-button>
                     </div>
                 </el-col>
                 <el-col :span="12">
                     <div class="flex align-item-center justify-end" 
style="height: 30px;">
-                        <el-button size="normal" :icon="RefreshRight" 
@click="getTableData" plain></el-button>
+                        <el-button :icon="RefreshRight" @click="getTableData" 
plain></el-button>
                     </div>
                 </el-col>
             </el-row>
@@ -452,14 +442,14 @@ function changeFields() {
         <el-card shadow="always">
             <el-table v-loading="data.loading" element-loading-text="loading" 
element-loading-spinner="el-icon-loading"
                 element-loading-background="rgba(0, 0, 0, 0.8)" 
ref="multipleTable" stripe border highlight-current-row
-                tooltip-effect="dark" empty-text="No data yet" 
@selection-change="handleSelectionChange"
+                tooltip-effect="dark" empty-text="No data yet"
                 :data="data.tableData">
                 <el-table-column type="selection" width="55">
                 </el-table-column>
                 <el-table-column type="index" label="number" width="90">
                 </el-table-column>
                 <el-table-column label="timestamp" width="260" key="timestamp" 
prop="timestamp"></el-table-column>
-                <el-table-column v-for="item in tableHeader" sortable 
:sort-change="sortChange" :key="item.name"
+                <el-table-column v-for="item in tableHeader" sortable 
:key="item.name"
                     :label="item.label" :prop="item.name" 
show-overflow-tooltip>
                 </el-table-column>
             </el-table>
diff --git a/ui/vite.config.js b/ui/vite.config.js
index 5660f03d..f68751c9 100644
--- a/ui/vite.config.js
+++ b/ui/vite.config.js
@@ -23,37 +23,41 @@ import { fileURLToPath, URL } from 'node:url'
 import AutoImport from 'unplugin-auto-import/vite'
 import Components from 'unplugin-vue-components/vite'
 import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
-import { defineConfig } from 'vite'
 import vue from '@vitejs/plugin-vue'
+import {loadEnv} from 'vite'
 
 // https://vitejs.dev/config/
-export default defineConfig({
-  plugins: [
-    // ...
-    AutoImport({
-      resolvers: [ElementPlusResolver()],
-    }),
-    Components({
-      resolvers: [ElementPlusResolver()],
-    }),
-    vue()
-  ],
-  resolve: {
-    alias: {
-      '@': fileURLToPath(new URL('./src', import.meta.url))
-    }
-  },
-  server: {
-    proxy: {
-      "^/api": {
-        target: "http://localhost:17913";,
-        changeOrigin: true,
-      },
-      "^/monitoring": {
-        target: "http://localhost:2121";,
-        changeOrigin: true,
-        rewrite: (path) => path.replace(/^\/monitoring/, ''),
-      },
+export default ({ mode }) => {
+  const { VITE_API_PROXY_TARGET, VITE_MONITOR_PROXY_TARGET } = loadEnv(mode, 
process.cwd());
+
+  return {
+    plugins: [
+      // ...
+      AutoImport({
+        resolvers: [ElementPlusResolver()],
+      }),
+      Components({
+        resolvers: [ElementPlusResolver()],
+      }),
+      vue()
+    ],
+    resolve: {
+      alias: {
+        '@': fileURLToPath(new URL('./src', import.meta.url))
+      }
     },
-  }
-})
+    server: {
+      proxy: {
+        "^/api": {
+          target: `${VITE_API_PROXY_TARGET || "http://127.0.0.1:12800"}`,
+          changeOrigin: true,
+        },
+        "^/monitoring": {
+          target: `${VITE_MONITOR_PROXY_TARGET || "http://127.0.0.1:12800"}`,
+          changeOrigin: true,
+          rewrite: (path) => path.replace(/^\/monitoring/, ''),
+        },
+      },
+    }
+  };
+};
\ No newline at end of file

Reply via email to