66
77 <div v-if =" !exporting" class =" dialog-body" >
88 <div class =" dropdown-wrapper" >
9- <label for =" formatSelect" >Select Format</label >
9+ <label for =" currentFormat" >Current Format</label >
10+ <div class =" current-format-value" >
11+ {{ currentFormat }}
12+ </div >
13+ </div >
14+
15+ <div class =" dropdown-wrapper" >
16+ <label for =" formatSelect" >Select Exported Format</label >
1017 <Select
1118 id =" formatSelect"
1219 v-model =" selectedFormat"
@@ -53,6 +60,7 @@ import { createDuckDbClient } from '@/utils/SrDuckDb';
5360import { useSrParquetCfgStore } from ' @/stores/srParquetCfgStore' ;
5461import {getArrowFetchUrlAndOptions } from " @/utils/fetchUtils" ;
5562import { exportCsvStreamed , getWritableFileStream } from " @/utils/SrParquetUtils" ;
63+ import { useFieldNameStore } from ' @/stores/fieldNameStore' ;
5664
5765
5866const props = defineProps <{
@@ -65,17 +73,34 @@ const emit = defineEmits<{
6573}>();
6674
6775const toast = useToast ();
76+ const fieldNameStore = useFieldNameStore ();
6877const visible = ref (props .modelValue );
6978const exporting = ref (false );
7079const selectedFormat = ref <' csv' | ' parquet' | ' geoparquet' | null >(null );
7180const headerCols = ref <string []>([]);
7281const rowCount = ref <number | null >(null );
7382
74- const formats = [
75- { label: ' CSV' , value: ' csv' },
76- { label: ' Parquet' , value: ' parquet' },
77- { label: ' GeoParquet' , value: ' geoparquet' },
78- ];
83+ const currentFormat = computed (() => {
84+ const isGeo = fieldNameStore .isGeoParquet (props .reqId );
85+ console .log (` [ExportDialog] currentFormat computed - reqId: ${props .reqId }, isGeo: ${isGeo }, asGeoCache: ` , fieldNameStore .asGeoCache );
86+ return isGeo ? ' GeoParquet' : ' Parquet' ;
87+ });
88+
89+ const formats = computed (() => {
90+ const isGeo = fieldNameStore .isGeoParquet (props .reqId );
91+ if (isGeo ) {
92+ return [
93+ { label: ' GeoParquet' , value: ' geoparquet' },
94+ { label: ' CSV' , value: ' csv' },
95+ ];
96+ } else {
97+ return [
98+ { label: ' CSV' , value: ' csv' },
99+ { label: ' Parquet' , value: ' parquet' },
100+ { label: ' GeoParquet' , value: ' geoparquet' },
101+ ];
102+ }
103+ });
79104
80105const estimatedSizeMB = computed (() => {
81106 if (rowCount .value !== null && headerCols .value .length > 0 ) {
@@ -103,6 +128,12 @@ onMounted(() => {
103128watch (visible , async (val ) => {
104129 if (val && props .reqId > 0 ) {
105130 try {
131+ // console.log(`[ExportDialog] Dialog opened for reqId: ${props.reqId}`);
132+
133+ // Load field name metadata including as_geo flag
134+ await fieldNameStore .loadMetaForReqId (props .reqId );
135+ // console.log(`[ExportDialog] After loadMetaForReqId, asGeoCache:`, fieldNameStore.asGeoCache);
136+
106137 const fileName = await db .getFilename (props .reqId );
107138 if (! fileName ) return ;
108139 const duck = await createDuckDbClient ();
@@ -217,7 +248,7 @@ async function exportGeoParquet(fileName: string) : Promise<boolean> {
217248 const metadata = await duckDbClient .getAllParquetMetadata (fileName );
218249
219250 const hasGeoMetadata = metadata && ' geo' in metadata ;
220-
251+ // console.log('exportGeoParquet - hasGeoMetadata:', hasGeoMetadata, metadata);
221252 if (hasGeoMetadata ) {
222253 // File already has geo metadata, export as-is using exportParquet pattern
223254 console .log (' File already has geo metadata, exporting as-is' );
@@ -326,6 +357,13 @@ async function exportGeoParquet(fileName: string) : Promise<boolean> {
326357 color : var (--label-color , #374151 );
327358}
328359
360+ .current-format-value {
361+ font-size : 0.875rem ;
362+ font-weight : 600 ;
363+ color : var (--primary-color , #3b82f6 );
364+ padding : 0.25rem 0 ;
365+ }
366+
329367.size-info {
330368 font-size : 0.875rem ;
331369 color : var (--info-color , #6b7280 );
@@ -366,6 +404,10 @@ async function exportGeoParquet(fileName: string) : Promise<boolean> {
366404 color : #cbd5e1 ;
367405 }
368406
407+ .current-format-value {
408+ color : #60a5fa ;
409+ }
410+
369411 .size-info {
370412 color : #94a3b8 ;
371413 }
0 commit comments