1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Merge branch 'feat/db-import-export' of https://github.com/toriphes/antares into pr/toriphes/129

This commit is contained in:
2022-02-16 09:16:14 +01:00
11 changed files with 477 additions and 2 deletions

View File

@ -65,6 +65,13 @@
>
<span class="d-flex"><i class="mdi mdi-18px mdi-database-arrow-down text-light pr-1" /> {{ $t('word.export') }}</span>
</div>
<div
v-if="workspace.customizations.schemaImport"
class="context-element"
@click="initImport"
>
<span class="d-flex"><i class="mdi mdi-18px mdi-database-arrow-up text-light pr-1" /> {{ $t('word.import') }}</span>
</div>
<div
v-if="workspace.customizations.schemaEdit"
class="context-element"
@ -107,6 +114,12 @@
:selected-schema="selectedSchema"
@close="hideExportSchemaModal"
/>
<ModalImportSchema
v-if="isImportSchemaModal"
ref="importModalRef"
:selected-schema="selectedSchema"
@close="hideImportSchemaModal"
/>
</BaseContextMenu>
</template>
@ -116,7 +129,9 @@ import BaseContextMenu from '@/components/BaseContextMenu';
import ConfirmModal from '@/components/BaseConfirmModal';
import ModalEditSchema from '@/components/ModalEditSchema';
import ModalExportSchema from '@/components/ModalExportSchema';
import ModalImportSchema from '@/components/ModalImportSchema';
import Schema from '@/ipc-api/Schema';
import Application from '@/ipc-api/Application';
export default {
name: 'WorkspaceExploreBarSchemaContext',
@ -124,7 +139,8 @@ export default {
BaseContextMenu,
ConfirmModal,
ModalEditSchema,
ModalExportSchema
ModalExportSchema,
ModalImportSchema
},
props: {
contextEvent: MouseEvent,
@ -134,7 +150,8 @@ export default {
return {
isDeleteModal: false,
isEditModal: false,
isExportSchemaModal: false
isExportSchemaModal: false,
isImportSchemaModal: false
};
},
computed: {
@ -191,6 +208,22 @@ export default {
hideExportSchemaModal () {
this.isExportSchemaModal = false;
},
showImportSchemaModal () {
this.isImportSchemaModal = true;
},
hideImportSchemaModal () {
this.isImportSchemaModal = false;
},
async initImport () {
const result = await Application.showOpenDialog({ properties: ['openFile'], filters: [{ name: 'SQL', extensions: ['sql'] }] });
if (result && !result.canceled) {
const file = result.filePaths[0];
this.showImportSchemaModal();
this.$nextTick(() => {
this.$refs.importModalRef.startImport(file);
});
}
},
closeContext () {
this.$emit('close-context');
},