Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59546ae163 | |||
| f14de07061 | |||
| cf0d90ffa7 |
+7
-12
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
namespace KTXM\Documents;
|
namespace KTXM\Documents;
|
||||||
|
|
||||||
use KTXF\Module\ModuleBrowserInterface;
|
use KTXF\Module\Configuration\BrowserModuleContextInterface;
|
||||||
|
use KTXF\Module\Configuration\ModuleContextInterface;
|
||||||
use KTXF\Module\ModuleInstanceAbstract;
|
use KTXF\Module\ModuleInstanceAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Documents Module - Document Browser UI
|
* Documents Module - Document Browser UI
|
||||||
*/
|
*/
|
||||||
class Module extends ModuleInstanceAbstract implements ModuleBrowserInterface
|
class Module extends ModuleInstanceAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -50,16 +51,10 @@ class Module extends ModuleInstanceAbstract implements ModuleBrowserInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerBI(): array
|
public function configure(ModuleContextInterface $context): void
|
||||||
{
|
{
|
||||||
return [
|
if ($context instanceof BrowserModuleContextInterface) {
|
||||||
'handle' => $this->handle(),
|
$context->registerModule($this, 'Documents', 'static/module.mjs');
|
||||||
'namespace' => 'Documents',
|
}
|
||||||
'version' => $this->version(),
|
|
||||||
'label' => $this->label(),
|
|
||||||
'author' => $this->author(),
|
|
||||||
'description' => $this->description(),
|
|
||||||
'boot' => 'static/module.mjs',
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-8
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, watch, nextTick, defineAsyncComponent } from 'vue'
|
import { ref, computed, onMounted, watch, nextTick, defineAsyncComponent } from 'vue'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
import { useModuleStore, useIntegrationStore } from '@KTXC'
|
import { useModuleStore, useIntegrationStore, usePreviewStore } from '@KTXC'
|
||||||
import { useDocumentManager, useDocumentSelection, useFileUpload, useFileEditor } from '@/composables'
|
import { useDocumentManager, useDocumentSelection, useFileUpload, useFileEditor } from '@/composables'
|
||||||
import type { ViewMode, SortField, SortOrder, BreadcrumbItem } from '@/types'
|
import type { ViewMode, SortField, SortOrder, BreadcrumbItem } from '@/types'
|
||||||
import { CollectionObject } from '@DocumentsManager/models/collection'
|
import { CollectionObject } from '@DocumentsManager/models/collection'
|
||||||
@@ -31,6 +31,8 @@ const isMobile = computed(() => display.mdAndDown.value)
|
|||||||
|
|
||||||
const moduleStore = useModuleStore()
|
const moduleStore = useModuleStore()
|
||||||
const integrationStore = useIntegrationStore()
|
const integrationStore = useIntegrationStore()
|
||||||
|
const previewStore = usePreviewStore()
|
||||||
|
const previewsAvailable = computed(() => previewStore.availability.storage)
|
||||||
const isFileManagerAvailable = computed(() => {
|
const isFileManagerAvailable = computed(() => {
|
||||||
return moduleStore.has('documents_manager') || moduleStore.has('DocumentsManager')
|
return moduleStore.has('documents_manager') || moduleStore.has('DocumentsManager')
|
||||||
})
|
})
|
||||||
@@ -128,7 +130,10 @@ function entityToViewerItem(entity: EntityObject): ViewerItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveViewerSource(item: ViewerItem): string {
|
function resolveViewerSource(item: ViewerItem): string | Promise<string> {
|
||||||
|
if (!previewsAvailable.value) {
|
||||||
|
return Promise.reject(new Error('Preview storage is unavailable'))
|
||||||
|
}
|
||||||
return documentManager.getEntityPreviewUrl(
|
return documentManager.getEntityPreviewUrl(
|
||||||
item.id,
|
item.id,
|
||||||
(item.meta?.collection as string | null) ?? null,
|
(item.meta?.collection as string | null) ?? null,
|
||||||
@@ -154,6 +159,7 @@ function resolveThumbnailSource(item: ViewerItem): string {
|
|||||||
|
|
||||||
// Preview shown in the info panel sidebar for the current single selection
|
// Preview shown in the info panel sidebar for the current single selection
|
||||||
const infoPanelPreviewUrl = computed<string | null>(() => {
|
const infoPanelPreviewUrl = computed<string | null>(() => {
|
||||||
|
if (!previewsAvailable.value) return null
|
||||||
const items = selection.selectedNodeArray.value
|
const items = selection.selectedNodeArray.value
|
||||||
if (items.length !== 1) return null
|
if (items.length !== 1) return null
|
||||||
const item = items[0]
|
const item = items[0]
|
||||||
@@ -815,8 +821,8 @@ onMounted(async () => {
|
|||||||
:collections="sortedItems.collections"
|
:collections="sortedItems.collections"
|
||||||
:entities="sortedItems.entities"
|
:entities="sortedItems.entities"
|
||||||
:selected-ids="selectedIds"
|
:selected-ids="selectedIds"
|
||||||
:preview-source="resolvePreviewSource"
|
:preview-source="previewsAvailable ? resolvePreviewSource : undefined"
|
||||||
:thumbnail-source="resolveThumbnailSource"
|
:thumbnail-source="previewsAvailable ? resolveThumbnailSource : undefined"
|
||||||
@item-click="handleItemClick"
|
@item-click="handleItemClick"
|
||||||
@open="handleOpenItem"
|
@open="handleOpenItem"
|
||||||
@edit="handleEditItem"
|
@edit="handleEditItem"
|
||||||
@@ -832,8 +838,8 @@ onMounted(async () => {
|
|||||||
:collections="sortedItems.collections"
|
:collections="sortedItems.collections"
|
||||||
:entities="sortedItems.entities"
|
:entities="sortedItems.entities"
|
||||||
:selected-ids="selectedIds"
|
:selected-ids="selectedIds"
|
||||||
:preview-source="resolvePreviewSource"
|
:preview-source="previewsAvailable ? resolvePreviewSource : undefined"
|
||||||
:thumbnail-source="resolveThumbnailSource"
|
:thumbnail-source="previewsAvailable ? resolveThumbnailSource : undefined"
|
||||||
@item-click="handleItemClick"
|
@item-click="handleItemClick"
|
||||||
@open="handleOpenItem"
|
@open="handleOpenItem"
|
||||||
@edit="handleEditItem"
|
@edit="handleEditItem"
|
||||||
@@ -849,8 +855,8 @@ onMounted(async () => {
|
|||||||
:collections="sortedItems.collections"
|
:collections="sortedItems.collections"
|
||||||
:entities="sortedItems.entities"
|
:entities="sortedItems.entities"
|
||||||
:selected-ids="selectedIds"
|
:selected-ids="selectedIds"
|
||||||
:preview-source="resolvePreviewSource"
|
:preview-source="previewsAvailable ? resolvePreviewSource : undefined"
|
||||||
:thumbnail-source="resolveThumbnailSource"
|
:thumbnail-source="previewsAvailable ? resolveThumbnailSource : undefined"
|
||||||
@item-click="handleItemClick"
|
@item-click="handleItemClick"
|
||||||
@open="handleOpenItem"
|
@open="handleOpenItem"
|
||||||
@edit="handleEditItem"
|
@edit="handleEditItem"
|
||||||
|
|||||||
Reference in New Issue
Block a user