refactor(gui): linting

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
This commit is contained in:
Pranav C
2021-07-19 16:30:37 +05:30
parent f9508c2d44
commit fa00be39b8
303 changed files with 34924 additions and 31761 deletions

View File

@@ -23,10 +23,12 @@
color="primary"
small
outlined
@click="exportMeta"
:loading="loading === 'export-file'"
@click="exportMeta"
>
<v-icon small>mdi-export</v-icon>&nbsp;
<v-icon small>
mdi-export
</v-icon>&nbsp;
<!-- Export to file -->
{{ $t('management.meta.export_to_file') }}
</v-btn>
@@ -47,7 +49,9 @@
outlined
@click="importMeta"
>
<v-icon small>mdi-import</v-icon>&nbsp;
<v-icon small>
mdi-import
</v-icon>&nbsp;
<!-- Import -->
{{ $t('management.meta.import') }}
@@ -69,7 +73,9 @@
:loading="loading === 'export-zip'"
@click="exportMetaZip()"
>
<v-icon small>mdi-export</v-icon>&nbsp;
<v-icon small>
mdi-export
</v-icon>&nbsp;
<!-- Export zip -->
{{ $t('management.meta.export_to_zip') }}
</v-btn>
@@ -89,19 +95,21 @@
outlined
@click="$refs.importFile.click()"
>
<v-icon small>mdi-import</v-icon>&nbsp;
<v-icon small>
mdi-import
</v-icon>&nbsp;
<!-- Import Zip -->
{{ $t('management.meta.import_zip') }}
</v-btn>
<input
v-show="false"
ref="importFile"
type="file"
accept=".zip"
@change="importMetaZip"
v-show="false"
ref="importFile"
/>
>
</td>
</tr>
<tr>
@@ -118,7 +126,9 @@
outlined
@click="resetMeta"
>
<v-icon small>mdi-delete-variant</v-icon>&nbsp;
<v-icon small>
mdi-delete-variant
</v-icon>&nbsp;
<!-- Reset -->
{{ $t('management.meta.reset') }}
</v-btn>
@@ -128,169 +138,168 @@
</v-simple-table>
<dlg-label-submit-cancel
type="primary"
v-if="dialogShow"
:actionsMtd="confirmAction"
:dialogShow="dialogShow"
type="primary"
:actions-mtd="confirmAction"
:dialog-show="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: 'XcMeta',
components: {
DlgLabelSubmitCancel,
DlgLabelSubmitCancel
},
data: () => ({
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 => {
async exportMeta () {
this.dialogShow = true
this.confirmMessage = 'Do you want to export metadata from meta tables?'
this.confirmAction = async (act) => {
if (act === 'hideDialog') {
this.dialogShow = false;
this.dialogShow = false
} else {
this.loading = 'export-file';
this.loading = 'export-file'
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{
// dbAlias: 'db',
env: 'dev',
env: 'dev'
},
'xcMetaTablesExportDbToLocalFs',
]);
this.$toast.success('Successfully exported metadata').goAway(3000);
'xcMetaTablesExportDbToLocalFs'
])
this.$toast.success('Successfully exported metadata').goAway(3000)
} catch (e) {
this.$toast.error('Some internal error occurred').goAway(3000);
this.$toast.error('Some internal error occurred').goAway(3000)
}
this.dialogShow = false;
this.loading = null;
this.dialogShow = false
this.loading = null
}
};
}
},
async exportMetaZip() {
this.dialogShow = true;
this.confirmMessage = 'Do you want to export metadata from meta tables?';
this.confirmAction = async act => {
async exportMetaZip () {
this.dialogShow = true
this.confirmMessage = 'Do you want to export metadata from meta tables?'
this.confirmAction = async (act) => {
if (act === 'hideDialog') {
this.dialogShow = false;
this.dialogShow = false
} else {
this.loading = 'export-zip';
let data;
this.loading = 'export-zip'
let data
try {
data = await this.$store.dispatch('sqlMgr/ActSqlOp', [
{
// dbAlias: 'db',
env: 'dev',
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
document.body.appendChild(link);
link.click();
this.$toast.success('Successfully exported metadata').goAway(3000);
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
document.body.appendChild(link)
link.click()
this.$toast.success('Successfully exported metadata').goAway(3000)
} catch (e) {
this.$toast.error('Some internal error occurred').goAway(3000);
this.$toast.error('Some internal error occurred').goAway(3000)
}
this.dialogShow = false;
this.loading = null;
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 => {
async resetMeta () {
this.dialogShow = true
this.confirmMessage = 'Do you want to clear metadata from meta tables?'
this.confirmAction = async (act) => {
if (act === 'hideDialog') {
this.dialogShow = false;
this.dialogShow = false
} else {
this.loading = 'reset-metadata';
this.loading = 'reset-metadata'
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{
// dbAlias: 'db',
env: 'dev',
env: 'dev'
},
'xcMetaTablesReset',
]);
this.$toast.success('Metadata cleared successfully').goAway(3000);
'xcMetaTablesReset'
])
this.$toast.success('Metadata cleared successfully').goAway(3000)
} catch (e) {
this.$toast.error('Some internal error occurred').goAway(3000);
this.$toast.error('Some internal error occurred').goAway(3000)
}
this.dialogShow = false;
this.loading = null;
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 => {
async importMeta () {
this.dialogShow = true
this.confirmMessage = 'Do you want to import metadata from meta directory?'
this.confirmAction = async (act) => {
if (act === 'hideDialog') {
this.dialogShow = false;
this.dialogShow = false
} else {
this.loading = 'import-file';
this.loading = 'import-file'
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{
env: 'dev',
env: 'dev'
},
'xcMetaTablesImportLocalFsToDb',
]);
'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.$toast.error('Some internal error occurred').goAway(3000)
}
this.dialogShow = false;
this.loading = null;
this.dialogShow = false
this.loading = null
}
};
}
},
async importMetaZip() {
async importMetaZip () {
if (this.$refs.importFile && this.$refs.importFile.files && this.$refs.importFile.files[0]) {
const zipFile = this.$refs.importFile.files[0];
this.loading = 'import-zip';
const zipFile = this.$refs.importFile.files[0]
this.loading = 'import-zip'
try {
this.$refs.importFile.value = '';
this.$refs.importFile.value = ''
await this.$store.dispatch('sqlMgr/ActUpload', [
{
// dbAlias: 'db',
env: 'dev',
env: 'dev'
},
'xcMetaTablesImportZipToLocalFsAndDb',
{},
zipFile,
]);
this.$toast.success('Successfully imported metadata').goAway(3000);
zipFile
])
this.$toast.success('Successfully imported metadata').goAway(3000)
} catch (e) {
this.$toast.error('Some internal error occurred').goAway(3000);
this.$toast.error('Some internal error occurred').goAway(3000)
}
this.dialogShow = false;
this.loading = null;
this.dialogShow = false
this.loading = null
}
},
},
};
}
}
}
</script>
<style scoped>