You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by ni...@apache.org on 2024/06/26 04:31:05 UTC

(paimon-webui) branch main updated: [Feature] Introduce log cleaner for logging query (#446)

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/paimon-webui.git


The following commit(s) were added to refs/heads/main by this push:
     new 572fb727 [Feature] Introduce log cleaner for logging query (#446)
572fb727 is described below

commit 572fb727e4a0b651dc2430b7e4479e6bddad3c1f
Author: s7monk <34...@users.noreply.github.com>
AuthorDate: Wed Jun 26 12:31:01 2024 +0800

    [Feature] Introduce log cleaner for logging query (#446)
---
 paimon-web-ui/src/api/models/job/index.ts          |  7 ++++++
 paimon-web-ui/src/locales/en/modules/playground.ts |  1 +
 paimon-web-ui/src/locales/zh/modules/playground.ts |  1 +
 .../components/query/components/console/index.tsx  | 26 ++++++++++++++++++++++
 4 files changed, 35 insertions(+)

diff --git a/paimon-web-ui/src/api/models/job/index.ts b/paimon-web-ui/src/api/models/job/index.ts
index 1bc7f7d9..c80bced0 100644
--- a/paimon-web-ui/src/api/models/job/index.ts
+++ b/paimon-web-ui/src/api/models/job/index.ts
@@ -83,3 +83,10 @@ export function createRecord(params: RecordDTO) {
 export function getLogs() {
   return httpRequest.get<unknown, ResponseOptions<string>>('/job/logs/get')
 }
+
+/**
+ * # Clear job logs
+ */
+export function clearLogs() {
+  return httpRequest.get<unknown, ResponseOptions<string>>('/job/logs/clear')
+}
diff --git a/paimon-web-ui/src/locales/en/modules/playground.ts b/paimon-web-ui/src/locales/en/modules/playground.ts
index d4b9637d..74810025 100644
--- a/paimon-web-ui/src/locales/en/modules/playground.ts
+++ b/paimon-web-ui/src/locales/en/modules/playground.ts
@@ -32,6 +32,7 @@ export default {
   reload: 'Restore Layout',
   save: 'Save',
   close: 'Close',
+  clear: 'Clear Logs',
   unfold: 'Unfold',
   collapse: 'Collapse',
   logs: 'Logs',
diff --git a/paimon-web-ui/src/locales/zh/modules/playground.ts b/paimon-web-ui/src/locales/zh/modules/playground.ts
index b4cafcec..39ce0510 100644
--- a/paimon-web-ui/src/locales/zh/modules/playground.ts
+++ b/paimon-web-ui/src/locales/zh/modules/playground.ts
@@ -32,6 +32,7 @@ export default {
   reload: '恢复布局',
   save: '保存',
   close: '关闭',
+  clear: '清空日志',
   unfold: '展开',
   collapse: '折叠',
   logs: '日志',
diff --git a/paimon-web-ui/src/views/playground/components/query/components/console/index.tsx b/paimon-web-ui/src/views/playground/components/query/components/console/index.tsx
index 93334680..72d75bbe 100644
--- a/paimon-web-ui/src/views/playground/components/query/components/console/index.tsx
+++ b/paimon-web-ui/src/views/playground/components/query/components/console/index.tsx
@@ -16,12 +16,14 @@ specific language governing permissions and limitations
 under the License. */
 
 import { CloseSharp, KeyboardDoubleArrowDownSharp, KeyboardDoubleArrowUpSharp } from '@vicons/material'
+import { ClearOutlined } from '@vicons/antd'
 import { throttle } from 'lodash'
 import TableActionBar from './components/controls'
 import TableResult from './components/table'
 import LogConsole from './components/log'
 import styles from './index.module.scss'
 import { useJobStore } from '@/store/job'
+import { clearLogs } from '@/api/models/job'
 
 export default defineComponent({
   name: 'EditorConsole',
@@ -57,6 +59,11 @@ export default defineComponent({
       emit('ConsoleClose', 'close')
     }
 
+    const handleClear = async () => {
+      const response = await clearLogs()
+      jobStore.setJobLog(response.data)
+    }
+
     watch(jobStatus, (newStatus, oldStatus) => {
       if (newStatus === 'RUNNING' && oldStatus !== 'RUNNING') {
         jobStore.startJobTimer(currentKey.value)
@@ -92,6 +99,7 @@ export default defineComponent({
       handleUp,
       handleDown,
       handleClose,
+      handleClear,
       editorConsoleRef,
       adjustedHeight,
       displayResult,
@@ -123,6 +131,24 @@ export default defineComponent({
         </n-tabs>
         <div class={styles.operations}>
           <n-space>
+            <n-popover
+              trigger="hover"
+              placement="bottom"
+              v-slots={{
+                trigger: () => (
+                  <n-button
+                    text
+                    onClick={this.handleClear}
+                    v-slots={{
+                      icon: () => <n-icon component={ClearOutlined} size="15.5"></n-icon>,
+                    }}
+                  >
+                  </n-button>
+                ),
+              }}
+            >
+              <span>{this.t('playground.clear')}</span>
+            </n-popover>
             <n-popover
               trigger="hover"
               placement="bottom"