You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by li...@apache.org on 2022/01/27 09:55:00 UTC

[dolphinscheduler] branch dev updated: [Feature][UI Next] Change how env is used. (#8221)

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

lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new a11fbf8  [Feature][UI Next] Change how env is used. (#8221)
a11fbf8 is described below

commit a11fbf83525bb741bc47b1752718f0bca07ffd0b
Author: songjianet <17...@qq.com>
AuthorDate: Thu Jan 27 17:54:46 2022 +0800

    [Feature][UI Next] Change how env is used. (#8221)
---
 dolphinscheduler-ui-next/.env.development                      |  2 +-
 dolphinscheduler-ui-next/.env.production                       |  2 +-
 dolphinscheduler-ui-next/src/layouts/content/index.tsx         |  7 +++++--
 dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts   |  8 ++------
 dolphinscheduler-ui-next/src/service/service.ts                |  5 ++++-
 .../src/views/projects/workflow/relation/index.tsx             |  4 ++--
 dolphinscheduler-ui-next/vite.config.ts                        | 10 +++++++++-
 7 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/dolphinscheduler-ui-next/.env.development b/dolphinscheduler-ui-next/.env.development
index b667c39..db4722f 100644
--- a/dolphinscheduler-ui-next/.env.development
+++ b/dolphinscheduler-ui-next/.env.development
@@ -15,4 +15,4 @@
 
 NODE_ENV = development
 
-VITE_APP_WEB_URL = ''
+VITE_APP_DEV_WEB_URL = ''
diff --git a/dolphinscheduler-ui-next/.env.production b/dolphinscheduler-ui-next/.env.production
index 35599c8..d974189 100644
--- a/dolphinscheduler-ui-next/.env.production
+++ b/dolphinscheduler-ui-next/.env.production
@@ -15,4 +15,4 @@
 
 NODE_ENV = production
 
-VITE_APP_WEB_URL = ''
+VITE_APP_PROD_WEB_URL = ''
diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
index eafc6f0..35ff966 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
@@ -64,7 +64,7 @@ const Content = defineComponent({
         state.isShowSide = menuStore.getShowSideStatus
         sideKey.value = route.matched[1]?.path
       },
-      {immediate: true}
+      { immediate: true }
     )
 
     const getSideMenu = (state: any) => {
@@ -101,7 +101,10 @@ const Content = defineComponent({
         </NLayoutHeader>
         <NLayout has-sider position='absolute' style='top: 65px'>
           {this.isShowSide && (
-            <SideBar sideMenuOptions={this.sideMenuOptions} sideKey={this.sideKey} />
+            <SideBar
+              sideMenuOptions={this.sideMenuOptions}
+              sideKey={this.sideKey}
+            />
           )}
           <NLayoutContent native-scrollbar={false} style='padding: 16px 22px'>
             <router-view key={this.$route.fullPath} />
diff --git a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
index 5ffb96f..e018e62 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
+++ b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
@@ -266,15 +266,11 @@ export function useDataList() {
 
   const changeHeaderMenuOptions = (state: any) => {
     state.headerMenuOptions = state.menuOptions.map(
-      (item: {
-        label: string
-        key: string
-        icon: any
-      }) => {
+      (item: { label: string; key: string; icon: any }) => {
         return {
           label: item.label,
           key: item.key,
-          icon: item.icon,
+          icon: item.icon
         }
       }
     )
diff --git a/dolphinscheduler-ui-next/src/service/service.ts b/dolphinscheduler-ui-next/src/service/service.ts
index a854f70..c71fbd8 100644
--- a/dolphinscheduler-ui-next/src/service/service.ts
+++ b/dolphinscheduler-ui-next/src/service/service.ts
@@ -23,7 +23,10 @@ import { useUserStore } from '@/store/user/user'
 const userStore = useUserStore()
 
 const baseRequestConfig: AxiosRequestConfig = {
-  baseURL: import.meta.env.VITE_APP_WEB_URL + '/dolphinscheduler',
+  baseURL:
+    import.meta.env.MODE === 'development'
+      ? '/dolphinscheduler'
+      : import.meta.env.VITE_APP_PROD_WEB_URL + '/dolphinscheduler',
   timeout: 10000,
   transformRequest: (params) => {
     if (_.isPlainObject(params)) {
diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx
index 0768480..8baa303 100644
--- a/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx
+++ b/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx
@@ -18,8 +18,8 @@
 import { defineComponent, onMounted, toRefs, watch } from 'vue'
 import { useI18n } from 'vue-i18n'
 import { useRoute } from 'vue-router'
-import {NSelect, NButton, NIcon, NSpace, NTooltip} from 'naive-ui'
-import {ReloadOutlined, EyeOutlined, EditOutlined} from '@vicons/antd'
+import { NSelect, NButton, NIcon, NSpace, NTooltip } from 'naive-ui'
+import { ReloadOutlined, EyeOutlined, EditOutlined } from '@vicons/antd'
 import { useRelation } from './use-relation'
 import Card from '@/components/card'
 import Graph from './components/Graph'
diff --git a/dolphinscheduler-ui-next/vite.config.ts b/dolphinscheduler-ui-next/vite.config.ts
index 8e82cce..019618e 100644
--- a/dolphinscheduler-ui-next/vite.config.ts
+++ b/dolphinscheduler-ui-next/vite.config.ts
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import { defineConfig } from 'vite'
+import { defineConfig, loadEnv } from 'vite'
 import vue from '@vitejs/plugin-vue'
 import vueJsx from '@vitejs/plugin-vue-jsx'
 import viteCompression from 'vite-plugin-compression'
@@ -49,5 +49,13 @@ export default defineConfig({
       // resolve vue-i18n warning: You are running the esm-bundler build of vue-i18n.
       'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
     }
+  },
+  server: {
+    proxy: {
+      '/dolphinscheduler': {
+        target: loadEnv('development', './').VITE_APP_DEV_WEB_URL,
+        changeOrigin: true
+      }
+    }
   }
 })