Skip to content

Commit

Permalink
feat: query results export
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Apr 22, 2021
1 parent 0d77aee commit 1d363f7
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/renderer/components/WorkspaceQueryTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,28 @@
<span>{{ $t('word.run') }}</span>
<i class="mdi mdi-24px mdi-play" />
</button>
<div class="dropdown export-dropdown pr-2">
<button
:disabled="!results.length || isQuering"
class="btn btn-dark btn-sm dropdown-toggle mr-0 pr-0"
tabindex="0"
>
<span>{{ $t('word.export') }}</span>
<i class="mdi mdi-24px mdi-file-export ml-1" />
<i class="mdi mdi-24px mdi-menu-down" />
</button>
<ul class="menu text-left">
<li class="menu-item">
<a class="c-hand" @click="downloadTable('json')">JSON</a>
</li>
<li class="menu-item">
<a class="c-hand" @click="downloadTable('csv')">CSV</a>
</li>
</ul>
</div>
<button
class="btn btn-dark btn-sm"
:disabled="!query"
:disabled="!query || isQuering"
title="CTRL+F8"
@click="beautify()"
>
Expand All @@ -42,7 +61,7 @@
</button>
<button
class="btn btn-link btn-sm"
:disabled="!query"
:disabled="!query || isQuering"
title="CTRL+W"
@click="clear()"
>
Expand Down Expand Up @@ -245,6 +264,9 @@ export default {
if (this.$refs.queryEditor)
this.$refs.queryEditor.editor.session.setValue('');
this.clearTabData();
},
downloadTable (format) {
this.$refs.queryTable.downloadTable(format, `${this.tab.type}-${this.tab.index}`);
}
}
};
Expand Down Expand Up @@ -298,4 +320,9 @@ export default {
}
}
.export-dropdown {
.menu {
min-width: 100%;
}
}
</style>

0 comments on commit 1d363f7

Please sign in to comment.