Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Dec 5, 2023
1 parent 8362c8b commit 2c486a3
Show file tree
Hide file tree
Showing 28 changed files with 111 additions and 127 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"@vitejs/plugin-vue": "^4.5.1",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/language-server": "^1.8.24",
"@vue/language-service": "^1.8.24",
"@vue/language-server": "^1.8.25",
"@vue/language-service": "^1.8.25",
"@vue/tsconfig": "0.1.3",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
Expand Down Expand Up @@ -84,23 +84,23 @@
"vue-flatpickr-component": "^11.0.3",
"vue-i18n": "9.8.0",
"vue-router": "4.2.5",
"vue-tsc": "1.8.24",
"vuetify": "3.4.4",
"vue-tsc": "1.8.25",
"vuetify": "3.4.5",
"webfontloader": "^1.6.28"
},
"peerDependencies": {
"@vuelidate/core": "2.0.3",
"@vuelidate/validators": "2.0.4",
"@vueuse/core": "10.6.0",
"@vueuse/integrations": "10.6.0",
"@vueuse/core": "10.7.0",
"@vueuse/integrations": "10.7.0",
"axios": "1.6.2",
"dayjs": "1.11.10",
"flatpickr": "4.6.13",
"pinia": "2.1.7",
"vue": "3.3.8",
"vue-i18n": "9.6.5",
"vue": "3.3.10",
"vue-i18n": "9.8.0",
"vue-router": "4.2.5",
"vuetify": "3.4.2"
"vuetify": "3.4.5"
},
"peerDependenciesMeta": {
"@vueuse/core": {
Expand Down
6 changes: 3 additions & 3 deletions src/components/damImage/AImageWidgetSimple.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { ref, toRefs, watch } from 'vue'
import imagePlaceholderPath from '@/assets/image/placeholder16x9.jpg'
import type { ImageAware } from '@/types/ImageAware'
import type { ImageAware, ImageCreateUpdateAware } from '@/types/ImageAware'
import { cloneDeep } from '@/utils/common'
import { useCommonAdminImageOptions } from '@/components/damImage/composables/commonAdminImageOptions'
import { useImageActions } from '@/components/damImage/composables/imageActions'
Expand All @@ -12,7 +12,7 @@ import { fetchImage } from '@/components/damImage/uploadQueue/api/imageApi'
const props = withDefaults(
defineProps<{
modelValue: IntegerIdNullable | undefined
image?: ImageAware | undefined // optional, if available, no need to fetch image data
image?: ImageAware | ImageCreateUpdateAware | undefined // optional, if available, no need to fetch image data
configName?: string
label?: string | undefined
width?: number | undefined
Expand All @@ -36,7 +36,7 @@ const imageOptions = useCommonAdminImageOptions(props.configName)
const { imageClient } = imageOptions
const { widgetImageToDamImageUrl } = useImageActions(imageOptions)
const resImage = ref<null | ImageAware>(null)
const resImage = ref<null | ImageAware | ImageCreateUpdateAware>(null)
const { image, modelValue } = toRefs(props)
Expand Down
6 changes: 2 additions & 4 deletions src/components/damImage/composables/imageActions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { ImageAware } from '@/types/ImageAware'
import type { ImageAware, ImageCreateUpdateAware } from '@/types/ImageAware'
import type { useCommonAdminImageOptions } from '@/components/damImage/composables/commonAdminImageOptions'
import type { IntegerId } from '@/types/common'
import { isNull } from '@/utils/common'

export function useImageActions(config: ReturnType<typeof useCommonAdminImageOptions>) {
const widgetImageToDamImageUrl = (
image: ImageAware,
image: ImageAware | ImageCreateUpdateAware,
width = config.imageWidth,
height = config.imageHeight,
random = true
Expand Down
6 changes: 5 additions & 1 deletion src/components/damImage/uploadQueue/api/uploadApi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { DamAssetType } from '@/types/coreDam/Asset'
import { type DamUploadStartResponse, type UploadQueueItem, UploadQueueItemStatus } from '@/types/coreDam/UploadQueue'
import { imageUploadChunk, imageUploadFinish, imageUploadStart } from '@/components/damImage/uploadQueue/api/damImageApi'
import {
imageUploadChunk,
imageUploadFinish,
imageUploadStart,
} from '@/components/damImage/uploadQueue/api/damImageApi'
import type { AxiosInstance } from 'axios'
import type { DocId } from '@/types/common'
import { AssetFileProcessStatus } from '@/types/coreDam/AssetFile'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import { useValidate } from '@/validators/vuelidate/useValidate'
import useVuelidate from '@vuelidate/core'
import {
useDamCachedAuthors,
useDamCachedAuthorsForRemoteAutocomplete
useDamCachedAuthorsForRemoteAutocomplete,
} from '@/components/damImage/uploadQueue/author/cachedAuthors'
import type { DamAuthor } from '@/components/damImage/uploadQueue/author/DamAuthor'
import { isArray } from '@/utils/common'
import AFormRemoteAutocompleteWithCached from '@/components/form/AFormRemoteAutocompleteWithCached.vue'
import AuthorRemoteAutocompleteCachedAuthorChip
from '@/components/damImage/uploadQueue/author/AuthorRemoteAutocompleteCachedAuthorChip.vue'
import AuthorRemoteAutocompleteCachedAuthorChipConflicts
from '@/components/damImage/uploadQueue/author/AuthorRemoteAutocompleteCachedAuthorChipConflicts.vue'
import AuthorRemoteAutocompleteCachedAuthorChip from '@/components/damImage/uploadQueue/author/AuthorRemoteAutocompleteCachedAuthorChip.vue'
import AuthorRemoteAutocompleteCachedAuthorChipConflicts from '@/components/damImage/uploadQueue/author/AuthorRemoteAutocompleteCachedAuthorChipConflicts.vue'
import { useAuthorSelectActions } from '@/components/damImage/uploadQueue/author/authorActions'
import { useAuthorFilter } from '@/components/damImage/uploadQueue/author/AuthorFilter'
import AuthorCreateButton from '@/components/damImage/uploadQueue/author/AuthorCreateButton.vue'
Expand Down
1 change: 1 addition & 0 deletions src/components/damImage/uploadQueue/author/AuthorType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
import type { ValueObjectOption } from '@/types/ValueObject'

export enum AuthorType {
None = 'none',
Internal = 'internal',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<script setup lang="ts">
import {
AssetDetailTabImageWithRoi,
useAssetDetailStore
useAssetDetailStore,
} from '@/components/damImage/uploadQueue/composables/assetDetailStore'
import { storeToRefs } from 'pinia'
import type { DocId } from '@/types/common'
import { type DamAssetStatus, DamAssetType } from '@/types/coreDam/Asset'
import type { DamAssetStatus, DamAssetType } from '@/types/coreDam/Asset'
import type { AssetFileFailReason, AssetFileProcessStatus } from '@/types/coreDam/AssetFile'
import { useI18n } from 'vue-i18n'
import AssetInfobox from '@/components/damImage/uploadQueue/components/AssetInfobox.vue'
import AssetDetailSidebarMetadata from '@/components/damImage/uploadQueue/components/AssetDetailSidebarMetadata.vue'
import AssetDetailSidebarROI from '@/components/damImage/uploadQueue/components/AssetDetailSidebarROI.vue'
import AssetDetailSidebarActionsTeleportTarget
from '@/components/damImage/uploadQueue/components/AssetDetailSidebarActionsTeleportTarget.vue'
import AssetDetailSidebarActionsTeleportTarget from '@/components/damImage/uploadQueue/components/AssetDetailSidebarActionsTeleportTarget.vue'
withDefaults(
defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts" setup>
import { nextTick, onBeforeUnmount, onMounted } from 'vue'
import {
useAssetDetailSidebarActionbar
} from '@/components/damImage/uploadQueue/composables/assetDetailSidebarActionbar'
import { useAssetDetailSidebarActionbar } from '@/components/damImage/uploadQueue/composables/assetDetailSidebarActionbar'
const { mounted, unMounted } = useAssetDetailSidebarActionbar()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script lang="ts" setup>
import {
useAssetDetailSidebarActionbar
} from '@/components/damImage/uploadQueue/composables/assetDetailSidebarActionbar'
import { useAssetDetailSidebarActionbar } from '@/components/damImage/uploadQueue/composables/assetDetailSidebarActionbar'
const { canTeleport } = useAssetDetailSidebarActionbar()
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const { damClient } = useCommonAdminCoreDamOptions()
const loadRois = async () => {
if (imageRoiStore.imageFile) {
imageRoiStore.showLoader()
const res = await fetchImageRoiList(damClient ,imageRoiStore.imageFile.id, pagination, {})
const res = await fetchImageRoiList(damClient, imageRoiStore.imageFile.id, pagination, {})
if (res.length > 0 && res[0].id) {
const roi = await fetchRoi(damClient ,res[0].id)
const roi = await fetchRoi(damClient, res[0].id)
imageRoiStore.setRoi(roi)
imageRoiStore.hideLoader()
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { type AssetFileProperties, DamAssetType } from '@/types/coreDam/Asset'
import { type AssetFileProperties, DamAssetType } from '@/types/coreDam/Asset'
import {
DIMENSIONS_CONFIG,
ICON_LOW, ICON_RSS, ICON_SLOTS,
LOW_DIMENSION
ICON_LOW,
ICON_RSS,
ICON_SLOTS,
LOW_DIMENSION,
} from '@/components/damImage/uploadQueue/composables/assetImageIconsConfig'
import { useDamConfigState } from '@/components/damImage/uploadQueue/composables/damConfigState'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import { useDamConfigState } from '@/components/damImage/uploadQueue/composables
import ASystemEntityScope from '@/components/form/ASystemEntityScope.vue'
import { dateTimePretty } from '@/utils/datetime'
import { ADamAssetMetadataValidationScopeSymbol } from '@/components/damImage/uploadQueue/composables/uploadValidations'
import AuthorRemoteAutocompleteWithCached
from '@/components/damImage/uploadQueue/author/AuthorRemoteAutocompleteWithCached.vue'
import KeywordRemoteAutocompleteWithCached
from '@/components/damImage/uploadQueue/keyword/KeywordRemoteAutocompleteWithCached.vue'
import AuthorRemoteAutocompleteWithCached from '@/components/damImage/uploadQueue/author/AuthorRemoteAutocompleteWithCached.vue'
import KeywordRemoteAutocompleteWithCached from '@/components/damImage/uploadQueue/keyword/KeywordRemoteAutocompleteWithCached.vue'
const { t } = useI18n()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { DocId } from '@/types/common'
import { isNull } from '@/utils/common'
import {
AImageMetadataValidationScopeSymbol,
useImageValidation
useImageValidation,
} from '@/components/damImage/uploadQueue/composables/uploadValidations'
import { useAlerts } from '@/composables/system/alerts'
Expand Down Expand Up @@ -71,9 +71,7 @@ const onEditAsset = () => {
v-if="loading"
class="d-flex align-center justify-center"
>
<VProgressCircular
indeterminate
/>
<VProgressCircular indeterminate />
</div>
<div
v-else-if="imageDetail"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import AFileInput from '@/components/file/AFileInput.vue'
import AAssetSelect from '@/components/dam/assetSelect/AAssetSelect.vue'
import type { AssetSelectReturnData } from '@/types/coreDam/AssetSelect'
import { ImageWidgetExtSystemConfig } from '@/components/damImage/composables/imageWidgetInkectionKeys'
import { DamExtSystemConfig } from '@/types/coreDam/DamConfig'
import type { DamExtSystemConfig } from '@/types/coreDam/DamConfig'
import { createImage, deleteImage, fetchImage, updateImage } from '@/components/damImage/uploadQueue/api/imageApi'
import ImageDetailDialogMetadata from '@/components/damImage/uploadQueue/components/ImageDetailDialogMetadata.vue'
import { useImageStore } from '@/components/damImage/uploadQueue/composables/imageStore'
Expand Down Expand Up @@ -182,9 +182,7 @@ const onAssetSelectConfirm = async (data: AssetSelectReturnData) => {
}
if (assetRes.authors.length > 0) {
const authorsRes = await fetchAuthorListByIds(damClient, props.extSystem, assetRes.authors)
source = authorsRes.map((author) =>
author.name
).join(', ')
source = authorsRes.map((author) => author.name).join(', ')
}
} catch (e) {
showErrorsDefault(e)
Expand Down Expand Up @@ -350,7 +348,7 @@ const onAssetUploadConfirm = (items: ImageCreateUpdateAware[]) => {
@files-input="onFileInput"
>
<template #activator="{ props: fileInputProps }">
<VListItem @click.stop="fileInputProps.onClick($event)">
<VListItem @click.stop="fileInputProps.onClick">
Upload
</VListItem>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { computed, inject, nextTick, onMounted, ref, type ShallowRef, toRaw } fr
import { isNull, isString, isUndefined } from '@/utils/common'
import type { UploadQueueKey } from '@/types/coreDam/UploadQueue'
import { ImageWidgetExtSystemConfig } from '@/components/damImage/composables/imageWidgetInkectionKeys'
import { DamExtSystemConfig } from '@/types/coreDam/DamConfig'
import type { DamExtSystemConfig } from '@/types/coreDam/DamConfig'
import { useImageStore } from '@/components/damImage/uploadQueue/composables/imageStore'
import ImageWidgetMultipleItem from '@/components/damImage/uploadQueue/components/ImageWidgetMultipleItem.vue'
import { storeToRefs } from 'pinia'
Expand Down Expand Up @@ -33,10 +33,7 @@ import { WIDGET_HTML_ID_PREFIX } from '@/components/sortable/sortableUtils'
import { fetchAuthorListByIds } from '@/components/damImage/uploadQueue/api/authorApi'
import { useI18n } from 'vue-i18n'
import useVuelidate from '@vuelidate/core'
import {
ADamAssetMetadataValidationScopeSymbol,
AImageMetadataValidationScopeSymbol
} from '@/components/damImage/uploadQueue/composables/uploadValidations'
import { AImageMetadataValidationScopeSymbol } from '@/components/damImage/uploadQueue/composables/uploadValidations'
const props = withDefaults(
defineProps<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { HANDLE_CLASS } from '@/components/sortable/sortableActions'
import { useI18n } from 'vue-i18n'
import {
AImageMetadataValidationScopeSymbol,
useImageValidation
useImageValidation,
} from '@/components/damImage/uploadQueue/composables/uploadValidations'
const props = withDefaults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import { useUploadQueueDialog } from '@/components/damImage/uploadQueue/composab
import { type UploadQueueItem, UploadQueueItemStatus } from '@/types/coreDam/UploadQueue'
import { dateTimeNow } from '@/utils/datetime'
import AssetFileFailReasonChip from '@/components/damImage/uploadQueue/components/AssetFileFailReasonChip.vue'
import AssetLinkExternal from '@/components/damImage/uploadQueue/components/AssetLinkExternal.vue'
import { useAlerts } from '@/composables/system/alerts'
import { bulkUpdateAssetsMetadata, fetchAsset } from '@/components/damImage/uploadQueue/api/damAssetApi'
import { useCommonAdminCoreDamOptions } from '@/components/dam/assetSelect/composables/commonAdminCoreDamOptions'
import UploadQueueDialogSingleSidebar from '@/components/damImage/uploadQueue/components/UploadQueueDialogSingleSidebar.vue'
import UploadQueueButtonStop from '@/components/damImage/uploadQueue/components/UploadQueueButtonStop.vue'
import { isString } from '@/utils/common'
import { isNull, isString } from '@/utils/common'
import { fetchAuthorListByIds } from '@/components/damImage/uploadQueue/api/authorApi'
import type { IntegerId } from '@/types/common'
Expand Down Expand Up @@ -171,22 +170,24 @@ const assetMainFile = computed(() => {
})
const processing = computed(() => {
return item.value && [UploadQueueItemStatus.Processing, UploadQueueItemStatus.Loading].includes(item.value.status)
return (
!isNull(item.value) && [UploadQueueItemStatus.Processing, UploadQueueItemStatus.Loading].includes(item.value.status)
)
})
const waiting = computed(() => {
return item.value && item.value.status === UploadQueueItemStatus.Waiting
return !isNull(item.value) && item.value.status === UploadQueueItemStatus.Waiting
})
const isDone = computed(() => {
return item.value && item.value.status === UploadQueueItemStatus.Uploaded
return !isNull(item.value) && item.value.status === UploadQueueItemStatus.Uploaded
})
const showDone = computed(() => {
return !props.disableDoneAnimation && isDone.value
})
const uploading = computed(() => {
return item.value && item.value.status === UploadQueueItemStatus.Uploading
return !isNull(item.value) && item.value.status === UploadQueueItemStatus.Uploading
})
const uploadProgress = computed(() => {
return item.value && item.value.progress.progressPercent
return item.value?.progress.progressPercent
})
const { damClient } = useCommonAdminCoreDamOptions()
Expand Down Expand Up @@ -250,9 +251,7 @@ const onSaveAndApply = async () => {
}
if (assetsMetadataRes[0].authors.length > 0) {
const authorsRes = await fetchAuthorListByIds(damClient, props.extSystem, assetsMetadataRes[0].authors)
source = authorsRes.map((author) =>
author.name
).join(', ')
source = authorsRes.map((author) => author.name).join(', ')
}
emit(
'onApply',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@/components/damImage/uploadQueue/composables/assetDetailStore'
import { storeToRefs } from 'pinia'
import type { DocId } from '@/types/common'
import { type DamAssetStatus, DamAssetType } from '@/types/coreDam/Asset'
import type { DamAssetStatus, DamAssetType } from '@/types/coreDam/Asset'
import type { AssetFileFailReason, AssetFileProcessStatus } from '@/types/coreDam/AssetFile'
import { useI18n } from 'vue-i18n'
import AssetDetailSidebarROI from '@/components/damImage/uploadQueue/components/AssetDetailSidebarROI.vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import AssetDetailSidebarActionsWrapper from '@/components/damImage/uploadQueue/components/AssetDetailSidebarActionsWrapper.vue'
import { useI18n } from 'vue-i18n'
import useVuelidate from '@vuelidate/core'
import type { DocId } from '@/types/common'
import type { DamAssetType } from '@/types/coreDam/Asset'
import UploadQueueDialogSingleSidebarMetadataContent from '@/components/damImage/uploadQueue/components/UploadQueueDialogSingleSidebarMetadataContent.vue'
import { ADamAssetMetadataValidationScopeSymbol } from '@/components/damImage/uploadQueue/composables/uploadValidations'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import { useUploadQueuesStore } from '@/components/damImage/uploadQueue/composables/uploadQueuesStore'
import type { UploadQueueItem } from '@/types/coreDam/UploadQueue'
import type { UploadQueueItem, UploadQueueKey } from '@/types/coreDam/UploadQueue'
import UploadQueueItemEditable from '@/components/damImage/uploadQueue/components/UploadQueueItemEditable.vue'
import AssetQueueSelectedSidebar from '@/components/damImage/uploadQueue/components/AssetQueueSelectedSidebar.vue'
import { useDamCachedKeywords } from '@/components/damImage/uploadQueue/keyword/cachedKeywords'
Expand Down Expand Up @@ -29,8 +29,8 @@ const list = computed(() => {
return uploadQueuesStore.getQueueItems(props.queueKey)
})
const cancelItem = (data: { index: number; item: UploadQueueItem; queueId: string }) => {
uploadQueuesStore.stopItemUpload(data.queueId, data.item, data.index)
const cancelItem = (data: { index: number; item: UploadQueueItem; queueKey: UploadQueueKey }) => {
uploadQueuesStore.stopItemUpload(data.queueKey, data.item, data.index)
}
const removeItem = (index: number) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { type AssetCustomData, DamAssetStatus } from '@/types/coreDam/Asset'
import type { DocId } from '@/types/common'
import { type UploadQueueItem, UploadQueueItemStatus } from '@/types/coreDam/UploadQueue'
import { type UploadQueueItem, UploadQueueItemStatus, type UploadQueueKey } from '@/types/coreDam/UploadQueue'
import { useAlerts } from '@/composables/system/alerts'
import { AssetFileFailReason } from '@/types/coreDam/AssetFile'
import ATableCopyIdButton from '@/components/buttons/table/ATableCopyIdButton.vue'
import AActionDeleteButton from '@/components/buttons/action/AActionDeleteButton.vue'
import { prettyBytes } from '@/utils/file'
import ASystemEntityScope from '@/components/form/ASystemEntityScope.vue'
import { useDamConfigState } from '@/components/damImage/uploadQueue/composables/damConfigState'
Expand Down Expand Up @@ -38,7 +37,7 @@ const emit = defineEmits<{
(e: 'update:customData', data: AssetCustomData): void
(e: 'update:keywords', data: DocId[]): void
(e: 'update:authors', data: DocId[]): void
(e: 'cancelItem', data: { index: number; item: UploadQueueItem; queueKey: string }): void
(e: 'cancelItem', data: { index: number; item: UploadQueueItem; queueKey: UploadQueueKey }): void
(e: 'removeItem', index: number): void
(e: 'showDetail', data: DocId): void
}>()
Expand Down
Loading

0 comments on commit 2c486a3

Please sign in to comment.