From cb7d0fddfbaf4eb536e0433f34944b957b6ea7e9 Mon Sep 17 00:00:00 2001 From: WuWQ98 <96223865+WuWQ98@users.noreply.github.com> Date: Wed, 8 Mar 2023 21:54:33 +0800 Subject: [PATCH] (# [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 ( Finished Queries @@ -82,7 +96,12 @@ export default function QueryProfile(params: any) { This table lists the latest 100 queries - {profile ? : ''} + {profile ? + + + : ''} {