From e4955934fd7223caf5ec9b0a7d6173a190ef1958 Mon Sep 17 00:00:00 2001 From: songjianet <1778651752@qq.com> Date: Tue, 14 Dec 2021 11:45:38 +0800 Subject: [PATCH] [Feature][UI-Next]: Build a front-end refactoring project. (#7387) --- dolphinscheduler-ui-next/.env.development | 18 +++++ dolphinscheduler-ui-next/.env.production | 18 +++++ dolphinscheduler-ui-next/.eslintignore | 17 +++++ dolphinscheduler-ui-next/.eslintrc.js | 66 ++++++++++++++++++ dolphinscheduler-ui-next/.gitignore | 30 ++++++++ dolphinscheduler-ui-next/.prettier.js | 29 ++++++++ dolphinscheduler-ui-next/.prettierignore | 17 +++++ dolphinscheduler-ui-next/README.md | 5 ++ dolphinscheduler-ui-next/index.html | 31 ++++++++ dolphinscheduler-ui-next/package.json | 43 ++++++++++++ dolphinscheduler-ui-next/pom.xml | 36 ++++++++++ dolphinscheduler-ui-next/public/favicon.ico | Bin 0 -> 4286 bytes dolphinscheduler-ui-next/src/App.tsx | 48 +++++++++++++ .../src/assets/styles/default.scss | 25 +++++++ dolphinscheduler-ui-next/src/env.d.ts | 32 +++++++++ dolphinscheduler-ui-next/src/locales/index.ts | 31 ++++++++ .../src/locales/modules/en_US.ts | 24 +++++++ .../src/locales/modules/zh_CN.ts | 24 +++++++ dolphinscheduler-ui-next/src/main.ts | 29 ++++++++ dolphinscheduler-ui-next/src/router/index.ts | 33 +++++++++ .../src/service/service.ts | 39 +++++++++++ dolphinscheduler-ui-next/src/store/theme.ts | 31 ++++++++ .../src/views/login/Login.tsx | 42 +++++++++++ .../src/views/login/login.module.scss | 29 ++++++++ dolphinscheduler-ui-next/tsconfig.json | 18 +++++ dolphinscheduler-ui-next/vite.config.ts | 49 +++++++++++++ pom.xml | 1 + 27 files changed, 765 insertions(+) create mode 100644 dolphinscheduler-ui-next/.env.development create mode 100644 dolphinscheduler-ui-next/.env.production create mode 100644 dolphinscheduler-ui-next/.eslintignore create mode 100644 dolphinscheduler-ui-next/.eslintrc.js create mode 100644 dolphinscheduler-ui-next/.gitignore create mode 100644 dolphinscheduler-ui-next/.prettier.js create mode 100644 dolphinscheduler-ui-next/.prettierignore create mode 100644 dolphinscheduler-ui-next/README.md create mode 100644 dolphinscheduler-ui-next/index.html create mode 100644 dolphinscheduler-ui-next/package.json create mode 100644 dolphinscheduler-ui-next/pom.xml create mode 100644 dolphinscheduler-ui-next/public/favicon.ico create mode 100644 dolphinscheduler-ui-next/src/App.tsx create mode 100644 dolphinscheduler-ui-next/src/assets/styles/default.scss create mode 100644 dolphinscheduler-ui-next/src/env.d.ts create mode 100644 dolphinscheduler-ui-next/src/locales/index.ts create mode 100644 dolphinscheduler-ui-next/src/locales/modules/en_US.ts create mode 100644 dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts create mode 100644 dolphinscheduler-ui-next/src/main.ts create mode 100644 dolphinscheduler-ui-next/src/router/index.ts create mode 100644 dolphinscheduler-ui-next/src/service/service.ts create mode 100644 dolphinscheduler-ui-next/src/store/theme.ts create mode 100644 dolphinscheduler-ui-next/src/views/login/Login.tsx create mode 100644 dolphinscheduler-ui-next/src/views/login/login.module.scss create mode 100644 dolphinscheduler-ui-next/tsconfig.json create mode 100644 dolphinscheduler-ui-next/vite.config.ts diff --git a/dolphinscheduler-ui-next/.env.development b/dolphinscheduler-ui-next/.env.development new file mode 100644 index 0000000000..b667c39809 --- /dev/null +++ b/dolphinscheduler-ui-next/.env.development @@ -0,0 +1,18 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more + # contributor license agreements. See the NOTICE file distributed with + # this work for additional information regarding copyright ownership. + # The ASF licenses this file to You under the Apache License, Version 2.0 + # (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + +NODE_ENV = development + +VITE_APP_WEB_URL = '' diff --git a/dolphinscheduler-ui-next/.env.production b/dolphinscheduler-ui-next/.env.production new file mode 100644 index 0000000000..35599c8a2d --- /dev/null +++ b/dolphinscheduler-ui-next/.env.production @@ -0,0 +1,18 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more + # contributor license agreements. See the NOTICE file distributed with + # this work for additional information regarding copyright ownership. + # The ASF licenses this file to You under the Apache License, Version 2.0 + # (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + +NODE_ENV = production + +VITE_APP_WEB_URL = '' diff --git a/dolphinscheduler-ui-next/.eslintignore b/dolphinscheduler-ui-next/.eslintignore new file mode 100644 index 0000000000..b078f551ab --- /dev/null +++ b/dolphinscheduler-ui-next/.eslintignore @@ -0,0 +1,17 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more + # contributor license agreements. See the NOTICE file distributed with + # this work for additional information regarding copyright ownership. + # The ASF licenses this file to You under the Apache License, Version 2.0 + # (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + +node_modules +dist diff --git a/dolphinscheduler-ui-next/.eslintrc.js b/dolphinscheduler-ui-next/.eslintrc.js new file mode 100644 index 0000000000..eeccacaf5b --- /dev/null +++ b/dolphinscheduler-ui-next/.eslintrc.js @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = { + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaVersion: 2021, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + extends: [ + 'plugin:vue/vue3-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + 'prettier' + ], + rules: { + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-empty-interface': 'off', + 'vue/custom-event-name-casing': 'off', + 'no-use-before-define': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^h$', + varsIgnorePattern: '^h$' + } + ], + 'no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^h$', + varsIgnorePattern: '^h$' + } + ], + 'space-before-function-paren': 'off', + quotes: ['error', 'single'], + 'comma-dangle': ['error', 'never'] + } +} diff --git a/dolphinscheduler-ui-next/.gitignore b/dolphinscheduler-ui-next/.gitignore new file mode 100644 index 0000000000..1abeae8d2b --- /dev/null +++ b/dolphinscheduler-ui-next/.gitignore @@ -0,0 +1,30 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more + # contributor license agreements. See the NOTICE file distributed with + # this work for additional information regarding copyright ownership. + # The ASF licenses this file to You under the Apache License, Version 2.0 + # (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + +.vscode +.idea +.DS_Store + +*.local +*.swp +*.tgz +*.tsbuildinfo + +node_modules +dist +dist-ssr + +pnpm-lock.yaml +.pnpm-debug.log diff --git a/dolphinscheduler-ui-next/.prettier.js b/dolphinscheduler-ui-next/.prettier.js new file mode 100644 index 0000000000..075ff8788f --- /dev/null +++ b/dolphinscheduler-ui-next/.prettier.js @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = { + "useTabs": false, + "semi": false, + "vueIndentScriptAndStyle": true, + "singleQuote": true, + "quoteProps": "as-needed", + "jsxBracketSameLine": false, + "jsxSingleQuote": true, + "arrowParens": "always", + "htmlWhitespaceSensitivity": "strict", + "endOfLine": "lf" +}; diff --git a/dolphinscheduler-ui-next/.prettierignore b/dolphinscheduler-ui-next/.prettierignore new file mode 100644 index 0000000000..b078f551ab --- /dev/null +++ b/dolphinscheduler-ui-next/.prettierignore @@ -0,0 +1,17 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more + # contributor license agreements. See the NOTICE file distributed with + # this work for additional information regarding copyright ownership. + # The ASF licenses this file to You under the Apache License, Version 2.0 + # (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + +node_modules +dist diff --git a/dolphinscheduler-ui-next/README.md b/dolphinscheduler-ui-next/README.md new file mode 100644 index 0000000000..fca6e7b905 --- /dev/null +++ b/dolphinscheduler-ui-next/README.md @@ -0,0 +1,5 @@ +### Dolphin Scheduler UI Next + +#### start + +Please make sure you use `node 16+` and `pnpm` to manage the dependencies of the project. diff --git a/dolphinscheduler-ui-next/index.html b/dolphinscheduler-ui-next/index.html new file mode 100644 index 0000000000..625b9c27bb --- /dev/null +++ b/dolphinscheduler-ui-next/index.html @@ -0,0 +1,31 @@ + + + + + + + + + Dolphin Scheduler Admin + + +
+ + + diff --git a/dolphinscheduler-ui-next/package.json b/dolphinscheduler-ui-next/package.json new file mode 100644 index 0000000000..f2a8a10166 --- /dev/null +++ b/dolphinscheduler-ui-next/package.json @@ -0,0 +1,43 @@ +{ + "name": "dolphinscheduler-ui-next", + "version": "0.0.0", + "scripts": { + "dev": "vite", + "build:dev": "vue-tsc --noEmit && vite build --mode development", + "build:prod": "vue-tsc --noEmit && vite build --mode production", + "preview": "vite preview", + "lint": "eslint src --fix --ext .ts,.tsx,.vue", + "prettier": "prettier --config .prettier.js --write src/**/*.{vue,ts,tsx}" + }, + "dependencies": { + "@vueuse/core": "^7.2.2", + "axios": "^0.24.0", + "date-fns": "^2.27.0", + "naive-ui": "^2.21.5", + "nprogress": "^0.2.0", + "pinia": "^2.0.0-rc.10", + "vfonts": "^0.1.0", + "vue": "^3.2.23", + "vue-i18n": "^9.2.0-beta.23", + "vue-router": "^4.0.12" + }, + "devDependencies": { + "@types/nprogress": "^0.2.0", + "@typescript-eslint/eslint-plugin": "^5.6.0", + "@typescript-eslint/parser": "^5.6.0", + "@vitejs/plugin-vue": "^1.10.2", + "@vitejs/plugin-vue-jsx": "^1.3.1", + "dart-sass": "^1.25.0", + "eslint": "^8.4.1", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-vue": "^8.2.0", + "prettier": "^2.5.1", + "sass": "^1.44.0", + "sass-loader": "^12.4.0", + "typescript": "^4.4.4", + "vite": "^2.7.0", + "vite-plugin-compression": "^0.3.6", + "vue-tsc": "^0.28.10" + } +} diff --git a/dolphinscheduler-ui-next/pom.xml b/dolphinscheduler-ui-next/pom.xml new file mode 100644 index 0000000000..6e71dda3e2 --- /dev/null +++ b/dolphinscheduler-ui-next/pom.xml @@ -0,0 +1,36 @@ + + + + + + dolphinscheduler + org.apache.dolphinscheduler + 2.0.0-SNAPSHOT + + 4.0.0 + + dolphinscheduler-ui-next + + ${project.artifactId} + + + v16.13.1 + 8.1.2 + src + + diff --git a/dolphinscheduler-ui-next/public/favicon.ico b/dolphinscheduler-ui-next/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..acf4cf74c893ddad709e7a4e9aafc5de77a51154 GIT binary patch literal 4286 zcmeH}Pe@cz6o;>kM8r@nLShPW5h1N4T11PSRfI^3h-e|vDng=F5Jd}%8EO&XLM#%* zB!&nH+K7bMkWms(l8A5-X(d__ja1YmgSYSZm?w9J8RwBr5%lEq+;{J}=XdVkH^$WP z*U(_}-`v_@Or0^N5vVe8Q2qbs-Y*6ZArq`R&7IVViQ8>NZ;_cS0kq2F+1S zZCXF#oPZRuZifNiTc9(`>AhLC4D!d?e70j zx<&c!P%L6!f#;yTuQTl5-&nPEfzF=3FKIZcKEw&m|F7r32Gn#V!+v3}Pqpg&1j_wEK*Sb@Is-dAv!hkMS- l8uMe$n9+-D+55)W=8hUm7~7nVSUxEhfBPNqvz9jZ`3bSwG&leN literal 0 HcmV?d00001 diff --git a/dolphinscheduler-ui-next/src/App.tsx b/dolphinscheduler-ui-next/src/App.tsx new file mode 100644 index 0000000000..b1025121fc --- /dev/null +++ b/dolphinscheduler-ui-next/src/App.tsx @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { defineComponent, computed } from 'vue' +import { NConfigProvider, darkTheme } from 'naive-ui' +import { useThemeStore } from '@/store/theme' + +const App = defineComponent({ + name: 'App', + setup() { + const themeStore = useThemeStore() + console.log(themeStore.dartTheme) + const currentTheme = computed(() => + themeStore.dartTheme ? darkTheme : undefined + ) + console.log(currentTheme.value) + + return { + currentTheme, + } + }, + render() { + return ( + + + + ) + }, +}) + +export default App diff --git a/dolphinscheduler-ui-next/src/assets/styles/default.scss b/dolphinscheduler-ui-next/src/assets/styles/default.scss new file mode 100644 index 0000000000..782dbcd49e --- /dev/null +++ b/dolphinscheduler-ui-next/src/assets/styles/default.scss @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +* { + outline: 0; +} + +html, body, p, dl, dd, dt { + margin: 0; + padding: 0; +} diff --git a/dolphinscheduler-ui-next/src/env.d.ts b/dolphinscheduler-ui-next/src/env.d.ts new file mode 100644 index 0000000000..962ad5018c --- /dev/null +++ b/dolphinscheduler-ui-next/src/env.d.ts @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module '*.vue' { + import { DefineComponent } from 'vue' + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types + const component: DefineComponent<{}, {}, any> + export default component +} + +declare module '*.scss' { + const classes: { readonly [key: string]: string } + export default classes +} + +declare module '*.png' +declare module '*.jpg' +declare module '*.jpeg' diff --git a/dolphinscheduler-ui-next/src/locales/index.ts b/dolphinscheduler-ui-next/src/locales/index.ts new file mode 100644 index 0000000000..bc4d230e9a --- /dev/null +++ b/dolphinscheduler-ui-next/src/locales/index.ts @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createI18n } from 'vue-i18n' +import zh_CN from './modules/zh_CN' +import en_US from './modules/en_US' + +const i18n = createI18n({ + globalInjection: true, + locale: 'zh_CN', + messages: { + zh_CN, + en_US, + }, +}) + +export default i18n diff --git a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts new file mode 100644 index 0000000000..e0db3dad83 --- /dev/null +++ b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const login = { + test: 'Test', +} + +export default { + login, +} diff --git a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts new file mode 100644 index 0000000000..b3a34647ec --- /dev/null +++ b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const login = { + test: '测试', +} + +export default { + login, +} diff --git a/dolphinscheduler-ui-next/src/main.ts b/dolphinscheduler-ui-next/src/main.ts new file mode 100644 index 0000000000..dd7b1a40a9 --- /dev/null +++ b/dolphinscheduler-ui-next/src/main.ts @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createApp } from 'vue' +import App from './App' +import router from './router' +import { createPinia } from 'pinia' +import i18n from '@/locales' +import './assets/styles/default.scss' + +const app = createApp(App) +app.use(router) +app.use(createPinia()) +app.use(i18n) +app.mount('#app') diff --git a/dolphinscheduler-ui-next/src/router/index.ts b/dolphinscheduler-ui-next/src/router/index.ts new file mode 100644 index 0000000000..4dc4643dc6 --- /dev/null +++ b/dolphinscheduler-ui-next/src/router/index.ts @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' + +const routes: RouteRecordRaw[] = [ + { + path: '/login', + name: 'Login', + component: () => import('@/views/login/Login'), + }, +] + +const index = createRouter({ + history: createWebHistory(), + routes, +}) + +export default index diff --git a/dolphinscheduler-ui-next/src/service/service.ts b/dolphinscheduler-ui-next/src/service/service.ts new file mode 100644 index 0000000000..72f58c5592 --- /dev/null +++ b/dolphinscheduler-ui-next/src/service/service.ts @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' + +const baseRequestConfig: AxiosRequestConfig = { + baseURL: '/', + timeout: 10000, +} + +const service = axios.create(baseRequestConfig) + +const err = (error: AxiosError): Promise => { + return Promise.reject(error) +} + +service.interceptors.request.use((config: AxiosRequestConfig) => { + return config +}, err) + +service.interceptors.response.use((res: AxiosResponse) => { + return res.data +}, err) + +export { service as axios } diff --git a/dolphinscheduler-ui-next/src/store/theme.ts b/dolphinscheduler-ui-next/src/store/theme.ts new file mode 100644 index 0000000000..113bc1e510 --- /dev/null +++ b/dolphinscheduler-ui-next/src/store/theme.ts @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { defineStore } from 'pinia' + +export const useThemeStore = defineStore({ + id: 'theme', + state: () => ({ + dartTheme: true, + }), + getters: { + getTheme(): boolean { + return this.dartTheme + }, + }, + actions: {}, +}) diff --git a/dolphinscheduler-ui-next/src/views/login/Login.tsx b/dolphinscheduler-ui-next/src/views/login/Login.tsx new file mode 100644 index 0000000000..adbc8c3e30 --- /dev/null +++ b/dolphinscheduler-ui-next/src/views/login/Login.tsx @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { defineComponent } from 'vue' +import styles from './login.module.scss' +import { useI18n } from 'vue-i18n' +import { NButton } from 'naive-ui' + +const Login = defineComponent({ + name: 'Login', + setup() { + const { t, locale } = useI18n() + return { t, locale } + }, + render() { + return ( +
+ {this.t('login.test')} + +
+ ) + }, +}) + +export default Login diff --git a/dolphinscheduler-ui-next/src/views/login/login.module.scss b/dolphinscheduler-ui-next/src/views/login/login.module.scss new file mode 100644 index 0000000000..00a7786757 --- /dev/null +++ b/dolphinscheduler-ui-next/src/views/login/login.module.scss @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.login-container { + width: 100%; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + + > .form-box { + width: 400px; + min-height: 260px; + } +} diff --git a/dolphinscheduler-ui-next/tsconfig.json b/dolphinscheduler-ui-next/tsconfig.json new file mode 100644 index 0000000000..cc9ac7ae0a --- /dev/null +++ b/dolphinscheduler-ui-next/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "lib": ["esnext", "dom"], + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] +} diff --git a/dolphinscheduler-ui-next/vite.config.ts b/dolphinscheduler-ui-next/vite.config.ts new file mode 100644 index 0000000000..884f05900a --- /dev/null +++ b/dolphinscheduler-ui-next/vite.config.ts @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' +import viteCompression from 'vite-plugin-compression' +import path from 'path' + +export default defineConfig({ + plugins: [ + vue(), + vueJsx(), + viteCompression({ + verbose: true, + disable: false, + threshold: 10240, + algorithm: 'gzip', + ext: '.gz' + }) + ], + build: { + terserOptions: { + compress: { + drop_console: true, + drop_debugger: true + } + } + }, + resolve: { + alias: { + '@': path.resolve(__dirname, 'src') + } + } +}) diff --git a/pom.xml b/pom.xml index 2bb5971dfb..9e61358fce 100644 --- a/pom.xml +++ b/pom.xml @@ -1246,5 +1246,6 @@ dolphinscheduler-worker dolphinscheduler-log-server dolphinscheduler-tools + dolphinscheduler-ui-next