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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4d62c4a917b Web console: concat data when doing a durable storage 
download (#16375)
4d62c4a917b is described below

commit 4d62c4a917b44396c09be728503abf8e8503b109
Author: Vadim Ogievetsky <[email protected]>
AuthorDate: Fri May 3 08:00:32 2024 -0700

    Web console: concat data when doing a durable storage download (#16375)
    
    * concat data
    
    * fix silly console.error
---
 web-console/src/console-application.tsx             |  4 +++-
 .../destination-pages-pane.tsx                      | 21 ++++++++++-----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/web-console/src/console-application.tsx 
b/web-console/src/console-application.tsx
index 08eaf74f4b7..e500af23e5d 100644
--- a/web-console/src/console-application.tsx
+++ b/web-console/src/console-application.tsx
@@ -123,7 +123,9 @@ export class ConsoleApplication extends React.PureComponent<
         return await Capabilities.detectCapacity(capabilities);
       },
       onStateChange: ({ data, loading, error }) => {
-        console.error('There was an error retrieving the capabilities', error);
+        if (error) {
+          console.error('There was an error retrieving the capabilities', 
error);
+        }
         this.setState({
           capabilities: data || Capabilities.FULL,
           capabilitiesLoading: loading,
diff --git 
a/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
 
b/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
index 8535db85a53..b58a75aea4b 100644
--- 
a/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
+++ 
b/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
@@ -82,9 +82,11 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
 
   const numTotalRows = destination?.numTotalRows;
 
-  function getPageUrl(pageIndex: number) {
+  function getResultUrl(pageIndex: number) {
     return UrlBaser.base(
-      
`/druid/v2/sql/statements/${id}/results?page=${pageIndex}&resultFormat=${desiredResultFormat}`,
+      `/druid/v2/sql/statements/${id}/results?${
+        pageIndex < 0 ? '' : `page=${pageIndex}&`
+      }resultFormat=${desiredResultFormat}`,
     );
   }
 
@@ -94,13 +96,10 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
     return 
`${id}_page_${pageNumberString}_of_${numPagesString}.${desiredExtension}`;
   }
 
-  async function downloadAllPages() {
+  async function downloadAllData() {
     if (!pages) return;
-    const numPages = pages.length;
-    for (let i = 0; i < pages.length; i++) {
-      downloadUrl(getPageUrl(i), getPageFilename(i, numPages));
-      await wait(100);
-    }
+    downloadUrl(getResultUrl(-1), `${id}_all_data.${desiredExtension}`);
+    await wait(100);
   }
 
   const numPages = pages.length;
@@ -139,8 +138,8 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
           <Button
             intent={Intent.PRIMARY}
             icon={IconNames.DOWNLOAD}
-            text={`Download all data (${pluralIfNeeded(numPages, 'file')})`}
-            onClick={() => void downloadAllPages()}
+            text="Download all data (concatenated)"
+            onClick={() => void downloadAllData()}
           />
         )}
       </p>
@@ -185,7 +184,7 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
                 icon={IconNames.DOWNLOAD}
                 text="Download"
                 minimal
-                href={getPageUrl(value)}
+                href={getResultUrl(value)}
                 download={getPageFilename(value, numPages)}
               />
             ),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to