2024-03-21 22:56:35 +08:00
|
|
|
<template>
|
2024-05-16 20:34:59 +08:00
|
|
|
<div ref="content" class="bg-white rounded" :class="{ 'p-4 mb-4': results.length || loading }" :data-e2e="'e2e-CO-globalSearch-folders'">
|
2024-04-11 15:22:50 +08:00
|
|
|
<template v-if="total && results.length">
|
2024-04-08 02:36:02 +08:00
|
|
|
<div class="flex items-center">
|
|
|
|
<h2 class="flex items-center gap-2 mt-0 mb-4">
|
|
|
|
<i class="sn-icon sn-icon-folder"></i>
|
|
|
|
{{ i18n.t('search.index.folders') }}
|
2024-04-25 21:01:45 +08:00
|
|
|
<span class="text-base" >[{{ total }}]</span>
|
2024-04-08 02:36:02 +08:00
|
|
|
</h2>
|
2024-05-16 20:34:59 +08:00
|
|
|
<SortFlyout v-if="selected" :sort="sort" @changeSort="changeSort" :e2eSortButton="'e2e-BT-globalSearch-folders-sort'"></SortFlyout>
|
2024-04-08 02:36:02 +08:00
|
|
|
</div>
|
2024-05-20 23:09:49 +08:00
|
|
|
<div class="grid grid-cols-[auto_110px_auto_auto_auto] items-center">
|
2024-05-13 19:46:56 +08:00
|
|
|
<TableHeader :selected="selected" :columnNames="[
|
2024-05-20 23:09:49 +08:00
|
|
|
i18n.t('search.index.id'),
|
2024-05-13 19:46:56 +08:00
|
|
|
i18n.t('search.index.created_at'),
|
|
|
|
i18n.t('search.index.folder'),
|
|
|
|
i18n.t('search.index.team')
|
|
|
|
]"></TableHeader>
|
2024-04-16 19:33:36 +08:00
|
|
|
<div v-for="(row, index) in preparedResults" :key="row.id" class="contents group">
|
2024-05-20 23:09:49 +08:00
|
|
|
<hr class="col-span-5 w-full m-0" v-if="index > 0">
|
2024-04-16 19:33:36 +08:00
|
|
|
<LinkTemplate :url="row.attributes.url" :value="labelName({ name: row.attributes.name, archived: row.attributes.archived})"/>
|
2024-05-20 23:09:49 +08:00
|
|
|
<CellTemplate :label="i18n.t('search.index.id')" :value="row.attributes.code"/>
|
2024-04-16 19:33:36 +08:00
|
|
|
<CellTemplate :label="i18n.t('search.index.created_at')" :value="row.attributes.created_at"/>
|
2024-05-07 16:18:56 +08:00
|
|
|
<CellTemplate :label="i18n.t('search.index.folder')" :visible="row.attributes.parent_folder"
|
2024-04-16 19:33:36 +08:00
|
|
|
:url="row.attributes.parent_folder?.url" :value="labelName(row.attributes.parent_folder)"/>
|
2024-05-09 20:50:40 +08:00
|
|
|
<CellTemplate :label="i18n.t('search.index.team')" :url="row.attributes.team.url" :value="row.attributes.team.name"/>
|
2024-04-16 19:33:36 +08:00
|
|
|
</div>
|
2024-03-27 18:44:52 +08:00
|
|
|
</div>
|
2024-04-25 21:01:45 +08:00
|
|
|
<div v-if="viewAll">
|
|
|
|
<hr class="w-full mb-4 mt-0">
|
2024-05-16 20:34:59 +08:00
|
|
|
<button class="btn btn-light" @click="$emit('selectGroup', 'FoldersComponent')" :data-e2e="'e2e-BT-globalSearch-folders-viewAll'">View all</button>
|
2024-03-27 18:44:52 +08:00
|
|
|
</div>
|
2024-04-08 02:36:02 +08:00
|
|
|
</template>
|
2024-04-16 19:33:36 +08:00
|
|
|
<Loader v-if="loading" :loaderRows="loaderRows" />
|
2024-04-25 21:01:45 +08:00
|
|
|
<ListEnd v-if="reachedEnd && preparedResults.length > 0" />
|
2024-04-16 19:33:36 +08:00
|
|
|
<NoSearchResult v-else-if="showNoSearchResult" />
|
2024-03-21 22:56:35 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-03-27 18:44:52 +08:00
|
|
|
import searchMixin from './search_mixin';
|
|
|
|
|
2024-03-21 22:56:35 +08:00
|
|
|
export default {
|
2024-03-27 18:44:52 +08:00
|
|
|
name: 'FoldersComponent',
|
|
|
|
mixins: [searchMixin],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
group: 'project_folders'
|
|
|
|
};
|
|
|
|
}
|
2024-03-21 22:56:35 +08:00
|
|
|
};
|
|
|
|
</script>
|