mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
878 B
37 lines
878 B
2 years ago
|
<script setup lang="ts">
|
||
|
import { message } from 'ant-design-vue'
|
||
|
import FileSaver from 'file-saver'
|
||
2 years ago
|
import { useI18n } from 'vue-i18n'
|
||
2 years ago
|
|
||
2 years ago
|
const { t } = useI18n()
|
||
2 years ago
|
const { api } = useApi()
|
||
|
|
||
|
async function exportCache() {
|
||
|
try {
|
||
|
const data = await api.utils.cacheGet()
|
||
|
if (!data) {
|
||
2 years ago
|
// Cache is empty
|
||
|
message.info(t('msg.info.cacheEmpty'))
|
||
2 years ago
|
return
|
||
|
}
|
||
|
const blob = new Blob([JSON.stringify(data)], {
|
||
|
type: 'text/plain;charset=utf-8',
|
||
|
})
|
||
|
FileSaver.saveAs(blob, 'cache_exported.json')
|
||
2 years ago
|
// Exported Cache Successfully
|
||
|
message.info(t('msg.info.exportedCache'))
|
||
2 years ago
|
} catch (e: any) {
|
||
|
message.error(e.message)
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<a-tooltip placement="bottom">
|
||
2 years ago
|
<template #title>
|
||
|
<span> Export Cache </span>
|
||
|
</template>
|
||
2 years ago
|
<mdi-export class="cursor-pointer" @click="exportCache" />
|
||
2 years ago
|
</a-tooltip>
|
||
|
</template>
|