@@ -2,6 +2,7 @@ import React, { FunctionComponent, useEffect, useState } from 'react';
22import { Button , Descriptions , Divider , message , Result , Typography } from 'antd' ;
33import { DownloadOutlined } from '@ant-design/icons' ;
44
5+ import { NotebookNavAnchor , NotebookNavStep } from '../Notebook' ;
56import { anonymizer , computeAnonymizationStats , formatPercentage , useCachedData } from '../shared' ;
67import { AnonymizationStats , AnonymizedQueryResult , BucketColumn , TableSchema } from '../types' ;
78import { AnonymizedResultsTable } from './AnonymizedResultsTable' ;
@@ -34,6 +35,7 @@ function AnonymizationSummary({ result, loading }: CommonProps) {
3435
3536 return (
3637 < div className = "AnonymizationSummary loading notebook-step" >
38+ < NotebookNavAnchor step = { NotebookNavStep . AnonymizationSummary } status = { loading ? 'loading' : 'done' } />
3739 < Title level = { 3 } > Anonymization summary</ Title >
3840 { result . rows . length === MAX_ROWS && (
3941 < div className = "mb-1" >
@@ -78,21 +80,34 @@ async function exportResult(schema: TableSchema, bucketColumns: BucketColumn[])
7880}
7981
8082function AnonymizationResults ( { schema, bucketColumns, result, loading } : CommonProps ) {
83+ const [ exported , setExported ] = useState ( false ) ;
84+ useEffect ( ( ) => {
85+ setExported ( false ) ;
86+ } , [ bucketColumns ] ) ;
87+
8188 return (
8289 < div className = "AnonymizationResults notebook-step" >
90+ < NotebookNavAnchor step = { NotebookNavStep . AnonymizedResults } status = { loading ? 'loading' : 'done' } />
8391 < Title level = { 3 } > Anonymized data</ Title >
8492 < div className = "mb-1" >
8593 < Text > Here is what the result looks like:</ Text >
8694 { result . rows . length === MAX_ROWS && < Text type = "secondary" > (only the first { MAX_ROWS } rows are shown)</ Text > }
8795 </ div >
8896 < AnonymizedResultsTable loading = { loading } result = { result } />
97+ < NotebookNavAnchor
98+ step = { NotebookNavStep . CsvExport }
99+ status = { loading ? 'inactive' : exported ? 'done' : 'active' }
100+ />
89101 < Button
90102 icon = { < DownloadOutlined /> }
91103 className = "AnonymizationResults-export-button"
92104 type = "primary"
93105 size = "large"
94106 disabled = { loading || ! result . rows . length }
95- onClick = { ( ) => exportResult ( schema , bucketColumns ) }
107+ onClick = { ( ) => {
108+ exportResult ( schema , bucketColumns ) ;
109+ setExported ( true ) ;
110+ } }
96111 >
97112 Export anonymized data to CSV
98113 </ Button >
@@ -125,6 +140,8 @@ export const AnonymizationStep: FunctionComponent<AnonymizationStepProps> = ({ b
125140 case 'failed' :
126141 return (
127142 < div className = "AnonymizationStep notebook-step failed" >
143+ < NotebookNavAnchor step = { NotebookNavStep . AnonymizationSummary } status = "failed" />
144+ < NotebookNavAnchor step = { NotebookNavStep . AnonymizedResults } status = "failed" />
128145 < Result status = "error" title = "Anonymization failed" subTitle = "Something went wrong." />
129146 </ div >
130147 ) ;
0 commit comments