0xJacky 2 роки тому
батько
коміт
133a0e9501

+ 18 - 15
frontend/components.d.ts

@@ -33,7 +33,6 @@ declare module '@vue/runtime-core' {
     APagination: typeof import('ant-design-vue/es')['Pagination']
     APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
     AProgress: typeof import('ant-design-vue/es')['Progress']
-    AreaChart: typeof import('./src/components/Chart/AreaChart.vue')['default']
     AResult: typeof import('ant-design-vue/es')['Result']
     ARow: typeof import('ant-design-vue/es')['Row']
     ASelect: typeof import('ant-design-vue/es')['Select']
@@ -49,21 +48,25 @@ declare module '@vue/runtime-core' {
     ATabs: typeof import('ant-design-vue/es')['Tabs']
     ATag: typeof import('ant-design-vue/es')['Tag']
     ATextarea: typeof import('ant-design-vue/es')['Textarea']
-    Breadcrumb: typeof import('./src/components/Breadcrumb/Breadcrumb.vue')['default']
-    CodeEditor: typeof import('./src/components/CodeEditor/CodeEditor.vue')['default']
-    FooterToolBar: typeof import('./src/components/FooterToolbar/FooterToolBar.vue')['default']
-    Logo: typeof import('./src/components/Logo/Logo.vue')['default']
-    PageHeader: typeof import('./src/components/PageHeader/PageHeader.vue')['default']
-    RadialBarChart: typeof import('./src/components/Chart/RadialBarChart.vue')['default']
+    BreadcrumbBreadcrumb: typeof import('./src/components/Breadcrumb/Breadcrumb.vue')['default']
+    ChartAreaChart: typeof import('./src/components/Chart/AreaChart.vue')['default']
+    ChartRadialBarChart: typeof import('./src/components/Chart/RadialBarChart.vue')['default']
+    CodeEditorCodeEditor: typeof import('./src/components/CodeEditor/CodeEditor.vue')['default']
+    FooterToolbarFooterToolBar: typeof import('./src/components/FooterToolbar/FooterToolBar.vue')['default']
+    LogoLogo: typeof import('./src/components/Logo/Logo.vue')['default']
+    PageHeaderPageHeader: typeof import('./src/components/PageHeader/PageHeader.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
-    SetLanguage: typeof import('./src/components/SetLanguage/SetLanguage.vue')['default']
-    StdBatchEdit: typeof import('./src/components/StdDataDisplay/StdBatchEdit.vue')['default']
-    StdCurd: typeof import('./src/components/StdDataDisplay/StdCurd.vue')['default']
-    StdPagination: typeof import('./src/components/StdDataDisplay/StdPagination.vue')['default']
-    StdPassword: typeof import('./src/components/StdDataEntry/components/StdPassword.vue')['default']
-    StdSelect: typeof import('./src/components/StdDataEntry/components/StdSelect.vue')['default']
-    StdSelector: typeof import('./src/components/StdDataEntry/components/StdSelector.vue')['default']
-    StdTable: typeof import('./src/components/StdDataDisplay/StdTable.vue')['default']
+    SetLanguageSetLanguage: typeof import('./src/components/SetLanguage/SetLanguage.vue')['default']
+    StdDataDisplayStdBatchEdit: typeof import('./src/components/StdDataDisplay/StdBatchEdit.vue')['default']
+    StdDataDisplayStdCurd: typeof import('./src/components/StdDataDisplay/StdCurd.vue')['default']
+    StdDataDisplayStdPagination: typeof import('./src/components/StdDataDisplay/StdPagination.vue')['default']
+    StdDataDisplayStdTable: typeof import('./src/components/StdDataDisplay/StdTable.vue')['default']
+    StdDataEntryComponentsStdPassword: typeof import('./src/components/StdDataEntry/components/StdPassword.vue')['default']
+    StdDataEntryComponentsStdSelect: typeof import('./src/components/StdDataEntry/components/StdSelect.vue')['default']
+    StdDataEntryComponentsStdSelector: typeof import('./src/components/StdDataEntry/components/StdSelector.vue')['default']
+    StdDataEntryCompontentsStdPassword: typeof import('./src/components/StdDataEntry/compontents/StdPassword.vue')['default']
+    StdDataEntryCompontentsStdSelect: typeof import('./src/components/StdDataEntry/compontents/StdSelect.vue')['default']
+    StdDataEntryCompontentsStdSelector: typeof import('./src/components/StdDataEntry/compontents/StdSelector.vue')['default']
   }
 }

+ 1 - 1
frontend/package.json

@@ -1,7 +1,7 @@
 {
     "name": "nginx-ui-frontend-next",
     "private": true,
-    "version": "1.6.6",
+    "version": "1.6.7",
     "type": "commonjs",
     "scripts": {
         "dev": "vite",

+ 1 - 1
frontend/src/components/StdDataDisplay/StdBatchEdit.vue

@@ -40,7 +40,7 @@ async function ok() {
         message.success($gettext('Save successfully'))
         emit('onSave')
     }).catch((e: any) => {
-        message.error(e?.message ?? $gettext('Server error'))
+        message.error($gettext(e?.message) ?? $gettext('Server error'))
     }).finally(() => {
         loading.value = false
     })

+ 5 - 1
frontend/src/components/StdDataDisplay/StdCurd.vue

@@ -123,7 +123,11 @@ function cancel() {
 }
 
 function edit(id: any) {
-    props.api!.get(id).then((r: any) => {
+    props.api!.get(id).then(async (r: any) => {
+        Object.keys(data).forEach(k => {
+            delete data[k]
+        })
+        data.id = null
         Object.assign(data, r)
         visible.value = true
     }).catch((e: any) => {

+ 14 - 3
frontend/src/components/StdDataDisplay/StdPagination.vue

@@ -1,20 +1,31 @@
 <script setup lang="ts">
 import {useGettext} from 'vue3-gettext'
+import {computed} from 'vue'
 
-const {pagination, size} = defineProps(['pagination', 'size'])
-const emit = defineEmits(['change'])
+const props = defineProps(['pagination', 'size'])
+const emit = defineEmits(['change', 'changePageSize'])
 const {$gettext} = useGettext()
 
 function change(num: number, pageSize: number) {
     emit('change', num, pageSize)
 }
+
+const pageSize = computed({
+    get() {
+        return props.pagination.per_page
+    },
+    set(v) {
+        emit('changePageSize', v)
+        props.pagination.per_page = v
+    }
+})
 </script>
 
 <template>
     <div class="pagination-container" v-if="pagination.total>pagination.per_page">
         <a-pagination
                 :current="pagination.current_page"
-                :pageSize="pagination.per_page"
+                v-model:pageSize="pageSize"
                 :size="size"
                 :total="pagination.total"
                 @change="change"

+ 5 - 1
frontend/src/components/StdDataDisplay/StdTable.vue

@@ -171,6 +171,7 @@ function get_list(page_num = null, page_size = 20) {
 
 function stdChange(pagination: any, filters: any, sorter: any) {
     if (sorter) {
+        selectedRowKeysBuffer.value = []
         params['order_by'] = sorter.field
         params['sort'] = sorter.order === 'ascend' ? 'asc' : 'desc'
         switch (sorter.order) {
@@ -185,6 +186,9 @@ function stdChange(pagination: any, filters: any, sorter: any) {
                 break
         }
     }
+    if (pagination) {
+        selectedRowKeysBuffer.value = []
+    }
 }
 
 function expandedTable(keys: any) {
@@ -526,7 +530,7 @@ function initSortable() {
                 </template>
             </template>
         </a-table>
-        <std-pagination :size="size" :pagination="pagination" @change="get_list"/>
+        <std-pagination :size="size" :pagination="pagination" @change="get_list" @changePageSize="stdChange"/>
     </div>
 </template>
 

+ 1 - 1
frontend/src/version.json

@@ -1 +1 @@
-{"version":"1.6.5","build_id":53,"total_build":123}
+{"version":"1.6.7","build_id":56,"total_build":126}

+ 1 - 1
frontend/version.json

@@ -1 +1 @@
-{"version":"1.6.5","build_id":53,"total_build":123}
+{"version":"1.6.7","build_id":56,"total_build":126}

+ 13 - 12
frontend/vite.config.ts

@@ -11,7 +11,7 @@ import vitePluginBuildId from 'vite-plugin-build-id'
 export default defineConfig({
     resolve: {
         alias: {
-            '@': fileURLToPath(new URL('./src', import.meta.url)),
+            '@': fileURLToPath(new URL('./src', import.meta.url))
         },
         extensions: [
             '.mjs',
@@ -26,7 +26,8 @@ export default defineConfig({
     },
     plugins: [vue(), vueJsx(), vitePluginBuildId(),
         Components({
-            resolvers: [AntDesignVueResolver({importStyle: false})]
+            resolvers: [AntDesignVueResolver({importStyle: false})],
+            directoryAsNamespace: true
         }),
         createHtmlPlugin({
             minify: true,
@@ -46,20 +47,20 @@ export default defineConfig({
              */
             inject: {
                 data: {
-                    title: 'Nginx UI',
-                },
-            },
-        }),
+                    title: 'Nginx UI'
+                }
+            }
+        })
     ],
     css: {
         preprocessorOptions: {
             less: {
                 modifyVars: {
-                    'border-radius-base': '4px',
+                    'border-radius-base': '4px'
                 },
-                javascriptEnabled: true,
+                javascriptEnabled: true
             }
-        },
+        }
     },
     server: {
         proxy: {
@@ -67,9 +68,9 @@ export default defineConfig({
                 target: 'https://nginx.jackyu.cn/',
                 changeOrigin: true,
                 secure: false,
-                ws: true,
-            },
-        },
+                ws: true
+            }
+        }
     },
     build: {
         chunkSizeWarningLimit: 600