mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-16 10:59:31 +00:00
Extend document replacement logic to include storedObject and update components
- Updated `replaceDocument` function to handle `storedObject` and ensure proper version assignment. - Added `@on-stored-object-refresh` event handling in `DocumentsList.vue` for dynamic updates. - Introduced `refresh-stored-object-auto` prop in various components to control auto-refresh behavior.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
:can-download="true"
|
||||
:dav-link="dav_link_href ?? ''"
|
||||
:dav-link-expiration="dav_link_expiration ?? 0"
|
||||
:refresh-stored-object-auto="false"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<document-action-buttons-group
|
||||
:stored-object="storedObject"
|
||||
:filename="filename"
|
||||
:refresh-stored-object-auto="false"
|
||||
></document-action-buttons-group>
|
||||
</p>
|
||||
</template>
|
||||
|
||||
@@ -53,6 +53,7 @@ const canRemove = computed<boolean>((): boolean => {
|
||||
<li>
|
||||
<document-action-buttons-group
|
||||
:stored-object="a.genericDoc.storedObject"
|
||||
:refresh-stored-object-auto="false"
|
||||
></document-action-buttons-group>
|
||||
</li>
|
||||
<li v-if="canRemove">
|
||||
|
||||
@@ -38,6 +38,7 @@ const clickOnAddButton = () => {
|
||||
<li v-if="props.genericDoc.storedObject !== null">
|
||||
<document-action-buttons-group
|
||||
:stored-object="props.genericDoc.storedObject"
|
||||
:refresh-stored-object-auto="false"
|
||||
></document-action-buttons-group>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
@on-stored-object-status-change="
|
||||
$emit('statusDocumentChanged', $event)
|
||||
"
|
||||
@on-stored-object-refresh="(newStoredObject) => replaceDocument(d, newStoredObject, newStoredObject.currentVersion)"
|
||||
></document-action-buttons-group>
|
||||
</li>
|
||||
<!--replace document-->
|
||||
@@ -318,6 +319,7 @@ async function goToGenerateWorkflowEvaluationDocument({
|
||||
* @return {void}
|
||||
*/
|
||||
async function replaceDocument(oldDocument, storedObject, storedObjectVersion) {
|
||||
console.log('replaceDocument', storedObject, storedObjectVersion);
|
||||
let document = {
|
||||
type: "accompanying_period_work_evaluation_document",
|
||||
storedObject: storedObject,
|
||||
@@ -328,6 +330,7 @@ async function replaceDocument(oldDocument, storedObject, storedObjectVersion) {
|
||||
key: props.evaluation.key,
|
||||
document,
|
||||
oldDocument: oldDocument,
|
||||
storedObject: storedObject,
|
||||
stored_object_version: storedObjectVersion,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ const store = createStore({
|
||||
* Replaces a document in the state with a new document.
|
||||
*
|
||||
* @param {object} state - The current state of the application.
|
||||
* @param {{key: number, oldDocument: {key: number}, stored_object_version: StoredObjectVersion}} payload - The object containing the information about the document to be replaced.
|
||||
* @param {{key: number, oldDocument: {key: number}, stored_object_version: StoredObjectVersion, storedObject: StoredObject}} payload - The object containing the information about the document to be replaced.
|
||||
* @return {void} - returns nothing.
|
||||
*/
|
||||
replaceDocument(state, payload) {
|
||||
@@ -364,6 +364,7 @@ const store = createStore({
|
||||
return;
|
||||
}
|
||||
|
||||
doc.storedObject = payload.storedObject;
|
||||
doc.storedObject.currentVersion = payload.stored_object_version;
|
||||
return;
|
||||
let newDocument = Object.assign(payload.document, {
|
||||
|
||||
Reference in New Issue
Block a user