Skip to content

Commit

Permalink
fix extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyRaphael committed Jun 19, 2024
1 parent f2d2ab6 commit ed603ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tableviewer",
"private": true,
"version": "1.2.0",
"version": "1.3.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
29 changes: 21 additions & 8 deletions src/components/datatable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<n-data-table max-height="calc(100vh - 120px)" :columns="tb_headers" :data="tb_body" size="small"
style="font-size:smaller;font-weight: 550;" />
</div>
<n-modal v-model:show="showModal" preset="dialog" negative-text="Cancel" positive-text="Ok" @positive-click="config_csv"
title="Choose Separator">
<n-modal v-model:show="showModal" preset="dialog" negative-text="Cancel" positive-text="Ok"
@positive-click="config_csv" title="Choose Separator">
<n-select v-model:value="csv_sep" :options="csv_sep_combos" />
</n-modal>
</template>
Expand All @@ -48,15 +48,15 @@ const tb_body = ref([]);
const filetype_options = [
{
label: 'parquet',
label: 'parquet(s)',
key: 'parquet'
},
{
label: 'arrow',
label: 'feather(s)',
key: 'arrow'
},
{
label: 'csv',
label: 'csv(s)',
key: 'csv'
}
]
Expand Down Expand Up @@ -101,14 +101,27 @@ async function execute_sql() {
}
}
interface ExtensionMapType {
[key: string]: string[]; // Index signature: any string key maps to an array of strings
}
const Extensions: ExtensionMapType = {
"parquet": ["parquet",],
"arrow": ["arrow", "ipc", "feather"],
"csv": ["csv",],
};
async function choose_filetype(key: string) {
sql.value = "select * from LAST offset 0 limit 100";
last_filetype.value = key;
const selected = await open({
multiple: true,
filters: [{
name: 'table file',
extensions: [key,]
name: 'Table File(s)',
extensions: Extensions[key]
}, {
name: 'All File(s)',
extensions: ["*",]
}]
});
// console.log(selected);
Expand Down Expand Up @@ -138,7 +151,7 @@ async function config_csv() {
// modal
const showModal = ref(false);
const csv_sep = ref(';');
const csv_sep = ref(',');
const csv_sep_combos = [
{
label: "comma(,)",
Expand Down

0 comments on commit ed603ef

Please sign in to comment.