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

yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 2fb6c5cf71 (# [feature](ui)add profile download button 17547)
2fb6c5cf71 is described below

commit 2fb6c5cf716248bd646209d94a348dc603c3978a
Author: WuWQ98 <96223865+wuw...@users.noreply.github.com>
AuthorDate: Wed Mar 8 21:54:33 2023 +0800

    (# [feature](ui)add profile download button 17547)
---
 ui/src/pages/query-profile/index.tsx | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/ui/src/pages/query-profile/index.tsx 
b/ui/src/pages/query-profile/index.tsx
index ccdf64ce26..bcd71b2ea0 100644
--- a/ui/src/pages/query-profile/index.tsx
+++ b/ui/src/pages/query-profile/index.tsx
@@ -18,7 +18,7 @@
  */
 
 import React, {useEffect, useRef, useState} from 'react';
-import {Button, Col, Row, Typography} from 'antd';
+import {Button, Col, Row, Typography, Space} from 'antd';
 import {queryProfile} from 'Src/api/api';
 import Table from 'Src/components/table';
 import {useHistory} from 'react-router-dom';
@@ -75,6 +75,20 @@ export default function QueryProfile(params: any) {
         history.push('/QueryProfile/');
     }
 
+    function download(profile) {
+        const blob = new Blob([JSON.stringify(profile)], {
+            type: "text/plain"
+        });
+        const tagA = document.createElement("a");
+        tagA.download = `profile_${(new Date()).valueOf()}.txt`;
+        tagA.style.display = "none";
+        tagA.href = URL.createObjectURL(blob);
+        document.body.appendChild(tagA);
+        tagA.click();
+        URL.revokeObjectURL(tagA.href);
+        document.body.removeChild(tagA);
+    }
+
     return (
         <Typography style={{padding: '30px'}}>
             <Title>Finished Queries</Title>
@@ -82,7 +96,12 @@ export default function QueryProfile(params: any) {
             <Row style={{paddingBottom: '15px'}}>
                 <Col span={12}><Text strong={true}>This table lists the latest 
100 queries</Text></Col>
                 <Col span={12} style={{textAlign: 'right'}}>
-                    {profile ? <Button type="primary" 
onClick={goPrev}>back</Button> : ''}
+                    {profile ? <Space>
+                        <Button type="primary" onClick={goPrev}>back</Button>
+                        <Button onClick={() => {
+                            download(profile)
+                        }}>download</Button>
+                    </Space> : ''}
                 </Col>
             </Row>
             {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to