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

nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 028502139 [CELEBORN-1303] Introduce API request module for dashboard 
frontend
028502139 is described below

commit 02850213927daea8babcfb636c23773341b2d871
Author: labbomb <[email protected]>
AuthorDate: Tue Mar 5 12:39:21 2024 +0800

    [CELEBORN-1303] Introduce API request module for dashboard frontend
    
    ### What changes were proposed in this pull request?
    
    - Adds api request module.
    - Adds license about `varlet/axle`.
    - Adss pagination function.
    
    ### Why are the changes needed?
    
    API request module is required to request the backend interface for 
dashboard frontend.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    No.
    
    Closes #2353 from labbomb/CELEBORN-1303.
    
    Authored-by: labbomb <[email protected]>
    Signed-off-by: SteNicholas <[email protected]>
---
 web/LICENSE                          |   3 +-
 web/licenses/LICENSE-@varlet-axle    |  21 ++++
 web/package.json                     |   1 +
 web/pnpm-lock.yaml                   | 216 ++++++++++++++++++++++++++++++++---
 web/src/api/index.ts                 |  18 +++
 web/src/api/models/overview/index.ts |  18 +++
 web/src/api/request.ts               |  73 ++++++++++++
 web/src/api/types.ts                 |  33 ++++++
 web/src/composables/index.ts         |  18 +++
 web/src/composables/pagination.ts    |  71 ++++++++++++
 10 files changed, 455 insertions(+), 17 deletions(-)

diff --git a/web/LICENSE b/web/LICENSE
index 3a0d2bfef..edc3430d2 100644
--- a/web/LICENSE
+++ b/web/LICENSE
@@ -217,6 +217,7 @@ MIT licenses
    @rushstack/eslint-patch 1.7.2: 
https://www.npmjs.com/package/@rushstack/eslint-patch/v/1.7.2 MIT
    @tsconfig/node20 20.1.2: 
https://www.npmjs.com/package/@tsconfig/node20/v/20.1.2 MIT
    @types/node 20.11.16 https://www.npmjs.com/package/@types/node/v/20.11.16 
MIT
+   @varlet/axle 0.6.0 https://www.npmjs.com/package/@varlet/axle/v/0.6.0 MIT
    @vitejs/plugin-vue 5.0.3 
https://www.npmjs.com/package/@vitejs/plugin-vue/v/5.0.3 MIT
    @vitejs/plugin-vue-jsx 3.1.0 
https://www.npmjs.com/package/@vitejs/plugin-vue-jsx/v/3.1.0 MIT
    @vue/eslint-config-prettier 9.0.0 
https://www.npmjs.com/package/@vue/eslint-config-prettier/v/9.0.0 MIT
@@ -243,5 +244,3 @@ BSD licenses
 ========================================================================
 The following components are provided under a BSD license. See project link 
for details.
 The text of each license is also included at licenses/LICENSE-[project].txt.
-
-   license-checker 25.0.1 
https://www.npmjs.com/package/license-checker/v/25.0.1 BSD-3-Clause
diff --git a/web/licenses/LICENSE-@varlet-axle 
b/web/licenses/LICENSE-@varlet-axle
new file mode 100644
index 000000000..5793700ca
--- /dev/null
+++ b/web/licenses/LICENSE-@varlet-axle
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 varlet
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/web/package.json b/web/package.json
index 2ef0011b7..84b391301 100644
--- a/web/package.json
+++ b/web/package.json
@@ -21,6 +21,7 @@
     "@rushstack/eslint-patch": "^1.3.3",
     "@tsconfig/node18": "^18.2.2",
     "@types/node": "^18.19.3",
+    "@varlet/axle": "^0.6.0",
     "@vitejs/plugin-vue": "^4.5.2",
     "@vitejs/plugin-vue-jsx": "^3.1.0",
     "@vue/eslint-config-prettier": "^8.0.0",
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index 90d9d740c..f357298a1 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -42,6 +42,9 @@ devDependencies:
   '@types/node':
     specifier: ^18.19.3
     version: 18.19.3
+  '@varlet/axle':
+    specifier: ^0.6.0
+    version: 0.6.0([email protected])
   '@vitejs/plugin-vue':
     specifier: ^4.5.2
     version: 4.5.2([email protected])([email protected])
@@ -911,7 +914,7 @@ packages:
     peerDependencies:
       '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha
       eslint: ^7.0.0 || ^8.0.0
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
@@ -939,7 +942,7 @@ packages:
     engines: {node: ^16.0.0 || >=18.0.0}
     peerDependencies:
       eslint: ^7.0.0 || ^8.0.0
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
@@ -968,7 +971,7 @@ packages:
     engines: {node: ^16.0.0 || >=18.0.0}
     peerDependencies:
       eslint: ^7.0.0 || ^8.0.0
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
@@ -992,7 +995,7 @@ packages:
     resolution: {integrity: 
sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==}
     engines: {node: ^16.0.0 || >=18.0.0}
     peerDependencies:
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
@@ -1037,6 +1040,26 @@ packages:
       eslint-visitor-keys: 3.4.3
     dev: true
 
+  /@varlet/[email protected]([email protected]):
+    resolution: {integrity: 
sha512-g+B0C5wlxvZXK3F5awbQ7xxaj0X4qhndIlBA/8SrAjnvOlq52Yi37OBoVkEcd6lBP8AvsHSJisKhn7GUN+JIVA==}
+    peerDependencies:
+      vue: ^3.2.0
+    dependencies:
+      '@varlet/shared': 2.20.3
+      axios: 1.6.7
+      crypto-js: 4.2.0
+      lodash: 4.17.21
+      minimatch: 9.0.3
+      qs: 6.11.2
+      vue: 3.3.11([email protected])
+    transitivePeerDependencies:
+      - debug
+    dev: true
+
+  /@varlet/[email protected]:
+    resolution: {integrity: 
sha512-MgLDRYfrGgKqu8Vg2kfRVRGRZE2d8CH0f75vph5h4AG+Clm+A7FgUZLaVTriMWuS6wXrrrceSgX5kNmb/lFShQ==}
+    dev: true
+
   /@vitejs/[email protected]([email protected])([email protected]):
     resolution: {integrity: 
sha512-w9M6F3LSEU5kszVb9An2/MmXNxocAnUb3WhRr8bHlimhDrXNt6n6D2nJQR3UXpGlZHh/EsgouOHCsM8V3Ln+WA==}
     engines: {node: ^14.18.0 || >=16.0.0}
@@ -1184,7 +1207,7 @@ packages:
     peerDependencies:
       eslint: ^6.2.0 || ^7.0.0 || ^8.0.0
       eslint-plugin-vue: ^9.0.0
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
@@ -1202,7 +1225,7 @@ packages:
   /@vue/[email protected]([email protected]):
     resolution: {integrity: 
sha512-NJk/5DnAZlpvXX8BdWmHI45bWGLViUaS3R/RMrmFSvFMSbJKuEODpM4kR0F0Ofv5SFzCWuNiMhxameWpVdQsnA==}
     peerDependencies:
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
@@ -1334,6 +1357,20 @@ packages:
     resolution: {integrity: 
sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==}
+    dependencies:
+      follow-redirects: 1.15.5
+      form-data: 4.0.0
+      proxy-from-env: 1.1.0
+    transitivePeerDependencies:
+      - debug
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
     dev: true
@@ -1378,6 +1415,17 @@ packages:
       update-browserslist-db: 1.0.13([email protected])
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==}
+    engines: {node: '>= 0.4'}
+    dependencies:
+      es-define-property: 1.0.0
+      es-errors: 1.3.0
+      function-bind: 1.1.2
+      get-intrinsic: 1.2.4
+      set-function-length: 1.2.1
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
     engines: {node: '>=6'}
@@ -1445,6 +1493,13 @@ packages:
     resolution: {integrity: 
sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
+    engines: {node: '>= 0.8'}
+    dependencies:
+      delayed-stream: 1.0.0
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==}
     dev: true
@@ -1466,6 +1521,10 @@ packages:
       which: 2.0.2
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-eWzS66patiGkTTik+ipO9qNGZ+uNuGyTmnz6/+EJIiFg8+3yZRpnMwgFo8YdXhQRsiePzehnusrxVvugNjXzbw==}
     dependencies:
@@ -1509,7 +1568,7 @@ packages:
     resolution: {integrity: 
sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
     engines: {node: '>=6.0'}
     peerDependencies:
-      supports-color: '#'
+      supports-color: '*'
     peerDependenciesMeta:
       supports-color:
         optional: true
@@ -1521,6 +1580,20 @@ packages:
     resolution: {integrity: 
sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}
+    engines: {node: '>= 0.4'}
+    dependencies:
+      es-define-property: 1.0.0
+      es-errors: 1.3.0
+      gopd: 1.0.1
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
+    engines: {node: '>=0.4.0'}
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
     engines: {node: '>=8'}
@@ -1550,6 +1623,18 @@ packages:
       is-arrayish: 0.2.1
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==}
+    engines: {node: '>= 0.4'}
+    dependencies:
+      get-intrinsic: 1.2.4
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
+    engines: {node: '>= 0.4'}
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==}
     engines: {node: '>=12'}
@@ -1616,7 +1701,7 @@ packages:
     peerDependencies:
       '@types/eslint': '>=8.0.0'
       eslint: '>=8.0.0'
-      eslint-config-prettier: '#'
+      eslint-config-prettier: '*'
       prettier: '>=3.0.0'
     peerDependenciesMeta:
       '@types/eslint':
@@ -1822,6 +1907,25 @@ packages:
     resolution: {integrity: 
sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==}
+    engines: {node: '>=4.0'}
+    peerDependencies:
+      debug: '*'
+    peerDependenciesMeta:
+      debug:
+        optional: true
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
+    engines: {node: '>= 6'}
+    dependencies:
+      asynckit: 0.4.0
+      combined-stream: 1.0.8
+      mime-types: 2.1.35
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
     dev: true
@@ -1843,6 +1947,17 @@ packages:
     engines: {node: '>=6.9.0'}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==}
+    engines: {node: '>= 0.4'}
+    dependencies:
+      es-errors: 1.3.0
+      function-bind: 1.1.2
+      has-proto: 1.0.3
+      has-symbols: 1.0.3
+      hasown: 2.0.0
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
     engines: {node: '>= 6'}
@@ -1892,6 +2007,12 @@ packages:
       slash: 3.0.0
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
+    dependencies:
+      get-intrinsic: 1.2.4
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
     dev: true
@@ -1906,6 +2027,22 @@ packages:
     engines: {node: '>=8'}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
+    dependencies:
+      es-define-property: 1.0.0
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==}
+    engines: {node: '>= 0.4'}
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==}
+    engines: {node: '>= 0.4'}
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
     engines: {node: '>= 0.4'}
@@ -2148,6 +2285,18 @@ packages:
       picomatch: 2.3.1
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
+    engines: {node: '>= 0.6'}
+    dev: true
+
+  /[email protected]:
+    resolution: {integrity: 
sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
+    engines: {node: '>= 0.6'}
+    dependencies:
+      mime-db: 1.52.0
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
     dependencies:
@@ -2253,6 +2402,10 @@ packages:
       boolbase: 1.0.0
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
     dependencies:
@@ -2409,11 +2562,22 @@ packages:
     hasBin: true
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
     engines: {node: '>=6'}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==}
+    engines: {node: '>=0.6'}
+    dependencies:
+      side-channel: 1.0.6
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
     dev: true
@@ -2525,6 +2689,18 @@ packages:
       lru-cache: 6.0.0
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==}
+    engines: {node: '>= 0.4'}
+    dependencies:
+      define-data-property: 1.1.4
+      es-errors: 1.3.0
+      function-bind: 1.1.2
+      get-intrinsic: 1.2.4
+      gopd: 1.0.1
+      has-property-descriptors: 1.0.2
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
     engines: {node: '>=8'}
@@ -2541,6 +2717,16 @@ packages:
     resolution: {integrity: 
sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==}
+    engines: {node: '>= 0.4'}
+    dependencies:
+      call-bind: 1.0.7
+      es-errors: 1.3.0
+      get-intrinsic: 1.2.4
+      object-inspect: 1.13.1
+    dev: true
+
   /[email protected]:
     resolution: {integrity: 
sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
     engines: {node: '>=8'}
@@ -2713,7 +2899,7 @@ packages:
     engines: {node: '>=14'}
     peerDependencies:
       '@nuxt/kit': ^3.2.2
-      '@vueuse/core': '#'
+      '@vueuse/core': '*'
     peerDependenciesMeta:
       '@nuxt/kit':
         optional: true
@@ -2813,11 +2999,11 @@ packages:
     hasBin: true
     peerDependencies:
       '@types/node': ^18.0.0 || >=20.0.0
-      less: '#'
+      less: '*'
       lightningcss: ^1.21.0
-      sass: '#'
-      stylus: '#'
-      sugarss: '#'
+      sass: '*'
+      stylus: '*'
+      sugarss: '*'
       terser: ^5.4.0
     peerDependenciesMeta:
       '@types/node':
@@ -2906,7 +3092,7 @@ packages:
     resolution: {integrity: 
sha512-lHsRhDc/Y7LINvYhZ3pv4elflFADoEOo67vfClAfF2heVHpHmVquLSjojgCSIwzA4F0Pc4vowT/psXCYcfk+iQ==}
     hasBin: true
     peerDependencies:
-      typescript: '#'
+      typescript: '*'
     dependencies:
       '@volar/typescript': 1.11.1
       '@vue/language-core': 1.8.25([email protected])
@@ -2917,7 +3103,7 @@ packages:
   /[email protected]([email protected]):
     resolution: {integrity: 
sha512-d4oBctG92CRO1cQfVBZp6WJAs0n8AK4Xf5fNjQCBeKCvMI1efGQ5E3Alt1slFJS9fZuPcFoiAiqFvQlv1X7t/w==}
     peerDependencies:
-      typescript: '#'
+      typescript: '*'
     peerDependenciesMeta:
       typescript:
         optional: true
diff --git a/web/src/api/index.ts b/web/src/api/index.ts
new file mode 100644
index 000000000..ed31181ce
--- /dev/null
+++ b/web/src/api/index.ts
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export * from './models/overview'
diff --git a/web/src/api/models/overview/index.ts 
b/web/src/api/models/overview/index.ts
new file mode 100644
index 000000000..68afce022
--- /dev/null
+++ b/web/src/api/models/overview/index.ts
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { api } from '@/api/request'
diff --git a/web/src/api/request.ts b/web/src/api/request.ts
new file mode 100644
index 000000000..434d88fbd
--- /dev/null
+++ b/web/src/api/request.ts
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {
+  createAxle,
+  requestHeadersInterceptor,
+  type RunnerMethod,
+  type AxleRequestConfig
+} from '@varlet/axle'
+import { createUseAxle } from '@varlet/axle/use'
+import type { Options } from './types'
+
+export const axle = createAxle({
+  baseURL: '/api'
+})
+
+axle.useRequestInterceptor(
+  requestHeadersInterceptor({
+    headers: () => ({
+      Authorization: ''
+    })
+  })
+)
+
+axle.useResponseInterceptor({
+  onFulfilled(response) {
+    const { status, message } = response.data
+    if (status !== 200 && message) {
+      // do something there
+      return Promise.reject(response.data)
+    }
+    return response.data
+  },
+  onRejected(error) {
+    if (!error.response) return Promise.reject(error)
+  }
+})
+
+export const useAxle = createUseAxle({
+  axle,
+  onTransform: (response) => response,
+  immediate: true
+})
+
+export function api(url: string, method: RunnerMethod) {
+  function load<V, P = Record<string, any>>(params?: P, config?: 
AxleRequestConfig): Promise<V> {
+    return axle[method](url, params, config)
+  }
+
+  function use<V, RV = V, P = Record<string, any>, R = RV>(options: Options<V, 
R, P> = {}) {
+    return useAxle({ url, method, ...options })
+  }
+
+  return {
+    url,
+    load,
+    use
+  }
+}
diff --git a/web/src/api/types.ts b/web/src/api/types.ts
new file mode 100644
index 000000000..0ae2f28ee
--- /dev/null
+++ b/web/src/api/types.ts
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { UseAxleOptions } from '@varlet/axle/use'
+export interface Response<T> {
+  data: T
+  status: number
+  statusText: string
+}
+
+export type Options<V, R, P> = Partial<UseAxleOptions<V, R, P>>
+
+export interface PaginationType<T> {
+  current_page?: number
+  items: T[]
+  page_count?: number
+  page_size?: number
+  total?: number
+}
diff --git a/web/src/composables/index.ts b/web/src/composables/index.ts
new file mode 100644
index 000000000..ef3072dbf
--- /dev/null
+++ b/web/src/composables/index.ts
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export * from './pagination'
diff --git a/web/src/composables/pagination.ts 
b/web/src/composables/pagination.ts
new file mode 100644
index 000000000..e74d9d438
--- /dev/null
+++ b/web/src/composables/pagination.ts
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export interface UsePaginationOptions {
+  search?: string
+  current_page?: number
+  page_size?: number
+  page_count?: number
+  item_count?: number
+  onLoadData?: Function
+}
+
+export function usePagination(options: UsePaginationOptions = {}) {
+  const search = ref(options.search ?? '')
+  const current_page = ref(options.current_page ?? 1)
+  const page_size = ref(options.page_size ?? 20)
+  const page_count = ref(options.page_count ?? 0)
+  const item_count = ref(options.item_count ?? 0)
+
+  function onUpdatePageChange(value: number) {
+    current_page.value = value
+    options.onLoadData!()
+  }
+
+  function onUpdateSizeChange(value: number) {
+    page_size.value = value
+    options.onLoadData!()
+  }
+
+  function reset() {
+    current_page.value = options.current_page ?? 1
+    page_size.value = options.page_size ?? 20
+    page_count.value = options.page_count ?? 0
+    item_count.value = options.item_count ?? 0
+  }
+
+  return {
+    search,
+    current_page,
+    page_size,
+    page_count,
+    item_count,
+    reset,
+    props: computed(() => {
+      return {
+        current_page: current_page.value,
+        page_size: page_size.value,
+        page_count: page_count.value,
+        item_count: item_count.value
+      }
+    }),
+    emits: {
+      'update:page': onUpdatePageChange,
+      'update:pageSize': onUpdateSizeChange
+    }
+  }
+}

Reply via email to