mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add title and creation date to export data handling
Enhanced export functionality by including `title` and `createdDate` in data passed to the Vue app. Updated controllers, templates, and components to handle and display the new fields, improving export file naming and user interface. Removed a debug `dump` call for cleaner code.
This commit is contained in:
parent
70ca4acafb
commit
fb806a9579
@ -538,7 +538,6 @@ class ExportController extends AbstractController
|
||||
$formFormatter->submit($dataFormatter);
|
||||
$dataFormatter = $formFormatter->getData();
|
||||
}
|
||||
dump($dataExport);
|
||||
|
||||
return [
|
||||
'centers' => $dataCenters['centers'],
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Entity\ExportGeneration;
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
@ -28,6 +29,7 @@ final readonly class ExportGenerationController
|
||||
private Security $security,
|
||||
private Environment $twig,
|
||||
private SerializerInterface $serializer,
|
||||
private ExportManager $exportManager,
|
||||
) {}
|
||||
|
||||
#[Route('/{_locale}/main/export-generation/{id}/wait', methods: ['GET'], name: 'chill_main_export-generation_wait')]
|
||||
@ -37,8 +39,10 @@ final readonly class ExportGenerationController
|
||||
throw new AccessDeniedHttpException('Only users can download an export');
|
||||
}
|
||||
|
||||
$export = $this->exportManager->getExport($exportGeneration->getExportAlias());
|
||||
|
||||
return new Response(
|
||||
$this->twig->render('@ChillMain/ExportGeneration/wait.html.twig', ['exportGeneration' => $exportGeneration]),
|
||||
$this->twig->render('@ChillMain/ExportGeneration/wait.html.twig', ['exportGeneration' => $exportGeneration, 'export' => $export]),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ import DocumentActionButtonsGroup from "ChillDocStoreAssets/vuejs/DocumentAction
|
||||
|
||||
interface AppProps {
|
||||
exportGenerationId: string;
|
||||
title: string;
|
||||
createdDate: string;
|
||||
}
|
||||
|
||||
const props = defineProps<AppProps>();
|
||||
@ -26,6 +28,7 @@ const isFetching = computed<boolean>(
|
||||
);
|
||||
const isReady = computed<boolean>(() => status.value === "ready");
|
||||
const isFailure = computed<boolean>(() => status.value === "failure");
|
||||
const filename = computed<string>(() => `${props.title}-${props.createdDate}`);
|
||||
|
||||
/**
|
||||
* counter for the number of times that we check for a new status
|
||||
@ -113,6 +116,7 @@ onMounted(() => {
|
||||
<p v-if="storedObject !== null">
|
||||
<document-action-buttons-group
|
||||
:stored-object="storedObject"
|
||||
:filename="filename"
|
||||
></document-action-buttons-group>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -9,4 +9,7 @@ if (null === el) {
|
||||
}
|
||||
|
||||
const exportGenerationId = el?.dataset.exportGenerationId as string;
|
||||
createApp(App, { exportGenerationId }).mount(el);
|
||||
const title = el?.dataset.exportTitle as string;
|
||||
const createdDate = el?.dataset.exportGenerationDate as string;
|
||||
|
||||
createApp(App, { exportGenerationId, title, createdDate }).mount(el);
|
||||
|
@ -11,7 +11,11 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="app" data-export-generation-id="{{ exportGeneration.id | escape('html_attr') }}"></div>
|
||||
<div id="app"
|
||||
data-export-generation-id="{{ exportGeneration.id | escape('html_attr') }}"
|
||||
data-export-generation-date="{{ exportGeneration.createdAt.format('Ymd-His') }}"
|
||||
data-export-title="{{ export.title|trans }}"
|
||||
></div>
|
||||
|
||||
<ul class="sticky-form-buttons record_actions">
|
||||
<li class="cancel">
|
||||
|
Loading…
x
Reference in New Issue
Block a user