Export Collection button now shows collection name not table name (#7379)

* export collection button to uses name not db name

* removed unused var

* fixed for review

* computed collectionName
This commit is contained in:
Jay Cammarano
2021-08-12 15:03:35 -04:00
committed by GitHub
parent af4dbad27d
commit 66d4c04121

View File

@@ -25,7 +25,7 @@
<div class="field full">
<v-button full-width @click="exportData">
{{ t('export_collection', { collection }) }}
{{ t('export_collection', { collection: collectionName }) }}
</v-button>
</div>
</div>
@@ -34,11 +34,12 @@
<script lang="ts">
import { useI18n } from 'vue-i18n';
import { defineComponent, ref, PropType } from 'vue';
import { defineComponent, ref, PropType, computed } from 'vue';
import { Filter } from '@directus/shared/types';
import api from '@/api';
import { getRootPath } from '@/utils/get-root-path';
import filtersToQuery from '@/utils/filters-to-query';
import { useCollectionsStore } from '@/stores/';
type LayoutQuery = {
fields?: string[];
@@ -65,13 +66,16 @@ export default defineComponent({
required: true,
},
},
setup(props) {
const { t } = useI18n();
const format = ref('csv');
const useFilters = ref(true);
const collectionsStore = useCollectionsStore();
const collectionName = computed(() => collectionsStore.getCollection(props.collection).name);
return { t, format, useFilters, exportData };
return { t, format, useFilters, exportData, collectionName };
function exportData() {
const endpoint = props.collection.startsWith('directus_')