|
|
|
@ -1,8 +1,9 @@
|
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
|
|
|
|
|
<h3 class="text-center mb-5 grey--text text--darken-2">Metadata Operations</h3> |
|
|
|
|
|
|
|
|
|
<h3 class="text-center mb-5 grey--text text--darken-2"> |
|
|
|
|
<!-- Metadata Operations --> |
|
|
|
|
{{ $t('management.meta.title') }} |
|
|
|
|
</h3> |
|
|
|
|
|
|
|
|
|
<v-simple-table class="ma-2 meta-table text-center mx-auto"> |
|
|
|
|
<!-- <thead>--> |
|
|
|
@ -11,78 +12,121 @@
|
|
|
|
|
<!-- </tr>--> |
|
|
|
|
<!-- </thead>--> |
|
|
|
|
<tbody> |
|
|
|
|
|
|
|
|
|
<tr> |
|
|
|
|
<td>Export all metadata from the meta tables to meta directory.</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn min-width="150" color="primary" small outlined @click="exportMeta" |
|
|
|
|
:loading="loading === 'export-file'"> |
|
|
|
|
<!-- Export all metadata from the meta tables to meta directory. --> |
|
|
|
|
{{ $t('management.meta.operation_1.desc') }} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn |
|
|
|
|
min-width="150" |
|
|
|
|
color="primary" |
|
|
|
|
small |
|
|
|
|
outlined |
|
|
|
|
@click="exportMeta" |
|
|
|
|
:loading="loading === 'export-file'" |
|
|
|
|
> |
|
|
|
|
<v-icon small>mdi-export</v-icon> |
|
|
|
|
Export to file |
|
|
|
|
<!-- Export to file --> |
|
|
|
|
{{ $t('management.meta.operation_1') }} |
|
|
|
|
</v-btn> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
<tr> |
|
|
|
|
<td>Import all metadata from the meta directory to meta tables.</td> |
|
|
|
|
<td> |
|
|
|
|
<!-- Import all metadata from the meta directory to meta tables. --> |
|
|
|
|
{{ $t('management.meta.operation_2.desc') }} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn |
|
|
|
|
:loading="loading === 'import-file'" |
|
|
|
|
min-width="150" color="info" small outlined @click="importMeta"> |
|
|
|
|
min-width="150" |
|
|
|
|
color="info" |
|
|
|
|
small |
|
|
|
|
outlined |
|
|
|
|
@click="importMeta" |
|
|
|
|
> |
|
|
|
|
<v-icon small>mdi-import</v-icon> |
|
|
|
|
|
|
|
|
|
Import |
|
|
|
|
<!-- Import --> |
|
|
|
|
{{ $t('management.meta.operation_2') }} |
|
|
|
|
</v-btn> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
<tr> |
|
|
|
|
<td>Export project meta to zip file and download.</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn min-width="150" |
|
|
|
|
<!-- Export project meta to zip file and download. --> |
|
|
|
|
{{ $t('management.meta.operation_3.desc') }} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn |
|
|
|
|
min-width="150" |
|
|
|
|
color="primary" |
|
|
|
|
small |
|
|
|
|
outlined |
|
|
|
|
:loading="loading === 'export-zip'" |
|
|
|
|
@click="exportMetaZip();"> |
|
|
|
|
@click="exportMetaZip()" |
|
|
|
|
> |
|
|
|
|
<v-icon small>mdi-export</v-icon> |
|
|
|
|
Export zip |
|
|
|
|
<!-- Export zip --> |
|
|
|
|
{{ $t('management.meta.operation_3') }} |
|
|
|
|
</v-btn> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td>Import project meta zip file and restart.</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn min-width="150" |
|
|
|
|
<!-- Import project meta zip file and restart. --> |
|
|
|
|
{{ $t('management.meta.operation_4.desc') }} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn |
|
|
|
|
min-width="150" |
|
|
|
|
:loading="loading === 'import-zip'" |
|
|
|
|
color="info" small outlined @click="$refs.importFile.click()"> |
|
|
|
|
color="info" |
|
|
|
|
small |
|
|
|
|
outlined |
|
|
|
|
@click="$refs.importFile.click()" |
|
|
|
|
> |
|
|
|
|
<v-icon small>mdi-import</v-icon> |
|
|
|
|
|
|
|
|
|
Import Zip |
|
|
|
|
<!-- Import Zip --> |
|
|
|
|
{{ $t('management.meta.operation_4') }} |
|
|
|
|
</v-btn> |
|
|
|
|
|
|
|
|
|
<input type="file" accept=".zip" @change="importMetaZip" v-show="false" ref="importFile"> |
|
|
|
|
|
|
|
|
|
<input |
|
|
|
|
type="file" |
|
|
|
|
accept=".zip" |
|
|
|
|
@change="importMetaZip" |
|
|
|
|
v-show="false" |
|
|
|
|
ref="importFile" |
|
|
|
|
/> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td>Clear all metadata from meta tables.</td> |
|
|
|
|
<td> |
|
|
|
|
<!-- Clear all metadata from meta tables. --> |
|
|
|
|
{{ $t('management.meta.operation_5.desc') }} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
<v-btn |
|
|
|
|
:loading="loading === 'reset-metadata'" min-width="150" color="error" small outlined @click="resetMeta"> |
|
|
|
|
:loading="loading === 'reset-metadata'" |
|
|
|
|
min-width="150" |
|
|
|
|
color="error" |
|
|
|
|
small |
|
|
|
|
outlined |
|
|
|
|
@click="resetMeta" |
|
|
|
|
> |
|
|
|
|
<v-icon small>mdi-delete-variant</v-icon> |
|
|
|
|
Reset |
|
|
|
|
<!-- Reset --> |
|
|
|
|
{{ $t('management.meta.operation_5') }} |
|
|
|
|
</v-btn> |
|
|
|
|
</td> |
|
|
|
|
|
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
</tbody> |
|
|
|
|
</v-simple-table> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dlg-label-submit-cancel |
|
|
|
|
type="primary" |
|
|
|
|
v-if="dialogShow" |
|
|
|
@ -90,18 +134,15 @@
|
|
|
|
|
:dialogShow="dialogShow" |
|
|
|
|
:heading="confirmMessage" |
|
|
|
|
> |
|
|
|
|
|
|
|
|
|
</dlg-label-submit-cancel> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
import DlgLabelSubmitCancel from "@/components/utils/dlgLabelSubmitCancel"; |
|
|
|
|
import DlgLabelSubmitCancel from '@/components/utils/dlgLabelSubmitCancel'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "xc-meta", |
|
|
|
|
name: 'xc-meta', |
|
|
|
|
components: { |
|
|
|
|
DlgLabelSubmitCancel, |
|
|
|
|
}, |
|
|
|
@ -109,23 +150,25 @@ export default {
|
|
|
|
|
loading: null, |
|
|
|
|
dialogShow: false, |
|
|
|
|
confirmAction: null, |
|
|
|
|
confirmMessage: '' |
|
|
|
|
confirmMessage: '', |
|
|
|
|
}), |
|
|
|
|
methods: { |
|
|
|
|
async exportMeta() { |
|
|
|
|
this.dialogShow = true; |
|
|
|
|
this.confirmMessage = 'Do you want to export metadata from meta tables?'; |
|
|
|
|
this.confirmAction = async (act) => { |
|
|
|
|
this.confirmAction = async act => { |
|
|
|
|
if (act === 'hideDialog') { |
|
|
|
|
this.dialogShow = false; |
|
|
|
|
} else { |
|
|
|
|
this.loading = 'export-file'; |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [{ |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [ |
|
|
|
|
{ |
|
|
|
|
// dbAlias: 'db', |
|
|
|
|
env: 'dev' |
|
|
|
|
}, 'xcMetaTablesExportDbToLocalFs']); |
|
|
|
|
env: 'dev', |
|
|
|
|
}, |
|
|
|
|
'xcMetaTablesExportDbToLocalFs', |
|
|
|
|
]); |
|
|
|
|
this.$toast.success('Successfully exported metadata').goAway(3000); |
|
|
|
|
} catch (e) { |
|
|
|
|
this.$toast.error('Some internal error occurred').goAway(3000); |
|
|
|
@ -133,25 +176,31 @@ export default {
|
|
|
|
|
this.dialogShow = false; |
|
|
|
|
this.loading = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, async exportMetaZip() { |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
async exportMetaZip() { |
|
|
|
|
this.dialogShow = true; |
|
|
|
|
this.confirmMessage = 'Do you want to export metadata from meta tables?'; |
|
|
|
|
this.confirmAction = async (act) => { |
|
|
|
|
this.confirmAction = async act => { |
|
|
|
|
if (act === 'hideDialog') { |
|
|
|
|
this.dialogShow = false; |
|
|
|
|
} else { |
|
|
|
|
this.loading = 'export-zip'; |
|
|
|
|
let data; |
|
|
|
|
try { |
|
|
|
|
data = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ |
|
|
|
|
data = await this.$store.dispatch('sqlMgr/ActSqlOp', [ |
|
|
|
|
{ |
|
|
|
|
// dbAlias: 'db', |
|
|
|
|
env: 'dev' |
|
|
|
|
}, 'xcMetaTablesExportDbToZip', null, null, { |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}]); |
|
|
|
|
const url = window.URL.createObjectURL(new Blob([data], {type: 'application/zip'})); |
|
|
|
|
env: 'dev', |
|
|
|
|
}, |
|
|
|
|
'xcMetaTablesExportDbToZip', |
|
|
|
|
null, |
|
|
|
|
null, |
|
|
|
|
{ |
|
|
|
|
responseType: 'blob', |
|
|
|
|
}, |
|
|
|
|
]); |
|
|
|
|
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/zip' })); |
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
link.href = url; |
|
|
|
|
link.setAttribute('download', 'meta.zip'); //or any other extension |
|
|
|
@ -164,56 +213,58 @@ export default {
|
|
|
|
|
this.dialogShow = false; |
|
|
|
|
this.loading = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
async resetMeta() { |
|
|
|
|
this.dialogShow = true; |
|
|
|
|
this.confirmMessage = 'Do you want to clear metadata from meta tables?'; |
|
|
|
|
this.confirmAction = async (act) => { |
|
|
|
|
this.confirmAction = async act => { |
|
|
|
|
if (act === 'hideDialog') { |
|
|
|
|
this.dialogShow = false; |
|
|
|
|
} else { |
|
|
|
|
this.loading = 'reset-metadata'; |
|
|
|
|
try { |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [{ |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [ |
|
|
|
|
{ |
|
|
|
|
// dbAlias: 'db', |
|
|
|
|
env: 'dev' |
|
|
|
|
}, 'xcMetaTablesReset',]); |
|
|
|
|
this.$toast.success('Metadata cleared successfully').goAway(3000) |
|
|
|
|
env: 'dev', |
|
|
|
|
}, |
|
|
|
|
'xcMetaTablesReset', |
|
|
|
|
]); |
|
|
|
|
this.$toast.success('Metadata cleared successfully').goAway(3000); |
|
|
|
|
} catch (e) { |
|
|
|
|
this.$toast.error('Some internal error occurred').goAway(3000); |
|
|
|
|
} |
|
|
|
|
this.dialogShow = false; |
|
|
|
|
this.loading = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
async importMeta() { |
|
|
|
|
this.dialogShow = true; |
|
|
|
|
this.confirmMessage = 'Do you want to import metadata from meta directory?'; |
|
|
|
|
this.confirmAction = async (act) => { |
|
|
|
|
this.confirmAction = async act => { |
|
|
|
|
if (act === 'hideDialog') { |
|
|
|
|
this.dialogShow = false; |
|
|
|
|
} else { |
|
|
|
|
this.loading = 'import-file'; |
|
|
|
|
try { |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [{ |
|
|
|
|
env: 'dev' |
|
|
|
|
}, 'xcMetaTablesImportLocalFsToDb']); |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [ |
|
|
|
|
{ |
|
|
|
|
env: 'dev', |
|
|
|
|
}, |
|
|
|
|
'xcMetaTablesImportLocalFsToDb', |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
this.$toast.success('Metadata imported successfully').goAway(3000) |
|
|
|
|
this.$toast.success('Metadata imported successfully').goAway(3000); |
|
|
|
|
} catch (e) { |
|
|
|
|
this.$toast.error('Some internal error occurred').goAway(3000); |
|
|
|
|
} |
|
|
|
|
this.dialogShow = false; |
|
|
|
|
this.loading = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
async importMetaZip() { |
|
|
|
|
if (this.$refs.importFile && this.$refs.importFile.files && this.$refs.importFile.files[0]) { |
|
|
|
@ -221,10 +272,15 @@ export default {
|
|
|
|
|
this.loading = 'import-zip'; |
|
|
|
|
try { |
|
|
|
|
this.$refs.importFile.value = ''; |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActUpload', [{ |
|
|
|
|
await this.$store.dispatch('sqlMgr/ActUpload', [ |
|
|
|
|
{ |
|
|
|
|
// dbAlias: 'db', |
|
|
|
|
env: 'dev' |
|
|
|
|
}, 'xcMetaTablesImportZipToLocalFsAndDb', {}, zipFile]); |
|
|
|
|
env: 'dev', |
|
|
|
|
}, |
|
|
|
|
'xcMetaTablesImportZipToLocalFsAndDb', |
|
|
|
|
{}, |
|
|
|
|
zipFile, |
|
|
|
|
]); |
|
|
|
|
this.$toast.success('Successfully imported metadata').goAway(3000); |
|
|
|
|
} catch (e) { |
|
|
|
|
this.$toast.error('Some internal error occurred').goAway(3000); |
|
|
|
@ -233,8 +289,8 @@ export default {
|
|
|
|
|
this.loading = null; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
@ -248,6 +304,7 @@ export default {
|
|
|
|
|
* |
|
|
|
|
* @author Naveen MR <oof1lab@gmail.com> |
|
|
|
|
* @author Pranav C Balan <pranavxc@gmail.com> |
|
|
|
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com> |
|
|
|
|
* |
|
|
|
|
* @license GNU AGPL version 3 or any later version |
|
|
|
|
* |
|
|
|
|