diff --git a/apps/vue/.eslintignore b/apps/vue/.eslintignore index 5aaaddd86..afa978eed 100644 --- a/apps/vue/.eslintignore +++ b/apps/vue/.eslintignore @@ -13,4 +13,4 @@ dist .local /bin Dockerfile -src/ \ No newline at end of file +src/ diff --git a/apps/vue/.eslintrc.js b/apps/vue/.eslintrc.js index 7d181e4ff..9aa3e10ce 100644 --- a/apps/vue/.eslintrc.js +++ b/apps/vue/.eslintrc.js @@ -1,6 +1,4 @@ -// @ts-check -const { defineConfig } = require('eslint-define-config'); -module.exports = defineConfig({ +module.exports = { root: true, env: { browser: true, @@ -20,9 +18,7 @@ module.exports = defineConfig({ extends: [ 'plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', - 'prettier', 'plugin:prettier/recommended', - 'plugin:jest/recommended', ], rules: { 'vue/script-setup-uses-vars': 'error', @@ -55,8 +51,6 @@ module.exports = defineConfig({ 'space-before-function-paren': 'off', 'vue/attributes-order': 'off', - 'vue/v-on-event-hyphenation': 'off', - 'vue/multi-word-component-names': 'off', 'vue/one-component-per-file': 'off', 'vue/html-closing-bracket-newline': 'off', 'vue/max-attributes-per-line': 'off', @@ -64,8 +58,7 @@ module.exports = defineConfig({ 'vue/singleline-html-element-content-newline': 'off', 'vue/attribute-hyphenation': 'off', 'vue/require-default-prop': 'off', - 'jest/no-commented-out-tests': 'warn', - 'function-url-quotes': 'off', + 'vue/require-explicit-emits': 'off', 'vue/html-self-closing': [ 'error', { @@ -78,5 +71,6 @@ module.exports = defineConfig({ math: 'always', }, ], + 'vue/multi-word-component-names': 'off', }, -}); +}; diff --git a/apps/vue/.github/workflows/issue-close-require.yml b/apps/vue/.github/workflows/issue-close-require.yml new file mode 100644 index 000000000..a5fb0a400 --- /dev/null +++ b/apps/vue/.github/workflows/issue-close-require.yml @@ -0,0 +1,17 @@ +name: Issue Close Require + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + close-issues: + runs-on: ubuntu-latest + steps: + - name: need reproduction + uses: actions-cool/issues-helper@v2.1.1 + with: + actions: 'close-issues' + token: ${{ secrets.OPER_TOKEN }} + labels: 'need reproduction' + inactive-day: 3 diff --git a/apps/vue/.github/workflows/issue-labeled.yml b/apps/vue/.github/workflows/issue-labeled.yml new file mode 100644 index 000000000..43a7a624a --- /dev/null +++ b/apps/vue/.github/workflows/issue-labeled.yml @@ -0,0 +1,29 @@ +name: Issue Labeled + +on: + issues: + types: [labeled] + +jobs: + reply-labeled: + runs-on: ubuntu-latest + steps: + - name: remove pending + if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' + uses: actions-cool/issues-helper@v2.1.1 + with: + actions: 'remove-labels' + token: ${{ secrets.OPER_TOKEN }} + issue-number: ${{ github.event.issue.number }} + labels: 'bug: pending triage' + + - name: need reproduction + if: github.event.label.name == 'need reproduction' + uses: actions-cool/issues-helper@v2.1.1 + with: + actions: 'create-comment, remove-labels' + token: ${{ secrets.OPER_TOKEN }} + issue-number: ${{ github.event.issue.number }} + body: | + Hello @${{ github.event.issue.user.login }}. Please provide the complete reproduction steps and code. Issues labeled by `need reproduction` will be closed if no activities in 3 days. + labels: 'bug: pending triage' diff --git a/apps/vue/.github/workflows/release.yml b/apps/vue/.github/workflows/release.yml new file mode 100644 index 000000000..74ab4a3d1 --- /dev/null +++ b/apps/vue/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Create Release + +on: + push: + tags: + - v* + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + + - name: Create Release for Tag + id: release_tag + uses: yyx990803/release-tag@master + env: + GITHUB_TOKEN: ${{ secrets.OPER_TOKEN }} + with: + tag_name: ${{ github.ref }} + body: | + Please refer to [CHANGELOG.md](https://github.com/anncwb/vue-vben-admin/blob/main/CHANGELOG.md) for details. diff --git a/apps/vue/.gitignore b/apps/vue/.gitignore index d25887c6f..003b54a7d 100644 --- a/apps/vue/.gitignore +++ b/apps/vue/.gitignore @@ -4,6 +4,7 @@ dist .npmrc .cache yarn.lock +pnpm-lock.yaml tests/server/static tests/server/static/upload @@ -28,3 +29,4 @@ pnpm-debug.log* *.njsproj *.sln *.sw? +/package-lock.json diff --git a/apps/vue/.gitpod.yml b/apps/vue/.gitpod.yml index 219189500..866381fcc 100644 --- a/apps/vue/.gitpod.yml +++ b/apps/vue/.gitpod.yml @@ -2,5 +2,5 @@ ports: - port: 3344 onOpen: open-preview tasks: - - init: yarn - command: yarn dev + - init: pnpm install + command: pnpm run dev diff --git a/apps/vue/.husky/pre-commit b/apps/vue/.husky/pre-commit index 35f92427c..eec6cb6ec 100644 --- a/apps/vue/.husky/pre-commit +++ b/apps/vue/.husky/pre-commit @@ -1,8 +1,8 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" -. "$(dirname "$0")/common.sh" +#. "$(dirname "$0")/_/husky.sh" +#. "$(dirname "$0")/common.sh" -[ -n "$CI" ] && exit 0 +#[ -n "$CI" ] && exit 0 # Format and submit code according to lintstagedrc.js configuration -npm run lint:lint-staged +# npm run lint:lint-staged diff --git a/apps/vue/README.md b/apps/vue/README.md index cea9083e2..c3d3d57fc 100644 --- a/apps/vue/README.md +++ b/apps/vue/README.md @@ -79,104 +79,99 @@ git clone https://github.com/anncwb/vue-vben-admin.git ```bash cd vue-vben-admin -yarn install +pnpm install ``` -- 运行 +- run ```bash -yarn serve +pnpm serve ``` -- 打包 +- build ```bash -yarn build +pnpm build ``` -## 更新日志 +## Change Log [CHANGELOG](./CHANGELOG.zh_CN.md) -## 项目地址 +## Project -- [vue-vben-admin](https://github.com/anncwb/vue-vben-admin) - 完整版 -- [vue-vben-admin-thin-next](https://github.com/anncwb/vben-admin-thin-next) - 简化版 +- [vue-vben-admin](https://github.com/anncwb/vue-vben-admin) - full version +- [vue-vben-admin-thin-next](https://github.com/anncwb/vben-admin-thin-next) - Simplified version -## 如何贡献 +## How to contribute -非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。 +You are very welcome to join![Raise an issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) Or submit a Pull Request。 **Pull Request:** -1. Fork 代码! -2. 创建自己的分支: `git checkout -b feat/xxxx` -3. 提交你的修改: `git commit -am 'feat(function): add xxxxx'` -4. 推送您的分支: `git push origin feat/xxxx` -5. 提交`pull request` +1. Fork code! +2. Create your own branch: `git checkout -b feat/xxxx` +3. Submit your changes: `git commit -am 'feat(function): add xxxxx'` +4. Push your branch: `git push origin feat/xxxx` +5. submit`pull request` -## Git 贡献提交规范 +## Git Contribution submission specification -- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) +- reference [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) specification ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - - `feat` 增加新功能 - - `fix` 修复问题/BUG - - `style` 代码风格相关无影响运行结果的 - - `perf` 优化/性能提升 - - `refactor` 重构 - - `revert` 撤销修改 - - `test` 测试相关 - - `docs` 文档/注释 - - `chore` 依赖更新/脚手架配置修改等 - - `workflow` 工作流改进 - - `ci` 持续集成 - - `types` 类型定义文件更改 - - `wip` 开发中 + - `feat` Add new features + - `fix` Fix the problem/BUG + - `style` The code style is related and does not affect the running result + - `perf` Optimization/performance improvement + - `refactor` Refactor + - `revert` Undo edit + - `test` Test related + - `docs` Documentation/notes + - `chore` Dependency update/scaffolding configuration modification etc. + - `workflow` Workflow improvements + - `ci` Continuous integration + - `types` Type definition file changes + - `wip` In development -## 浏览器支持 +## Related warehouse -本地开发推荐使用`Chrome 80+` 浏览器 +If these plugins are helpful to you, you can give a star support -支持现代浏览器, 不支持 IE +- [vite-plugin-mock](https://github.com/anncwb/vite-plugin-mock) - Used for local and development environment data mock +- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - Used for html template conversion and compression +- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - Used for component library style introduction on demand +- [vite-plugin-theme](https://github.com/anncwb/vite-plugin-theme) - Used for online switching of theme colors and other color-related configurations +- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - Used to pack compressed image resources +- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - Used to pack input .gz|.brotil files +- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - Used to quickly generate svg sprite -| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | :-: | -| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | - -## 相关仓库 - -如果这些插件对你有帮助,可以给一个 star 支持下 +## Browser support -- [vite-plugin-mock](https://github.com/anncwb/vite-plugin-mock) - 用于本地及开发环境数据 mock -- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - 用于 html 模版转换及压缩 -- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - 用于组件库样式按需引入 -- [vite-plugin-theme](https://github.com/anncwb/vite-plugin-theme) - 用于在线切换主题色等颜色相关配置 -- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - 用于打包压缩图片资源 -- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - 用于打包输出.gz|.brotil 文件 -- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - 用于快速生成 svg 雪碧图 +The `Chrome 80+` browser is recommended for local development -## 后台整合示例 +Support modern browsers, not IE -- [lamp-cloud](https://github.com/zuihou/lamp-cloud) - 基于 SpringCloud Alibaba 的微服务中后台快速开发平台 +| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| :-: | :-: | :-: | :-: | :-: | +| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | -## 维护者 +## Maintainer [@Vben](https://github.com/anncwb) -## 捐赠 +## Donate -如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! +If you think this project is helpful to you, you can help the author buy a cup of coffee to show your support! ![donate](https://anncwb.github.io/anncwb/images/sponsor.png) Paypal Me -## 交流 - -`Vue-vben-Admin` 是完全开源免费的项目,在帮助开发者更方便地进行中大型管理系统开发,同时也提供 QQ 交流群使用问题欢迎在群内提问。 +## Discord -- QQ 群 `569291866` +- [github discussions](https://github.com/anncwb/vue-vben-admin/discussions) +- [Discord](https://discord.gg/8GuAdwDhj6) ## License diff --git a/apps/vue/README.zh-CN.md b/apps/vue/README.zh-CN.md new file mode 100644 index 000000000..408af3cc8 --- /dev/null +++ b/apps/vue/README.zh-CN.md @@ -0,0 +1,175 @@ +
VbenAdmin Logo

+ +[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) + +

Vue vben admin

+
+ +**中文** | [English](./README.md) + +## 简介 + +Vue Vben Admin 是一个免费开源的中后台模版。使用了最新的`vue3`,`vite2`,`TypeScript`等主流技术开发,开箱即用的中后台前端解决方案,也可用于学习参考。 + +## 特性 + +- **最新技术栈**:使用 Vue3/vite2 等前端前沿技术开发 +- **TypeScript**: 应用程序级 JavaScript 的语言 +- **主题**:可配置的主题 +- **国际化**:内置完善的国际化方案 +- **Mock 数据** 内置 Mock 数据方案 +- **权限** 内置完善的动态路由权限生成方案 +- **组件** 二次封装了多个常用的组件 + +## 预览 + +- [vue-vben-admin](https://vvbin.cn/next/) - 完整版中文站点 +- [vue-vben-admin-gh-pages](https://anncwb.github.io/vue-vben-admin/) - 完整版 github 站点 +- [vben-admin-thin-next](https://vvbin.cn/thin/next/) - 简化版中文站点 +- [vben-admin-thin-gh-pages](https://anncwb.github.io/vben-admin-thin-next/) - 简化版 github 站点 + +测试账号: vben/123456 + +

+ VbenAdmin Logo + VbenAdmin Logo + VbenAdmin Logo +

+ +### 使用 Gitpod + +在 Gitpod(适用于 GitHub 的免费在线开发环境)中打开项目,并立即开始编码. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/anncwb/vue-vben-admin) + +## 文档 + +[文档地址](https://vvbin.cn/doc-next/) + +## 准备 + +- [node](http://nodejs.org/) 和 [git](https://git-scm.com/) -项目开发环境 +- [Vite](https://vitejs.dev/) - 熟悉 vite 特性 +- [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法 +- [TypeScript](https://www.typescriptlang.org/) - 熟悉`TypeScript`基本语法 +- [Es6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法 +- [Vue-Router-Next](https://next.router.vuejs.org/) - 熟悉 vue-router 基本使用 +- [Ant-Design-Vue](https://2x.antdv.com/docs/vue/introduce-cn/) - ui 基本使用 +- [Mock.js](https://github.com/nuysoft/Mock) - mockjs 基本语法 + +## 安装使用 + +- 获取项目代码 + +```bash +git clone https://github.com/anncwb/vue-vben-admin.git +``` + +- 安装依赖 + +```bash +cd vue-vben-admin + +pnpm install + +``` + +- 运行 + +```bash +pnpm serve +``` + +- 打包 + +```bash +pnpm build +``` + +## 更新日志 + +[CHANGELOG](./CHANGELOG.zh_CN.md) + +## 项目地址 + +- [vue-vben-admin](https://github.com/anncwb/vue-vben-admin) - 完整版 +- [vue-vben-admin-thin-next](https://github.com/anncwb/vben-admin-thin-next) - 简化版 + +## 如何贡献 + +非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。 + +**Pull Request:** + +1. Fork 代码! +2. 创建自己的分支: `git checkout -b feat/xxxx` +3. 提交你的修改: `git commit -am 'feat(function): add xxxxx'` +4. 推送您的分支: `git push origin feat/xxxx` +5. 提交`pull request` + +## Git 贡献提交规范 + +- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) + + - `feat` 增加新功能 + - `fix` 修复问题/BUG + - `style` 代码风格相关无影响运行结果的 + - `perf` 优化/性能提升 + - `refactor` 重构 + - `revert` 撤销修改 + - `test` 测试相关 + - `docs` 文档/注释 + - `chore` 依赖更新/脚手架配置修改等 + - `workflow` 工作流改进 + - `ci` 持续集成 + - `types` 类型定义文件更改 + - `wip` 开发中 + +## 浏览器支持 + +本地开发推荐使用`Chrome 80+` 浏览器 + +支持现代浏览器, 不支持 IE + +| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| :-: | :-: | :-: | :-: | :-: | +| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | + +## 相关仓库 + +如果这些插件对你有帮助,可以给一个 star 支持下 + +- [vite-plugin-mock](https://github.com/anncwb/vite-plugin-mock) - 用于本地及开发环境数据 mock +- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - 用于 html 模版转换及压缩 +- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - 用于组件库样式按需引入 +- [vite-plugin-theme](https://github.com/anncwb/vite-plugin-theme) - 用于在线切换主题色等颜色相关配置 +- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - 用于打包压缩图片资源 +- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - 用于打包输出.gz|.brotil 文件 +- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - 用于快速生成 svg 雪碧图 + +## 后台整合示例 + +- [lamp-cloud](https://github.com/zuihou/lamp-cloud) - 基于 SpringCloud Alibaba 的微服务中后台快速开发平台 +- [matecloud](https://github.com/matevip/matecloud) - MateCloud 微服务脚手架,基于 Spring Cloud 2020.0.3、SpringBoot 2.5.3 的全开源平台 + +## 维护者 + +[@Vben](https://github.com/anncwb) + +## 捐赠 + +如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! + +![donate](https://anncwb.github.io/anncwb/images/sponsor.png) + +Paypal Me + +## 交流 + +`Vue-vben-Admin` 是完全开源免费的项目,在帮助开发者更方便地进行中大型管理系统开发,同时也提供 QQ 交流群使用问题欢迎在群内提问。 + +- QQ 群 `569291866` + +## License + +[MIT © Vben-2020](./LICENSE) diff --git a/apps/vue/build/generate/icon/index.ts b/apps/vue/build/generate/icon/index.ts index c78cb09f2..b01fec4cb 100644 --- a/apps/vue/build/generate/icon/index.ts +++ b/apps/vue/build/generate/icon/index.ts @@ -1,7 +1,7 @@ import path from 'path'; import fs from 'fs-extra'; import inquirer from 'inquirer'; -import chalk from 'chalk'; +import colors from 'picocolors'; import pkg from '../../../package.json'; async function generateIcon() { @@ -64,7 +64,7 @@ async function generateIcon() { } fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite')); console.log( - `✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`, + `✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`, ); }); } diff --git a/apps/vue/build/script/buildConf.ts b/apps/vue/build/script/buildConf.ts index 342c15411..c35977497 100644 --- a/apps/vue/build/script/buildConf.ts +++ b/apps/vue/build/script/buildConf.ts @@ -3,7 +3,7 @@ */ import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'; import fs, { writeFileSync } from 'fs-extra'; -import chalk from 'chalk'; +import colors from 'picocolors'; import { getEnvConfig, getRootPath } from '../utils'; import { getConfigFileName } from '../getConfigFileName'; @@ -21,7 +21,8 @@ function createConfig(params: CreateConfigParams) { try { const windowConf = `window.${configName}`; // Ensure that the variable will not be modified - const configStr = `${windowConf}=${JSON.stringify(config)}; + let configStr = `${windowConf}=${JSON.stringify(config)};`; + configStr += ` Object.freeze(${windowConf}); Object.defineProperty(window, "${configName}", { configurable: false, @@ -31,10 +32,10 @@ function createConfig(params: CreateConfigParams) { fs.mkdirp(getRootPath(OUTPUT_DIR)); writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr); - console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); - console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n'); + console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); + console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n'); } catch (error) { - console.log(chalk.red('configuration file configuration file failed to package:\n' + error)); + console.log(colors.red('configuration file configuration file failed to package:\n' + error)); } } diff --git a/apps/vue/build/script/postBuild.ts b/apps/vue/build/script/postBuild.ts index e1554bff7..42635d88b 100644 --- a/apps/vue/build/script/postBuild.ts +++ b/apps/vue/build/script/postBuild.ts @@ -1,7 +1,7 @@ // #!/usr/bin/env node import { runBuildConfig } from './buildConf'; -import chalk from 'chalk'; +import colors from 'picocolors'; import pkg from '../../package.json'; @@ -14,9 +14,9 @@ export const runBuild = async () => { runBuildConfig(); } - console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!'); + console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!'); } catch (error) { - console.log(chalk.red('vite build error:\n' + error)); + console.log(colors.red('vite build error:\n' + error)); process.exit(1); } }; diff --git a/apps/vue/build/vite/plugin/compress.ts b/apps/vue/build/vite/plugin/compress.ts index 3ad32be12..ff4f6311d 100644 --- a/apps/vue/build/vite/plugin/compress.ts +++ b/apps/vue/build/vite/plugin/compress.ts @@ -2,16 +2,16 @@ * Used to package and output gzip. Note that this does not work properly in Vite, the specific reason is still being investigated * https://github.com/anncwb/vite-plugin-compression */ -import type { Plugin } from 'vite'; +import type { PluginOption } from 'vite'; import compressPlugin from 'vite-plugin-compression'; export function configCompressPlugin( compress: 'gzip' | 'brotli' | 'none', deleteOriginFile = false, -): Plugin | Plugin[] { +): PluginOption | PluginOption[] { const compressList = compress.split(','); - const plugins: Plugin[] = []; + const plugins: PluginOption[] = []; if (compressList.includes('gzip')) { plugins.push( diff --git a/apps/vue/build/vite/plugin/html.ts b/apps/vue/build/vite/plugin/html.ts index 848190bd8..6af034ac4 100644 --- a/apps/vue/build/vite/plugin/html.ts +++ b/apps/vue/build/vite/plugin/html.ts @@ -2,8 +2,8 @@ * Plugin to minimize and use ejs template syntax in index.html. * https://github.com/anncwb/vite-plugin-html */ -import type { Plugin } from 'vite'; -import html from 'vite-plugin-html'; +import type { PluginOption } from 'vite'; +import { createHtmlPlugin } from 'vite-plugin-html'; import pkg from '../../../package.json'; import { GLOB_CONFIG_FILE_NAME } from '../../constant'; @@ -16,7 +16,7 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) { return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`; }; - const htmlPlugin: Plugin[] = html({ + const htmlPlugin: PluginOption[] = createHtmlPlugin({ minify: isBuild, inject: { // Inject data into ejs template diff --git a/apps/vue/build/vite/plugin/index.ts b/apps/vue/build/vite/plugin/index.ts index 9c0924a0d..0efe660db 100644 --- a/apps/vue/build/vite/plugin/index.ts +++ b/apps/vue/build/vite/plugin/index.ts @@ -1,9 +1,10 @@ -import type { Plugin } from 'vite'; +import { PluginOption } from 'vite'; import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; import legacy from '@vitejs/plugin-legacy'; import purgeIcons from 'vite-plugin-purge-icons'; import windiCSS from 'vite-plugin-windicss'; +import VitePluginCertificate from 'vite-plugin-mkcert'; import vueSetupExtend from 'vite-plugin-vue-setup-extend'; import { configHtmlPlugin } from './html'; import { configPwaConfig } from './pwa'; @@ -14,7 +15,6 @@ import { configVisualizerConfig } from './visualizer'; import { configThemePlugin } from './theme'; import { configImageminPlugin } from './imagemin'; import { configSvgIconsPlugin } from './svgSprite'; -import { configHmrPlugin } from './hmr'; export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { const { @@ -25,21 +25,21 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE, } = viteEnv; - const vitePlugins: (Plugin | Plugin[])[] = [ + const vitePlugins: (PluginOption | PluginOption[])[] = [ // have to vue(), // have to vueJsx(), // support name vueSetupExtend(), + VitePluginCertificate({ + source: 'coding', + }), ]; // vite-plugin-windicss vitePlugins.push(windiCSS()); - // TODO - !isBuild && vitePlugins.push(configHmrPlugin()); - // @vitejs/plugin-legacy VITE_LEGACY && isBuild && vitePlugins.push(legacy()); @@ -61,12 +61,12 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { // rollup-plugin-visualizer vitePlugins.push(configVisualizerConfig()); - //vite-plugin-theme + // vite-plugin-theme vitePlugins.push(configThemePlugin(isBuild)); // The following plugins only work in the production environment if (isBuild) { - //vite-plugin-imagemin + // vite-plugin-imagemin VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()); // rollup-plugin-gzip diff --git a/apps/vue/build/vite/plugin/styleImport.ts b/apps/vue/build/vite/plugin/styleImport.ts index 111a3faaf..32b8f823a 100644 --- a/apps/vue/build/vite/plugin/styleImport.ts +++ b/apps/vue/build/vite/plugin/styleImport.ts @@ -2,13 +2,13 @@ * Introduces component library styles on demand. * https://github.com/anncwb/vite-plugin-style-import */ -import styleImport from 'vite-plugin-style-import'; +import { createStyleImportPlugin } from 'vite-plugin-style-import'; -export function configStyleImportPlugin(isBuild: boolean) { - if (!isBuild) { - return []; - } - const styleImportPlugin = styleImport({ +export function configStyleImportPlugin(_isBuild: boolean) { + // if (!isBuild) { + // return []; + // } + const styleImportPlugin = createStyleImportPlugin({ libs: [ { libraryName: 'ant-design-vue', @@ -19,6 +19,7 @@ export function configStyleImportPlugin(isBuild: boolean) { 'anchor-link', 'sub-menu', 'menu-item', + 'menu-divider', 'menu-item-group', 'breadcrumb-item', 'breadcrumb-separator', @@ -63,6 +64,8 @@ export function configStyleImportPlugin(isBuild: boolean) { 'layout-footer': 'layout', 'layout-header': 'layout', 'month-picker': 'date-picker', + 'range-picker': 'date-picker', + 'image-preview-group': 'image', }; return ignoreList.includes(name) diff --git a/apps/vue/build/vite/plugin/svgSprite.ts b/apps/vue/build/vite/plugin/svgSprite.ts index 3817acbfc..61f637f4e 100644 --- a/apps/vue/build/vite/plugin/svgSprite.ts +++ b/apps/vue/build/vite/plugin/svgSprite.ts @@ -3,11 +3,11 @@ * https://github.com/anncwb/vite-plugin-svg-icons */ -import SvgIconsPlugin from 'vite-plugin-svg-icons'; +import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'; import path from 'path'; export function configSvgIconsPlugin(isBuild: boolean) { - const svgIconsPlugin = SvgIconsPlugin({ + const svgIconsPlugin = createSvgIconsPlugin({ iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')], svgoOptions: isBuild, // default diff --git a/apps/vue/build/vite/plugin/theme.ts b/apps/vue/build/vite/plugin/theme.ts index c54f1a834..118983f77 100644 --- a/apps/vue/build/vite/plugin/theme.ts +++ b/apps/vue/build/vite/plugin/theme.ts @@ -2,7 +2,7 @@ * Vite plugin for website theme color switching * https://github.com/anncwb/vite-plugin-theme */ -import type { Plugin } from 'vite'; +import type { PluginOption } from 'vite'; import path from 'path'; import { viteThemePlugin, @@ -14,7 +14,7 @@ import { import { getThemeColors, generateColors } from '../../config/themeConfig'; import { generateModifyVars } from '../../generate/generateModifyVars'; -export function configThemePlugin(isBuild: boolean): Plugin[] { +export function configThemePlugin(isBuild: boolean): PluginOption[] { const colors = generateColors({ mixDarken, mixLighten, @@ -85,5 +85,5 @@ export function configThemePlugin(isBuild: boolean): Plugin[] { }), ]; - return plugin as unknown as Plugin[]; + return plugin as unknown as PluginOption[]; } diff --git a/apps/vue/commitlint.config.js b/apps/vue/commitlint.config.js index 54598876e..151ead3cf 100644 --- a/apps/vue/commitlint.config.js +++ b/apps/vue/commitlint.config.js @@ -1,3 +1,23 @@ +const fs = require('fs'); +const path = require('path'); +const { execSync } = require('child_process'); + +const scopes = fs + .readdirSync(path.resolve(__dirname, 'src'), { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name.replace(/s$/, '')); + +// precomputed scope +const scopeComplete = execSync('git status --porcelain || true') + .toString() + .trim() + .split('\n') + .find((r) => ~r.indexOf('M src')) + ?.replace(/(\/)/g, '%%') + ?.match(/src%%((\w|-)*)/)?.[1] + ?.replace(/s$/, ''); + +/** @type {import('cz-git').UserConfig} */ module.exports = { ignores: [(commit) => commit.includes('init')], extends: ['@commitlint/config-conventional'], @@ -30,4 +50,58 @@ module.exports = { ], ], }, + prompt: { + /** @use `yarn commit :f` */ + alias: { + f: 'docs: fix typos', + r: 'docs: update README', + s: 'style: update code format', + b: 'build: bump dependencies', + c: 'chore: update config', + }, + customScopesAlign: !scopeComplete ? 'top' : 'bottom', + defaultScope: scopeComplete, + scopes: [...scopes, 'mock'], + allowEmptyIssuePrefixs: false, + allowCustomIssuePrefixs: false, + + // English + typesAppend: [ + { value: 'wip', name: 'wip: work in process' }, + { value: 'workflow', name: 'workflow: workflow improvements' }, + { value: 'types', name: 'types: type definition file changes' }, + ], + + // 中英文对照版 + // messages: { + // type: '选择你要提交的类型 :', + // scope: '选择一个提交范围 (可选):', + // customScope: '请输入自定义的提交范围 :', + // subject: '填写简短精炼的变更描述 :\n', + // body: '填写更加详细的变更描述 (可选)。使用 "|" 换行 :\n', + // breaking: '列举非兼容性重大的变更 (可选)。使用 "|" 换行 :\n', + // footerPrefixsSelect: '选择关联issue前缀 (可选):', + // customFooterPrefixs: '输入自定义issue前缀 :', + // footer: '列举关联issue (可选) 例如: #31, #I3244 :\n', + // confirmCommit: '是否提交或修改commit ?', + // }, + // types: [ + // { value: 'feat', name: 'feat: 新增功能' }, + // { value: 'fix', name: 'fix: 修复缺陷' }, + // { value: 'docs', name: 'docs: 文档变更' }, + // { value: 'style', name: 'style: 代码格式' }, + // { value: 'refactor', name: 'refactor: 代码重构' }, + // { value: 'perf', name: 'perf: 性能优化' }, + // { value: 'test', name: 'test: 添加疏漏测试或已有测试改动' }, + // { value: 'build', name: 'build: 构建流程、外部依赖变更 (如升级 npm 包、修改打包配置等)' }, + // { value: 'ci', name: 'ci: 修改 CI 配置、脚本' }, + // { value: 'revert', name: 'revert: 回滚 commit' }, + // { value: 'chore', name: 'chore: 对构建过程或辅助工具和库的更改 (不影响源文件、测试用例)' }, + // { value: 'wip', name: 'wip: 正在开发中' }, + // { value: 'workflow', name: 'workflow: 工作流程改进' }, + // { value: 'types', name: 'types: 类型定义文件修改' }, + // ], + // emptyScopesAlias: 'empty: 不填写', + // customScopesAlias: 'custom: 自定义', + }, }; diff --git a/apps/vue/index.html b/apps/vue/index.html index 5b99faf67..f615e97cc 100644 --- a/apps/vue/index.html +++ b/apps/vue/index.html @@ -8,7 +8,6 @@ name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" /> - <%= title %> @@ -30,7 +29,7 @@ } html[data-theme='dark'] .app-loading .app-loading-title { - color: rgba(255, 255, 255, 0.85); + color: rgb(255 255 255 / 85%); } .app-loading { @@ -48,7 +47,6 @@ top: 50%; left: 50%; display: flex; - -webkit-transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0); justify-content: center; align-items: center; @@ -66,7 +64,7 @@ display: flex; margin-top: 30px; font-size: 30px; - color: rgba(0, 0, 0, 0.85); + color: rgb(0 0 0 / 85%); justify-content: center; align-items: center; } @@ -97,7 +95,7 @@ height: 20px; background-color: #0065cc; border-radius: 100%; - opacity: 0.3; + opacity: 30%; transform: scale(0.75); animation: antSpinMove 1s infinite linear alternate; transform-origin: 50% 50%; @@ -111,43 +109,38 @@ .dot i:nth-child(2) { top: 0; right: 0; - -webkit-animation-delay: 0.4s; animation-delay: 0.4s; } .dot i:nth-child(3) { right: 0; bottom: 0; - -webkit-animation-delay: 0.8s; animation-delay: 0.8s; } .dot i:nth-child(4) { bottom: 0; left: 0; - -webkit-animation-delay: 1.2s; animation-delay: 1.2s; } @keyframes antRotate { to { - -webkit-transform: rotate(405deg); transform: rotate(405deg); } } - @-webkit-keyframes antRotate { + @keyframes antRotate { to { - -webkit-transform: rotate(405deg); transform: rotate(405deg); } } @keyframes antSpinMove { to { - opacity: 1; + opacity: 100%; } } - @-webkit-keyframes antSpinMove { + @keyframes antSpinMove { to { - opacity: 1; + opacity: 100%; } } diff --git a/apps/vue/mock/demo/api-cascader.ts b/apps/vue/mock/demo/api-cascader.ts new file mode 100644 index 000000000..6334ef5b1 --- /dev/null +++ b/apps/vue/mock/demo/api-cascader.ts @@ -0,0 +1,325 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { resultSuccess } from '../_util'; + +const areaList: any[] = [ + { + id: '530825900854620160', + code: '430000', + parentCode: '100000', + levelType: 1, + name: '湖南省', + province: '湖南省', + city: null, + district: null, + town: null, + village: null, + parentPath: '430000', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 16:33:42', + customized: false, + usable: true, + }, + { + id: '530825900883980288', + code: '430100', + parentCode: '430000', + levelType: 2, + name: '长沙市', + province: '湖南省', + city: '长沙市', + district: null, + town: null, + village: null, + parentPath: '430000,430100', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 16:33:42', + customized: false, + usable: true, + }, + { + id: '530825900951089152', + code: '430102', + parentCode: '430100', + levelType: 3, + name: '芙蓉区', + province: '湖南省', + city: '长沙市', + district: '芙蓉区', + town: null, + village: null, + parentPath: '430000,430100,430102', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 16:33:42', + customized: false, + usable: true, + }, + { + id: '530825901014003712', + code: '430104', + parentCode: '430100', + levelType: 3, + name: '岳麓区', + province: '湖南省', + city: '长沙市', + district: '岳麓区', + town: null, + village: null, + parentPath: '430000,430100,430104', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 16:33:42', + customized: false, + usable: true, + }, + { + id: '530825900988837888', + code: '430103', + parentCode: '430100', + levelType: 3, + name: '天心区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: null, + village: null, + parentPath: '430000,430100,430103', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 16:33:42', + customized: false, + usable: true, + }, + { + id: '530826672489115648', + code: '430103002', + parentCode: '430103', + levelType: 4, + name: '坡子街街道', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: null, + parentPath: '430000,430100,430103,430103002', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-12-14 15:26:43', + customized: false, + usable: true, + }, + { + id: '530840241171607552', + code: '430103002001', + parentCode: '430103002', + levelType: 5, + name: '八角亭社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '八角亭社区', + parentPath: '430000,430100,430103,430103002,430103002001', + createTime: '2020-11-30 15:47:31', + updateTime: '2021-01-20 14:07:23', + customized: false, + usable: true, + }, + { + id: '530840241200967680', + code: '430103002002', + parentCode: '430103002', + levelType: 5, + name: '西牌楼社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '西牌楼社区', + parentPath: '430000,430100,430103,430103002,430103002002', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241230327808', + code: '430103002003', + parentCode: '430103002', + levelType: 5, + name: '太平街社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '太平街社区', + parentPath: '430000,430100,430103,430103002,430103002003', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241259687936', + code: '430103002005', + parentCode: '430103002', + levelType: 5, + name: '坡子街社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '坡子街社区', + parentPath: '430000,430100,430103,430103002,430103002005', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241284853760', + code: '430103002006', + parentCode: '430103002', + levelType: 5, + name: '青山祠社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '青山祠社区', + parentPath: '430000,430100,430103,430103002,430103002006', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241310019584', + code: '430103002007', + parentCode: '430103002', + levelType: 5, + name: '沙河社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '沙河社区', + parentPath: '430000,430100,430103,430103002,430103002007', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241381322752', + code: '430103002008', + parentCode: '430103002', + levelType: 5, + name: '碧湘社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '碧湘社区', + parentPath: '430000,430100,430103,430103002,430103002008', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241410682880', + code: '430103002009', + parentCode: '430103002', + levelType: 5, + name: '创远社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '创远社区', + parentPath: '430000,430100,430103,430103002,430103002009', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241431654400', + code: '430103002010', + parentCode: '430103002', + levelType: 5, + name: '楚湘社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '楚湘社区', + parentPath: '430000,430100,430103,430103002,430103002010', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241465208832', + code: '430103002011', + parentCode: '430103002', + levelType: 5, + name: '西湖社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '西湖社区', + parentPath: '430000,430100,430103,430103002,430103002011', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241502957568', + code: '430103002012', + parentCode: '430103002', + levelType: 5, + name: '登仁桥社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '登仁桥社区', + parentPath: '430000,430100,430103,430103002,430103002012', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, + { + id: '530840241553289216', + code: '430103002013', + parentCode: '430103002', + levelType: 5, + name: '文庙坪社区', + province: '湖南省', + city: '长沙市', + district: '天心区', + town: '坡子街街道', + village: '文庙坪社区', + parentPath: '430000,430100,430103,430103002,430103002013', + createTime: '2020-11-30 15:47:31', + updateTime: '2020-11-30 17:30:41', + customized: false, + usable: true, + }, +]; +export default [ + { + url: '/basic-api/cascader/getAreaRecord', + timeout: 1000, + method: 'post', + response: ({ body }) => { + const { parentCode } = body || {}; + if (!parentCode) { + return resultSuccess(areaList.filter((it) => it.code === '430000')); + } + return resultSuccess(areaList.filter((it) => it.parentCode === parentCode)); + }, + }, +] as MockMethod[]; diff --git a/apps/vue/mock/demo/select-demo.ts b/apps/vue/mock/demo/select-demo.ts new file mode 100644 index 000000000..631c6bb05 --- /dev/null +++ b/apps/vue/mock/demo/select-demo.ts @@ -0,0 +1,28 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { resultSuccess } from '../_util'; + +const demoList = (keyword, count = 20) => { + const result = { + list: [] as any[], + }; + for (let index = 0; index < count; index++) { + result.list.push({ + name: `${keyword ?? ''}选项${index}`, + id: `${index}`, + }); + } + return result; +}; + +export default [ + { + url: '/basic-api/select/getDemoOptions', + timeout: 1000, + method: 'get', + response: ({ query }) => { + const { keyword, count } = query; + console.log(keyword); + return resultSuccess(demoList(keyword, count)); + }, + }, +] as MockMethod[]; diff --git a/apps/vue/mock/demo/system.ts b/apps/vue/mock/demo/system.ts new file mode 100644 index 000000000..c41772736 --- /dev/null +++ b/apps/vue/mock/demo/system.ts @@ -0,0 +1,202 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { resultError, resultPageSuccess, resultSuccess } from '../_util'; + +const accountList = (() => { + const result: any[] = []; + for (let index = 0; index < 20; index++) { + result.push({ + id: `${index}`, + account: '@first', + email: '@email', + nickname: '@cname()', + role: '@first', + createTime: '@datetime', + remark: '@cword(10,20)', + 'status|1': ['0', '1'], + }); + } + return result; +})(); + +const roleList = (() => { + const result: any[] = []; + for (let index = 0; index < 4; index++) { + result.push({ + id: index + 1, + orderNo: `${index + 1}`, + roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index], + roleValue: '@first', + createTime: '@datetime', + remark: '@cword(10,20)', + menu: [['0', '1', '2'], ['0', '1'], ['0', '2'], ['2']][index], + 'status|1': ['0', '1'], + }); + } + return result; +})(); + +const deptList = (() => { + const result: any[] = []; + for (let index = 0; index < 3; index++) { + result.push({ + id: `${index}`, + deptName: ['华东分部', '华南分部', '西北分部'][index], + orderNo: index + 1, + createTime: '@datetime', + remark: '@cword(10,20)', + 'status|1': ['0', '0', '1'], + children: (() => { + const children: any[] = []; + for (let j = 0; j < 4; j++) { + children.push({ + id: `${index}-${j}`, + deptName: ['研发部', '市场部', '商务部', '财务部'][j], + orderNo: j + 1, + createTime: '@datetime', + remark: '@cword(10,20)', + 'status|1': ['0', '1'], + parentDept: `${index}`, + children: undefined, + }); + } + return children; + })(), + }); + } + return result; +})(); + +const menuList = (() => { + const result: any[] = []; + for (let index = 0; index < 3; index++) { + result.push({ + id: `${index}`, + icon: ['ion:layers-outline', 'ion:git-compare-outline', 'ion:tv-outline'][index], + component: 'LAYOUT', + type: '0', + menuName: ['Dashboard', '权限管理', '功能'][index], + permission: '', + orderNo: index + 1, + createTime: '@datetime', + 'status|1': ['0', '0', '1'], + children: (() => { + const children: any[] = []; + for (let j = 0; j < 4; j++) { + children.push({ + id: `${index}-${j}`, + type: '1', + menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j], + icon: 'ion:document', + permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index], + component: [ + '/dashboard/welcome/index', + '/dashboard/analysis/index', + '/dashboard/workbench/index', + '/dashboard/test/index', + ][j], + orderNo: j + 1, + createTime: '@datetime', + 'status|1': ['0', '1'], + parentMenu: `${index}`, + children: (() => { + const children: any[] = []; + for (let k = 0; k < 4; k++) { + children.push({ + id: `${index}-${j}-${k}`, + type: '2', + menuName: '按钮' + (j + 1) + '-' + (k + 1), + icon: '', + permission: + ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] + + ':btn' + + (k + 1), + component: [ + '/dashboard/welcome/index', + '/dashboard/analysis/index', + '/dashboard/workbench/index', + '/dashboard/test/index', + ][j], + orderNo: j + 1, + createTime: '@datetime', + 'status|1': ['0', '1'], + parentMenu: `${index}-${j}`, + children: undefined, + }); + } + return children; + })(), + }); + } + return children; + })(), + }); + } + return result; +})(); + +export default [ + { + url: '/basic-api/system/getAccountList', + timeout: 100, + method: 'get', + response: ({ query }) => { + const { page = 1, pageSize = 20 } = query; + return resultPageSuccess(page, pageSize, accountList); + }, + }, + { + url: '/basic-api/system/getRoleListByPage', + timeout: 100, + method: 'get', + response: ({ query }) => { + const { page = 1, pageSize = 20 } = query; + return resultPageSuccess(page, pageSize, roleList); + }, + }, + { + url: '/basic-api/system/setRoleStatus', + timeout: 500, + method: 'post', + response: ({ query }) => { + const { id, status } = query; + return resultSuccess({ id, status }); + }, + }, + { + url: '/basic-api/system/getAllRoleList', + timeout: 100, + method: 'get', + response: () => { + return resultSuccess(roleList); + }, + }, + { + url: '/basic-api/system/getDeptList', + timeout: 100, + method: 'get', + response: () => { + return resultSuccess(deptList); + }, + }, + { + url: '/basic-api/system/getMenuList', + timeout: 100, + method: 'get', + response: () => { + return resultSuccess(menuList); + }, + }, + { + url: '/basic-api/system/accountExist', + timeout: 500, + method: 'post', + response: ({ body }) => { + const { account } = body || {}; + if (account && account.indexOf('admin') !== -1) { + return resultError('该字段不能包含admin'); + } else { + return resultSuccess(`${account} can use`); + } + }, + }, +] as MockMethod[]; diff --git a/apps/vue/mock/demo/table-demo.ts b/apps/vue/mock/demo/table-demo.ts new file mode 100644 index 000000000..f3a0f16fd --- /dev/null +++ b/apps/vue/mock/demo/table-demo.ts @@ -0,0 +1,52 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { Random } from 'mockjs'; +import { resultPageSuccess } from '../_util'; + +function getRandomPics(count = 10): string[] { + const arr: string[] = []; + for (let i = 0; i < count; i++) { + arr.push(Random.image('800x600', Random.color(), Random.color(), Random.title())); + } + return arr; +} + +const demoList = (() => { + const result: any[] = []; + for (let index = 0; index < 200; index++) { + result.push({ + id: `${index}`, + beginTime: '@datetime', + endTime: '@datetime', + address: '@city()', + name: '@cname()', + name1: '@cname()', + name2: '@cname()', + name3: '@cname()', + name4: '@cname()', + name5: '@cname()', + name6: '@cname()', + name7: '@cname()', + name8: '@cname()', + avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()), + imgArr: getRandomPics(Math.ceil(Math.random() * 3) + 1), + imgs: getRandomPics(Math.ceil(Math.random() * 3) + 1), + date: `@date('yyyy-MM-dd')`, + time: `@time('HH:mm')`, + 'no|100000-10000000': 100000, + 'status|1': ['normal', 'enable', 'disable'], + }); + } + return result; +})(); + +export default [ + { + url: '/basic-api/table/getDemoList', + timeout: 100, + method: 'get', + response: ({ query }) => { + const { page = 1, pageSize = 20 } = query; + return resultPageSuccess(page, pageSize, demoList); + }, + }, +] as MockMethod[]; diff --git a/apps/vue/mock/demo/tree-demo.ts b/apps/vue/mock/demo/tree-demo.ts new file mode 100644 index 000000000..6fdcb8591 --- /dev/null +++ b/apps/vue/mock/demo/tree-demo.ts @@ -0,0 +1,38 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { resultSuccess } from '../_util'; + +const demoTreeList = (keyword) => { + const result = { + list: [] as Recordable[], + }; + for (let index = 0; index < 5; index++) { + const children: Recordable[] = []; + for (let j = 0; j < 3; j++) { + children.push({ + title: `${keyword ?? ''}选项${index}-${j}`, + value: `${index}-${j}`, + key: `${index}-${j}`, + }); + } + result.list.push({ + title: `${keyword ?? ''}选项${index}`, + value: `${index}`, + key: `${index}`, + children, + }); + } + return result; +}; + +export default [ + { + url: '/basic-api/tree/getDemoOptions', + timeout: 1000, + method: 'get', + response: ({ query }) => { + const { keyword } = query; + console.log(keyword); + return resultSuccess(demoTreeList(keyword)); + }, + }, +] as MockMethod[]; diff --git a/apps/vue/mock/sys/user.ts b/apps/vue/mock/sys/user.ts index 8b8989fa4..5b569d4d9 100644 --- a/apps/vue/mock/sys/user.ts +++ b/apps/vue/mock/sys/user.ts @@ -111,4 +111,12 @@ export default [ return resultSuccess(undefined, { message: 'Token has been destroyed' }); }, }, + { + url: '/basic-api/testRetry', + statusCode: 405, + method: 'get', + response: () => { + return resultError('Error!'); + }, + }, ] as MockMethod[]; diff --git a/apps/vue/package.json b/apps/vue/package.json index 07f614248..fc116b104 100644 --- a/apps/vue/package.json +++ b/apps/vue/package.json @@ -7,12 +7,13 @@ "url": "https://github.com/anncwb" }, "scripts": { - "bootstrap": "yarn install", + "commit": "czg", + "bootstrap": "pnpm install", "serve": "npm run dev", "dev": "vite", "build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", "build:test": "cross-env vite build --mode test && esno ./build/script/postBuild.ts", - "build:no-cache": "yarn clean:cache && npm run build", + "build:no-cache": "pnpm clean:cache && npm run build", "report": "cross-env REPORT=true npm run build", "type:check": "vue-tsc --noEmit --skipLibCheck", "preview": "npm run build && vite preview", @@ -23,124 +24,133 @@ "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", - "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", + "lint:lint-staged": "lint-staged", "test:unit": "jest", - "test:unit-coverage": "jest --coverage", "test:gzip": "npx http-server dist --cors --gzip -c-1", "test:br": "npx http-server dist --cors --brotli -c-1", - "reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run bootstrap", + "reinstall": "rimraf pnpm-lock.yaml && rimraf package.lock.json && rimraf node_modules && npm run bootstrap", "prepare": "husky install", "gen:icon": "esno ./build/generate/icon/index.ts" }, "dependencies": { "@ant-design/colors": "^6.0.0", - "@ant-design/icons-vue": "^6.0.1", - "@iconify/iconify": "^2.0.4", + "@ant-design/icons-vue": "^6.1.0", + "@iconify/iconify": "^2.2.1", + "@logicflow/core": "^1.1.13", + "@logicflow/extension": "^1.1.13", "@microsoft/signalr": "^6.0.0", - "@vueuse/core": "^6.7.4", - "@vueuse/shared": "^6.7.4", - "@zxcvbn-ts/core": "^1.0.0-beta.0", - "ant-design-vue": "2.2.8", - "axios": "^0.24.0", - "codemirror": "^5.62.2", + "@vue/runtime-core": "^3.2.33", + "@vue/shared": "^3.2.33", + "@vueuse/core": "^8.3.0", + "@vueuse/shared": "^8.3.0", + "@zxcvbn-ts/core": "^2.0.1", + "ant-design-vue": "^3.2.0", + "axios": "^0.26.1", + "codemirror": "^5.65.3", "cropperjs": "^1.5.12", "crypto-js": "^4.1.1", - "echarts": "^5.2.2", + "cz-git": "^1.3.9", + "czg": "^1.3.9", + "dayjs": "^1.11.1", + "echarts": "^5.3.2", + "intro.js": "^5.1.0", "lodash-es": "^4.17.21", "mockjs": "^1.1.0", - "moment": "^2.29.1", "nprogress": "^0.2.0", "oidc-client": "^1.11.5", "path-to-regexp": "^6.2.0", - "pinia": "2.0.0", - "qrcode": "^1.4.4", - "qs": "^6.10.1", + "pinia": "2.0.12", + "print-js": "^1.6.0", + "qrcode": "^1.5.0", + "qs": "^6.10.3", "resize-observer-polyfill": "^1.5.1", + "showdown": "^2.1.0", "simple-uploader.js": "^0.5.6", - "sortablejs": "^1.14.0", - "vue": "^3.2.21", + "sortablejs": "^1.15.0", + "tinymce": "^5.10.3", + "vditor": "^3.8.13", + "vue": "^3.2.33", + "vue-cookies": "^1.8.1", "vue-i18n": "^9.1.9", - "vue-json-pretty": "^1.8.1", - "vue-router": "^4.0.12", + "vue-json-pretty": "^2.0.6", + "vue-router": "^4.0.14", "vue-types": "^4.1.1", - "xlsx": "^0.17.3" + "xlsx": "^0.18.5" }, "devDependencies": { - "@commitlint/cli": "^14.1.0", - "@commitlint/config-conventional": "^14.1.0", - "@iconify/json": "^1.1.422", - "@purge-icons/generated": "^0.7.0", + "@commitlint/cli": "^16.2.3", + "@commitlint/config-conventional": "^16.2.1", + "@iconify/json": "^2.1.30", + "@purge-icons/generated": "^0.8.1", "@types/codemirror": "^5.60.5", - "@types/crypto-js": "^4.0.2", + "@types/crypto-js": "^4.1.1", "@types/fs-extra": "^9.0.13", - "@types/inquirer": "^8.1.3", + "@types/inquirer": "^8.2.1", "@types/intro.js": "^3.0.2", - "@types/jest": "^27.0.2", - "@types/lodash-es": "^4.17.5", - "@types/mockjs": "^1.0.4", - "@types/node": "^16.11.6", + "@types/lodash-es": "^4.17.6", + "@types/mockjs": "^1.0.6", + "@types/node": "^17.0.25", "@types/nprogress": "^0.2.0", - "@types/qrcode": "^1.4.1", + "@types/qrcode": "^1.4.2", "@types/qs": "^6.9.7", "@types/showdown": "^1.9.4", "@types/sortablejs": "^1.10.7", - "@typescript-eslint/eslint-plugin": "^5.3.0", - "@typescript-eslint/parser": "^5.3.0", - "@vitejs/plugin-legacy": "^1.6.2", - "@vitejs/plugin-vue": "^1.9.4", - "@vitejs/plugin-vue-jsx": "^1.2.0", - "@vue/compiler-sfc": "3.2.21", - "@vue/test-utils": "^2.0.0-rc.16", - "autoprefixer": "^10.4.0", + "@typescript-eslint/eslint-plugin": "^5.20.0", + "@typescript-eslint/parser": "^5.20.0", + "@vitejs/plugin-legacy": "^1.8.1", + "@vitejs/plugin-vue": "^2.3.1", + "@vitejs/plugin-vue-jsx": "^1.3.10", + "@vue/compiler-sfc": "^3.2.33", + "@vue/test-utils": "^2.0.0-rc.21", + "autoprefixer": "^10.4.4", "commitizen": "^4.2.4", - "conventional-changelog-cli": "^2.1.1", + "conventional-changelog-cli": "^2.2.2", "cross-env": "^7.0.3", - "dotenv": "^10.0.0", - "eslint": "^8.1.0", - "eslint-config-prettier": "^8.3.0", - "eslint-define-config": "^1.1.2", - "eslint-plugin-jest": "^25.2.2", + "dotenv": "^16.0.0", + "eslint": "^8.13.0", + "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^8.0.3", - "esno": "^0.10.1", - "fs-extra": "^10.0.0", + "eslint-plugin-vue": "^8.6.0", + "esno": "^0.14.1", + "fs-extra": "^10.1.0", "husky": "^7.0.4", - "inquirer": "^8.2.0", - "jest": "^27.3.1", + "inquirer": "^8.2.2", "less": "^4.1.2", - "lint-staged": "11.2.6", + "lint-staged": "12.3.7", "npm-run-all": "^4.1.5", - "postcss": "^8.3.11", - "postcss-html": "^1.2.0", - "postcss-less": "^5.0.0", - "prettier": "^2.4.1", + "picocolors": "^1.0.0", + "postcss": "^8.4.12", + "postcss-html": "^1.4.1", + "postcss-less": "^6.0.0", + "prettier": "^2.6.2", "rimraf": "^3.0.2", - "rollup-plugin-visualizer": "^5.5.2", - "stylelint": "^14.0.1", - "stylelint-config-html": "^1.0.0", + "rollup": "^2.70.2", + "rollup-plugin-visualizer": "^5.6.0", + "stylelint": "^14.7.1", "stylelint-config-prettier": "^9.0.3", - "stylelint-config-standard": "^23.0.0", + "stylelint-config-recommended": "^7.0.0", + "stylelint-config-recommended-vue": "^1.4.0", + "stylelint-config-standard": "^25.0.0", "stylelint-order": "^5.0.0", - "ts-jest": "^27.0.7", - "ts-node": "^10.4.0", - "typescript": "^4.4.4", - "vite": "^2.6.13", - "vite-plugin-compression": "^0.3.5", - "vite-plugin-html": "^2.1.1", - "vite-plugin-imagemin": "^0.4.6", + "ts-node": "^10.7.0", + "typescript": "^4.6.3", + "vite": "^2.9.5", + "vite-plugin-compression": "^0.5.1", + "vite-plugin-html": "^3.2.0", + "vite-plugin-imagemin": "^0.6.1", + "vite-plugin-mkcert": "^1.6.0", "vite-plugin-mock": "^2.9.6", - "vite-plugin-purge-icons": "^0.7.0", - "vite-plugin-pwa": "^0.11.3", - "vite-plugin-style-import": "^1.3.0", - "vite-plugin-svg-icons": "^1.0.5", - "vite-plugin-theme": "^0.8.1", - "vite-plugin-vue-setup-extend": "^0.1.0", - "vite-plugin-windicss": "^1.4.12", - "vue-eslint-parser": "^8.0.1", - "vue-tsc": "^0.28.10" + "vite-plugin-purge-icons": "^0.8.1", + "vite-plugin-pwa": "^0.11.13", + "vite-plugin-style-import": "^2.0.0", + "vite-plugin-svg-icons": "^2.0.1", + "vite-plugin-theme": "^0.8.6", + "vite-plugin-vue-setup-extend": "^0.4.0", + "vite-plugin-windicss": "^1.8.4", + "vue-eslint-parser": "^8.3.0", + "vue-tsc": "^0.33.9" }, "resolutions": { - "//": "Used to install imagemin dependencies, because imagemin may not be installed in China. If it is abroad, you can delete it", "bin-wrapper": "npm:bin-wrapper-china", "rollup": "^2.56.3", "gifsicle": "5.2.0" @@ -156,5 +166,34 @@ "homepage": "https://github.com/anncwb/vue-vben-admin", "engines": { "node": "^12 || >=14" + }, + "lint-staged": { + "*.{js,jsx,ts,tsx}": [ + "eslint --fix", + "prettier --write" + ], + "{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [ + "prettier --write--parser json" + ], + "package.json": [ + "prettier --write" + ], + "*.vue": [ + "eslint --fix", + "prettier --write", + "stylelint --fix" + ], + "*.{scss,less,styl,html}": [ + "stylelint --fix", + "prettier --write" + ], + "*.md": [ + "prettier --write" + ] + }, + "config": { + "commitizen": { + "path": "node_modules/cz-git" + } } } diff --git a/apps/vue/src/App.vue b/apps/vue/src/App.vue index f8df489e3..f4fab182c 100644 --- a/apps/vue/src/App.vue +++ b/apps/vue/src/App.vue @@ -12,6 +12,7 @@ import { useTitle } from '/@/hooks/web/useTitle'; import { useLocale } from '/@/locales/useLocale'; + import 'dayjs/locale/zh-cn'; // support Multi-language const { getAntdLocale } = useLocale(); diff --git a/apps/vue/src/api/account/accounts.ts b/apps/vue/src/api/account/accounts.ts index cbfc7cde6..eed2096fe 100644 --- a/apps/vue/src/api/account/accounts.ts +++ b/apps/vue/src/api/account/accounts.ts @@ -1,14 +1,18 @@ import { defAbpHttp } from '/@/utils/http/abp'; import { Register, PhoneRegister, PhoneResetPassword } from './model/accountsModel'; import { User } from '/@/api/identity/model/userModel'; +import { ListResultDto } from '../model/baseModel'; +import { format } from '/@/utils/strings'; enum Api { Register = '/api/account/register', RegisterByPhone = '/api/account/phone/register', ResetPassword = '/api/account/phone/reset-password', + SendEmailSignCode = '/api/account/email/send-signin-code', SendPhoneSignCode = '/api/account/phone/send-signin-code', SendPhoneRegisterCode = '/api/account/phone/send-register-code', SendPhoneResetPasswordCode = '/api/account/phone/send-password-reset-code', + GetTwoFactorProviders = '/api/account/two-factor-providers?userId={userId}', } export const register = (input: Register) => { @@ -41,6 +45,15 @@ export const sendPhoneSignCode = (phoneNumber: string) => { }); }; +export const sendEmailSignCode = (emailAddress: string) => { + return defAbpHttp.post({ + url: Api.SendEmailSignCode, + data: { + emailAddress: emailAddress, + }, + }); +}; + export const sendPhoneRegisterCode = (phoneNumber: string) => { return defAbpHttp.post({ url: Api.SendPhoneRegisterCode, @@ -58,3 +71,9 @@ export const sendPhoneResetPasswordCode = (phoneNumber: string) => { }, }); }; + +export const getTwoFactorProviders = (userId: string) => { + return defAbpHttp.get>>({ + url: format(Api.GetTwoFactorProviders, { userId: userId }), + }); +} diff --git a/apps/vue/src/api/account/model/profilesModel.ts b/apps/vue/src/api/account/model/profilesModel.ts index b29236c2e..6f3f8b912 100644 --- a/apps/vue/src/api/account/model/profilesModel.ts +++ b/apps/vue/src/api/account/model/profilesModel.ts @@ -28,3 +28,10 @@ export interface ChangePhoneNumber { export interface TwoFactorEnabled { enabled: boolean; } + +export interface SendEmailConfirmCode { + email: string; + appName: string; + returnUrl?: string; + returnUrlHash?: string; +} diff --git a/apps/vue/src/api/account/profiles.ts b/apps/vue/src/api/account/profiles.ts index e33976f03..e73d1ecbe 100644 --- a/apps/vue/src/api/account/profiles.ts +++ b/apps/vue/src/api/account/profiles.ts @@ -5,6 +5,7 @@ import { ChangePassword, ChangePhoneNumber, TwoFactorEnabled, + SendEmailConfirmCode, } from './model/profilesModel'; enum Api { @@ -15,6 +16,7 @@ enum Api { ChangePhoneNumber = '/api/account/my-profile/change-phone-number', GetTwoFactorEnabled = '/api/account/my-profile/two-factor', ChangeTwoFactorEnabled = '/api/account/my-profile/change-two-factor', + SendEmailConfirmLink = '/api/account/my-profile/send-email-confirm-link', } export const get = () => { @@ -37,8 +39,15 @@ export const changePassword = (input: ChangePassword) => { }); }; +export const sendEmailConfirmLink = (input: SendEmailConfirmCode) => { + return defAbpHttp.post({ + url: Api.SendEmailConfirmLink, + data: input, + }); +}; + export const sendChangePhoneNumberCode = (phoneNumber: string) => { - return defAbpHttp.put({ + return defAbpHttp.post({ url: Api.SendChangePhoneNumberCode, data: { newPhoneNumber: phoneNumber, diff --git a/apps/vue/src/api/api-gateway/aggregate.ts b/apps/vue/src/api/api-gateway/aggregate.ts deleted file mode 100644 index d112d1e77..000000000 --- a/apps/vue/src/api/api-gateway/aggregate.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { defAbpHttp } from '/@/utils/http/abp'; -import { - AggregateRoute, - CreateAggregateRoute, - CreateAggregateRouteConfig, - UpdateAggregateRoute, - GetAggregateRoutePagedRequest, - AggregateRoutePagedResult, -} from './model/aggregateModel'; -import { format } from '/@/utils/strings'; - -enum Api { - RemoteService = 'ApiGateway', - Controller = 'AggregateReRoute', - GetById = '/api/ApiGateway/Aggregates/{routeId}', - GetList = '/api/ApiGateway/Globals', - GetActivedList = '/api/ApiGateway/RouteGroups/Actived', -} - -export const create = (input: CreateAggregateRoute) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'CreateAsync', - data: input, - }); -}; - -export const createConfig = (input: CreateAggregateRouteConfig) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'AddRouteConfigAsync', - data: input, - }); -}; - -export const deleteById = (routeId: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'DeleteAsync', - params: { - input: { - RouteId: routeId, - }, - }, - }); -}; - -export const deleteConfig = (routeId: string, routeKey: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'DeleteAsync', - params: { - input: { - RouteId: routeId, - ReRouteKey: routeKey, - }, - }, - }); -}; - -export const getById = (id: string) => { - return defAbpHttp.get({ - url: format(Api.GetById, { routeId: id }), - }); -}; - -export const getList = (input: GetAggregateRoutePagedRequest) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'GetPagedListAsync', - params: { - input: input, - }, - }); -}; - -export const update = (input: UpdateAggregateRoute) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'UpdateAsync', - data: input, - }); -}; diff --git a/apps/vue/src/api/api-gateway/basic.ts b/apps/vue/src/api/api-gateway/basic.ts deleted file mode 100644 index 7666b7aea..000000000 --- a/apps/vue/src/api/api-gateway/basic.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { defAbpHttp } from '/@/utils/http/abp'; -import { LoadBalancerDescriptor } from './model/basicModel'; -import { ListResultDto } from '../model/baseModel'; - -enum Api { - GetLoadBalancerProviders = '/api/ApiGateway/Basic/LoadBalancers', - GetDefinedAggregatorProvicers = '/api/ApiGateway/Basic/Aggregators', -} - -export const getLoadBalancerProviders = () => { - return defAbpHttp.get>({ - url: Api.GetLoadBalancerProviders, - }); -}; - -export async function getDefinedAggregatorProviders() { - const { items } = await defAbpHttp.get>({ - url: Api.GetDefinedAggregatorProvicers, - }); - // 需要对返回格式转换以适配 ApiSelect组件 - return items.map((item) => { - return { - provider: item, - }; - }); -} diff --git a/apps/vue/src/api/api-gateway/global.ts b/apps/vue/src/api/api-gateway/global.ts deleted file mode 100644 index bcc92bcc2..000000000 --- a/apps/vue/src/api/api-gateway/global.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { defAbpHttp } from '/@/utils/http/abp'; -import { - GlobalConfiguration, - CreateGlobalConfiguration, - UpdateGlobalConfiguration, - GetGlobalPagedRequest, - GlobalConfigurationPagedResult, -} from './model/globalModel'; - -enum Api { - RemoteService = 'ApiGateway', - Controller = 'GlobalConfiguration', - GetList = '/api/ApiGateway/Globals', - GetActivedList = '/api/ApiGateway/RouteGroups/Actived', -} - -export const create = (input: CreateGlobalConfiguration) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'CreateAsync', - data: input, - }); -}; - -export const update = (input: UpdateGlobalConfiguration) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'UpdateAsync', - data: input, - }); -}; - -export const getByAppId = (appId: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'GetAsync', - params: { - input: { - appId: appId, - }, - }, - }); -}; - -export const getList = (input: GetGlobalPagedRequest) => { - return defAbpHttp.get({ - url: Api.GetList, - params: input, - }); -}; - -export const deleteByAppId = (appId: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'DeleteAsync', - params: { - input: { - appId: appId, - }, - }, - }); -}; diff --git a/apps/vue/src/api/api-gateway/group.ts b/apps/vue/src/api/api-gateway/group.ts deleted file mode 100644 index 53f058619..000000000 --- a/apps/vue/src/api/api-gateway/group.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { defAbpHttp } from '/@/utils/http/abp'; -import { - RouteGroup, - CreateRouteGroup, - UpdateRouteGroup, - RouteGroupListResult, - GetRouteGroupPagedRequest, - RouteGroupPagedResult, -} from './model/groupModel'; - -enum Api { - RemoteService = 'ApiGateway', - Controller = 'RouteGroup', - GetList = '/api/ApiGateway/RouteGroups', - GetActivedList = '/api/ApiGateway/RouteGroups/Actived', -} - -export const create = (input: CreateRouteGroup) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'CreateAsync', - data: input, - }); -}; - -export const update = (input: UpdateRouteGroup) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'UpdateAsync', - data: input, - }); -}; - -export const getByAppId = (appId: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'GetAsync', - params: { - input: { - appId: appId, - }, - }, - }); -}; - -export const getActivedList = () => { - return defAbpHttp.get({ - url: Api.GetList, - }); -}; - -export const getList = (input: GetRouteGroupPagedRequest) => { - return defAbpHttp.get({ - url: Api.GetList, - params: input, - }); -}; - -export const deleteByAppId = (appId: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'DeleteAsync', - params: { - input: { - appId: appId, - }, - }, - }); -}; diff --git a/apps/vue/src/api/api-gateway/model/aggregateModel.ts b/apps/vue/src/api/api-gateway/model/aggregateModel.ts deleted file mode 100644 index e20df54ea..000000000 --- a/apps/vue/src/api/api-gateway/model/aggregateModel.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { PagedAndSortedResultRequestDto, PagedResultDto } from '../../model/baseModel'; - -export class AggregateRouteConfig { - reRouteKey = ''; - parameter = ''; - jsonPath = ''; -} - -export class CreateAggregateRouteConfig extends AggregateRouteConfig { - routeId = ''; -} - -export class AggregateRouteBase { - reRouteKeys: string[] = []; - upstreamPathTemplate = ''; - upstreamHost = ''; - reRouteIsCaseSensitive = true; - aggregator = ''; - priority?: number; - upstreamHttpMethod: string[] = []; -} - -export class AggregateRoute extends AggregateRouteBase { - appId = ''; - name = ''; - reRouteId = ''; - concurrencyStamp = ''; - reRouteKeysConfig: AggregateRouteConfig[] = []; -} - -export class CreateAggregateRoute extends AggregateRouteBase { - appId = ''; - name = ''; -} - -export class UpdateAggregateRoute extends AggregateRouteBase { - routeId = ''; - concurrencyStamp = ''; -} - -export class GetAggregateRoutePagedRequest extends PagedAndSortedResultRequestDto { - appId = ''; - filter = ''; -} - -export class AggregateRoutePagedResult extends PagedResultDto {} diff --git a/apps/vue/src/api/api-gateway/model/basicModel.ts b/apps/vue/src/api/api-gateway/model/basicModel.ts deleted file mode 100644 index ec7bc33ba..000000000 --- a/apps/vue/src/api/api-gateway/model/basicModel.ts +++ /dev/null @@ -1,80 +0,0 @@ -export class ServiceDiscoveryProvider { - host!: string; - port?: number; - type!: string; - token?: string; - configurationKey?: string; - pollingInterval?: number; - namespace?: string; - scheme?: string; -} - -export class RateLimitOptions { - clientIdHeader?: string; - httpStatusCode?: number; - quotaExceededMessage?: string; - rateLimitCounterPrefix?: string; - disableRateLimitHeaders!: boolean; -} - -export class RateLimitRuleOptions { - clientWhitelist?: string[] = []; - enableRateLimiting!: boolean; - period?: string; - periodTimespan?: boolean; - limit?: number; -} - -export class QoSOptions { - timeoutValue?: number = 10000; - durationOfBreak?: number = 60000; - exceptionsAllowedBeforeBreaking?: number = 50; -} - -export class LoadBalancerOptions { - type?: string = ''; - key?: string = ''; - expiry?: number = 0; -} - -export class HostAndPort { - host = ''; - port?: number = 80; -} - -export class HttpHandlerOptions { - useProxy = false; - useTracing = false; - allowAutoRedirect = false; - useCookieContainer = false; - maxConnectionsPerServer?: number = 0; -} - -export class FileCacheOptions { - ttlSeconds?: number = 0; - region?: string = ''; -} - -export class AuthenticationOptions { - authenticationProviderKey?: string = ''; - allowedScopes?: string[] = []; -} - -export class SecurityOptions { - ipAllowedList?: string[] = []; - ipBlockedList?: string[] = []; -} - -export class LoadBalancerDescriptor { - type!: string; - displayName!: string; -} - -export const HttpMethods: { [key: string]: string } = { - ['GET']: 'blue', - ['POST']: 'green', - ['PUT']: 'orange', - ['DELETE']: 'red', - ['OPTIONS']: 'cyan', - ['PATCH']: 'pink', -}; diff --git a/apps/vue/src/api/api-gateway/model/globalModel.ts b/apps/vue/src/api/api-gateway/model/globalModel.ts deleted file mode 100644 index b28305d8e..000000000 --- a/apps/vue/src/api/api-gateway/model/globalModel.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { PagedAndSortedResultRequestDto, PagedResultDto } from '../../model/baseModel'; -import { - HttpHandlerOptions, - LoadBalancerOptions, - QoSOptions, - RateLimitOptions, - ServiceDiscoveryProvider, -} from './basicModel'; - -export class GlobalConfigurationBase { - baseUrl = ''; - requestIdKey?: string = ''; - downstreamScheme?: string = ''; - downstreamHttpVersion?: string = ''; - qoSOptions!: QoSOptions; - rateLimitOptions!: RateLimitOptions; - httpHandlerOptions!: HttpHandlerOptions; - loadBalancerOptions!: LoadBalancerOptions; - serviceDiscoveryProvider!: ServiceDiscoveryProvider; -} - -export class GlobalConfiguration extends GlobalConfigurationBase { - appId!: string; - itemId!: string; -} - -export class CreateGlobalConfiguration extends GlobalConfigurationBase { - appId = ''; -} - -export class UpdateGlobalConfiguration extends GlobalConfigurationBase { - itemId!: string; -} - -export class GetGlobalPagedRequest extends PagedAndSortedResultRequestDto { - filter = ''; -} - -export class GlobalConfigurationPagedResult extends PagedResultDto {} diff --git a/apps/vue/src/api/api-gateway/model/groupModel.ts b/apps/vue/src/api/api-gateway/model/groupModel.ts deleted file mode 100644 index a4ea71765..000000000 --- a/apps/vue/src/api/api-gateway/model/groupModel.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - FullAuditedEntityDto, - ListResultDto, - PagedAndSortedResultRequestDto, - PagedResultDto, -} from '../../model/baseModel'; - -export class RouteGroup extends FullAuditedEntityDto { - id!: string; - name!: string; - appId!: string; - appName!: string; - appIpAddress?: string; - description?: string; - isActive!: boolean; -} - -export class CreateOrUpdateRouteGroup { - name = ''; - appId = ''; - appName = ''; - isActive = true; - appIpAddress?: string = ''; - description?: string = ''; -} - -export class CreateRouteGroup extends CreateOrUpdateRouteGroup {} - -export class UpdateRouteGroup extends CreateOrUpdateRouteGroup {} - -export class GetRouteGroupPagedRequest extends PagedAndSortedResultRequestDto { - filter = ''; - sorting = 'AppId'; -} - -export class RouteGroupPagedResult extends PagedResultDto {} - -export class RouteGroupListResult extends ListResultDto {} diff --git a/apps/vue/src/api/api-gateway/model/routeModel.ts b/apps/vue/src/api/api-gateway/model/routeModel.ts deleted file mode 100644 index 908f47791..000000000 --- a/apps/vue/src/api/api-gateway/model/routeModel.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { PagedAndSortedResultRequestDto, PagedResultDto } from '../../model/baseModel'; -import { - AuthenticationOptions, - FileCacheOptions, - HostAndPort, - HttpHandlerOptions, - LoadBalancerOptions, - QoSOptions, - RateLimitRuleOptions, - SecurityOptions, -} from './basicModel'; - -export class RouteBase { - reRouteName = ''; // TODO: 需要修改名称 - downstreamPathTemplate = ''; - changeDownstreamPathTemplate?: { [key: string]: string }; - upstreamPathTemplate = ''; - upstreamHttpMethod!: string[]; - addHeadersToRequest?: { [key: string]: string }; - upstreamHeaderTransform?: { [key: string]: string }; - downstreamHeaderTransform?: { [key: string]: string }; - addClaimsToRequest?: { [key: string]: string }; - routeClaimsRequirement?: { [key: string]: string }; - addQueriesToRequest?: { [key: string]: string }; - requestIdKey? = ''; - reRouteIsCaseSensitive? = true; - serviceName? = ''; - serviceNamespace? = ''; - downstreamScheme? = 'HTTP'; - downstreamHostAndPorts!: HostAndPort[]; - upstreamHost = ''; - key? = ''; - delegatingHandlers?: string[]; - priority? = 0; - timeout? = 30000; - dangerousAcceptAnyServerCertificateValidator?: boolean = true; - downstreamHttpVersion? = ''; - downstreamHttpMethod? = ''; - securityOptions?: SecurityOptions; - qoSOptions?: QoSOptions; - rateLimitOptions?: RateLimitRuleOptions; - loadBalancerOptions?: LoadBalancerOptions; - fileCacheOptions?: FileCacheOptions; - authenticationOptions?: AuthenticationOptions; - httpHandlerOptions?: HttpHandlerOptions; -} - -export class Route extends RouteBase { - id!: number; - appId!: string; - reRouteId!: string; - concurrencyStamp!: string; -} - -export class CreateRoute extends RouteBase { - appId = ''; -} - -export class UpdateRoute extends RouteBase { - reRouteId = ''; - concurrencyStamp!: string; -} - -export class GetRoutePagedRequest extends PagedAndSortedResultRequestDto { - appId!: string; - filter = ''; - sorting = 'ReRouteName'; -} - -export class RoutePagedResult extends PagedResultDto {} diff --git a/apps/vue/src/api/api-gateway/route.ts b/apps/vue/src/api/api-gateway/route.ts deleted file mode 100644 index 104438945..000000000 --- a/apps/vue/src/api/api-gateway/route.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { defAbpHttp } from '/@/utils/http/abp'; -import { - Route, - CreateRoute, - UpdateRoute, - GetRoutePagedRequest, - RoutePagedResult, -} from './model/routeModel'; - -enum Api { - RemoteService = 'ApiGateway', - Controller = 'ReRoute', - GetList = '/api/ApiGateway/Globals', - GetActivedList = '/api/ApiGateway/RouteGroups/Actived', -} - -export const create = (input: CreateRoute) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'CreateAsync', - data: input, - }); -}; - -export const deleteById = (id: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'DeleteAsync', - params: { - input: { - RouteId: id, - }, - }, - }); -}; - -export const getById = (id: string) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'GetAsync', - params: { - input: { - RouteId: id, - }, - }, - }); -}; - -export const getList = (input: GetRoutePagedRequest) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'GetListAsync', - params: { - input: input, - }, - }); -}; - -export const update = (input: UpdateRoute) => { - return defAbpHttp.request({ - service: Api.RemoteService, - controller: Api.Controller, - action: 'UpdateAsync', - data: input, - }); -}; diff --git a/apps/vue/src/api/caching-management/cache/index.ts b/apps/vue/src/api/caching-management/cache/index.ts new file mode 100644 index 000000000..fcfaa16c3 --- /dev/null +++ b/apps/vue/src/api/caching-management/cache/index.ts @@ -0,0 +1,56 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + CacheKeys, + CacheValue, + CacheRefreshRequest, + GetCacheKeysRequest, +} from './model'; + +const remoteServiceName = 'CachingManagement'; +const controllerName = 'Cache'; + +export const getKeys = (input: GetCacheKeysRequest) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetKeysAsync', + params: { + input: input, + }, + }); +}; + +export const getValue = (key: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetValueAsync', + params: { + input: { + key: key, + } + }, + }); +}; + +export const refresh = (input: CacheRefreshRequest) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'RefreshAsync', + data: input, + }); +}; + +export const remove = (key: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'RemoveAsync', + params: { + input: { + key: key, + } + }, + }); +}; diff --git a/apps/vue/src/api/caching-management/cache/model/index.ts b/apps/vue/src/api/caching-management/cache/model/index.ts new file mode 100644 index 000000000..423851bf8 --- /dev/null +++ b/apps/vue/src/api/caching-management/cache/model/index.ts @@ -0,0 +1,23 @@ +export interface CacheKeys { + nextMarker: string; + keys: string[], +} + +export interface CacheValue { + type: string; + size: number; + expiration?: Date; + values: {[key:string]: any}; +} + +export interface CacheRefreshRequest { + key: string; + absoluteExpiration?: Date; + slidingExpiration?: Date; +} + +export interface GetCacheKeysRequest { + prefix?: string; + marker?: string; + filter?: string; +} diff --git a/apps/vue/src/api/demo/error.ts b/apps/vue/src/api/demo/error.ts deleted file mode 100644 index 3ce607217..000000000 --- a/apps/vue/src/api/demo/error.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { defHttp } from '/@/utils/http/axios'; - -enum Api { - // The address does not exist - Error = '/error', -} - -/** - * @description: Trigger ajax error - */ - -export const fireErrorApi = () => defHttp.get({ url: Api.Error }); diff --git a/apps/vue/src/api/identity/model/claimModel.ts b/apps/vue/src/api/identity/model/claimModel.ts index 8675f4df2..ee5988598 100644 --- a/apps/vue/src/api/identity/model/claimModel.ts +++ b/apps/vue/src/api/identity/model/claimModel.ts @@ -45,3 +45,19 @@ export class GetIdentityClaimTypePagedRequest extends PagedAndSortedResultReques export class IdentityClaimTypeListResult extends ListResultDto {} export class IdentityClaimTypePagedResult extends PagedResultDto {} + +export class IdentityClaim { + claimType = ''; + claimValue = ''; +} + +export class DeleteIdentityClaim { + claimType = ''; + claimValue = ''; +} + +export class CreateIdentityClaim extends IdentityClaim {} + +export class UpdateIdentityClaim extends IdentityClaim { + newClaimValue!: string; +} diff --git a/apps/vue/src/api/identity/model/roleModel.ts b/apps/vue/src/api/identity/model/roleModel.ts index b6feca7a8..cc00a93e5 100644 --- a/apps/vue/src/api/identity/model/roleModel.ts +++ b/apps/vue/src/api/identity/model/roleModel.ts @@ -3,6 +3,7 @@ import { PagedAndSortedResultRequestDto, PagedResultDto, } from '../../model/baseModel'; +import { IdentityClaim } from './claimModel'; export class RoleBase { name!: string; @@ -38,23 +39,7 @@ export class ChangeRoleOrganizationUnitDto { organizationUnitIds: string[] = []; } -export class RoleClaimBase { - claimType = ''; - claimValue = ''; -} - -export class DeleteRoleClaim { - claimType = ''; - claimValue = ''; -} - -export class CreateRoleClaim extends RoleClaimBase {} - -export class UpdateRoleClaim extends RoleClaimBase { - newClaimValue!: string; -} - -export class RoleClaim extends RoleClaimBase { +export class RoleClaim extends IdentityClaim { id!: string; } diff --git a/apps/vue/src/api/identity/model/userModel.ts b/apps/vue/src/api/identity/model/userModel.ts index 6db28b79e..eee5c67fd 100644 --- a/apps/vue/src/api/identity/model/userModel.ts +++ b/apps/vue/src/api/identity/model/userModel.ts @@ -5,6 +5,7 @@ import { PagedAndSortedResultRequestDto, PagedResultDto, } from '../../model/baseModel'; +import { IdentityClaim } from './claimModel'; /** 用户对象接口 */ export interface IUser { @@ -29,6 +30,10 @@ export interface ChangePassword { newPassword: string; } +export interface SetPassword { + password: string; +} + /** 用户对象 */ export class User extends FullAuditedEntityDto implements IUser { /** 用户名 */ @@ -96,18 +101,7 @@ export class GetUserPagedRequest extends PagedAndSortedResultRequestDto { export class UserPagedResult extends PagedResultDto {} -export class UserClaimBase { - claimType = ''; - claimValue = ''; -} - -export class CreateUserClaim extends UserClaimBase {} - -export class UpdateUserClaim extends UserClaimBase { - newClaimValue!: string; -} - -export class UserClaim extends UserClaimBase { +export class UserClaim extends IdentityClaim { id!: string; } diff --git a/apps/vue/src/api/identity/organization-units.ts b/apps/vue/src/api/identity/organization-units.ts index a1ff35631..1630ced15 100644 --- a/apps/vue/src/api/identity/organization-units.ts +++ b/apps/vue/src/api/identity/organization-units.ts @@ -15,8 +15,8 @@ enum Api { Create = '/api/identity/organization-units', Delete = '/api/identity/organization-units/{id}', Update = '/api/identity/organization-units/{id}', - GetById = '/api/identity/organization-units​/{id}', - GetList = '/api​/identity​/organization-units​', + GetById = '/api/identity/organization-units/{id}', + GetList = '/api/identity/organization-units', GetAllList = '/api/identity/organization-units/all', GetUnaddedMemberList = '/api/identity/organization-units/{id}/unadded-users', GetMemberList = '/api/identity/organization-units/{id}/users', @@ -47,6 +47,12 @@ export const deleteById = (id: string) => { }); }; +export const get = (id: string) => { + return defAbpHttp.get({ + url: format(Api.GetById, { id: id }), + }); +} + export const getList = (input: GetOrganizationUnitPagedRequest) => { return defAbpHttp.get({ url: Api.GetList, diff --git a/apps/vue/src/api/identity/role.ts b/apps/vue/src/api/identity/role.ts index ca19a2bbc..fc352e0af 100644 --- a/apps/vue/src/api/identity/role.ts +++ b/apps/vue/src/api/identity/role.ts @@ -6,21 +6,20 @@ import { RolePagedResult, UpdateRole, CreateRole, - CreateRoleClaim, RoleClaimListResult, - UpdateRoleClaim, RoleClaim, } from './model/roleModel'; import { format } from '/@/utils/strings'; +import { CreateIdentityClaim, UpdateIdentityClaim } from './model/claimModel'; enum Api { RemoteService = 'AbpIdentity', Controller = 'IdentityRole', Create = '/api/identity/roles', CreateClaim = '/api/identity/roles/{id}/claims', - DeleteClaim = '', + DeleteClaim = '/api/identity/roles/{id}/claims', Update = '/api/identity/roles/{id}', - UpdateClaim = '', + UpdateClaim = '/api/identity/roles/{id}/claims', GetById = '/api/identity/roles/{id}', GetAllList = '/api/identity/roles/all', GetClaimList = '/api/identity/roles/{id}/claims', @@ -36,7 +35,7 @@ export const create = (input: CreateRole) => { }); }; -export const createClaim = (id: string, input: CreateRoleClaim) => { +export const createClaim = (id: string, input: CreateIdentityClaim) => { return defAbpHttp.post({ url: format(Api.CreateClaim, { id: id }), data: input, @@ -50,9 +49,9 @@ export const update = (id: string, input: UpdateRole) => { }); }; -export const updateClaim = (id: string, input: UpdateRoleClaim) => { +export const updateClaim = (id: string, input: UpdateIdentityClaim) => { return defAbpHttp.put({ - url: format(Api.CreateClaim, { id: id }), + url: format(Api.UpdateClaim, { id: id }), data: input, }); }; diff --git a/apps/vue/src/api/identity/user.ts b/apps/vue/src/api/identity/user.ts index 8ea73dc2d..c7362826d 100644 --- a/apps/vue/src/api/identity/user.ts +++ b/apps/vue/src/api/identity/user.ts @@ -3,16 +3,15 @@ import { User, UserClaimListResult, CreateUser, - CreateUserClaim, - ChangePassword, + SetPassword, UpdateUser, GetUserPagedRequest, UserPagedResult, - UpdateUserClaim, UserClaim, } from './model/userModel'; import { RoleListResult } from './model/roleModel'; import { format } from '/@/utils/strings'; +import { CreateIdentityClaim, UpdateIdentityClaim } from './model/claimModel'; enum Api { Create = '/api/identity/users', @@ -40,14 +39,14 @@ export const create = (input: CreateUser) => { }); }; -export const createClaim = (id: string, input: CreateUserClaim) => { +export const createClaim = (id: string, input: CreateIdentityClaim) => { return defAbpHttp.post({ url: format(Api.CreateClaim, { id: id }), data: input, }); }; -export const changePassword = (id: string, input: ChangePassword) => { +export const changePassword = (id: string, input: SetPassword) => { return defAbpHttp.put({ url: Api.ChangePassword, data: input, @@ -116,7 +115,7 @@ export const update = (id: string, input: UpdateUser) => { }); }; -export const updateClaim = (id: string, input: UpdateUserClaim) => { +export const updateClaim = (id: string, input: UpdateIdentityClaim) => { return defAbpHttp.put({ url: format(Api.CreateClaim, { id: id }), data: input, diff --git a/apps/vue/src/api/localization/languages.ts b/apps/vue/src/api/localization/languages.ts index afc1a9c77..ee2971966 100644 --- a/apps/vue/src/api/localization/languages.ts +++ b/apps/vue/src/api/localization/languages.ts @@ -1,56 +1,12 @@ import { defAbpHttp } from '/@/utils/http/abp'; -import { - Language, - LanguageCreateOrUpdate, - GetLanguagePagedRequest, - LanguageListResult, - LanguagePagedResult, -} from './model/languagesModel'; -import { format } from '/@/utils/strings'; +import { LanguageListResult } from './model/languagesModel'; enum Api { - Create = '/api/localization/languages', - DeleteById = '/api/localization/languages/{id}', - GetById = '/api/localization/languages/{id}', - GetList = '/api/localization/languages', - GetAllList = '/api/localization/languages/all', + GetList = '/api/abp/localization/languages', } -export const get = (id: string) => { - return defAbpHttp.get({ - url: format(Api.GetById, { id: id }), - }); -}; - -export const create = (input: LanguageCreateOrUpdate) => { - return defAbpHttp.post({ - url: Api.Create, - data: input, - }); -}; - -export const deleteById = (id: string) => { - return defAbpHttp.delete({ - url: format(Api.GetById, { id: id }), - }); -}; - -export const update = (id: string, input: LanguageCreateOrUpdate) => { - return defAbpHttp.put({ - url: format(Api.GetById, { id: id }), - data: input, - }); -}; - -export const getList = (input: GetLanguagePagedRequest) => { - return defAbpHttp.get({ - url: Api.GetList, - params: input, - }); -}; - -export const getAll = () => { +export const getList = () => { return defAbpHttp.get({ - url: Api.GetAllList, + url: Api.GetList, }); }; diff --git a/apps/vue/src/api/localization/model/resourcesModel.ts b/apps/vue/src/api/localization/model/resourcesModel.ts index 6b2bb3e14..b5549032e 100644 --- a/apps/vue/src/api/localization/model/resourcesModel.ts +++ b/apps/vue/src/api/localization/model/resourcesModel.ts @@ -1,13 +1,10 @@ import { - AuditedEntityDto, ListResultDto, PagedAndSortedResultRequestDto, PagedResultDto, } from '/@/api/model/baseModel'; -export interface Resource extends AuditedEntityDto { - id: string; - enable: boolean; +export interface Resource { name: string; displayName: string; description: string; diff --git a/apps/vue/src/api/localization/model/textsModel.ts b/apps/vue/src/api/localization/model/textsModel.ts index e4121c488..1452057e6 100644 --- a/apps/vue/src/api/localization/model/textsModel.ts +++ b/apps/vue/src/api/localization/model/textsModel.ts @@ -1,7 +1,6 @@ -import { PagedAndSortedResultRequestDto, PagedResultDto } from '/@/api/model/baseModel'; +import { ListResultDto } from '/@/api/model/baseModel'; export interface Text { - id?: number; key: boolean; value: string; cultureName: string; @@ -9,7 +8,6 @@ export interface Text { } export interface TextDifference { - id: number; key: boolean; value: string; cultureName: string; @@ -18,19 +16,14 @@ export interface TextDifference { targetValue: string; } -export interface TextCreateOrUpdate { - value: string; -} - -export interface TextCreate extends TextCreateOrUpdate { +export interface SetTextInput { key: boolean; + value: string; cultureName: string; resourceName: string; } -export type TextUpdate = TextCreateOrUpdate; - -export class TextPagedResult extends PagedResultDto {} +export class TextListResult extends ListResultDto {} export interface GetTextByKey { key: boolean; @@ -38,7 +31,7 @@ export interface GetTextByKey { resourceName: string; } -export class GetTextPagedRequest extends PagedAndSortedResultRequestDto { +export class GetTextRequest { filter = ''; cultureName = ''; targetCultureName = ''; diff --git a/apps/vue/src/api/localization/resources.ts b/apps/vue/src/api/localization/resources.ts index 4f8e98a68..7c9b7db56 100644 --- a/apps/vue/src/api/localization/resources.ts +++ b/apps/vue/src/api/localization/resources.ts @@ -1,56 +1,12 @@ import { defAbpHttp } from '/@/utils/http/abp'; -import { - Resource, - ResourceCreateOrUpdate, - GetResourcePagedRequest, - ResourceListResult, - ResourcePagedResult, -} from './model/resourcesModel'; -import { format } from '/@/utils/strings'; +import { ResourceListResult } from './model/resourcesModel'; enum Api { - Create = '/api/localization/resources', - DeleteById = '/api/localization/resources/{id}', - GetById = '/api/localization/resources/{id}', - GetList = '/api/localization/resources', - GetAllList = '/api/localization/resources/all', + GetList = '/api/abp/localization/resources', } -export const get = (id: string) => { - return defAbpHttp.get({ - url: format(Api.GetById, { id: id }), - }); -}; - -export const create = (input: ResourceCreateOrUpdate) => { - return defAbpHttp.post({ - url: Api.Create, - data: input, - }); -}; - -export const deleteById = (id: string) => { - return defAbpHttp.delete({ - url: format(Api.GetById, { id: id }), - }); -}; - -export const update = (id: string, input: ResourceCreateOrUpdate) => { - return defAbpHttp.put({ - url: format(Api.GetById, { id: id }), - data: input, - }); -}; - -export const getList = (input: GetResourcePagedRequest) => { - return defAbpHttp.get({ - url: Api.GetList, - params: input, - }); -}; - -export const getAll = () => { +export const getList = () => { return defAbpHttp.get({ - url: Api.GetAllList, + url: Api.GetList, }); }; diff --git a/apps/vue/src/api/localization/texts.ts b/apps/vue/src/api/localization/texts.ts index 310d00ea3..487b5db6c 100644 --- a/apps/vue/src/api/localization/texts.ts +++ b/apps/vue/src/api/localization/texts.ts @@ -1,28 +1,18 @@ import { defAbpHttp } from '/@/utils/http/abp'; import { Text, - TextCreate, - TextUpdate, + SetTextInput, GetTextByKey, - GetTextPagedRequest, - TextPagedResult, + GetTextRequest, + TextListResult, } from './model/textsModel'; -import { format } from '/@/utils/strings'; enum Api { - Create = '/api/localization/texts', - DeleteById = '/api/localization/texts/{id}', - GetById = '/api/localization/texts/{id}', - GetList = '/api/localization/texts', - GetByCulture = '/api/localization/texts/by-culture-key', + SetText = '/api/localization/texts', + GetList = '/api/abp/localization/texts', + GetByCulture = '/api/abp/localization/texts/by-culture-key', } -export const get = (id: number) => { - return defAbpHttp.get({ - url: format(Api.GetById, { id: id }), - }); -}; - export const getByCulture = (input: GetTextByKey) => { return defAbpHttp.get({ url: Api.GetByCulture, @@ -30,28 +20,15 @@ export const getByCulture = (input: GetTextByKey) => { }); }; -export const create = (input: TextCreate) => { - return defAbpHttp.post({ - url: Api.Create, - data: input, - }); -}; - -export const deleteById = (id: string) => { - return defAbpHttp.delete({ - url: format(Api.GetById, { id: id }), - }); -}; - -export const update = (id: number, input: TextUpdate) => { +export const setText = (input: SetTextInput) => { return defAbpHttp.put({ - url: format(Api.GetById, { id: id }), + url: Api.SetText, data: input, }); }; -export const getList = (input: GetTextPagedRequest) => { - return defAbpHttp.get({ +export const getList = (input: GetTextRequest) => { + return defAbpHttp.get({ url: Api.GetList, params: input, }); diff --git a/apps/vue/src/api/messages/notifications.ts b/apps/vue/src/api/messages/notifications.ts index 80f0d035d..6bab1c12f 100644 --- a/apps/vue/src/api/messages/notifications.ts +++ b/apps/vue/src/api/messages/notifications.ts @@ -3,13 +3,34 @@ import { GetNotificationPagedRequest, NotificationPagedResult, NotificationGroupListResult, + NotificationReadState, } from './model/notificationsModel'; +import { format } from '/@/utils/strings'; enum Api { + GetById = '/api/my-notifilers/{id}', GetList = '/api/my-notifilers', GetAssignableNotifiers = '/api/my-notifilers/assignables', + Read = '/api/my-notifilers/{id}/read', + MarkReadState = '/api/my-notifilers/mark-read-state', } +export const markReadState = (ids: string[], state: NotificationReadState = NotificationReadState.Read) => { + return defHttp.put({ + url: Api.MarkReadState, + data: { + idList: ids, + state: state, + }, + }); +}; + +export const deleteById = (id: string) => { + return defHttp.delete({ + url: format(Api.GetById, { id: id }), + }); +}; + export const getList = (input: GetNotificationPagedRequest) => { return defHttp.get({ url: Api.GetList, diff --git a/apps/vue/src/api/multi-tenancy/models/tenantModel.ts b/apps/vue/src/api/multi-tenancy/models/tenantModel.ts index 7145179c6..2db8da259 100644 --- a/apps/vue/src/api/multi-tenancy/models/tenantModel.ts +++ b/apps/vue/src/api/multi-tenancy/models/tenantModel.ts @@ -40,4 +40,5 @@ export class FindTenantResult { name = ''; tenantId = ''; success = ''; + isActive = false; } diff --git a/apps/vue/src/api/openiddict/applications/index.ts b/apps/vue/src/api/openiddict/applications/index.ts new file mode 100644 index 000000000..fc3804c00 --- /dev/null +++ b/apps/vue/src/api/openiddict/applications/index.ts @@ -0,0 +1,71 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + OpenIddictApplicationDto, + OpenIddictApplicationCreateDto, + OpenIddictApplicationUpdateDto, + OpenIddictApplicationGetListInput, +} from './model'; +import { PagedResultDto } from '../../model/baseModel'; + +const remoteServiceName = 'AbpOpenIddict'; +const controllerName = 'OpenIddictApplication'; + +export const getById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAsync', + params: { + id: id, + }, + }); +}; + +export const getList = (input: OpenIddictApplicationGetListInput) => { + return defAbpHttp.get>({ + url: '/api/openiddict/applications', + params: input, + }, { + withToken: false + }); +}; + +// export const getList = (input: OpenIddictApplicationGetListInput) => { +// return defAbpHttp.pagedRequest({ +// service: remoteServiceName, +// controller: controllerName, +// action: 'GetListAsync', +// params: { +// input: input, +// }, +// }); +// }; + +export const deleteById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'DeleteAsync', + params: { + id: id, + }, + }); +}; + +export const create = (input: OpenIddictApplicationCreateDto) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'CreateAsync', + data: input, + }); +}; + +export const update = (input: OpenIddictApplicationUpdateDto) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'UpdateAsync', + data: input, + }); +}; diff --git a/apps/vue/src/api/openiddict/applications/model/index.ts b/apps/vue/src/api/openiddict/applications/model/index.ts new file mode 100644 index 000000000..9a1734089 --- /dev/null +++ b/apps/vue/src/api/openiddict/applications/model/index.ts @@ -0,0 +1,47 @@ +import { ExtensibleObject, ExtensibleAuditedEntity, PagedAndSortedResultRequestDto } from '../../../model/baseModel'; + +export interface OpenIddictApplicationDto extends ExtensibleAuditedEntity { + clientId: string; + clientSecret?: string; + consentType?: string; + displayName?: string; + displayNames?: {[key: string]: string}; + endpoints?: string[]; + grantTypes?: string[]; + responseTypes?: string[]; + scopes?: string[]; + postLogoutRedirectUris?: string[]; + properties?: {[key: string]: string}; + redirectUris?: string[]; + requirements?: string[]; + type?: string; + clientUri?: string; + logoUri?: string; +} + +export interface OpenIddictApplicationGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; +} + +interface OpenIddictApplicationCreateOrUpdateDto extends ExtensibleObject { + clientId: string; + clientSecret?: string; + consentType?: string; + displayName?: string; + displayNames?: {[key: string]: string}; + endpoints?: string[]; + grantTypes?: string[]; + responseTypes?: string[]; + scopes?: string[]; + postLogoutRedirectUris?: string[]; + properties?: {[key: string]: string}; + redirectUris?: string[]; + requirements?: string[]; + type?: string; + clientUri?: string; + logoUri?: string; +} + +export type OpenIddictApplicationCreateDto = OpenIddictApplicationCreateOrUpdateDto; + +export type OpenIddictApplicationUpdateDto = OpenIddictApplicationCreateOrUpdateDto; diff --git a/apps/vue/src/api/openiddict/authorizations/index.ts b/apps/vue/src/api/openiddict/authorizations/index.ts new file mode 100644 index 000000000..5560f078e --- /dev/null +++ b/apps/vue/src/api/openiddict/authorizations/index.ts @@ -0,0 +1,51 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + OpenIddictAuthorizationDto, + OpenIddictAuthorizationGetListInput, +} from './model'; +import { PagedResultDto } from '../../model/baseModel'; + +const remoteServiceName = 'AbpOpenIddict'; +const controllerName = 'OpenIddictAuthorization'; + +export const getById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAsync', + params: { + id: id, + }, + }); +}; + +// export const getList = (input: OpenIddictAuthorizationGetListInput) => { +// return defAbpHttp.pagedRequest({ +// service: remoteServiceName, +// controller: controllerName, +// action: 'GetListAsync', +// params: { +// input: input, +// }, +// }); +// }; + +export const getList = (input: OpenIddictAuthorizationGetListInput) => { + return defAbpHttp.get>({ + url: '/api/openiddict/authorizations', + params: input, + }, { + withToken: false + }); +}; + +export const deleteById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'DeleteAsync', + params: { + id: id, + }, + }); +}; diff --git a/apps/vue/src/api/openiddict/authorizations/model/index.ts b/apps/vue/src/api/openiddict/authorizations/model/index.ts new file mode 100644 index 000000000..41a62d119 --- /dev/null +++ b/apps/vue/src/api/openiddict/authorizations/model/index.ts @@ -0,0 +1,21 @@ +import { ExtensibleAuditedEntity, PagedAndSortedResultRequestDto } from '../../../model/baseModel'; + +export interface OpenIddictAuthorizationDto extends ExtensibleAuditedEntity { + applicationId?: string; + creationDate?: Date; + properties?: {[key: string]: string}; + scopes?: string[]; + type?: string; + status?: string; + subject?: string; +} + +export interface OpenIddictAuthorizationGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; + subject?: string; + clientId?: string; + status?: string; + type?: string; + beginCreationTime?: Date; + endCreationTime?: string; +} diff --git a/apps/vue/src/api/openiddict/scopes/index.ts b/apps/vue/src/api/openiddict/scopes/index.ts new file mode 100644 index 000000000..2811f623a --- /dev/null +++ b/apps/vue/src/api/openiddict/scopes/index.ts @@ -0,0 +1,61 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + OpenIddictScopeDto, + OpenIddictScopeCreateDto, + OpenIddictScopeUpdateDto, + OpenIddictScopeGetListInput, +} from './model'; + +const remoteServiceName = 'AbpOpenIddict'; +const controllerName = 'OpenIddictScope'; + +export const getById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAsync', + params: { + id: id, + }, + }); +}; + +export const getList = (input: OpenIddictScopeGetListInput) => { + return defAbpHttp.pagedRequest({ + service: remoteServiceName, + controller: controllerName, + action: 'GetListAsync', + params: { + input: input, + }, + }); +}; + +export const deleteById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'DeleteAsync', + params: { + id: id, + }, + }); +}; + +export const create = (input: OpenIddictScopeCreateDto) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'CreateAsync', + data: input, + }); +}; + +export const update = (input: OpenIddictScopeUpdateDto) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'UpdateAsync', + data: input, + }); +}; diff --git a/apps/vue/src/api/openiddict/scopes/model/index.ts b/apps/vue/src/api/openiddict/scopes/model/index.ts new file mode 100644 index 000000000..9b8de3ef7 --- /dev/null +++ b/apps/vue/src/api/openiddict/scopes/model/index.ts @@ -0,0 +1,29 @@ +import { ExtensibleObject, ExtensibleAuditedEntity, PagedAndSortedResultRequestDto } from '../../../model/baseModel'; + +export interface OpenIddictScopeDto extends ExtensibleAuditedEntity { + name: string; + displayName?: string; + displayNames?: {[key: string]: string}; + description?: string; + descriptions?: {[key: string]: string}; + properties?: {[key: string]: string}; + resources?: {[key: string]: string}; +} + +export interface OpenIddictScopeGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; +} + +interface OpenIddictScopeCreateOrUpdateDto extends ExtensibleObject { + name: string; + displayName?: string; + displayNames?: {[key: string]: string}; + description?: string; + descriptions?: {[key: string]: string}; + properties?: {[key: string]: string}; + resources?: {[key: string]: string}; +} + +export type OpenIddictScopeCreateDto = OpenIddictScopeCreateOrUpdateDto; + +export type OpenIddictScopeUpdateDto = OpenIddictScopeCreateOrUpdateDto; diff --git a/apps/vue/src/api/openiddict/tokens/index.ts b/apps/vue/src/api/openiddict/tokens/index.ts new file mode 100644 index 000000000..d7f53cc44 --- /dev/null +++ b/apps/vue/src/api/openiddict/tokens/index.ts @@ -0,0 +1,68 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + OpenIddictTokenDto, + OpenIddictTokenGetListInput, +} from './model'; +import { PagedResultDto } from '../../model/baseModel'; + +const remoteServiceName = 'AbpOpenIddict'; +const controllerName = 'OpenIddictToken'; + +// export const getById = (id: string) => { +// return defAbpHttp.request({ +// service: remoteServiceName, +// controller: controllerName, +// action: 'GetAsync', +// params: { +// id: id, +// }, +// }); +// }; + +export const getById = (id: string) => { + return defAbpHttp.get({ + url: `/api/openiddict/tokens/${id}`, + }, { + withToken: false + }); +}; + +// export const getList = (input: OpenIddictTokenGetListInput) => { +// return defAbpHttp.pagedRequest({ +// service: remoteServiceName, +// controller: controllerName, +// action: 'GetListAsync', +// params: { +// input: input, +// }, +// }); +// }; + +export const getList = (input: OpenIddictTokenGetListInput) => { + return defAbpHttp.get>({ + url: '/api/openiddict/tokens', + params: input, + }, { + withToken: false + }); +}; + + +// export const deleteById = (id: string) => { +// return defAbpHttp.request({ +// service: remoteServiceName, +// controller: controllerName, +// action: 'DeleteAsync', +// params: { +// id: id, +// }, +// }); +// }; + +export const deleteById = (id: string) => { + return defAbpHttp.delete({ + url: `/api/openiddict/tokens/${id}`, + }, { + withToken: false + }); +}; diff --git a/apps/vue/src/api/openiddict/tokens/model/index.ts b/apps/vue/src/api/openiddict/tokens/model/index.ts new file mode 100644 index 000000000..273740fac --- /dev/null +++ b/apps/vue/src/api/openiddict/tokens/model/index.ts @@ -0,0 +1,29 @@ +import { ExtensibleAuditedEntity, PagedAndSortedResultRequestDto } from '../../../model/baseModel'; + +export interface OpenIddictTokenDto extends ExtensibleAuditedEntity { + applicationId?: string; + authorizationId?: string; + creationDate?: Date; + expirationDate?: Date; + payload?: string; + properties?: string; + redemptionDate?: Date; + referenceId?: string; + type?: string; + status?: string; + subject?: string; +} + +export interface OpenIddictTokenGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; + clientId?: string; + authorizationId?: string; + subject?: string; + status?: string; + type?: string; + referenceId?: string; + beginCreationTime?: Date; + endCreationTime?: string; + beginExpirationDate?: Date; + endExpirationDate?: Date; +} diff --git a/apps/vue/src/api/sys/model/menuModel.ts b/apps/vue/src/api/sys/model/menuModel.ts index 72ac1d796..a4bd4b621 100644 --- a/apps/vue/src/api/sys/model/menuModel.ts +++ b/apps/vue/src/api/sys/model/menuModel.ts @@ -1,8 +1,7 @@ -import type { RouteMeta } from '/@/router/types'; +import type { RouteMeta } from 'vue-router'; export interface RouteItem { path: string; component: any; - components?: any; meta: RouteMeta; name?: string; alias?: string | string[]; diff --git a/apps/vue/src/api/sys/model/userModel.ts b/apps/vue/src/api/sys/model/userModel.ts index d4bb76900..ae40d20e8 100644 --- a/apps/vue/src/api/sys/model/userModel.ts +++ b/apps/vue/src/api/sys/model/userModel.ts @@ -4,6 +4,8 @@ export interface LoginParams { username: string; password: string; + twoFactorProvider?: string; + twoFactorCode?: string; } export interface LoginByPhoneParams { diff --git a/apps/vue/src/api/sys/user.ts b/apps/vue/src/api/sys/user.ts index 380d10994..7b4c4ae05 100644 --- a/apps/vue/src/api/sys/user.ts +++ b/apps/vue/src/api/sys/user.ts @@ -28,6 +28,8 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') grant_type: 'password', username: params.username, password: params.password, + TwoFactorProvider: params.twoFactorProvider, + TwoFactorCode: params.twoFactorCode, }; return defHttp.post( { diff --git a/apps/vue/src/api/task-management/backgroundJobAction.ts b/apps/vue/src/api/task-management/backgroundJobAction.ts new file mode 100644 index 000000000..eee7dee6e --- /dev/null +++ b/apps/vue/src/api/task-management/backgroundJobAction.ts @@ -0,0 +1,51 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + BackgroundJobAction, + BackgroundJobActionDefinition, + CreateBackgroundJobAction, + UpdateBackgroundJobAction, + BackgroundJobActionGetDefinitionsInput +} from './model/backgroundJobActionModel'; +import { format } from '/@/utils/strings'; +import { ListResultDto } from '../model/baseModel'; + +enum Api { + AddAction = '/api/task-management/background-jobs/actions/{jobId}', + UpdateAction = '/api/task-management/background-jobs/actions/{id}', + DeleteAction = '/api/task-management/background-jobs/actions/{id}', + GetActions = '/api/task-management/background-jobs/actions/{jobId}', + GetDefinitions = '/api/task-management/background-jobs/actions/definitions', +} + +export const addAction = (jobId: string, input: CreateBackgroundJobAction) => { + return defAbpHttp.post({ + url: format(Api.AddAction, { jobId: jobId }), + data: input, + }); +}; + +export const updateAction = (id: string, input: UpdateBackgroundJobAction) => { + return defAbpHttp.put({ + url: format(Api.UpdateAction, { id: id }), + data: input, + }); +}; + +export const deleteAction = (id: string) => { + return defAbpHttp.delete({ + url: format(Api.DeleteAction, { id: id }), + }); +}; + +export const getActions = (jobId: string) => { + return defAbpHttp.get>({ + url: format(Api.GetActions, { jobId: jobId }), + }); +}; + +export const getDefinitions = (input: BackgroundJobActionGetDefinitionsInput) => { + return defAbpHttp.get>({ + url: Api.GetDefinitions, + params: input, + }); +}; diff --git a/apps/vue/src/api/task-management/backgroundJobInfo.ts b/apps/vue/src/api/task-management/backgroundJobInfo.ts index 3f0480c38..fbf58bd43 100644 --- a/apps/vue/src/api/task-management/backgroundJobInfo.ts +++ b/apps/vue/src/api/task-management/backgroundJobInfo.ts @@ -3,10 +3,11 @@ import { BackgroundJobInfo, BackgroundJobInfoCreate, BackgroundJobInfoUpdate, + BackgroundJobDefinition, BackgroundJobInfoGetListInput, } from './model/backgroundJobInfoModel'; import { format } from '/@/utils/strings'; -import { PagedResultDto } from '../model/baseModel'; +import { ListResultDto, PagedResultDto } from '../model/baseModel'; enum Api { GetById = '/api/task-management/background-jobs/{id}', @@ -25,6 +26,7 @@ enum Api { BulkStart = '/api/task-management/background-jobs/bulk-start', BulkStop = '/api/task-management/background-jobs/bulk-stop', BulkDelete = '/api/task-management/background-jobs/bulk-delete', + GetDefinitions = '/api/task-management/background-jobs/definitions', } export const getById = (id: string) => { @@ -40,6 +42,12 @@ export const getList = (input: BackgroundJobInfoGetListInput) => { }); }; +export const getDefinitions = () => { + return defAbpHttp.get>({ + url: Api.GetDefinitions, + }); +}; + export const create = (input: BackgroundJobInfoCreate) => { return defAbpHttp.post({ url: Api.Create, diff --git a/apps/vue/src/api/task-management/model/backgroundJobActionModel.ts b/apps/vue/src/api/task-management/model/backgroundJobActionModel.ts new file mode 100644 index 000000000..1967b672b --- /dev/null +++ b/apps/vue/src/api/task-management/model/backgroundJobActionModel.ts @@ -0,0 +1,43 @@ +export enum JobActionType { + Failed = -1, + Successed = 0, +} + +export interface BackgroundJobAction { + id: string; + jobId: string; + name: string; + displayName?: string; + isEnabled: boolean; + paramters: ExtraPropertyDictionary; +} + +export interface BackgroundJobActionParamter { + name: string; + required: boolean; + displayName: string; + description?: string; +} + +export interface BackgroundJobActionDefinition { + name: string; + type: JobActionType; + displayName: string; + description?: string; + paramters: BackgroundJobActionParamter[]; +} + +export interface CreateBackgroundJobAction { + name: string; + isEnabled: boolean; + paramters: ExtraPropertyDictionary; +} + +export interface UpdateBackgroundJobAction { + isEnabled: boolean; + paramters: ExtraPropertyDictionary; +} + +export interface BackgroundJobActionGetDefinitionsInput { + type?: JobActionType; +} diff --git a/apps/vue/src/api/task-management/model/backgroundJobInfoModel.ts b/apps/vue/src/api/task-management/model/backgroundJobInfoModel.ts index 8d219fa8b..3a167edd8 100644 --- a/apps/vue/src/api/task-management/model/backgroundJobInfoModel.ts +++ b/apps/vue/src/api/task-management/model/backgroundJobInfoModel.ts @@ -29,6 +29,20 @@ export enum JobPriority { High = 25 } +export interface BackgroundJobParamter { + name: string; + required: boolean; + DisplayName: string; + Description?: string; +} + +export interface BackgroundJobDefinition { + name: string; + displayName: string; + description?: string; + paramters: BackgroundJobParamter[]; +} + export interface BackgroundJobInfo extends ExtensibleAuditedEntity, IHasConcurrencyStamp { isEnabled: boolean; name: string; diff --git a/apps/vue/src/api/text-templating/templates/index.ts b/apps/vue/src/api/text-templating/templates/index.ts new file mode 100644 index 000000000..89e5c5c0a --- /dev/null +++ b/apps/vue/src/api/text-templating/templates/index.ts @@ -0,0 +1,64 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { PagedResultDto } from '../../model/baseModel'; +import { + TextTemplateDefinition, + TextTemplateContent, + TextTemplateContentGetInput, + TextTemplateUpdateInput, + TextTemplateRestoreInput, + TextTemplateDefinitionGetListInput, +} from './model'; + +const remoteServiceName = 'AbpTextTemplating'; +const controllerName = 'TextTemplate'; + +export const get = (name: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAsync', + params: { + name: name, + }, + }); +}; + +export const getContent = (input: TextTemplateContentGetInput) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetContentAsync', + params: { + input: input, + }, + }); +} + +export const getList = (input: TextTemplateDefinitionGetListInput) => { + return defAbpHttp.request>({ + service: remoteServiceName, + controller: controllerName, + action: 'GetListAsync', + params: { + input: input, + }, + }); +}; + +export const restoreToDefault = (input: TextTemplateRestoreInput) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'RestoreToDefaultAsync', + data: input, + }); +}; + +export const update = (input: TextTemplateUpdateInput) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'UpdateAsync', + data: input, + }); +}; diff --git a/apps/vue/src/api/text-templating/templates/model/index.ts b/apps/vue/src/api/text-templating/templates/model/index.ts new file mode 100644 index 000000000..fa935f89f --- /dev/null +++ b/apps/vue/src/api/text-templating/templates/model/index.ts @@ -0,0 +1,36 @@ +import { PagedAndSortedResultRequestDto } from "/@/api/model/baseModel"; + +export interface TextTemplateDefinition { + name: string; + displayName: string; + defaultCultureName?: string; + isInlineLocalized: boolean; + isLayout: boolean; + layout?: string; +} + +export interface TextTemplateContent { + name: string; + content?: string; + culture?: string; +} + +export interface TextTemplateContentGetInput { + name: string; + culture?: string; +} + +export interface TextTemplateRestoreInput { + name: string; + culture?: string; +} + +export interface TextTemplateUpdateInput { + name: string; + culture?: string; + content: string; +} + +export interface TextTemplateDefinitionGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; +} diff --git a/apps/vue/src/components/Application/src/AppLocalePicker.vue b/apps/vue/src/components/Application/src/AppLocalePicker.vue index 3d40a53b7..f71b81280 100644 --- a/apps/vue/src/components/Application/src/AppLocalePicker.vue +++ b/apps/vue/src/components/Application/src/AppLocalePicker.vue @@ -4,11 +4,11 @@ --> - + {{ t('common.cancelText') }} @@ -62,7 +62,6 @@ import { SearchOutlined } from '@ant-design/icons-vue'; import AppSearchFooter from './AppSearchFooter.vue'; import Icon from '/@/components/Icon'; - import { Input } from '/@/components/Input'; // @ts-ignore import vClickOutside from '/@/directives/clickOutside'; import { useDesign } from '/@/hooks/web/useDesign'; diff --git a/apps/vue/src/components/CardList/src/CardList.vue b/apps/vue/src/components/CardList/src/CardList.vue index 0000cd4fd..d14f7c6fa 100644 --- a/apps/vue/src/components/CardList/src/CardList.vue +++ b/apps/vue/src/components/CardList/src/CardList.vue @@ -1,3 +1,80 @@ + - - diff --git a/apps/vue/src/components/CardList/src/data.ts b/apps/vue/src/components/CardList/src/data.ts index ac56cad91..b7c4be78c 100644 --- a/apps/vue/src/components/CardList/src/data.ts +++ b/apps/vue/src/components/CardList/src/data.ts @@ -1,5 +1,5 @@ import { ref } from 'vue'; -//每行个数 +// 每行个数 export const grid = ref(12); // slider属性 export const useSlider = (min = 6, max = 12) => { diff --git a/apps/vue/src/components/CodeEditor/index.ts b/apps/vue/src/components/CodeEditor/index.ts index 872bfedf9..38f664f4e 100644 --- a/apps/vue/src/components/CodeEditor/index.ts +++ b/apps/vue/src/components/CodeEditor/index.ts @@ -1,8 +1,10 @@ import { withInstall } from '/@/utils'; import codeEditor from './src/CodeEditor.vue'; +import codeEditorX from './src/codemirrorX/CodeMirrorX.vue'; import jsonPreview from './src/json-preview/JsonPreview.vue'; export const CodeEditor = withInstall(codeEditor); +export const CodeEditorX = withInstall(codeEditorX); export const JsonPreview = withInstall(jsonPreview); export * from './src/typing'; diff --git a/apps/vue/src/components/CodeEditor/src/codemirror/codemirror.css b/apps/vue/src/components/CodeEditor/src/codemirror/codemirror.css index 8e9cbd864..cbcfa8764 100644 --- a/apps/vue/src/components/CodeEditor/src/codemirror/codemirror.css +++ b/apps/vue/src/components/CodeEditor/src/codemirror/codemirror.css @@ -39,7 +39,7 @@ .CodeMirror-gutters { position: absolute; top: 0; - left: 0; + left: 5 !important; z-index: 3; min-height: 100%; white-space: nowrap; @@ -49,11 +49,11 @@ .CodeMirror-linenumber { min-width: 20px; - padding: 0 3px 0 5px; + padding: 1 8px 0 5px; color: var(--comment); - text-align: right; + text-align: left !important; white-space: nowrap; - opacity: 60%; + opacity: 0.6; } .CodeMirror-guttermarker { @@ -90,7 +90,7 @@ display: inline-block; font-size: 0.8em; content: '>'; - opacity: 80%; + opacity: 0.8; transform: rotate(90deg); transition: transform 0.2s; } diff --git a/apps/vue/src/components/CodeEditor/src/codemirrorX/CodeMirrorX.vue b/apps/vue/src/components/CodeEditor/src/codemirrorX/CodeMirrorX.vue new file mode 100644 index 000000000..52d543c35 --- /dev/null +++ b/apps/vue/src/components/CodeEditor/src/codemirrorX/CodeMirrorX.vue @@ -0,0 +1,137 @@ + + + diff --git a/apps/vue/src/components/CodeEditor/src/json-preview/JsonPreview.vue b/apps/vue/src/components/CodeEditor/src/json-preview/JsonPreview.vue index 3e081bf50..75890c336 100644 --- a/apps/vue/src/components/CodeEditor/src/json-preview/JsonPreview.vue +++ b/apps/vue/src/components/CodeEditor/src/json-preview/JsonPreview.vue @@ -3,7 +3,6 @@ diff --git a/apps/vue/src/components/Tree/src/TreeHeader.vue b/apps/vue/src/components/Tree/src/TreeHeader.vue index 57739d50e..d2124a9f0 100644 --- a/apps/vue/src/components/Tree/src/TreeHeader.vue +++ b/apps/vue/src/components/Tree/src/TreeHeader.vue @@ -1,12 +1,11 @@ - - diff --git a/apps/vue/src/components/Tree/src/TreeIcon.ts b/apps/vue/src/components/Tree/src/TreeIcon.ts index 69e7cd066..900d6bfcf 100644 --- a/apps/vue/src/components/Tree/src/TreeIcon.ts +++ b/apps/vue/src/components/Tree/src/TreeIcon.ts @@ -1,14 +1,10 @@ import type { VNode, FunctionalComponent } from 'vue'; import { h } from 'vue'; -import { isString } from '/@/utils/is'; +import { isString } from '@vue/shared'; import { Icon } from '/@/components/Icon'; -export interface ComponentProps { - icon: VNode | string; -} - -export const TreeIcon: FunctionalComponent = ({ icon }: ComponentProps) => { +export const TreeIcon: FunctionalComponent = ({ icon }: { icon: VNode | string }) => { if (!icon) return null; if (isString(icon)) { return h(Icon, { icon, class: 'mr-1' }); diff --git a/apps/vue/src/components/Tree/src/tree.ts b/apps/vue/src/components/Tree/src/tree.ts new file mode 100644 index 000000000..03fe57fe3 --- /dev/null +++ b/apps/vue/src/components/Tree/src/tree.ts @@ -0,0 +1,194 @@ +import type { ExtractPropTypes } from 'vue'; +import type { TreeDataItem } from 'ant-design-vue/es/tree/Tree'; + +import { buildProps } from '/@/utils/props'; + +export enum ToolbarEnum { + SELECT_ALL, + UN_SELECT_ALL, + EXPAND_ALL, + UN_EXPAND_ALL, + CHECK_STRICTLY, + CHECK_UN_STRICTLY, +} + +export const treeEmits = [ + 'update:expandedKeys', + 'update:selectedKeys', + 'update:value', + 'change', + 'check', + 'update:searchValue', +]; + +export interface TreeState { + expandedKeys: KeyType[]; + selectedKeys: KeyType[]; + checkedKeys: CheckKeys; + checkStrictly: boolean; +} + +export interface FieldNames { + children?: string; + title?: string; + key?: string; +} + +export type KeyType = string | number; + +export type CheckKeys = + | KeyType[] + | { checked: string[] | number[]; halfChecked: string[] | number[] }; + +export const treeProps = buildProps({ + value: { + type: [Object, Array] as PropType, + }, + + renderIcon: { + type: Function as PropType<(params: Recordable) => string>, + }, + + helpMessage: { + type: [String, Array] as PropType, + default: '', + }, + + title: { + type: String, + default: '', + }, + toolbar: Boolean, + search: Boolean, + searchValue: { + type: String, + default: '', + }, + checkStrictly: Boolean, + clickRowToExpand: { + type: Boolean, + default: false, + }, + checkable: Boolean, + defaultExpandLevel: { + type: [String, Number] as PropType, + default: '', + }, + defaultExpandAll: Boolean, + + fieldNames: { + type: Object as PropType, + }, + + treeData: { + type: Array as PropType, + }, + + actionList: { + type: Array as PropType, + default: () => [], + }, + + expandedKeys: { + type: Array as PropType, + default: () => [], + }, + + selectedKeys: { + type: Array as PropType, + default: () => [], + }, + + checkedKeys: { + type: Array as PropType, + default: () => [], + }, + + beforeRightClick: { + type: Function as PropType<(...arg: any) => ContextMenuItem[] | ContextMenuOptions>, + default: undefined, + }, + + rightMenuList: { + type: Array as PropType, + }, + // 自定义数据过滤判断方法(注: 不是整个过滤方法,而是内置过滤的判断方法,用于增强原本仅能通过title进行过滤的方式) + filterFn: { + type: Function as PropType< + (searchValue: any, node: TreeItem, fieldNames: FieldNames) => boolean + >, + default: undefined, + }, + // 高亮搜索值,仅高亮具体匹配值(通过title)值为true时使用默认色值,值为#xxx时使用此值替代且高亮开启 + highlight: { + type: [Boolean, String] as PropType, + default: false, + }, + // 搜索完成时自动展开结果 + expandOnSearch: Boolean, + // 搜索完成自动选中所有结果,当且仅当 checkable===true 时生效 + checkOnSearch: Boolean, + // 搜索完成自动select所有结果 + selectedOnSearch: Boolean, + loading: { + type: Boolean, + default: false, + }, +}); + +export type TreeProps = ExtractPropTypes; + +export interface ContextMenuItem { + label: string; + icon?: string; + hidden?: boolean; + disabled?: boolean; + handler?: Fn; + divider?: boolean; + children?: ContextMenuItem[]; +} + +export interface ContextMenuOptions { + icon?: string; + styles?: any; + items?: ContextMenuItem[]; +} + +export interface TreeItem extends TreeDataItem { + icon?: any; +} + +export interface TreeActionItem { + render: (record: Recordable) => any; + show?: boolean | ((record: Recordable) => boolean); +} + +export interface InsertNodeParams { + parentKey: string | null; + node: TreeDataItem; + list?: TreeDataItem[]; + push?: 'push' | 'unshift'; +} + +export interface TreeActionType { + checkAll: (checkAll: boolean) => void; + expandAll: (expandAll: boolean) => void; + setExpandedKeys: (keys: KeyType[]) => void; + getExpandedKeys: () => KeyType[]; + setSelectedKeys: (keys: KeyType[]) => void; + getSelectedKeys: () => KeyType[]; + setCheckedKeys: (keys: CheckKeys) => void; + getCheckedKeys: () => CheckKeys; + filterByLevel: (level: number) => void; + insertNodeByKey: (opt: InsertNodeParams) => void; + insertNodesByKey: (opt: InsertNodeParams) => void; + deleteNodeByKey: (key: string) => void; + updateNodeByKey: (key: string, node: Omit) => void; + setSearchValue: (value: string) => void; + getSearchValue: () => string; + getSelectedNode: ( + key: KeyType, + treeList?: TreeItem[], + selectNode?: TreeItem | null, + ) => TreeItem | null; +} diff --git a/apps/vue/src/components/Tree/src/useTree.ts b/apps/vue/src/components/Tree/src/useTree.ts index 840e5bc19..4713a54cb 100644 --- a/apps/vue/src/components/Tree/src/useTree.ts +++ b/apps/vue/src/components/Tree/src/useTree.ts @@ -1,4 +1,4 @@ -import type { InsertNodeParams, Keys, ReplaceFields } from './typing'; +import type { InsertNodeParams, KeyType, FieldNames, TreeItem } from './tree'; import type { Ref, ComputedRef } from 'vue'; import type { TreeDataItem } from 'ant-design-vue/es/tree/Tree'; @@ -6,14 +6,11 @@ import { cloneDeep } from 'lodash-es'; import { unref } from 'vue'; import { forEach } from '/@/utils/helper/treeHelper'; -export function useTree( - treeDataRef: Ref, - getReplaceFields: ComputedRef, -) { +export function useTree(treeDataRef: Ref, getFieldNames: ComputedRef) { function getAllKeys(list?: TreeDataItem[]) { const keys: string[] = []; const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return keys; for (let index = 0; index < treeData.length; index++) { @@ -24,13 +21,14 @@ export function useTree( keys.push(...(getAllKeys(children) as string[])); } } - return keys as Keys; + return keys as KeyType[]; } + // get keys that can be checked and selected function getEnabledKeys(list?: TreeDataItem[]) { const keys: string[] = []; const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return keys; for (let index = 0; index < treeData.length; index++) { @@ -41,13 +39,13 @@ export function useTree( keys.push(...(getEnabledKeys(children) as string[])); } } - return keys as Keys; + return keys as KeyType[]; } - function getChildrenKeys(nodeKey: string | number, list?: TreeDataItem[]): Keys { - const keys: Keys = []; + function getChildrenKeys(nodeKey: string | number, list?: TreeDataItem[]) { + const keys: KeyType[] = []; const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return keys; for (let index = 0; index < treeData.length; index++) { const node = treeData[index]; @@ -63,14 +61,14 @@ export function useTree( } } } - return keys as Keys; + return keys as KeyType[]; } // Update node function updateNodeByKey(key: string, node: TreeDataItem, list?: TreeDataItem[]) { if (!key) return; const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return; @@ -97,7 +95,7 @@ export function useTree( for (let index = 0; index < data.length; index++) { const item = data[index]; - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); const key = keyField ? item[keyField] : ''; const children = childrenField ? item[childrenField] : []; res.push(key); @@ -119,7 +117,7 @@ export function useTree( treeDataRef.value = treeData; return; } - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return; forEach(treeData, (treeItem) => { @@ -144,7 +142,7 @@ export function useTree( treeData[push](list[i]); } } else { - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return; forEach(treeData, (treeItem) => { @@ -163,7 +161,7 @@ export function useTree( function deleteNodeByKey(key: string, list?: TreeDataItem[]) { if (!key) return; const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getReplaceFields); + const { key: keyField, children: childrenField } = unref(getFieldNames); if (!childrenField || !keyField) return; for (let index = 0; index < treeData.length; index++) { @@ -178,6 +176,23 @@ export function useTree( } } } + + // Get selected node + function getSelectedNode(key: KeyType, list?: TreeItem[], selectedNode?: TreeItem | null) { + if (!key && key !== 0) return null; + const treeData = list || unref(treeDataRef); + treeData.forEach((item) => { + if (selectedNode?.key || selectedNode?.key === 0) return selectedNode; + if (item.key === key) { + selectedNode = item; + return; + } + if (item.children && item.children.length) { + selectedNode = getSelectedNode(key, item.children, selectedNode); + } + }); + return selectedNode || null; + } return { deleteNodeByKey, insertNodeByKey, @@ -187,5 +202,6 @@ export function useTree( getAllKeys, getChildrenKeys, getEnabledKeys, + getSelectedNode, }; } diff --git a/apps/vue/src/components/Tree/style/index.less b/apps/vue/src/components/Tree/style/index.less new file mode 100644 index 000000000..472d4caa5 --- /dev/null +++ b/apps/vue/src/components/Tree/style/index.less @@ -0,0 +1,52 @@ +@tree-prefix-cls: ~'@{namespace}-tree'; + +.@{tree-prefix-cls} { + background-color: @component-background; + + .ant-tree-node-content-wrapper { + position: relative; + + .ant-tree-title { + position: absolute; + left: 0; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + + &__title { + position: relative; + display: flex; + align-items: center; + width: 100%; + padding-right: 10px; + + &:hover { + .@{tree-prefix-cls}__action { + visibility: visible; + } + } + } + + &__content { + overflow: hidden; + } + + &__actions { + position: absolute; + //top: 2px; + right: 3px; + display: flex; + } + + &__action { + margin-left: 4px; + visibility: hidden; + } + + &-header { + border-bottom: 1px solid @border-color-base; + } +} diff --git a/apps/vue/src/components/Tree/style/index.ts b/apps/vue/src/components/Tree/style/index.ts new file mode 100644 index 000000000..d74e52ee9 --- /dev/null +++ b/apps/vue/src/components/Tree/style/index.ts @@ -0,0 +1 @@ +import './index.less'; diff --git a/apps/vue/src/components/Upload/src/BasicUpload.vue b/apps/vue/src/components/Upload/src/BasicUpload.vue index 1418fd6b8..2422e313c 100644 --- a/apps/vue/src/components/Upload/src/BasicUpload.vue +++ b/apps/vue/src/components/Upload/src/BasicUpload.vue @@ -1,6 +1,6 @@ - - + - - diff --git a/apps/vue/src/views/account/center/ShareList.vue b/apps/vue/src/views/account/center/ShareList.vue index 5029b0b7b..fb52caf15 100644 --- a/apps/vue/src/views/account/center/ShareList.vue +++ b/apps/vue/src/views/account/center/ShareList.vue @@ -1,23 +1,25 @@ @@ -45,7 +47,7 @@ }); const emit = defineEmits(['delete:file:share']); - const { L } = useLocalization('AbpOssManagement', 'AbpUi'); + const { L } = useLocalization(['AbpOssManagement', 'AbpUi']); const { createConfirm, createMessage } = useMessage(); const [registerTable, { setTableData }] = useTable({ rowKey: 'url', @@ -67,7 +69,6 @@ width: 180, title: L('Actions'), dataIndex: 'action', - slots: { customRender: 'action' }, }, }); @@ -82,10 +83,10 @@ } function handleCopyLink(record) { - let url = window.location.origin - url += '/api/files/share/' + record.url + let url = window.location.origin; + url += '/api/files/share/' + record.url; if (copyTextToClipboard(url)) { - createMessage.success(L('Successful')) + createMessage.success(L('Successful')); } } diff --git a/apps/vue/src/views/account/center/index.vue b/apps/vue/src/views/account/center/index.vue index 38d73c451..96fad12ca 100644 --- a/apps/vue/src/views/account/center/index.vue +++ b/apps/vue/src/views/account/center/index.vue @@ -14,7 +14,11 @@
- + diff --git a/apps/vue/src/views/account/setting/index.vue b/apps/vue/src/views/account/setting/index.vue index 733a886e4..2b655db53 100644 --- a/apps/vue/src/views/account/setting/index.vue +++ b/apps/vue/src/views/account/setting/index.vue @@ -4,7 +4,7 @@ @@ -13,10 +13,13 @@ diff --git a/apps/vue/src/views/api-gateway/aggregate/components/AggregateRouteTable.vue b/apps/vue/src/views/api-gateway/aggregate/components/AggregateRouteTable.vue deleted file mode 100644 index dddd6969c..000000000 --- a/apps/vue/src/views/api-gateway/aggregate/components/AggregateRouteTable.vue +++ /dev/null @@ -1,174 +0,0 @@ - - - diff --git a/apps/vue/src/views/api-gateway/aggregate/components/ModalData.ts b/apps/vue/src/views/api-gateway/aggregate/components/ModalData.ts deleted file mode 100644 index 7a16e5111..000000000 --- a/apps/vue/src/views/api-gateway/aggregate/components/ModalData.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { useLocalization } from '/@/hooks/abp/useLocalization'; -import { FormProps, FormSchema } from '/@/components/Form'; -import { getActivedList } from '/@/api/api-gateway/group'; -import { getDefinedAggregatorProviders } from '/@/api/api-gateway/basic'; - -const { L } = useLocalization('ApiGateway'); - -export function getSearchFormSchemas(): Partial { - return { - labelWidth: 100, - schemas: [ - { - field: 'appId', - component: 'ApiSelect', - label: L('DisplayName:AppId'), - colProps: { span: 12 }, - required: true, - componentProps: { - api: () => getActivedList(), - resultField: 'items', - labelField: 'appName', - valueField: 'appId', - }, - }, - { - field: 'filter', - component: 'Input', - label: L('Search'), - colProps: { span: 12 }, - defaultValue: '', - }, - ], - }; -} - -export function getModalFormSchemas(): FormSchema[] { - return [ - { - field: 'reRouteId', - component: 'Input', - label: 'reRouteId', - colProps: { span: 24 }, - show: false, - }, - { - field: 'concurrencyStamp', - component: 'Input', - label: 'concurrencyStamp', - colProps: { span: 24 }, - show: false, - }, - { - field: 'appId', - component: 'ApiSelect', - label: L('DisplayName:AppId'), - colProps: { span: 24 }, - required: true, - componentProps: { - api: () => getActivedList(), - resultField: 'items', - labelField: 'appName', - valueField: 'appId', - }, - dynamicDisabled: ({ values }) => { - return values.reRouteId !== undefined; - }, - }, - { - field: 'name', - component: 'Input', - label: L('DisplayName:Name'), - colProps: { span: 24 }, - required: true, - }, - { - field: 'aggregator', - component: 'ApiSelect', - label: L('DisplayName:Aggregator'), - colProps: { span: 24 }, - componentProps: { - api: () => getDefinedAggregatorProviders(), - resultField: 'items', - labelField: 'provider', - valueField: 'provider', - }, - }, - { - field: 'reRouteKeys', - component: 'Select', - label: L('DisplayName:RouteKeys'), - colProps: { span: 24 }, - required: true, - componentProps: { - mode: 'tags', - open: false, - tokenSeparators: [','], - }, - }, - { - field: 'priority', - component: 'InputNumber', - label: L('DisplayName:Priority'), - colProps: { span: 24 }, - componentProps: { - style: { - width: '100%', - }, - }, - }, - { - field: 'upstreamHost', - component: 'Input', - label: L('DisplayName:UpstreamHost'), - colProps: { span: 24 }, - }, - { - field: 'reRouteIsCaseSensitive', - component: 'Checkbox', - label: L('DisplayName:CaseSensitive'), - colProps: { span: 24 }, - defaultValue: true, - renderComponentContent: L('DisplayName:CaseSensitive'), - }, - { - field: 'upstreamPathTemplate', - component: 'Input', - label: L('DisplayName:UpstreamPathTemplate'), - colProps: { span: 24 }, - required: true, - }, - { - field: 'upstreamHttpMethod', - component: 'Select', - label: L('DisplayName:UpstreamHttpMethod'), - colProps: { span: 24 }, - componentProps: { - mode: 'tags', - open: false, - tokenSeparators: [','], - }, - }, - ]; -} - -export function getConfigModalFormSchemas(): FormSchema[] { - return [ - { - field: 'routeId', - component: 'Input', - label: 'routeId', - colProps: { span: 24 }, - show: false, - }, - { - field: 'reRouteKey', - component: 'Input', - label: L('DisplayName:RouteKey'), - colProps: { span: 24 }, - required: true, - }, - { - field: 'parameter', - component: 'Input', - label: L('DisplayName:Parameter'), - colProps: { span: 24 }, - }, - { - field: 'jsonPath', - component: 'Input', - label: L('DisplayName:JsonPath'), - colProps: { span: 24 }, - }, - ]; -} diff --git a/apps/vue/src/views/api-gateway/aggregate/components/TableData.ts b/apps/vue/src/views/api-gateway/aggregate/components/TableData.ts deleted file mode 100644 index 81dda671e..000000000 --- a/apps/vue/src/views/api-gateway/aggregate/components/TableData.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { BasicColumn } from '/@/components/Table/src/types/table'; -import { useLocalization } from '/@/hooks/abp/useLocalization'; - -const { L } = useLocalization('ApiGateway'); - -export function getDataColumns(): BasicColumn[] { - return [ - { - title: 'reRouteId', - dataIndex: 'reRouteId', - width: 1, - ifShow: false, - }, - { - title: 'appId', - dataIndex: 'appId', - width: 1, - ifShow: false, - }, - { - title: L('DisplayName:Name'), - dataIndex: 'name', - align: 'left', - width: 250, - sorter: true, - }, - { - title: L('DisplayName:UpstreamPathTemplate'), - dataIndex: 'upstreamPathTemplate', - align: 'left', - width: 300, - sorter: true, - }, - { - title: L('DisplayName:RouteKeys'), - dataIndex: 'reRouteKeys', - align: 'left', - width: 180, - slots: { - customRender: 'keys', - style: { - margin: '16px', - }, - }, - }, - { - title: L('DisplayName:UpstreamHost'), - dataIndex: 'upstreamHost', - align: 'left', - width: 200, - sorter: true, - }, - { - title: L('DisplayName:Aggregator'), - dataIndex: 'aggregator', - width: 200, - sorter: true, - }, - { - title: L('DisplayName:Priority'), - dataIndex: 'priority', - width: 100, - }, - ]; -} - -export function getConfigDataColumns(): BasicColumn[] { - return [ - { - title: L('DisplayName:RouteKey'), - dataIndex: 'reRouteKey', - align: 'left', - width: 150, - sorter: true, - }, - { - title: L('DisplayName:Parameter'), - dataIndex: 'parameter', - align: 'left', - width: 150, - sorter: true, - }, - { - title: L('DisplayName:JsonPath'), - dataIndex: 'jsonPath', - align: 'left', - width: 200, - sorter: true, - }, - ]; -} diff --git a/apps/vue/src/views/api-gateway/aggregate/index.vue b/apps/vue/src/views/api-gateway/aggregate/index.vue deleted file mode 100644 index 977d77ab3..000000000 --- a/apps/vue/src/views/api-gateway/aggregate/index.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/apps/vue/src/views/api-gateway/global/components/GlobalModal.vue b/apps/vue/src/views/api-gateway/global/components/GlobalModal.vue deleted file mode 100644 index e21e1ba27..000000000 --- a/apps/vue/src/views/api-gateway/global/components/GlobalModal.vue +++ /dev/null @@ -1,276 +0,0 @@ -