From d325dd7493da8dfcececf78b7fa3942e966cef31 Mon Sep 17 00:00:00 2001 From: 0xJacky Date: Wed, 29 Nov 2023 13:56:40 +0800 Subject: [PATCH] fix: resolved eslint errors --- app/components.d.ts | 9 +- app/env.d.ts | 5 + app/package.json | 14 +- app/pnpm-lock.yaml | 57 ++- app/src/api/curd.ts | 9 + app/src/api/environment.ts | 9 +- app/src/api/openai.ts | 2 +- app/src/api/user.ts | 8 +- app/src/components/Breadcrumb/Breadcrumb.vue | 2 +- app/src/components/Chart/AreaChart.vue | 6 +- app/src/components/ChatGPT/ChatGPT.vue | 4 +- .../components/NodeSelector/NodeSelector.vue | 1 - .../StdDesign/StdDataDisplay/StdCurd.vue | 112 ++-- .../StdDataDisplay/StdPagination.vue | 2 +- .../StdDesign/StdDataDisplay/StdTable.vue | 477 +++++------------- .../StdDesign/StdDataDisplay/index.ts | 9 + .../StdDataDisplay/methods/exportCsv.ts | 71 +++ .../StdDataDisplay/methods/sortable.ts | 132 +++++ .../StdDesign/StdDataEntry/StdDataEntry.tsx | 54 -- .../StdDesign/StdDataEntry/StdDataEntry.vue | 83 +++ .../StdDataEntry/components/StdSelector.vue | 3 +- .../StdDesign/StdDataEntry/index.tsx | 2 +- app/src/components/StdDesign/types.d.ts | 50 +- app/src/layouts/BaseRouterView.vue | 5 +- app/src/layouts/Loading.vue | 14 +- app/src/version.json | 2 +- app/src/views/dashboard/ServerAnalytic.vue | 2 +- .../dashboard/components/NodeAnalyticItem.vue | 20 +- app/src/views/domain/DomainList.vue | 10 +- app/src/views/system/About.vue | 27 +- app/src/views/user/User.vue | 19 +- app/tsconfig.json | 5 +- app/version.json | 2 +- 33 files changed, 643 insertions(+), 584 deletions(-) create mode 100644 app/env.d.ts create mode 100644 app/src/components/StdDesign/StdDataDisplay/methods/exportCsv.ts create mode 100644 app/src/components/StdDesign/StdDataDisplay/methods/sortable.ts delete mode 100644 app/src/components/StdDesign/StdDataEntry/StdDataEntry.tsx create mode 100644 app/src/components/StdDesign/StdDataEntry/StdDataEntry.vue diff --git a/app/components.d.ts b/app/components.d.ts index dcbecddc..a72bff5c 100644 --- a/app/components.d.ts +++ b/app/components.d.ts @@ -77,14 +77,6 @@ declare module 'vue' { RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] SetLanguageSetLanguage: typeof import('./src/components/SetLanguage/SetLanguage.vue')['default'] - StdDataDisplayStdBatchEdit: typeof import('./src/components/StdDesign/StdDataDisplay/StdBatchEdit.vue')['default'] - StdDataDisplayStdCurd: typeof import('./src/components/StdDesign/StdDataDisplay/StdCurd.vue')['default'] - StdDataDisplayStdPagination: typeof import('./src/components/StdDesign/StdDataDisplay/StdPagination.vue')['default'] - StdDataDisplayStdTable: typeof import('./src/components/StdDesign/StdDataDisplay/StdTable.vue')['default'] - StdDataEntryComponentsStdPassword: typeof import('./src/components/StdDesign/StdDataEntry/components/StdPassword.vue')['default'] - StdDataEntryComponentsStdSelect: typeof import('./src/components/StdDesign/StdDataEntry/components/StdSelect.vue')['default'] - StdDataEntryComponentsStdSelector: typeof import('./src/components/StdDesign/StdDataEntry/components/StdSelector.vue')['default'] - StdDataEntryStdFormItem: typeof import('./src/components/StdDesign/StdDataEntry/StdFormItem.vue')['default'] StdDesignStdDataDisplayStdBatchEdit: typeof import('./src/components/StdDesign/StdDataDisplay/StdBatchEdit.vue')['default'] StdDesignStdDataDisplayStdCurd: typeof import('./src/components/StdDesign/StdDataDisplay/StdCurd.vue')['default'] StdDesignStdDataDisplayStdPagination: typeof import('./src/components/StdDesign/StdDataDisplay/StdPagination.vue')['default'] @@ -92,6 +84,7 @@ declare module 'vue' { StdDesignStdDataEntryComponentsStdPassword: typeof import('./src/components/StdDesign/StdDataEntry/components/StdPassword.vue')['default'] StdDesignStdDataEntryComponentsStdSelect: typeof import('./src/components/StdDesign/StdDataEntry/components/StdSelect.vue')['default'] StdDesignStdDataEntryComponentsStdSelector: typeof import('./src/components/StdDesign/StdDataEntry/components/StdSelector.vue')['default'] + StdDesignStdDataEntryStdDataEntry: typeof import('./src/components/StdDesign/StdDataEntry/StdDataEntry.vue')['default'] StdDesignStdDataEntryStdFormItem: typeof import('./src/components/StdDesign/StdDataEntry/StdFormItem.vue')['default'] SwitchAppearanceIconsVPIconMoon: typeof import('./src/components/SwitchAppearance/icons/VPIconMoon.vue')['default'] SwitchAppearanceIconsVPIconSun: typeof import('./src/components/SwitchAppearance/icons/VPIconSun.vue')['default'] diff --git a/app/env.d.ts b/app/env.d.ts new file mode 100644 index 00000000..fe73665d --- /dev/null +++ b/app/env.d.ts @@ -0,0 +1,5 @@ +declare module '*.svg' { + import React from 'react' + const content: React.FC> + export default content +} diff --git a/app/package.json b/app/package.json index 75217f7e..dc512ea8 100644 --- a/app/package.json +++ b/app/package.json @@ -1,11 +1,10 @@ { "name": "nginx-ui-app-next", - "private": true, "version": "2.0.0-beta.4", - "type": "commonjs", "scripts": { "dev": "vite", - "lint": "eslint . -c .eslintrc.js --fix --ext .ts,.vue,.tsx", + "typecheck": "vue-tsc --noEmit", + "lint": "eslint . -c .eslintrc.js --fix --ext .ts,.vue,.tsx,.d.ts", "build": "vite build", "preview": "vite preview", "gettext:extract": "vue-gettext-extract", @@ -14,9 +13,6 @@ "dependencies": { "@ant-design/icons-vue": "^7.0.1", "@formkit/auto-animate": "^0.8.0", - "@types/lodash": "^4.14.202", - "@types/nprogress": "^0.2.0", - "@types/sortablejs": "^1.15.0", "@vue/reactivity": "^3.3.9", "@vue/shared": "^3.3.9", "@vueuse/core": "^10.6.1", @@ -45,6 +41,10 @@ "xterm-addon-fit": "^0.8.0" }, "devDependencies": { + "@types/lodash": "^4.14.202", + "@types/nprogress": "^0.2.0", + "@types/sortablejs": "^1.15.0", + "@vue/tsconfig": "^0.4.0", "@antfu/eslint-config-vue": "^0.43.1", "@typescript-eslint/eslint-plugin": "^6.13.0", "@typescript-eslint/parser": "^6.13.0", @@ -67,7 +67,7 @@ "unplugin-auto-import": "^0.17.1", "unplugin-vue-components": "^0.25.2", "unplugin-vue-define-options": "^1.4.0", - "vite": "^5.0.2", + "vite": "^5.0.3", "vite-plugin-html": "^3.2.0", "vite-svg-loader": "^5.1.0", "vue-tsc": "^1.8.22" diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 0122dc51..732c95e0 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -11,15 +11,6 @@ dependencies: '@formkit/auto-animate': specifier: ^0.8.0 version: 0.8.1 - '@types/lodash': - specifier: ^4.14.202 - version: 4.14.202 - '@types/nprogress': - specifier: ^0.2.0 - version: 0.2.3 - '@types/sortablejs': - specifier: ^1.15.0 - version: 1.15.7 '@vue/reactivity': specifier: ^3.3.9 version: 3.3.9 @@ -103,6 +94,15 @@ devDependencies: '@antfu/eslint-config-vue': specifier: ^0.43.1 version: 0.43.1(@typescript-eslint/eslint-plugin@6.13.0)(@typescript-eslint/parser@6.13.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0)(typescript@5.3.2) + '@types/lodash': + specifier: ^4.14.202 + version: 4.14.202 + '@types/nprogress': + specifier: ^0.2.0 + version: 0.2.3 + '@types/sortablejs': + specifier: ^1.15.0 + version: 1.15.7 '@typescript-eslint/eslint-plugin': specifier: ^6.13.0 version: 6.13.0(@typescript-eslint/parser@6.13.0)(eslint@8.54.0)(typescript@5.3.2) @@ -111,13 +111,16 @@ devDependencies: version: 6.13.0(eslint@8.54.0)(typescript@5.3.2) '@vitejs/plugin-vue': specifier: ^4.5.0 - version: 4.5.0(vite@5.0.2)(vue@3.3.9) + version: 4.5.0(vite@5.0.3)(vue@3.3.9) '@vitejs/plugin-vue-jsx': specifier: ^3.1.0 - version: 3.1.0(vite@5.0.2)(vue@3.3.9) + version: 3.1.0(vite@5.0.3)(vue@3.3.9) '@vue/compiler-sfc': specifier: ^3.3.9 version: 3.3.9 + '@vue/tsconfig': + specifier: ^0.4.0 + version: 0.4.0 ace-builds: specifier: ^1.31.2 version: 1.31.2 @@ -167,11 +170,11 @@ devDependencies: specifier: ^1.4.0 version: 1.4.0(vue@3.3.9) vite: - specifier: ^5.0.2 - version: 5.0.2(less@4.2.0) + specifier: ^5.0.3 + version: 5.0.3(less@4.2.0) vite-plugin-html: specifier: ^3.2.0 - version: 3.2.0(vite@5.0.2) + version: 3.2.0(vite@5.0.3) vite-svg-loader: specifier: ^5.1.0 version: 5.1.0(vue@3.3.9) @@ -1297,7 +1300,7 @@ packages: /@types/lodash@4.14.202: resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} - dev: false + dev: true /@types/mdast@3.0.15: resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==} @@ -1327,7 +1330,7 @@ packages: /@types/nprogress@0.2.3: resolution: {integrity: sha512-k7kRA033QNtC+gLc4VPlfnue58CM1iQLgn1IMAU8VPHGOj7oIHPp9UlhedEnD/Gl8evoCjwkZjlBORtZ3JByUA==} - dev: false + dev: true /@types/parse-json@4.0.2: resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} @@ -1343,7 +1346,7 @@ packages: /@types/sortablejs@1.15.7: resolution: {integrity: sha512-PvgWCx1Lbgm88FdQ6S7OGvLIjWS66mudKPlfdrWil0TjsO5zmoZmzoKiiwRShs1dwPgrlkr0N4ewuy0/+QUXYQ==} - dev: false + dev: true /@types/unist@2.0.10: resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} @@ -1549,7 +1552,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@vitejs/plugin-vue-jsx@3.1.0(vite@5.0.2)(vue@3.3.9): + /@vitejs/plugin-vue-jsx@3.1.0(vite@5.0.3)(vue@3.3.9): resolution: {integrity: sha512-w9M6F3LSEU5kszVb9An2/MmXNxocAnUb3WhRr8bHlimhDrXNt6n6D2nJQR3UXpGlZHh/EsgouOHCsM8V3Ln+WA==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -1559,20 +1562,20 @@ packages: '@babel/core': 7.23.3 '@babel/plugin-transform-typescript': 7.23.4(@babel/core@7.23.3) '@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.23.3) - vite: 5.0.2(less@4.2.0) + vite: 5.0.3(less@4.2.0) vue: 3.3.9(typescript@5.3.2) transitivePeerDependencies: - supports-color dev: true - /@vitejs/plugin-vue@4.5.0(vite@5.0.2)(vue@3.3.9): + /@vitejs/plugin-vue@4.5.0(vite@5.0.3)(vue@3.3.9): resolution: {integrity: sha512-a2WSpP8X8HTEww/U00bU4mX1QpLINNuz/2KMNpLsdu3BzOpak3AGI1CJYBTXcc4SPhaD0eNRUp7IyQK405L5dQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^4.0.0 || ^5.0.0 vue: ^3.2.25 dependencies: - vite: 5.0.2(less@4.2.0) + vite: 5.0.3(less@4.2.0) vue: 3.3.9(typescript@5.3.2) dev: true @@ -1734,6 +1737,10 @@ packages: /@vue/shared@3.3.9: resolution: {integrity: sha512-ZE0VTIR0LmYgeyhurPTpy4KzKsuDyQbMSdM49eKkMnT5X4VfFBLysMzjIZhLEFQYjjOVVfbvUDHckwjDFiO2eA==} + /@vue/tsconfig@0.4.0: + resolution: {integrity: sha512-CPuIReonid9+zOG/CGTT05FXrPYATEqoDGNrEaqS4hwcw5BUNM2FguC0mOwJD4Jr16UpRVl9N0pY3P+srIbqmg==} + dev: true + /@vueuse/core@10.6.1(vue@3.3.9): resolution: {integrity: sha512-Pc26IJbqgC9VG1u6VY/xrXXfxD33hnvxBnKrLlA2LJlyHII+BSrRoTPJgGYq7qZOu61itITFUnm6QbacwZ4H8Q==} dependencies: @@ -5360,7 +5367,7 @@ packages: - terser dev: false - /vite-plugin-html@3.2.0(vite@5.0.2): + /vite-plugin-html@3.2.0(vite@5.0.3): resolution: {integrity: sha512-2VLCeDiHmV/BqqNn5h2V+4280KRgQzCFN47cst3WiNK848klESPQnzuC3okH5XHtgwHH/6s1Ho/YV6yIO0pgoQ==} peerDependencies: vite: '>=2.0.0' @@ -5377,7 +5384,7 @@ packages: html-minifier-terser: 6.1.0 node-html-parser: 5.4.2 pathe: 0.2.0 - vite: 5.0.2(less@4.2.0) + vite: 5.0.3(less@4.2.0) dev: true /vite-svg-loader@5.1.0(vue@3.3.9): @@ -5426,8 +5433,8 @@ packages: fsevents: 2.3.3 dev: false - /vite@5.0.2(less@4.2.0): - resolution: {integrity: sha512-6CCq1CAJCNM1ya2ZZA7+jS2KgnhbzvxakmlIjN24cF/PXhRMzpM/z8QgsVJA/Dm5fWUWnVEsmtBoMhmerPxT0g==} + /vite@5.0.3(less@4.2.0): + resolution: {integrity: sha512-WgEq8WEKpZ8c0DL4M1+E+kBZEJyjBmGVrul6z8Ljfhv+PPbNF4aGq014DwNYxGz2FGq6NKL0N8usdiESWd2l2w==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: diff --git a/app/src/api/curd.ts b/app/src/api/curd.ts index 309fce17..c553392b 100644 --- a/app/src/api/curd.ts +++ b/app/src/api/curd.ts @@ -26,6 +26,7 @@ class Curd { get = this._get.bind(this) save = this._save.bind(this) destroy = this._destroy.bind(this) + update_order = this._update_order.bind(this) constructor(baseUrl: string, plural: string | null = null) { this.baseUrl = baseUrl @@ -51,6 +52,14 @@ class Curd { _destroy(id: any = null) { return http.delete(`${this.baseUrl}/${id}`) } + + _update_order(data: { + target_id: number + direction: number + affected_ids: number[] + }) { + return http.post(`${this.plural}/order`, data) + } } export default Curd diff --git a/app/src/api/environment.ts b/app/src/api/environment.ts index 0556bc6f..93630c2a 100644 --- a/app/src/api/environment.ts +++ b/app/src/api/environment.ts @@ -1,5 +1,12 @@ +import type { ModelBase } from '@/api/curd' import Curd from '@/api/curd' -const environment = new Curd('/environment') +export interface Environment extends ModelBase { + name: string + url: string + token: string +} + +const environment: Curd = new Curd('/environment') export default environment diff --git a/app/src/api/openai.ts b/app/src/api/openai.ts index 5f72621b..8b8e088b 100644 --- a/app/src/api/openai.ts +++ b/app/src/api/openai.ts @@ -7,7 +7,7 @@ export interface ChatComplicationMessage { } const openai = { - store_record(data: { file_name: string; messages: ChatComplicationMessage[] }) { + store_record(data: { file_name?: string; messages: ChatComplicationMessage[] }) { return http.post('/chat_gpt_record', data) }, } diff --git a/app/src/api/user.ts b/app/src/api/user.ts index 9158f440..ceff3fea 100644 --- a/app/src/api/user.ts +++ b/app/src/api/user.ts @@ -1,5 +1,11 @@ +import type { ModelBase } from '@/api/curd' import Curd from '@/api/curd' -const user: Curd = new Curd('user') +export interface User extends ModelBase { + name: string + password: string +} + +const user: Curd = new Curd('user') export default user diff --git a/app/src/components/Breadcrumb/Breadcrumb.vue b/app/src/components/Breadcrumb/Breadcrumb.vue index 91bed5bc..ab4937aa 100644 --- a/app/src/components/Breadcrumb/Breadcrumb.vue +++ b/app/src/components/Breadcrumb/Breadcrumb.vue @@ -17,7 +17,7 @@ const breadList = computed(() => { route.matched.forEach(item => { // item.name !== 'index' && this.breadList.push(item) _breadList.push({ - name: item.name as () => string, + name: item.name as never as () => string, path: item.path, }) }) diff --git a/app/src/components/Chart/AreaChart.vue b/app/src/components/Chart/AreaChart.vue index 78cfbda1..b57dbf75 100644 --- a/app/src/components/Chart/AreaChart.vue +++ b/app/src/components/Chart/AreaChart.vue @@ -5,7 +5,7 @@ import type { Ref } from 'vue' import { useSettingsStore } from '@/pinia' import type { Series } from '@/components/Chart/types' -const { series, max, y_formatter } = defineProps<{ +const { series, max, yFormatter } = defineProps<{ series: Series[] max?: number yFormatter?: (value: number) => string @@ -69,7 +69,7 @@ let chartOptions = { style: { colors: fontColor(), }, - formatter: y_formatter, + formatter: yFormatter, }, }, legend: { @@ -106,7 +106,7 @@ const callback = () => { style: { colors: fontColor(), }, - formatter: y_formatter, + formatter: yFormatter, }, }, legend: { diff --git a/app/src/components/ChatGPT/ChatGPT.vue b/app/src/components/ChatGPT/ChatGPT.vue index 9e664611..3373cefe 100644 --- a/app/src/components/ChatGPT/ChatGPT.vue +++ b/app/src/components/ChatGPT/ChatGPT.vue @@ -295,7 +295,7 @@ const show = computed(() => !messages.value || messages.value?.length === 0) v-model:value="ask_buffer" auto-size /> -
+
!messages.value || messages.value?.length === 0) justify-content: center; } - .sned-btn { + .send-btn { position: absolute; right: 0; bottom: 3px; diff --git a/app/src/components/NodeSelector/NodeSelector.vue b/app/src/components/NodeSelector/NodeSelector.vue index 0c14d231..e42570bc 100644 --- a/app/src/components/NodeSelector/NodeSelector.vue +++ b/app/src/components/NodeSelector/NodeSelector.vue @@ -1,5 +1,4 @@