@anzusystems/common-admin 2.0.0-rc.28 → 2.0.0-rc.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domains/dam/api/damAssetApi.d.ts +12 -1
- package/dist/domains/dam/api/damAssetApi.js +151 -95
- package/dist/domains/dam/api/damAssetApi.js.map +1 -1
- package/dist/domains/dam/api/damMetadataOnServer.d.ts +35 -0
- package/dist/domains/dam/api/damMetadataOnServer.js +28 -0
- package/dist/domains/dam/api/damMetadataOnServer.js.map +1 -0
- package/dist/domains/dam/assetDetail/components/AssetDetailSidebarMetadata.vue.js +26 -25
- package/dist/domains/dam/assetDetail/components/AssetDetailSidebarMetadata.vue.js.map +1 -1
- package/dist/domains/dam/assetDetail/store/assetDetailStore.js +40 -39
- package/dist/domains/dam/assetDetail/store/assetDetailStore.js.map +1 -1
- package/dist/domains/dam/cropper/components/ACropper.vue.d.ts +1 -1
- package/dist/domains/dam/cropper/components/ACropper.vue.js +153 -136
- package/dist/domains/dam/cropper/components/ACropper.vue.js.map +1 -1
- package/dist/domains/dam/imageWidget/components/AImageMediaWidget.vue.d.ts +1 -1
- package/dist/domains/dam/imageWidget/components/AImagePublicInput.vue.d.ts +1 -1
- package/dist/domains/dam/imageWidget/components/AImageWidget.vue.d.ts +1 -1
- package/dist/domains/dam/imageWidget/components/AImageWidgetMultiple.vue.d.ts +1 -1
- package/dist/domains/dam/imageWidget/components/ImageMediaWidgetInner.vue.d.ts +1 -1
- package/dist/domains/dam/imageWidget/components/ImageWidgetInner.vue.d.ts +1 -1
- package/dist/domains/dam/imageWidget/components/ImageWidgetMultipleInner.vue.d.ts +1 -1
- package/dist/domains/dam/uploadQueue/components/UploadQueueDialog.vue.js +106 -106
- package/dist/domains/dam/uploadQueue/components/UploadQueueDialog.vue.js.map +1 -1
- package/dist/domains/dam/uploadQueue/components/UploadQueueDialogSingle.vue.js +13 -13
- package/dist/domains/dam/uploadQueue/components/UploadQueueDialogSingle.vue.js.map +1 -1
- package/dist/domains/dam/uploadQueue/settlement/uploadSettle.js +115 -114
- package/dist/domains/dam/uploadQueue/settlement/uploadSettle.js.map +1 -1
- package/dist/domains/dam/uploadQueue/store/uploadQueuesStore.js +147 -143
- package/dist/domains/dam/uploadQueue/store/uploadQueuesStore.js.map +1 -1
- package/dist/domains/filters/components/FiltersSelected.vue.js +5 -5
- package/dist/domains/filters/components/FiltersSelected.vue.js.map +1 -1
- package/dist/domains/filters/composables/filterFactory.js +41 -38
- package/dist/domains/filters/composables/filterFactory.js.map +1 -1
- package/dist/domains/remoteAutocomplete/components/AFormRemoteAutocomplete.vue.js +46 -38
- package/dist/domains/remoteAutocomplete/components/AFormRemoteAutocomplete.vue.js.map +1 -1
- package/dist/domains/system/composables/alerts.js +8 -2
- package/dist/domains/system/composables/alerts.js.map +1 -1
- package/dist/domains/system/systemBar/utils/appReload.d.ts +9 -1
- package/dist/domains/system/systemBar/utils/appReload.js +3 -3
- package/dist/domains/system/systemBar/utils/appReload.js.map +1 -1
- package/dist/lib.d.ts +2 -2
- package/package.json +2 -2
|
@@ -53,28 +53,28 @@ var w = {
|
|
|
53
53
|
B.stopUpload(O.queueKey), F.setAsset(null), V.value = null;
|
|
54
54
|
};
|
|
55
55
|
y(O.queueKey);
|
|
56
|
-
let _e = e(() => B.getQueueTotalCount(O.queueKey)), Y = e(() => B.getQueueProcessedCount(O.queueKey)), X = e(() => _e.value > Y.value), Z =
|
|
56
|
+
let _e = e(() => B.getQueueTotalCount(O.queueKey)), Y = e(() => B.getQueueProcessedCount(O.queueKey)), X = e(() => _e.value > Y.value), Z = s(!1);
|
|
57
57
|
u(() => U.value?.isDuplicate, (e) => {
|
|
58
|
-
|
|
58
|
+
Z.value = !!e && U.value?.mainFileSingleUse === !0;
|
|
59
59
|
}, { immediate: !0 });
|
|
60
|
-
let
|
|
61
|
-
if (H.value.length !== 0 && C(
|
|
62
|
-
|
|
60
|
+
let Q = s(null), $ = (e) => Promise.all(e.map((e) => e.assetId ? F.savingOf(e.assetId, A) : null)), ve = async () => {
|
|
61
|
+
if (H.value.length !== 0 && C(Q.value)) {
|
|
62
|
+
Q.value = "save";
|
|
63
63
|
try {
|
|
64
|
-
await x(G, K, H.value,
|
|
64
|
+
await $(H.value), await x(G, K, H.value, void 0, O.extSystem, A), N("updated");
|
|
65
65
|
} catch (e) {
|
|
66
66
|
S(e, O.extSystem, A);
|
|
67
67
|
} finally {
|
|
68
|
-
|
|
68
|
+
Q.value = null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}, ye = async () => {
|
|
72
|
-
if (H.value.length !== 0 && W.value && C(
|
|
73
|
-
|
|
72
|
+
if (H.value.length !== 0 && W.value && C(Q.value)) {
|
|
73
|
+
Q.value = "saveAndApply";
|
|
74
74
|
try {
|
|
75
75
|
let e;
|
|
76
76
|
try {
|
|
77
|
-
if (e = await x(G, K, H.value,
|
|
77
|
+
if (await $(H.value), e = await x(G, K, H.value, void 0, O.extSystem, A), !e[0]) throw Error("Fatal error updating asset metadata");
|
|
78
78
|
} catch (e) {
|
|
79
79
|
S(e, O.extSystem, A);
|
|
80
80
|
return;
|
|
@@ -88,7 +88,7 @@ var w = {
|
|
|
88
88
|
} catch (e) {
|
|
89
89
|
M(e);
|
|
90
90
|
} finally {
|
|
91
|
-
|
|
91
|
+
Q.value = null;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -142,11 +142,11 @@ var w = {
|
|
|
142
142
|
"asset-type": e.assetType,
|
|
143
143
|
"asset-main-file-status": e.mainFile ? e.mainFile.fileAttributes.status : void 0,
|
|
144
144
|
"asset-main-file-fail-reason": e.mainFile ? e.mainFile.fileAttributes.failReason : void 0,
|
|
145
|
-
saving:
|
|
145
|
+
saving: Q.value,
|
|
146
146
|
onSave: ve,
|
|
147
147
|
onSaveAndApply: ye
|
|
148
148
|
}, {
|
|
149
|
-
"prepend-sidebar": d(() => [U.value?.isDuplicate ? (o(), r("div", T, c(l(P)("common.damImage.asset.detail.info.status.duplicate")), 1)) : n("", !0), U.value?.isDuplicate &&
|
|
149
|
+
"prepend-sidebar": d(() => [U.value?.isDuplicate ? (o(), r("div", T, c(l(P)("common.damImage.asset.detail.info.status.duplicate")), 1)) : n("", !0), U.value?.isDuplicate && Z.value ? (o(), r("div", E, c(l(P)("common.damImage.asset.model.mainFileSingleUse")), 1)) : n("", !0)]),
|
|
150
150
|
_: 1
|
|
151
151
|
}, 8, [
|
|
152
152
|
"queue-key",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadQueueDialogSingle.vue.js","names":["_openBlock","_createBlock","AssetDetailDialogFrame","_unref","_withCtx","_createElementBlock","_toDisplayString","_normalizeClass","_createVNode","UploadQueueButtonStop","UploadQueueItemErrorOverlay","UploadQueueDialogSingleSidebar","computed","createBlock","createCommentVNode","createElementBlock","createVNode","defineComponent","normalizeClass","onMounted","openBlock","ref","toDisplayString","unref","watch","withCtx","storeToRefs","useI18n","AssetDetailTabImageWithRoi","useAssetDetailStore","DamAssetType","AssetDetailDialogFrame_default","assetDetailViewOfUploadItem","useUploadQueuesStore","useUploadQueueDialog","useUploadQueueDialogDrawn","UploadQueueItemStatus","UploadQueueItemErrorOverlay_default","useAlerts","bulkUpdateAssetsMetadata","fetchAsset","showMetadataSaveError","useCommonAdminCoreDamOptions","UploadQueueDialogSingleSidebar_default","UploadQueueButtonStop_default","isNull","mapUploadMetadataToImages","useDamConfigName","useDamCreditConfig","_hoisted_1","_hoisted_2","_hoisted_3","UploadQueueDialogSingle_vue_vue_type_script_setup_true_lang_default","__props","__emit","props","emit","damConfigName","creditConfigOf","showErrorsDefault","showRecordWas","t","assetDetailStore","activeTab","loading","assetDetail","enableRoiTab","uploadQueuesStore","uploadQueueDialog","items","item","isDone","isFailed","damClient","endPointAsset","endPointAuthor","customUploadMetadataToImageMap","simpleAssetSidebarEnabled","view","onStopConfirm","queueTotalCount","queueProcessedCount","isUploading","mainFileSingleUse","originalIsSingleUse","isDuplicate","saving","onSave","error","onSaveAndApply","assetsMetadataRes","mappedItems","done","assetId","row","res","_ctx","_cache","shown"],"sources":["../../../../../src/domains/dam/uploadQueue/components/UploadQueueDialogSingle.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, watch } from 'vue'\nimport { storeToRefs } from 'pinia'\nimport { useI18n } from 'vue-i18n'\nimport { AssetDetailTabImageWithRoi, useAssetDetailStore } from '@/domains/dam/assetDetail/store/assetDetailStore'\nimport { DamAssetType } from '@/domains/dam/types/Asset'\nimport AssetDetailDialogFrame from '@/domains/dam/assetDetail/components/AssetDetailDialogFrame.vue'\nimport { assetDetailViewOfUploadItem } from '@/domains/dam/assetDetail/composables/assetDetailView'\nimport type { ImageCreateUpdateAware } from '@/domains/dam/types/ImageAware'\nimport { useUploadQueuesStore } from '@/domains/dam/uploadQueue/store/uploadQueuesStore'\nimport {\n useUploadQueueDialog,\n useUploadQueueDialogDrawn,\n} from '@/domains/dam/uploadQueue/composables/useUploadQueueDialog'\nimport { type UploadQueueItem, UploadQueueItemStatus } from '@/domains/dam/types/UploadQueue'\nimport UploadQueueItemErrorOverlay from '@/domains/dam/uploadQueue/components/UploadQueueItemErrorOverlay.vue'\nimport { useAlerts } from '@/domains/system/composables/alerts'\nimport {\n type AssetMetadataBulkItem,\n bulkUpdateAssetsMetadata,\n fetchAsset,\n showMetadataSaveError,\n} from '@/domains/dam/api/damAssetApi'\nimport { useCommonAdminCoreDamOptions } from '@/domains/dam/composables/commonAdminCoreDamOptions'\nimport UploadQueueDialogSingleSidebar from '@/domains/dam/uploadQueue/components/UploadQueueDialogSingleSidebar.vue'\nimport UploadQueueButtonStop from '@/domains/dam/uploadQueue/components/UploadQueueButtonStop.vue'\nimport { isNull } from '@/shared/utils/common'\nimport { mapUploadMetadataToImages } from '@/domains/dam/imageWidget/utils/metadataToImageMap'\nimport type { IntegerId } from '@/shared/types/common'\nimport { useDamConfigName } from '@/domains/dam/composables/damConfigName'\nimport { useDamCreditConfig } from '@/domains/dam/author/composables/damCredit'\n\nconst props = withDefaults(\n defineProps<{\n queueKey: string\n extSystem: IntegerId\n licenceId: IntegerId\n fileInputKey: number\n accept: string | undefined\n maxSizes: Record<string, number> | undefined\n configName?: string\n disableDoneAnimation?: boolean\n }>(),\n {\n configName: undefined,\n disableDoneAnimation: false,\n }\n)\n\nconst emit = defineEmits<{\n (e: 'apply', items: ImageCreateUpdateAware[]): void\n}>()\n// eslint-disable-next-line vue/no-setup-props-reactivity-loss\nconst damConfigName = useDamConfigName(props.configName)\nconst creditConfigOf = useDamCreditConfig(damConfigName)\n\nconst { showErrorsDefault, showRecordWas } = useAlerts()\n\nconst { t } = useI18n()\n\nconst assetDetailStore = useAssetDetailStore()\nconst { activeTab, loading, asset: assetDetail } = storeToRefs(assetDetailStore)\nconst enableRoiTab = ref(false)\n\nconst uploadQueuesStore = useUploadQueuesStore()\nconst { uploadQueueDialog } = useUploadQueueDialog()\n\nconst items = computed(() => {\n return uploadQueuesStore.getQueueItems(props.queueKey)\n})\n\nconst item = computed<UploadQueueItem | null>(() => {\n return items.value[0] ?? null\n})\n\nconst isDone = computed(() => {\n return !isNull(item.value) && item.value.status === UploadQueueItemStatus.Uploaded\n})\n\n// The title stays \"done\", in the error colour for a refused or failed file.\nconst isFailed = computed(() => item.value?.status === UploadQueueItemStatus.Failed)\n\nconst { damClient, endPointAsset, endPointAuthor, customUploadMetadataToImageMap, simpleAssetSidebarEnabled } =\n useCommonAdminCoreDamOptions(damConfigName)\n\nconst view = computed(() =>\n assetDetailViewOfUploadItem(item.value, assetDetail.value, {\n enableRoiTab: enableRoiTab.value,\n disableDoneAnimation: props.disableDoneAnimation,\n simpleAssetSidebarEnabled,\n })\n)\n\nconst onStopConfirm = async () => {\n uploadQueuesStore.stopUpload(props.queueKey)\n assetDetailStore.setAsset(null)\n uploadQueueDialog.value = null\n}\n// eslint-disable-next-line vue/no-setup-props-reactivity-loss\nuseUploadQueueDialogDrawn(props.queueKey)\n\nconst queueTotalCount = computed(() => {\n return uploadQueuesStore.getQueueTotalCount(props.queueKey)\n})\n\nconst queueProcessedCount = computed(() => {\n return uploadQueuesStore.getQueueProcessedCount(props.queueKey)\n})\n\nconst isUploading = computed(() => {\n return queueTotalCount.value > queueProcessedCount.value\n})\n\n// The item's own switch. The store loads it with the item's metadata,\n// then the user owns it. A duplicate takes the original's value.\n// Not the asset detail's value: that is reset from the server when the\n// item turns uploaded, overwriting the user's choice made during upload.\nconst mainFileSingleUse = computed(() => item.value?.mainFileSingleUse ?? false)\n\n// Whether the duplicate's original is single use, as found. The notice is about that\n// asset and does not follow the switch, which is the item's value from then on.\nconst originalIsSingleUse = ref(false)\nwatch(\n () => item.value?.isDuplicate,\n (isDuplicate) => {\n originalIsSingleUse.value = !!isDuplicate && item.value?.mainFileSingleUse === true\n },\n { immediate: true }\n)\n\n// Which button is saving. The other one waits, so no second request is sent.\nconst saving = ref<'save' | 'saveAndApply' | null>(null)\n\nconst onSave = async () => {\n if (items.value.length === 0 || !isNull(saving.value)) return\n saving.value = 'save'\n try {\n await bulkUpdateAssetsMetadata(\n damClient,\n endPointAsset,\n items.value,\n mainFileSingleUse.value,\n props.extSystem,\n damConfigName\n )\n showRecordWas('updated')\n } catch (error) {\n showMetadataSaveError(error, props.extSystem, damConfigName)\n } finally {\n saving.value = null\n }\n}\n\nconst onSaveAndApply = async () => {\n // A file still sent has no image to hand over yet.\n if (items.value.length === 0 || !isDone.value || !isNull(saving.value)) return\n saving.value = 'saveAndApply'\n try {\n let assetsMetadataRes: AssetMetadataBulkItem[]\n try {\n assetsMetadataRes = await bulkUpdateAssetsMetadata(\n damClient,\n endPointAsset,\n items.value,\n mainFileSingleUse.value,\n props.extSystem,\n damConfigName\n )\n if (!assetsMetadataRes[0]) {\n throw new Error('Fatal error updating asset metadata')\n }\n } catch (error) {\n showMetadataSaveError(error, props.extSystem, damConfigName)\n return\n }\n showRecordWas('updated')\n const mappedItems = customUploadMetadataToImageMap\n ? await customUploadMetadataToImageMap(\n items.value,\n assetsMetadataRes,\n damClient,\n props.extSystem,\n props.licenceId\n )\n : await mapUploadMetadataToImages(\n items.value,\n assetsMetadataRes,\n damClient,\n props.extSystem,\n props.licenceId,\n endPointAuthor,\n creditConfigOf(props.extSystem)\n )\n emit(\n 'apply',\n mappedItems.map((item) => ({\n ...item,\n position: 1,\n }))\n )\n await onStopConfirm()\n } catch (error) {\n showErrorsDefault(error)\n } finally {\n saving.value = null\n }\n}\n\n// Read when the file is done and again when the row gets another asset.\n// A duplicate row becomes the original only after the original asset was read, so the first read showed no \"File info\".\nwatch(\n [isDone, () => item.value?.assetId],\n async ([done, assetId]) => {\n if (!done || !assetId) return\n // Capture the row being read. A dialog closed meanwhile empties its\n // queue, and the widget's next upload is a new row in the same queue.\n const row = item.value\n try {\n const res = await fetchAsset(damClient, endPointAsset, assetId)\n // If the dialog closed meanwhile, its queue is emptied. The detail store\n // is shared, so writing now would show this asset in the next dialog.\n // The same applies to a row that has another asset by now.\n if (item.value?.assetId !== assetId) return\n assetDetailStore.setAsset(res)\n enableRoiTab.value = true\n } catch (e) {\n // Skip the error if the dialog closed meanwhile. It would appear\n // over whatever the user moved on to, such as the next upload.\n // A row that became the original of a duplicate is the same row, so its failed read is reported normally.\n if (item.value !== row) return\n showErrorsDefault(e)\n }\n },\n { immediate: true }\n)\n\nonMounted(() => {\n activeTab.value = AssetDetailTabImageWithRoi.Info\n})\n</script>\n\n<template>\n <AssetDetailDialogFrame\n :loading=\"loading || !item\"\n :view=\"view\"\n :ext-system=\"extSystem\"\n :config-name=\"damConfigName\"\n @close=\"onStopConfirm\"\n >\n <template #title>\n <div\n v-if=\"isUploading\"\n class=\"text-label-large\"\n >\n {{ t('common.damImage.upload.title') }}\n </div>\n <div\n v-else\n class=\"text-label-large font-weight-bold\"\n :class=\"isFailed ? 'text-error' : 'text-green-darken-3'\"\n >\n {{ t('common.damImage.upload.titleDone') }}\n </div>\n </template>\n <template #toolbar-actions>\n <UploadQueueButtonStop\n data-cy=\"button-close\"\n :button-size=\"36\"\n :is-uploading=\"isUploading\"\n @confirm=\"onStopConfirm\"\n />\n </template>\n <template #image-overlay>\n <UploadQueueItemErrorOverlay\n v-if=\"item && item.error.hasError\"\n :error=\"item.error\"\n />\n </template>\n <template #sidebar=\"{ view: shown }\">\n <UploadQueueDialogSingleSidebar\n v-if=\"shown.id\"\n :key=\"shown.id\"\n :queue-key=\"queueKey\"\n :ext-system=\"extSystem\"\n :config-name=\"damConfigName\"\n :enable-roi-tab=\"enableRoiTab\"\n :show-file-info=\"enableRoiTab\"\n :asset-id=\"shown.id\"\n :is-video=\"shown.assetType === DamAssetType.Video\"\n :is-audio=\"shown.assetType === DamAssetType.Audio\"\n :is-image=\"shown.assetType === DamAssetType.Image\"\n :is-document=\"shown.assetType === DamAssetType.Document\"\n :asset-status=\"shown.assetStatus\"\n :asset-type=\"shown.assetType\"\n :asset-main-file-status=\"shown.mainFile ? shown.mainFile.fileAttributes.status : undefined\"\n :asset-main-file-fail-reason=\"shown.mainFile ? shown.mainFile.fileAttributes.failReason : undefined\"\n :saving=\"saving\"\n @save=\"onSave\"\n @save-and-apply=\"onSaveAndApply\"\n >\n <template #prepend-sidebar>\n <div\n v-if=\"item?.isDuplicate\"\n class=\"text-body-small text-warning px-3 py-2\"\n >\n {{ t('common.damImage.asset.detail.info.status.duplicate') }}\n </div>\n <div\n v-if=\"item?.isDuplicate && originalIsSingleUse\"\n class=\"text-body-small text-error px-3 py-2\"\n >\n {{ t('common.damImage.asset.model.mainFileSingleUse') }}\n </div>\n </template>\n </UploadQueueDialogSingleSidebar>\n </template>\n </AssetDetailDialogFrame>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,IAAMuD,IAAQF,GAiBRG,IAAOF,GAIPG,IAAgBV,GAAiBQ,EAAM,UAAU,GACjDG,IAAiBV,GAAmBS,CAAa,GAEjD,EAAEE,sBAAmBC,qBAAkBtB,GA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D,EAAAsD,CAAA;IACb,kBAAgBS,EAAA;IAChB,kBAAgBA,EAAA;IAChB,YAAUgC,EAAM;IAChB,YAAUA,EAAM,cAAc/F,EAAA2B,CAAA,CAAY,CAAC;IAC3C,YAAUoE,EAAM,cAAc/F,EAAA2B,CAAA,CAAY,CAAC;IAC3C,YAAUoE,EAAM,cAAc/F,EAAA2B,CAAA,CAAY,CAAC;IAC3C,eAAaoE,EAAM,cAAc/F,EAAA2B,CAAA,CAAY,CAAC;IAC9C,gBAAcoE,EAAM;IACpB,cAAYA,EAAM;IAClB,0BAAwBA,EAAM,WAAWA,EAAM,SAAS,eAAe,SAAS,KAAA;IAChF,+BAA6BA,EAAM,WAAWA,EAAM,SAAS,eAAe,aAAa,KAAA;IACzF,QAAQZ,EAAA;IACFC;IACUE;;IAEN,mBAAerF,QAMlB,CAJEkE,EAAA,OAAM,eADdtE,EAAA,GAAAK,EAKM,OALN6C,GAKM5C,EADDH,EAAA0D,CAAA,CAAC,CAAA,oDAAA,CAAA,GAAA,CAAA,K,WAGES,EAAA,OAAM,eAAec,EAAA,SAD7BpF,EAAA,GAAAK,EAKM,OALN8C,GAKM7C,EADDH,EAAA0D,CAAA,CAAC,CAAA,+CAAA,CAAA,GAAA,CAAA,K"}
|
|
1
|
+
{"version":3,"file":"UploadQueueDialogSingle.vue.js","names":["_openBlock","_createBlock","AssetDetailDialogFrame","_unref","_withCtx","_createElementBlock","_toDisplayString","_normalizeClass","_createVNode","UploadQueueButtonStop","UploadQueueItemErrorOverlay","UploadQueueDialogSingleSidebar","computed","createBlock","createCommentVNode","createElementBlock","createVNode","defineComponent","normalizeClass","onMounted","openBlock","ref","toDisplayString","unref","watch","withCtx","storeToRefs","useI18n","AssetDetailTabImageWithRoi","useAssetDetailStore","DamAssetType","AssetDetailDialogFrame_default","assetDetailViewOfUploadItem","useUploadQueuesStore","useUploadQueueDialog","useUploadQueueDialogDrawn","UploadQueueItemStatus","UploadQueueItemErrorOverlay_default","useAlerts","bulkUpdateAssetsMetadata","fetchAsset","showMetadataSaveError","useCommonAdminCoreDamOptions","UploadQueueDialogSingleSidebar_default","UploadQueueButtonStop_default","isNull","mapUploadMetadataToImages","useDamConfigName","useDamCreditConfig","_hoisted_1","_hoisted_2","_hoisted_3","UploadQueueDialogSingle_vue_vue_type_script_setup_true_lang_default","__props","__emit","props","emit","damConfigName","creditConfigOf","showErrorsDefault","showRecordWas","t","assetDetailStore","activeTab","loading","assetDetail","enableRoiTab","uploadQueuesStore","uploadQueueDialog","items","item","isDone","isFailed","damClient","endPointAsset","endPointAuthor","customUploadMetadataToImageMap","simpleAssetSidebarEnabled","view","onStopConfirm","queueTotalCount","queueProcessedCount","isUploading","originalIsSingleUse","isDuplicate","saving","detailSavesOf","rows","row","onSave","error","onSaveAndApply","assetsMetadataRes","mappedItems","done","assetId","res","_ctx","_cache","shown"],"sources":["../../../../../src/domains/dam/uploadQueue/components/UploadQueueDialogSingle.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, watch } from 'vue'\nimport { storeToRefs } from 'pinia'\nimport { useI18n } from 'vue-i18n'\nimport { AssetDetailTabImageWithRoi, useAssetDetailStore } from '@/domains/dam/assetDetail/store/assetDetailStore'\nimport { DamAssetType } from '@/domains/dam/types/Asset'\nimport AssetDetailDialogFrame from '@/domains/dam/assetDetail/components/AssetDetailDialogFrame.vue'\nimport { assetDetailViewOfUploadItem } from '@/domains/dam/assetDetail/composables/assetDetailView'\nimport type { ImageCreateUpdateAware } from '@/domains/dam/types/ImageAware'\nimport { useUploadQueuesStore } from '@/domains/dam/uploadQueue/store/uploadQueuesStore'\nimport {\n useUploadQueueDialog,\n useUploadQueueDialogDrawn,\n} from '@/domains/dam/uploadQueue/composables/useUploadQueueDialog'\nimport { type UploadQueueItem, UploadQueueItemStatus } from '@/domains/dam/types/UploadQueue'\nimport UploadQueueItemErrorOverlay from '@/domains/dam/uploadQueue/components/UploadQueueItemErrorOverlay.vue'\nimport { useAlerts } from '@/domains/system/composables/alerts'\nimport {\n type AssetMetadataBulkItem,\n bulkUpdateAssetsMetadata,\n fetchAsset,\n showMetadataSaveError,\n} from '@/domains/dam/api/damAssetApi'\nimport { useCommonAdminCoreDamOptions } from '@/domains/dam/composables/commonAdminCoreDamOptions'\nimport UploadQueueDialogSingleSidebar from '@/domains/dam/uploadQueue/components/UploadQueueDialogSingleSidebar.vue'\nimport UploadQueueButtonStop from '@/domains/dam/uploadQueue/components/UploadQueueButtonStop.vue'\nimport { isNull } from '@/shared/utils/common'\nimport { mapUploadMetadataToImages } from '@/domains/dam/imageWidget/utils/metadataToImageMap'\nimport type { IntegerId } from '@/shared/types/common'\nimport { useDamConfigName } from '@/domains/dam/composables/damConfigName'\nimport { useDamCreditConfig } from '@/domains/dam/author/composables/damCredit'\n\nconst props = withDefaults(\n defineProps<{\n queueKey: string\n extSystem: IntegerId\n licenceId: IntegerId\n fileInputKey: number\n accept: string | undefined\n maxSizes: Record<string, number> | undefined\n configName?: string\n disableDoneAnimation?: boolean\n }>(),\n {\n configName: undefined,\n disableDoneAnimation: false,\n }\n)\n\nconst emit = defineEmits<{\n (e: 'apply', items: ImageCreateUpdateAware[]): void\n}>()\n// eslint-disable-next-line vue/no-setup-props-reactivity-loss\nconst damConfigName = useDamConfigName(props.configName)\nconst creditConfigOf = useDamCreditConfig(damConfigName)\n\nconst { showErrorsDefault, showRecordWas } = useAlerts()\n\nconst { t } = useI18n()\n\nconst assetDetailStore = useAssetDetailStore()\nconst { activeTab, loading, asset: assetDetail } = storeToRefs(assetDetailStore)\nconst enableRoiTab = ref(false)\n\nconst uploadQueuesStore = useUploadQueuesStore()\nconst { uploadQueueDialog } = useUploadQueueDialog()\n\nconst items = computed(() => {\n return uploadQueuesStore.getQueueItems(props.queueKey)\n})\n\nconst item = computed<UploadQueueItem | null>(() => {\n return items.value[0] ?? null\n})\n\nconst isDone = computed(() => {\n return !isNull(item.value) && item.value.status === UploadQueueItemStatus.Uploaded\n})\n\n// The title stays \"done\", in the error colour for a refused or failed file.\nconst isFailed = computed(() => item.value?.status === UploadQueueItemStatus.Failed)\n\nconst { damClient, endPointAsset, endPointAuthor, customUploadMetadataToImageMap, simpleAssetSidebarEnabled } =\n useCommonAdminCoreDamOptions(damConfigName)\n\nconst view = computed(() =>\n assetDetailViewOfUploadItem(item.value, assetDetail.value, {\n enableRoiTab: enableRoiTab.value,\n disableDoneAnimation: props.disableDoneAnimation,\n simpleAssetSidebarEnabled,\n })\n)\n\nconst onStopConfirm = async () => {\n uploadQueuesStore.stopUpload(props.queueKey)\n assetDetailStore.setAsset(null)\n uploadQueueDialog.value = null\n}\n// eslint-disable-next-line vue/no-setup-props-reactivity-loss\nuseUploadQueueDialogDrawn(props.queueKey)\n\nconst queueTotalCount = computed(() => {\n return uploadQueuesStore.getQueueTotalCount(props.queueKey)\n})\n\nconst queueProcessedCount = computed(() => {\n return uploadQueuesStore.getQueueProcessedCount(props.queueKey)\n})\n\nconst isUploading = computed(() => {\n return queueTotalCount.value > queueProcessedCount.value\n})\n\n// Whether the duplicate's original is single use, as found. The notice is about that\n// asset and does not follow the switch, which is the item's value from then on.\nconst originalIsSingleUse = ref(false)\nwatch(\n () => item.value?.isDuplicate,\n (isDuplicate) => {\n originalIsSingleUse.value = !!isDuplicate && item.value?.mainFileSingleUse === true\n },\n { immediate: true }\n)\n\n// Which button is saving. The other one waits, so no second request is sent.\nconst saving = ref<'save' | 'saveAndApply' | null>(null)\n\n// No override of the single use switch. The switch is the item's own: the store loads it with the item's metadata,\n// then the user owns it, and the save sends it only when it differs from what the DAM had. Sent unchanged, it turned\n// off single use the DAM gave the file meanwhile (#87746). Not the asset detail's value: that is reset from the server\n// when the item turns uploaded, overwriting the user's choice made during upload.\n// A save in the asset detail of the item's asset can still run after the detail closed: the widget that opened this\n// dialog opens the detail too, and a duplicate file makes that asset the item's. The save waits for it, as the queue\n// dialog does, so it reads the asset after it. Otherwise its custom data put back what the detail changed (#87746).\nconst detailSavesOf = (rows: UploadQueueItem[]) =>\n Promise.all(rows.map((row) => (row.assetId ? assetDetailStore.savingOf(row.assetId, damConfigName) : null)))\n\nconst onSave = async () => {\n if (items.value.length === 0 || !isNull(saving.value)) return\n saving.value = 'save'\n try {\n await detailSavesOf(items.value)\n await bulkUpdateAssetsMetadata(damClient, endPointAsset, items.value, undefined, props.extSystem, damConfigName)\n showRecordWas('updated')\n } catch (error) {\n showMetadataSaveError(error, props.extSystem, damConfigName)\n } finally {\n saving.value = null\n }\n}\n\nconst onSaveAndApply = async () => {\n // A file still sent has no image to hand over yet.\n if (items.value.length === 0 || !isDone.value || !isNull(saving.value)) return\n saving.value = 'saveAndApply'\n try {\n let assetsMetadataRes: AssetMetadataBulkItem[]\n try {\n await detailSavesOf(items.value)\n assetsMetadataRes = await bulkUpdateAssetsMetadata(\n damClient,\n endPointAsset,\n items.value,\n undefined,\n props.extSystem,\n damConfigName\n )\n if (!assetsMetadataRes[0]) {\n throw new Error('Fatal error updating asset metadata')\n }\n } catch (error) {\n showMetadataSaveError(error, props.extSystem, damConfigName)\n return\n }\n showRecordWas('updated')\n const mappedItems = customUploadMetadataToImageMap\n ? await customUploadMetadataToImageMap(\n items.value,\n assetsMetadataRes,\n damClient,\n props.extSystem,\n props.licenceId\n )\n : await mapUploadMetadataToImages(\n items.value,\n assetsMetadataRes,\n damClient,\n props.extSystem,\n props.licenceId,\n endPointAuthor,\n creditConfigOf(props.extSystem)\n )\n emit(\n 'apply',\n mappedItems.map((item) => ({\n ...item,\n position: 1,\n }))\n )\n await onStopConfirm()\n } catch (error) {\n showErrorsDefault(error)\n } finally {\n saving.value = null\n }\n}\n\n// Read when the file is done and again when the row gets another asset.\n// A duplicate row becomes the original only after the original asset was read, so the first read showed no \"File info\".\nwatch(\n [isDone, () => item.value?.assetId],\n async ([done, assetId]) => {\n if (!done || !assetId) return\n // Capture the row being read. A dialog closed meanwhile empties its\n // queue, and the widget's next upload is a new row in the same queue.\n const row = item.value\n try {\n const res = await fetchAsset(damClient, endPointAsset, assetId)\n // If the dialog closed meanwhile, its queue is emptied. The detail store\n // is shared, so writing now would show this asset in the next dialog.\n // The same applies to a row that has another asset by now.\n if (item.value?.assetId !== assetId) return\n assetDetailStore.setAsset(res)\n enableRoiTab.value = true\n } catch (e) {\n // Skip the error if the dialog closed meanwhile. It would appear\n // over whatever the user moved on to, such as the next upload.\n // A row that became the original of a duplicate is the same row, so its failed read is reported normally.\n if (item.value !== row) return\n showErrorsDefault(e)\n }\n },\n { immediate: true }\n)\n\nonMounted(() => {\n activeTab.value = AssetDetailTabImageWithRoi.Info\n})\n</script>\n\n<template>\n <AssetDetailDialogFrame\n :loading=\"loading || !item\"\n :view=\"view\"\n :ext-system=\"extSystem\"\n :config-name=\"damConfigName\"\n @close=\"onStopConfirm\"\n >\n <template #title>\n <div\n v-if=\"isUploading\"\n class=\"text-label-large\"\n >\n {{ t('common.damImage.upload.title') }}\n </div>\n <div\n v-else\n class=\"text-label-large font-weight-bold\"\n :class=\"isFailed ? 'text-error' : 'text-green-darken-3'\"\n >\n {{ t('common.damImage.upload.titleDone') }}\n </div>\n </template>\n <template #toolbar-actions>\n <UploadQueueButtonStop\n data-cy=\"button-close\"\n :button-size=\"36\"\n :is-uploading=\"isUploading\"\n @confirm=\"onStopConfirm\"\n />\n </template>\n <template #image-overlay>\n <UploadQueueItemErrorOverlay\n v-if=\"item && item.error.hasError\"\n :error=\"item.error\"\n />\n </template>\n <template #sidebar=\"{ view: shown }\">\n <UploadQueueDialogSingleSidebar\n v-if=\"shown.id\"\n :key=\"shown.id\"\n :queue-key=\"queueKey\"\n :ext-system=\"extSystem\"\n :config-name=\"damConfigName\"\n :enable-roi-tab=\"enableRoiTab\"\n :show-file-info=\"enableRoiTab\"\n :asset-id=\"shown.id\"\n :is-video=\"shown.assetType === DamAssetType.Video\"\n :is-audio=\"shown.assetType === DamAssetType.Audio\"\n :is-image=\"shown.assetType === DamAssetType.Image\"\n :is-document=\"shown.assetType === DamAssetType.Document\"\n :asset-status=\"shown.assetStatus\"\n :asset-type=\"shown.assetType\"\n :asset-main-file-status=\"shown.mainFile ? shown.mainFile.fileAttributes.status : undefined\"\n :asset-main-file-fail-reason=\"shown.mainFile ? shown.mainFile.fileAttributes.failReason : undefined\"\n :saving=\"saving\"\n @save=\"onSave\"\n @save-and-apply=\"onSaveAndApply\"\n >\n <template #prepend-sidebar>\n <div\n v-if=\"item?.isDuplicate\"\n class=\"text-body-small text-warning px-3 py-2\"\n >\n {{ t('common.damImage.asset.detail.info.status.duplicate') }}\n </div>\n <div\n v-if=\"item?.isDuplicate && originalIsSingleUse\"\n class=\"text-body-small text-error px-3 py-2\"\n >\n {{ t('common.damImage.asset.model.mainFileSingleUse') }}\n </div>\n </template>\n </UploadQueueDialogSingleSidebar>\n </template>\n </AssetDetailDialogFrame>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,IAAMuD,IAAQF,GAiBRG,IAAOF,GAIPG,IAAgBV,GAAiBQ,EAAM,UAAU,GACjDG,IAAiBV,GAAmBS,CAAa,GAEjD,EAAEE,sBAAmBC,qBAAkBtB,GAAU,GAEjD,EAAEuB,SAAMlC,GAAQ,GAEhBmC,IAAmBjC,EAAoB,GACvC,EAAEkC,cAAWC,YAAS,OAAOC,MAAgBvC,GAAYoC,CAAgB,GACzEI,IAAe7C,EAAI,EAAK,GAExB8C,IAAoBlC,EAAqB,GACzC,EAAEmC,yBAAsBlC,EAAqB,GAE7CmC,IAAQzD,QACLuD,EAAkB,cAAcZ,EAAM,QAAQ,CACtD,GAEKe,IAAO1D,QACJyD,EAAM,MAAM,MAAM,IAC1B,GAEKE,IAAS3D,QACN,CAACiC,EAAOyB,EAAK,KAAK,KAAKA,EAAK,MAAM,WAAWlC,EAAsB,QAC3E,GAGKoC,KAAW5D,QAAe0D,EAAK,OAAO,WAAWlC,EAAsB,MAAM,GAE7E,EAAEqC,cAAWC,kBAAeC,oBAAgBC,mCAAgCC,kCAChFnC,GAA6Be,C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AAS,KAAA;IAChF,+BAA6BA,EAAM,WAAWA,EAAM,SAAS,eAAe,aAAa,KAAA;IACzF,QAAQd,EAAA;IACFI;IACUE;;IAEN,mBAAevF,QAMlB,CAJEkE,EAAA,OAAM,eADdtE,EAAA,GAAAK,EAKM,OALN6C,GAKM5C,EADDH,EAAA0D,CAAA,CAAC,CAAA,oDAAA,CAAA,GAAA,CAAA,K,WAGES,EAAA,OAAM,eAAea,EAAA,SAD7BnF,EAAA,GAAAK,EAKM,OALN8C,GAKM7C,EADDH,EAAA0D,CAAA,CAAC,CAAA,+CAAA,CAAA,GAAA,CAAA,K"}
|
|
@@ -5,8 +5,9 @@ import { UploadQueueItemStatus as i } from "../../types/UploadQueue.js";
|
|
|
5
5
|
import { useAssetSuggestions as a } from "../composables/assetSuggestions.js";
|
|
6
6
|
import { UploadRowRole as o } from "./uploadSettlementTypes.js";
|
|
7
7
|
import { isArray as s, isNull as c, isObject as l, isUndefined as u } from "../../../../shared/utils/common.js";
|
|
8
|
+
import { metadataOfAsset as d, setMetadataOnServer as f } from "../../api/damMetadataOnServer.js";
|
|
8
9
|
// src/domains/dam/uploadQueue/settlement/uploadSettle.ts
|
|
9
|
-
var
|
|
10
|
+
var p = () => ({
|
|
10
11
|
tracked: /* @__PURE__ */ new WeakMap(),
|
|
11
12
|
revision: /* @__PURE__ */ new WeakMap(),
|
|
12
13
|
metadataLoaded: /* @__PURE__ */ new WeakSet(),
|
|
@@ -15,50 +16,50 @@ var d = () => ({
|
|
|
15
16
|
givenUpMissing: /* @__PURE__ */ new WeakSet(),
|
|
16
17
|
notices: /* @__PURE__ */ new WeakMap(),
|
|
17
18
|
clock: 0
|
|
18
|
-
}),
|
|
19
|
+
}), m = (e) => e === r.Processed || e === r.Duplicate || e === r.Failed, h = (e, t, n) => {
|
|
19
20
|
if (!c(t.fileId) && t.fileId !== e.mainFile?.id) return n.hint ?? void 0;
|
|
20
21
|
let r = e.mainFile?.fileAttributes?.status;
|
|
21
|
-
return
|
|
22
|
-
},
|
|
22
|
+
return m(r) ? r : n.hint ?? r;
|
|
23
|
+
}, g = (e) => {
|
|
23
24
|
e.error = {
|
|
24
25
|
hasError: !1,
|
|
25
26
|
message: "",
|
|
26
27
|
assetFileFailReason: n
|
|
27
28
|
};
|
|
28
|
-
},
|
|
29
|
-
function
|
|
29
|
+
}, _ = (e) => u(e) || c(e) || e === "" || s(e) && !e.length;
|
|
30
|
+
function v(e, t, n, r) {
|
|
30
31
|
let { updateNewNames: i, getAuthorConflicts: o } = a();
|
|
31
|
-
|
|
32
|
+
_(t.keywords) && (t.keywords = [...n.keywords ?? []]), _(t.authors) && (t.authors = [...n.authors ?? []]), _(t.sources) && (t.sources = [...n.sources ?? []]);
|
|
32
33
|
let s = l(n.metadata.customData) ? { ...n.metadata.customData } : {};
|
|
33
|
-
if (l(t.customData)) for (let [e, n] of Object.entries(t.customData))
|
|
34
|
-
t.customData = s, t.mainFileSingleUse = n.mainFileSingleUse, t.mainFileInternal = n.mainFileInternal;
|
|
34
|
+
if (l(t.customData)) for (let [e, n] of Object.entries(t.customData)) _(n) || (s[e] = n);
|
|
35
|
+
t.customData = s, t.mainFileSingleUse = n.mainFileSingleUse, t.mainFileInternal = n.mainFileInternal, f(t, d(n));
|
|
35
36
|
let c = n.metadata.authorSuggestions ?? {};
|
|
36
37
|
i(c, e.suggestions.newAuthorNames), i(n.metadata.keywordSuggestions ?? {}, e.suggestions.newKeywordNames), t.authorConflicts = o(c), r.addKeywords(t.keywords), r.addAuthors([...t.authors, ...t.sources ?? []]), r.addAuthors(t.authorConflicts);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function y(e, t, n, r, i) {
|
|
39
40
|
e.assetStatus = t.attributes.assetStatus, (c(e.fileId) || e.fileId === n.id) && (n.links?.image_detail && (e.imagePreview = n.links.image_detail), !e.canEditMetadata && !i && r !== o.MassEdit && (e.mainFileSingleUse = t.mainFileSingleUse, e.mainFileInternal = t.mainFileInternal));
|
|
40
41
|
}
|
|
41
|
-
var
|
|
42
|
+
var b = (e) => {
|
|
42
43
|
e.isDuplicate = !0, e.uploadedAssetId ??= e.assetId;
|
|
43
44
|
};
|
|
44
|
-
function
|
|
45
|
-
let u = (e) => n.policyFor(n.roleOf(e)),
|
|
45
|
+
function x(n, o = p(), s = {}) {
|
|
46
|
+
let u = (e) => n.policyFor(n.roleOf(e)), m = (e, t, r, i) => (!n.configOf || !r.configNames?.length || r.configNames.includes(n.configOf(e))) && n.matches(t, r, i), _ = (e) => {
|
|
46
47
|
let t = n.configOf ? [...new Set(e.configNames ?? [])] : [];
|
|
47
48
|
return t.length > 1 ? t.map((t) => ({
|
|
48
49
|
...e,
|
|
49
50
|
configNames: [t]
|
|
50
51
|
})) : [e];
|
|
51
|
-
},
|
|
52
|
+
}, x = /* @__PURE__ */ new Set(), S = (e) => (x.add(e), n.configOf ? {
|
|
52
53
|
addAuthors: (t) => n.caches.addAuthors(t, e),
|
|
53
54
|
addKeywords: (t) => n.caches.addKeywords(t, e)
|
|
54
55
|
} : {
|
|
55
56
|
addAuthors: (e) => n.caches.addAuthors(e),
|
|
56
57
|
addKeywords: (e) => n.caches.addKeywords(e)
|
|
57
|
-
}),
|
|
58
|
-
let e = [...
|
|
59
|
-
if (
|
|
58
|
+
}), C = () => {
|
|
59
|
+
let e = [...x];
|
|
60
|
+
if (x.clear(), !n.configOf) n.caches.fetchAuthors(), n.caches.fetchKeywords();
|
|
60
61
|
else for (let t of e) n.caches.fetchAuthors(t), n.caches.fetchKeywords(t);
|
|
61
|
-
},
|
|
62
|
+
}, w = () => {
|
|
62
63
|
let e = [];
|
|
63
64
|
for (let [t, r] of n.queues()) for (let n of r.items) e.push({
|
|
64
65
|
queueKey: t,
|
|
@@ -66,20 +67,20 @@ function y(n, o = d(), s = {}) {
|
|
|
66
67
|
row: n
|
|
67
68
|
});
|
|
68
69
|
return e;
|
|
69
|
-
},
|
|
70
|
+
}, T = (e) => e.status === i.Stop, E = (t) => {
|
|
70
71
|
let r = e(t);
|
|
71
72
|
for (let [, t] of n.queues()) if (e(t.items).some((t) => e(t) === r)) return !0;
|
|
72
73
|
return !1;
|
|
73
|
-
},
|
|
74
|
+
}, D = (e) => e.isDuplicate && u(e).duplicate === "markDuplicate", O = () => s.isDisposed?.() === !0, k = (t, r, i) => y(t, r, i, n.roleOf(t), o.metadataLoaded.has(e(t))), A = (t) => o.revision.get(e(t)) ?? 0, j = (t) => {
|
|
74
75
|
let n = ++o.clock;
|
|
75
76
|
return o.revision.set(e(t), n), n;
|
|
76
|
-
},
|
|
77
|
+
}, M = (e, t) => t <= A(e), N = () => ++o.clock, P = (t) => o.tracked.get(e(t)), F = (t) => {
|
|
77
78
|
let n = e(t), r = o.tracked.get(n);
|
|
78
79
|
r && (o.tracked.delete(n), s.onUntrack?.(r.queueKey));
|
|
79
|
-
},
|
|
80
|
+
}, I = (t, r, i) => {
|
|
80
81
|
let a = e(r);
|
|
81
82
|
o.refreshMayHelp.has(a) !== i && (i ? o.refreshMayHelp.add(a) : o.refreshMayHelp.delete(a), n.hooks.onRefreshMayHelp?.(t, r, i));
|
|
82
|
-
},
|
|
83
|
+
}, L = (t) => {
|
|
83
84
|
let n = e(t), r = o.notices.get(n);
|
|
84
85
|
return r || (r = {
|
|
85
86
|
slow: !1,
|
|
@@ -87,51 +88,51 @@ function y(n, o = d(), s = {}) {
|
|
|
87
88
|
shown: null,
|
|
88
89
|
text: null
|
|
89
90
|
}, o.notices.set(n, r)), r;
|
|
90
|
-
},
|
|
91
|
+
}, R = (t) => o.notices.delete(e(t)), z = (t) => {
|
|
91
92
|
let n = o.notices.get(e(t));
|
|
92
93
|
return !!n?.shown && t.error.message === n.text;
|
|
93
|
-
},
|
|
94
|
-
let r =
|
|
95
|
-
if (r.readWarning && u(e).metadata === "load" && !e.canEditMetadata && !
|
|
94
|
+
}, B = (e, { clear: t = !1 } = {}) => {
|
|
95
|
+
let r = L(e), a = null;
|
|
96
|
+
if (r.readWarning && u(e).metadata === "load" && !e.canEditMetadata && !D(e) && e.status !== i.Failed ? a = "readWarning" : r.slow && e.status === i.Processing && (a = "slow"), a) {
|
|
96
97
|
let t = a === "slow" ? n.messages.processingTooLong(e) : n.messages.readFailed(e);
|
|
97
98
|
e.error.hasError = !0, e.error.message = t, r.shown = a, r.text = t;
|
|
98
|
-
} else t ?
|
|
99
|
+
} else t ? g(e) : z(e) && (e.status === i.Failed ? e.error = {
|
|
99
100
|
...e.error,
|
|
100
101
|
message: ""
|
|
101
|
-
} :
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
},
|
|
102
|
+
} : g(e)), r.shown = null, r.text = null;
|
|
103
|
+
}, V = ({ queueKey: t, queue: n, row: r }, i) => {
|
|
104
|
+
v(n, r, i, S(t)), o.metadataLoaded.add(e(r));
|
|
105
|
+
}, H = ({ queueKey: t, queue: r, row: a }, s, l, d) => {
|
|
105
106
|
let f = e(a), p = a.status === i.Failed || o.reviveWithMetadata.has(f);
|
|
106
|
-
a.status = i.Uploaded, c(a.fileId) && (a.fileId = l.id),
|
|
107
|
-
let m =
|
|
108
|
-
u(a).metadata === "load" && !
|
|
107
|
+
a.status = i.Uploaded, c(a.fileId) && (a.fileId = l.id), k(a, s, l);
|
|
108
|
+
let m = L(a);
|
|
109
|
+
u(a).metadata === "load" && !D(a) && (d.metadata || p) && (!a.canEditMetadata && !o.metadataLoaded.has(f) && V({
|
|
109
110
|
queueKey: t,
|
|
110
111
|
queue: r,
|
|
111
112
|
row: a
|
|
112
|
-
}, s), a.canEditMetadata = !0, m.readWarning = !1, n.hooks.afterMetadataLoaded?.(t, a)), o.reviveWithMetadata.delete(f), o.givenUpMissing.delete(f), m.slow = !1,
|
|
113
|
-
},
|
|
113
|
+
}, s), a.canEditMetadata = !0, m.readWarning = !1, n.hooks.afterMetadataLoaded?.(t, a)), o.reviveWithMetadata.delete(f), o.givenUpMissing.delete(f), m.slow = !1, B(a, { clear: !0 }), I(t, a, !1), F(a), n.hooks.onRowFinal(t, a);
|
|
114
|
+
}, U = ({ queueKey: t, row: r }, a) => {
|
|
114
115
|
r.status = i.Failed, r.error = {
|
|
115
116
|
hasError: !0,
|
|
116
117
|
message: "",
|
|
117
118
|
assetFileFailReason: a
|
|
118
|
-
}, r.canEditMetadata = !1,
|
|
119
|
-
},
|
|
120
|
-
for (let n of
|
|
121
|
-
},
|
|
122
|
-
for (let { queueKey: r, row: a } of
|
|
123
|
-
if (a.status === i.Stop || u(a).settleOn !== "event" || !
|
|
119
|
+
}, r.canEditMetadata = !1, R(r), o.reviveWithMetadata.delete(e(r)), o.givenUpMissing.delete(e(r)), I(t, r, !1), F(r), n.hooks.onRowFinal(t, r);
|
|
120
|
+
}, W = (e, t) => {
|
|
121
|
+
for (let n of w()) n.row.status !== i.Stop && m(n.queueKey, n.row, e, "settle") && (U(n, t), j(n.row));
|
|
122
|
+
}, G = (t) => {
|
|
123
|
+
for (let { queueKey: r, row: a } of w()) {
|
|
124
|
+
if (a.status === i.Stop || u(a).settleOn !== "event" || !m(r, a, t, "settle")) continue;
|
|
124
125
|
let s = e(a);
|
|
125
|
-
a.status === i.Failed && o.reviveWithMetadata.add(s), o.givenUpMissing.delete(s), a.status = i.Uploaded, !
|
|
126
|
+
a.status === i.Failed && o.reviveWithMetadata.add(s), o.givenUpMissing.delete(s), a.status = i.Uploaded, !D(a) && o.metadataLoaded.has(s) && (a.canEditMetadata = !0), L(a).slow = !1, B(a, { clear: !0 }), j(a), I(r, a, !1), F(a), n.hooks.onRowFinal(r, a);
|
|
126
127
|
}
|
|
127
|
-
},
|
|
128
|
-
for (let { queueKey: t, row: r } of
|
|
129
|
-
},
|
|
128
|
+
}, K = (e) => {
|
|
129
|
+
for (let { queueKey: t, row: r } of w()) r.status !== i.Stop && u(r).settleOn === "never" && m(t, r, e, "decorate") && n.hooks.onProcessedSeen?.(t, r);
|
|
130
|
+
}, q = (e, t, n) => w().filter(({ queueKey: r, row: a }) => a.status !== i.Stop && n(a) && u(a).duplicate === t && m(r, a, e, "settle")), J = async (t, r, a, s) => {
|
|
130
131
|
let c = [];
|
|
131
|
-
for (let { queueKey: r, row: a } of
|
|
132
|
+
for (let { queueKey: r, row: a } of q(t, "markDuplicate", s)) b(a), a.status = i.Uploaded, a.canEditMetadata = !1, g(a), R(a), o.reviveWithMetadata.delete(e(a)), o.givenUpMissing.delete(e(a)), c.push({
|
|
132
133
|
row: a,
|
|
133
|
-
mark:
|
|
134
|
-
}),
|
|
134
|
+
mark: j(a)
|
|
135
|
+
}), I(r, a, !1), F(a), n.hooks.onRowFinal(r, a);
|
|
135
136
|
if (!c.length || !r || !a || !n.readers.duplicateOriginFile) return;
|
|
136
137
|
let l = null;
|
|
137
138
|
try {
|
|
@@ -139,107 +140,107 @@ function y(n, o = d(), s = {}) {
|
|
|
139
140
|
} catch (e) {
|
|
140
141
|
console.error("uploadQueue: the duplicated file could not be read", e);
|
|
141
142
|
}
|
|
142
|
-
if (l && !
|
|
143
|
-
},
|
|
143
|
+
if (l && !O()) for (let { row: e, mark: t } of c) E(e) && e.status !== i.Stop && e.isDuplicate && A(e) === t && (e.fileId = l.id, e.duplicateAssetId = l.asset, e.mainFileSingleUse = l.flags.singleUse, l.links?.image_detail && (e.imagePreview = l.links.image_detail));
|
|
144
|
+
}, Y = async (r, s, c, u) => {
|
|
144
145
|
if (!s || c !== t.Image) return !1;
|
|
145
|
-
let
|
|
146
|
+
let p = q(r, "becomeOriginal", u).map((e) => ({
|
|
146
147
|
...e,
|
|
147
|
-
mark:
|
|
148
|
+
mark: A(e.row)
|
|
148
149
|
}));
|
|
149
|
-
if (!
|
|
150
|
-
let
|
|
150
|
+
if (!p.length) return !1;
|
|
151
|
+
let m = () => p.filter(({ row: e, mark: t }) => E(e) && !T(e) && A(e) === t), { updateNewNames: h, getAuthorConflicts: _ } = a(), v;
|
|
151
152
|
try {
|
|
152
153
|
if (!n.readers.duplicateOriginAsset) throw Error("uploadSettlement: no reader of the original asset");
|
|
153
|
-
|
|
154
|
+
v = await n.readers.duplicateOriginAsset(s, { queueKey: p[0].queueKey });
|
|
154
155
|
} catch {
|
|
155
|
-
if (
|
|
156
|
+
if (O()) return !1;
|
|
156
157
|
let t = !1;
|
|
157
|
-
for (let { queueKey: r, row: a } of
|
|
158
|
+
for (let { queueKey: r, row: a } of m()) {
|
|
158
159
|
let s = o.refreshMayHelp.has(e(a));
|
|
159
|
-
|
|
160
|
+
F(a);
|
|
160
161
|
let c = a.status === i.Processing;
|
|
161
162
|
c && (a.status = i.Failed, a.error = {
|
|
162
163
|
...a.error,
|
|
163
164
|
hasError: !0,
|
|
164
|
-
message:
|
|
165
|
-
}, a.canEditMetadata = !1,
|
|
165
|
+
message: z(a) ? "" : a.error.message
|
|
166
|
+
}, a.canEditMetadata = !1, R(a), n.hooks.onRowFinal(r, a)), (c || s) && (I(r, a, !0), t = !0);
|
|
166
167
|
}
|
|
167
168
|
return t;
|
|
168
169
|
}
|
|
169
|
-
if (
|
|
170
|
-
for (let { queueKey: t, queue: r, row: a } of
|
|
171
|
-
let c =
|
|
172
|
-
|
|
173
|
-
let u =
|
|
174
|
-
u.addKeywords(a.keywords), u.addAuthors([...a.authors, ...a.sources ?? []]), u.addAuthors(a.authorConflicts), a.assetId =
|
|
170
|
+
if (O()) return !1;
|
|
171
|
+
for (let { queueKey: t, queue: r, row: a } of m()) {
|
|
172
|
+
let c = v.metadata.authorSuggestions ?? {};
|
|
173
|
+
b(a), a.status = i.Uploaded, g(a), a.fileId = s, a.duplicateAssetId = v.id, a.assetStatus = v.attributes.assetStatus, v.mainFile?.links?.image_detail && (a.imagePreview = v.mainFile.links.image_detail), a.keywords = [...v.keywords ?? []], a.authors = [...v.authors ?? []], a.sources = [...v.sources ?? []], a.customData = l(v.metadata.customData) ? { ...v.metadata.customData } : {}, h(c, r.suggestions.newAuthorNames), h(v.metadata.keywordSuggestions ?? {}, r.suggestions.newKeywordNames), a.authorConflicts = _(c);
|
|
174
|
+
let u = S(t);
|
|
175
|
+
u.addKeywords(a.keywords), u.addAuthors([...a.authors, ...a.sources ?? []]), u.addAuthors(a.authorConflicts), a.assetId = v.id, a.mainFileSingleUse = v.mainFileSingleUse, a.mainFileInternal = v.mainFileInternal, f(a, d(v)), o.metadataLoaded.add(e(a)), a.canEditMetadata = !0, R(a), o.reviveWithMetadata.delete(e(a)), o.givenUpMissing.delete(e(a)), j(a), I(t, a, !1), F(a), n.hooks.onRowFinal(t, a);
|
|
175
176
|
}
|
|
176
|
-
return
|
|
177
|
-
},
|
|
178
|
-
let i =
|
|
177
|
+
return C(), !1;
|
|
178
|
+
}, X = async (e, t, n, r = () => !0) => {
|
|
179
|
+
let i = _(e), [, a] = await Promise.all([J(e, t, n, r), i.length === 1 ? Y(e, t, n, r) : Promise.all(i.map((e) => Y(e, t, n, r))).then((e) => e.some(Boolean))]);
|
|
179
180
|
return a;
|
|
180
|
-
},
|
|
181
|
+
}, Z = async (e, t, n) => {
|
|
181
182
|
try {
|
|
182
|
-
await
|
|
183
|
+
await X(e, t, n);
|
|
183
184
|
} catch (e) {
|
|
184
185
|
console.error("uploadQueue: the duplicate could not be settled", e);
|
|
185
186
|
}
|
|
186
|
-
},
|
|
187
|
-
u(a).metadata !== "load" || a.canEditMetadata ||
|
|
187
|
+
}, Q = ({ queueKey: t, queue: r, row: a }, s) => {
|
|
188
|
+
u(a).metadata !== "load" || a.canEditMetadata || D(a) || (a.status !== i.Failed || n.metadataGate?.(t, a) === "load") && (o.metadataLoaded.has(e(a)) || V({
|
|
188
189
|
queueKey: t,
|
|
189
190
|
queue: r,
|
|
190
191
|
row: a
|
|
191
|
-
}, s), a.canEditMetadata = !0,
|
|
192
|
-
},
|
|
193
|
-
let o = e.mainFile ?? null, s =
|
|
194
|
-
for (let d of
|
|
195
|
-
let { queueKey:
|
|
196
|
-
if ((!c ||
|
|
197
|
-
if (!
|
|
198
|
-
let h = f
|
|
199
|
-
if (s === r.Processed) u(
|
|
192
|
+
}, s), a.canEditMetadata = !0, L(a).readWarning = !1, B(a), n.hooks.afterMetadataLoaded?.(t, a));
|
|
193
|
+
}, ee = async (e, t, i, a) => {
|
|
194
|
+
let o = e.mainFile ?? null, s = h(e, t, i), c = !1, l = !1;
|
|
195
|
+
for (let d of w()) {
|
|
196
|
+
let { queueKey: f, row: p } = d;
|
|
197
|
+
if ((!c || E(p)) && !T(p)) {
|
|
198
|
+
if (!M(p, a) && o && m(f, p, t, "decorate")) {
|
|
199
|
+
let h = m(f, p, t, "settle");
|
|
200
|
+
if (s === r.Processed) u(p).settleOn === "never" ? (k(p, e, o), i.seen && n.hooks.onProcessedSeen?.(f, p)) : h && H(d, e, o, i);
|
|
200
201
|
else if (s === r.Duplicate && h) {
|
|
201
202
|
if (!c) {
|
|
202
|
-
if (c = !0, l = await
|
|
203
|
-
if (!
|
|
203
|
+
if (c = !0, l = await X(t, o.originAssetFile, e.attributes.assetType, (e) => !M(e, a)), O()) return l;
|
|
204
|
+
if (!E(p) || T(p)) continue;
|
|
204
205
|
}
|
|
205
|
-
} else s === r.Failed && h &&
|
|
206
|
+
} else s === r.Failed && h && U(d, o.fileAttributes.failReason);
|
|
206
207
|
}
|
|
207
|
-
i.early && f
|
|
208
|
+
i.early && m(f, p, t, "metadata") && Q(d, e);
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
return n.hooks.onAssetRead?.(e), l;
|
|
211
|
-
},
|
|
212
|
+
}, $ = (e) => e.status === i.Uploaded && !e.canEditMetadata && u(e).metadata === "load" && !D(e);
|
|
212
213
|
return {
|
|
213
214
|
memory: o,
|
|
214
215
|
policyOf: u,
|
|
215
|
-
concerns:
|
|
216
|
-
byConfiguration:
|
|
217
|
-
fetchNames:
|
|
218
|
-
rows:
|
|
219
|
-
isLive:
|
|
220
|
-
bump:
|
|
221
|
-
isStale:
|
|
222
|
-
startRead:
|
|
223
|
-
trackStateOf:
|
|
224
|
-
untrack:
|
|
225
|
-
setRefreshMayHelp:
|
|
226
|
-
noticeOf:
|
|
227
|
-
syncNotice:
|
|
228
|
-
applyAssetRead:
|
|
229
|
-
settleProcessedByEvent:
|
|
230
|
-
announceProcessed:
|
|
231
|
-
settleFailed:
|
|
232
|
-
settleKnownFailed:
|
|
233
|
-
settleDuplicate:
|
|
234
|
-
settleKnownDuplicate:
|
|
235
|
-
awaitsMetadata:
|
|
216
|
+
concerns: m,
|
|
217
|
+
byConfiguration: _,
|
|
218
|
+
fetchNames: C,
|
|
219
|
+
rows: w,
|
|
220
|
+
isLive: E,
|
|
221
|
+
bump: j,
|
|
222
|
+
isStale: M,
|
|
223
|
+
startRead: N,
|
|
224
|
+
trackStateOf: P,
|
|
225
|
+
untrack: F,
|
|
226
|
+
setRefreshMayHelp: I,
|
|
227
|
+
noticeOf: L,
|
|
228
|
+
syncNotice: B,
|
|
229
|
+
applyAssetRead: ee,
|
|
230
|
+
settleProcessedByEvent: G,
|
|
231
|
+
announceProcessed: K,
|
|
232
|
+
settleFailed: U,
|
|
233
|
+
settleKnownFailed: W,
|
|
234
|
+
settleDuplicate: X,
|
|
235
|
+
settleKnownDuplicate: Z,
|
|
236
|
+
awaitsMetadata: $,
|
|
236
237
|
giveUpOnMissing: ({ queueKey: t, row: r }) => {
|
|
237
|
-
|
|
238
|
-
let a =
|
|
239
|
-
r.status !== i.Processing && !a ?
|
|
238
|
+
I(t, r, !1);
|
|
239
|
+
let a = $(r);
|
|
240
|
+
r.status !== i.Processing && !a ? F(r) : (r.status = i.Failed, r.error.hasError = !0, r.error.message = a ? n.messages.assetGone?.(r) ?? n.messages.assetMissing(r) : n.messages.assetMissing(r), r.canEditMetadata = !1, o.givenUpMissing.add(e(r)), R(r), F(r), n.hooks.onRowFinal(t, r));
|
|
240
241
|
}
|
|
241
242
|
};
|
|
242
243
|
}
|
|
243
|
-
export {
|
|
244
|
+
export { g as clearRowError, x as createUploadSettle, p as createUploadSettleMemory, y as decorateRow, _ as isEmptyMetadataValue, m as isFinalFileStatus, v as mergeLoadedMetadata, h as resolveReadStatus };
|
|
244
245
|
|
|
245
246
|
//# sourceMappingURL=uploadSettle.js.map
|