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

jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git


The following commit(s) were added to refs/heads/master by this push:
     new bb56cfe2a [Improvement]: Supplement mock and merge code (#2841)
bb56cfe2a is described below

commit bb56cfe2a81d5791d6ebaa201383c04f057528e0
Author: xiaomo <[email protected]>
AuthorDate: Fri May 17 16:00:03 2024 +0800

    [Improvement]: Supplement mock and merge code (#2841)
    
    Co-authored-by: ZhouJinsong <[email protected]>
---
 .../amoro-ams-dashboard/mock/modules/optimize.js   |  31 +++--
 .../amoro-ams-dashboard/mock/modules/table.js      | 125 ++++++++++++++++++++-
 amoro-ams/amoro-ams-dashboard/src/language/en.ts   |   3 +
 .../amoro-ams-dashboard/src/types/common.type.ts   |   2 +
 .../src/views/resource/components/List.vue         |  53 +++++----
 5 files changed, 181 insertions(+), 33 deletions(-)

diff --git a/amoro-ams/amoro-ams-dashboard/mock/modules/optimize.js 
b/amoro-ams/amoro-ams-dashboard/mock/modules/optimize.js
index a88afb394..81207ee18 100644
--- a/amoro-ams/amoro-ams-dashboard/mock/modules/optimize.js
+++ b/amoro-ams/amoro-ams-dashboard/mock/modules/optimize.js
@@ -75,11 +75,6 @@ export default [
       }
     }),
   },
-  {
-    url: '/mock/ams/v1/optimize/optimizerGroups/all/optimizers',
-    method: 'get',
-    response: () => ({ "message": "success", "code": 200, "result": { "list": 
[], "total": 0 } }),
-  },
   {
     url: '/mock/ams/v1/optimize/optimizerGroups/local/optimizers',
     method: 'post',
@@ -160,6 +155,28 @@ export default [
       "result": "The optimizer group has been successfully deleted."
     }),
   },
-
-
+  {
+    url: '/mock/ams/v1/optimize/optimizerGroups/all/optimizers',
+    method: 'get',
+    response: () => ({
+      "message": "success",
+      "code": 200,
+      "result": {
+        "list": [
+          {
+            "token": "183c4ce4-a006-4d18-b8b3-4f9bee3e7527",
+            "startTime": 1715862320085,
+            "touchTime": 1715862530475,
+            "jobId": null,
+            "groupName": "local",
+            "coreNumber": 1,
+            "memory": 8192,
+            "jobStatus": "RUNNING",
+            "container": "localContainer"
+          }
+        ],
+        "total": 1
+      }
+    }),
+  },
 ]
diff --git a/amoro-ams/amoro-ams-dashboard/mock/modules/table.js 
b/amoro-ams/amoro-ams-dashboard/mock/modules/table.js
index c58f9eba8..0e94541ca 100644
--- a/amoro-ams/amoro-ams-dashboard/mock/modules/table.js
+++ b/amoro-ams/amoro-ams-dashboard/mock/modules/table.js
@@ -190,13 +190,134 @@ export default [
     }),
   },
   {
-    url: 
'/mock/ams/v1/tables/catalogs/test_catalog/dbs/db/tables/user/optimizing-processes',
+    url: 
'/mock/ams/v1/tables/catalogs/test_catalog/dbs/db/tables/user/operations',
     method: 'get',
     response: () => ({ "message": "success", "code": 200, "result": { "list": 
[], "total": 0 } }),
   },
+  {
+    url: 
'/mock/ams/v1/tables/catalogs/test_catalog/dbs/db/tables/user/partitions/:filter/files',
+    method: 'get',
+    response: () => ({
+      "message": "success",
+      "code": 200,
+      "result": {
+        "list": [
+          {
+            "commitId": "3015968602476930240",
+            "fileType": "BASE_FILE",
+            "commitTime": 1715861982880,
+            "size": "883.00B",
+            "partition": "ts_day=2022-07-01",
+            "specId": 0,
+            "path": 
"/tmp/local_iceberg/db/user/data/ts_day=2022-07-01/00042-1-179d061d-6fe9-4945-b6a6-f8c088595412-00001.parquet",
+            "file": 
"00042-1-179d061d-6fe9-4945-b6a6-f8c088595412-00001.parquet",
+            "fileSize": 883,
+            "operation": null
+          }
+        ],
+        "total": 1
+      }
+    }),
+  },
+  {
+    url: 
'/mock/ams/v1/tables/catalogs/test_catalog/dbs/db/tables/user/snapshots/:snapshotId/detail',
+    method: 'get',
+    response: () => ({
+      "message": "success",
+      "code": 200,
+      "result": {
+        "list": [
+          {
+            "commitId": "3015968602476930240",
+            "fileType": "BASE_FILE",
+            "commitTime": 1715861982880,
+            "size": "883.00B",
+            "partition": "ts_day=2022-07-01",
+            "specId": 0,
+            "path": 
"/tmp/local_iceberg/db/user/data/ts_day=2022-07-01/00042-1-179d061d-6fe9-4945-b6a6-f8c088595412-00001.parquet",
+            "file": 
"00042-1-179d061d-6fe9-4945-b6a6-f8c088595412-00001.parquet",
+            "fileSize": 883,
+            "operation": "add"
+          },
+          {
+            "commitId": "3015968602476930240",
+            "fileType": "BASE_FILE",
+            "commitTime": 1715861982880,
+            "size": "891.00B",
+            "partition": "ts_day=2022-07-02",
+            "specId": 0,
+            "path": 
"/tmp/local_iceberg/db/user/data/ts_day=2022-07-02/00082-2-179d061d-6fe9-4945-b6a6-f8c088595412-00001.parquet",
+            "file": 
"00082-2-179d061d-6fe9-4945-b6a6-f8c088595412-00001.parquet",
+            "fileSize": 891,
+            "operation": "add"
+          }
+        ],
+        "total": 2
+      }
+    }),
+  },
+  {
+    url: 
'/mock/ams/v1/tables/catalogs/test_catalog/dbs/db/tables/user/optimizing-processes',
+    method: 'get',
+    response: () => ({
+      "message": "success",
+      "code": 200,
+      "result": {
+        "list": [
+          {
+            "tableId": 1,
+            "catalogName": "local_iceberg",
+            "dbName": "db",
+            "tableName": "user",
+            "processId": 1715862413340,
+            "startTime": 1715862413340,
+            "optimizingType": "MINOR",
+            "status": "SUCCESS",
+            "failReason": null,
+            "duration": 1531,
+            "successTasks": 2,
+            "totalTasks": 2,
+            "runningTasks": 0,
+            "finishTime": 1715862414871,
+            "inputFiles": {
+              "fileCnt": 16,
+              "totalSize": 14192,
+              "averageSize": 887
+            },
+            "outputFiles": {
+              "fileCnt": 2,
+              "totalSize": 2064,
+              "averageSize": 1032
+            },
+            "summary": {
+              "input-data-files(rewrite)": "16",
+              "input-data-size(rewrite)": "13.86KB",
+              "input-data-records(rewrite)": "24",
+              "output-data-files": "2",
+              "output-data-size": "2.02KB",
+              "output-data-records": "24"
+            }
+          }
+        ],
+        "total": 1
+      }
+    }),
+  },
   {
     url: 
'/mock/ams/v1/tables/catalogs/test_catalog/dbs/db/tables/user/operations',
     method: 'get',
-    response: () => ({ "message": "success", "code": 200, "result": { "list": 
[], "total": 0 } }),
+    response: () => ({
+      "message": "success",
+      "code": 200,
+      "result": {
+        "list": [
+          {
+            "ts": 1715862487163,
+            "operation": "ALTER TABLE user ADD COLUMNS (age bigint)"
+          }
+        ],
+        "total": 1
+      }
+    }),
   },
 ]
diff --git a/amoro-ams/amoro-ams-dashboard/src/language/en.ts 
b/amoro-ams/amoro-ams-dashboard/src/language/en.ts
index 2596f0931..790f57525 100644
--- a/amoro-ams/amoro-ams-dashboard/src/language/en.ts
+++ b/amoro-ams/amoro-ams-dashboard/src/language/en.ts
@@ -34,6 +34,7 @@ export default {
   logout: 'Logout',
   logoutModalTitle: 'Log out of the ams?',
   order: 'Order',
+  token: 'Token',
   cluster: 'Cluster',
   database: 'Database | Databases',
   table: 'Table | Tables',
@@ -83,6 +84,7 @@ export default {
   fileContent: 'File Content',
   startTime: 'Start Time',
   finishTime: 'Finish Time',
+  touchTime: 'Touch Time',
   duration: 'Duration',
   optimizeType: 'Optimize Type',
   parallelism: 'Parallelism',
@@ -94,6 +96,7 @@ export default {
   operationDetails: 'Operation Details',
   copy: 'Copy',
   optimizer: 'Optimizer',
+  optimizerId: 'Optimizer Id',
   optimizers: 'Optimizers',
   container: 'Container',
   status: 'Status',
diff --git a/amoro-ams/amoro-ams-dashboard/src/types/common.type.ts 
b/amoro-ams/amoro-ams-dashboard/src/types/common.type.ts
index 33d109073..adc2a5f56 100644
--- a/amoro-ams/amoro-ams-dashboard/src/types/common.type.ts
+++ b/amoro-ams/amoro-ams-dashboard/src/types/common.type.ts
@@ -260,6 +260,8 @@ export interface IIOptimizeGroupItem {
 }
 
 export interface IOptimizeResourceTableItem {
+  touchTime: string;
+  startTime: string;
   index: number
   jobId: number
   jobStatus: string
diff --git 
a/amoro-ams/amoro-ams-dashboard/src/views/resource/components/List.vue 
b/amoro-ams/amoro-ams-dashboard/src/views/resource/components/List.vue
index 523da332c..4c7f17a48 100644
--- a/amoro-ams/amoro-ams-dashboard/src/views/resource/components/List.vue
+++ b/amoro-ams/amoro-ams-dashboard/src/views/resource/components/List.vue
@@ -1,4 +1,3 @@
-
 <!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -19,14 +18,8 @@ limitations under the License.
 
 <template>
   <div class="list-wrap">
-    <a-table
-      class="ant-table-common"
-      :columns="columns"
-      :data-source="dataSource"
-      :pagination="pagination"
-      :loading="loading"
-      @change="changeTable"
-      >
+    <a-table class="ant-table-common" :columns="columns" 
:data-source="dataSource" :pagination="pagination"
+      :loading="loading" @change="changeTable">
       <template #bodyCell="{ column, record }">
         <template v-if="column.dataIndex === 'durationDisplay'">
           <span :title="record.durationDesc">
@@ -34,16 +27,19 @@ limitations under the License.
           </span>
         </template>
         <template v-if="column.dataIndex === 'optimizeStatus'">
-          <span :style="{'background-color': 
(STATUS_CONFIG[record.optimizeStatus] || {}).color}" class="status-icon"></span>
+          <span :style="{ 'background-color': 
(STATUS_CONFIG[record.optimizeStatus] || {}).color }"
+            class="status-icon"></span>
           <span>{{ record.optimizeStatus }}</span>
         </template>
         <template v-if="column.dataIndex === 'operation'">
-          <span class="primary-link" :class="{'disabled': record.container === 
'external'}" @click="releaseModal(record)">
+          <span class="primary-link" :class="{ 'disabled': record.container 
=== 'external' }"
+            @click="releaseModal(record)">
             {{ t('release') }}
           </span>
         </template>
         <template v-if="column.dataIndex === 'operationGroup'">
-          <span class="primary-link g-mr-12" :class="{'disabled': 
record.container === 'external'}" @click="scaleOutGroup(record)">
+          <span class="primary-link g-mr-12" :class="{ 'disabled': 
record.container === 'external' }"
+            @click="scaleOutGroup(record)">
             {{ t('scaleOut') }}
           </span>
           <span class="primary-link g-mr-12" @click="editGroup(record)">
@@ -65,7 +61,7 @@ import { IOptimizeResourceTableItem, IIOptimizeGroupItem } 
from '@/types/common.
 import { getOptimizerResourceList, getResourceGroupsListAPI, 
groupDeleteCheckAPI, groupDeleteAPI, releaseResource } from 
'@/services/optimize.service'
 import { useI18n } from 'vue-i18n'
 import { usePagination } from '@/hooks/usePagination'
-import { mbToSize } from '@/utils'
+import { mbToSize, dateFormat } from '@/utils'
 
 import { message, Modal, Table as ATable } from 'ant-design-vue'
 
@@ -77,7 +73,7 @@ const router = useRouter()
 
 const props = defineProps<{ curGroupName: string, type: string }>()
 
-const emit = defineEmits<{(e: 'editGroup', record: IIOptimizeGroupItem): void; 
(e: 'refresh'): void}>()
+const emit = defineEmits<{ (e: 'editGroup', record: IIOptimizeGroupItem): 
void; (e: 'refresh'): void }>()
 
 const STATUS_CONFIG = shallowReactive({
   pending: { title: 'pending', color: '#ffcc00' },
@@ -98,11 +94,14 @@ const tableColumns = shallowReactive([
   { dataIndex: 'operationGroup', title: t('operation'), key: 'operationGroup', 
ellipsis: true, width: 230, scopedSlots: { customRender: 'operationGroup' } }
 ])
 const optimizerColumns = shallowReactive([
-  { dataIndex: 'index', title: t('order'), width: 80, ellipsis: true },
+  { dataIndex: 'jobId', title: t('optimizerId'), width: '15%', ellipsis: true 
},
+  { dataIndex: 'token', title: t('token'), width: '10%', ellipsis: true },
   { dataIndex: 'groupName', title: t('optimizerGroup'), ellipsis: true },
   { dataIndex: 'container', title: t('container'), ellipsis: true },
   { dataIndex: 'jobStatus', title: t('status'), ellipsis: true },
-  { dataIndex: 'resourceAllocation', title: t('resourceAllocation'), width: 
'20%', ellipsis: true },
+  { dataIndex: 'resourceAllocation', title: t('resourceAllocation'), width: 
'10%', ellipsis: true },
+  { dataIndex: 'startTime', title: t('startTime'), width: 172, ellipsis: true 
},
+  { dataIndex: 'touchTime', title: t('touchTime'), width: 172, ellipsis: true 
},
   { dataIndex: 'operation', title: t('operation'), key: 'operation', ellipsis: 
true, width: 160, scopedSlots: { customRender: 'operationGroup' } }
 ])
 const pagination = reactive(usePagination())
@@ -128,7 +127,7 @@ function refresh(resetPage?: boolean) {
   }
 }
 
-function releaseModal (record: IOptimizeResourceTableItem) {
+function releaseModal(record: IOptimizeResourceTableItem) {
   if (record.container === 'external') {
     return
   }
@@ -142,12 +141,12 @@ function releaseModal (record: 
IOptimizeResourceTableItem) {
     }
   })
 }
-async function releaseJob (record: IOptimizeResourceTableItem) {
+async function releaseJob(record: IOptimizeResourceTableItem) {
   try {
     releaseLoading.value = true
     await releaseResource({
       optimizerGroup: record.groupName,
-      jobId: record.jobId
+      jobId: (record.jobId) as unknown as string
     })
     refresh(true)
     emit('refreshCurGroupInfo')
@@ -156,7 +155,7 @@ async function releaseJob (record: 
IOptimizeResourceTableItem) {
   }
 }
 
-async function getOptimizersList () {
+async function getOptimizersList() {
   try {
     optimizersList.length = 0
     loading.value = true
@@ -171,6 +170,8 @@ async function getOptimizersList () {
     (list || []).forEach((p: IOptimizeResourceTableItem, index: number) => {
       p.resourceAllocation = `${p.coreNumber} ${t('core')} 
${mbToSize(p.memory)}`
       p.index = (pagination.current - 1) * pagination.pageSize + index + 1
+      p.startTime = p.startTime ? dateFormat(p.startTime) : '-'
+      p.touchTime = p.touchTime ? dateFormat(p.touchTime) : '-'
       optimizersList.push(p)
     })
   } catch (error) {
@@ -179,7 +180,7 @@ async function getOptimizersList () {
   }
 }
 
-async function getResourceGroupsList () {
+async function getResourceGroupsList() {
   try {
     groupList.length = 0
     loading.value = true
@@ -200,12 +201,12 @@ async function getResourceGroupsList () {
 const editGroup = (record: IIOptimizeGroupItem) => {
   emit('editGroup', record)
 }
-const removeGroup = async(record: IIOptimizeGroupItem) => {
+const removeGroup = async (record: IIOptimizeGroupItem) => {
   const res = await groupDeleteCheckAPI({ name: record.name })
   if (res) {
     Modal.confirm({
       title: t('deleteGroupModalTitle'),
-      onOk: async() => {
+      onOk: async () => {
         await groupDeleteAPI({ name: record.name })
         message.success(`${t('remove')} ${t('success')}`)
         refresh()
@@ -229,7 +230,7 @@ const scaleOutGroup = (record: IIOptimizeGroupItem) => {
   scaleOutViseble.value = true
 }
 
-function changeTable ({ current = pagination.current, pageSize = 
pagination.pageSize }) {
+function changeTable({ current = pagination.current, pageSize = 
pagination.pageSize }) {
   pagination.current = current
   const resetPage = pageSize !== pagination.pageSize
   pagination.pageSize = pageSize
@@ -244,16 +245,20 @@ onMounted(() => {
 .list-wrap {
   .primary-link {
     color: @primary-color;
+
     &:hover {
       cursor: pointer;
     }
+
     &.disabled {
       color: #999;
+
       &:hover {
         cursor: not-allowed;
       }
     }
   }
+
   .status-icon {
     width: 8px;
     height: 8px;

Reply via email to