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.
41 lines
901 B
41 lines
901 B
<script setup lang="ts"> |
|
import { iconMap, message, useApi, useI18n } from '#imports' |
|
|
|
const { t } = useI18n() |
|
|
|
const { api } = useApi() |
|
|
|
async function exportCache() { |
|
const FileSaver = await import('file-saver') |
|
|
|
try { |
|
const data = await api.utils.cacheGet() |
|
if (!data) { |
|
// Cache is empty |
|
message.info(t('msg.info.cacheEmpty')) |
|
return |
|
} |
|
|
|
const blob = new Blob([JSON.stringify(data)], { |
|
type: 'text/plain;charset=utf-8', |
|
}) |
|
|
|
FileSaver.saveAs(blob, 'cache_exported.json') |
|
|
|
// Exported Cache Successfully |
|
message.info(t('msg.info.exportedCache')) |
|
} catch (e: any) { |
|
message.error(e.message) |
|
} |
|
} |
|
</script> |
|
|
|
<template> |
|
<a-tooltip placement="bottom"> |
|
<template #title> |
|
<span> Export Cache </span> |
|
</template> |
|
|
|
<component :is="iconMap.export" class="cursor-pointer" @click="exportCache" /> |
|
</a-tooltip> |
|
</template>
|
|
|