Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Dec 14, 2023
1 parent f929fa2 commit b7e0cb3
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 41 deletions.
20 changes: 15 additions & 5 deletions src/components/coreDam/customMetadata/AssetCustomMetadataForm.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts" setup>
import type { DamAssetType } from '@anzusystems/common-admin'
import { type DamAssetType, isUndefined } from '@anzusystems/common-admin'
import { computed } from 'vue'
import { ACustomDataForm, useDamConfigState } from '@anzusystems/common-admin'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand All @@ -18,16 +19,25 @@ const emit = defineEmits<{
(e: 'anyChange'): void
}>()
const { damConfigAssetCustomFormElements } = useDamConfigState()
const { getDamConfigAssetCustomFormElements, getDamConfigExtSystem } = useDamConfigState()

Check failure on line 22 in src/components/coreDam/customMetadata/AssetCustomMetadataForm.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigAssetCustomFormElements' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.

Check failure on line 22 in src/components/coreDam/customMetadata/AssetCustomMetadataForm.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configAssetCustomFormElements = getDamConfigAssetCustomFormElements(currentExtSystemId.value)
if (isUndefined(configAssetCustomFormElements)) {
throw new Error('Custom form elements must be initialised.')
}
const elements = computed(() => {
return damConfigAssetCustomFormElements.value[props.assetType]
return configAssetCustomFormElements[props.assetType]
})
const { damConfigExtSystem } = useDamConfigState()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const pinnedCount = computed(() => {
return damConfigExtSystem.value[props.assetType].customMetadataPinnedAmount
return configExtSystem[props.assetType].customMetadataPinnedAmount
})
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import AssetDetailSidebarMetadata from '@/views/coreDam/asset/detail/components/AssetDetailSidebarMetadata.vue'
import AssetDetailSidebarROI from '@/views/coreDam/asset/detail/components/AssetDetailSidebarROI.vue'
import { AssetDetailTab, useAssetDetailTab } from '@/composables/system/assetDetailTab'
import type { DamAssetStatus, DamAssetType } from '@anzusystems/common-admin'
import { type DamAssetStatus, type DamAssetType, isUndefined } from '@anzusystems/common-admin'
import {
type AssetFileFailReason,
type AssetFileProcessStatus,
Expand All @@ -20,6 +20,7 @@ import DistributionCategoryWidget from '@/views/coreDam/distributionCategory/com
import AssetDetailSidebarImagePreview from '@/views/coreDam/asset/detail/components/AssetDetailSidebarImagePreview.vue'
import AssetDetailSidebarVideoShow from '@/views/coreDam/asset/detail/components/videoShow/AssetDetailSidebarVideoShow.vue'
import { ACL } from '@/types/Permission'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -52,10 +53,15 @@ const { t } = useI18n()
const { activeTab } = useAssetDetailTab()
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 56 in src/views/coreDam/asset/detail/components/AssetDetailDialogSidebar.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const typeHasDistributions = computed(() => {
return damConfigExtSystem.value[props.assetType].distribution.distributionServices.length > 0
return configExtSystem[props.assetType].distribution.distributionServices.length > 0
})
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { DamAssetType, DamDistributionRequirementsConfig } from '@anzusystems/common-admin'
import { type DamAssetType, type DamDistributionRequirementsConfig, isUndefined } from '@anzusystems/common-admin'
import {
cloneDeep,
DamDistributionRequirementStrategy,
Expand All @@ -16,6 +16,7 @@ import { useDistributionFilter } from '@/model/coreDam/filter/DistributionFilter
import { useDistributionStatus } from '@/model/coreDam/valueObject/DamDistributionStatus'
import useVuelidate, { type ErrorObject } from '@vuelidate/core'
import { useI18n } from 'vue-i18n'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
// now only supports strategy AtLeastOne, as BE too
Expand Down Expand Up @@ -60,13 +61,18 @@ const assetFileIdComputed = computed(() => {
return props.assetFileId
})
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 64 in src/views/coreDam/asset/detail/components/distribution/DistributionBlockedBy.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const itemsComputed = computed(() => {
return distributions.value.map((item) => {
return {
title:
(damConfigExtSystem.value[props.assetType]?.distribution.distributionRequirements[item.distributionService]
(configExtSystem[props.assetType]?.distribution.distributionRequirements[item.distributionService]
?.title || item.distributionService) + ` (${getDistributionStatusOption(item.status)?.title})`,
value: item.id,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { DamDistributionServiceType } from '@anzusystems/common-admin'
import { type DamDistributionServiceType, isUndefined } from '@anzusystems/common-admin'
import { ACopyText, type DamAssetType, DamDistributionStatus, useDamConfigState } from '@anzusystems/common-admin'
import DistributionStatusChip from '@/views/coreDam/asset/detail/components/distribution/DistributionStatusChip.vue'
import type { DistributionCustomItem, DistributionJwItem, DistributionYoutubeItem } from '@/types/coreDam/Distribution'
import { isDistributionCustomItem } from '@/types/coreDam/Distribution'
import { useI18n } from 'vue-i18n'
import DistributionFailReasonChip from '@/views/coreDam/asset/detail/components/distribution/DistributionFailReasonChip.vue'
import DistributionListItemCustomDistributionDataItem from '@/views/coreDam/asset/detail/components/distribution/DistributionListItemCustomDistributionDataItem.vue'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand All @@ -25,10 +26,15 @@ const emit = defineEmits<{
const { t } = useI18n()
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 29 in src/views/coreDam/asset/detail/components/distribution/DistributionListItemCustom.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const serviceRequirements = computed(() => {
return damConfigExtSystem.value[props.assetType].distribution.distributionRequirements[props.item.distributionService]
return configExtSystem[props.assetType].distribution.distributionRequirements[props.item.distributionService]
})
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { DamDistributionServiceType } from '@anzusystems/common-admin'
import { type DamDistributionServiceType, isUndefined } from '@anzusystems/common-admin'
import { type DamAssetType, DamDistributionStatus, useDamConfigState } from '@anzusystems/common-admin'
import DistributionStatusChip from '@/views/coreDam/asset/detail/components/distribution/DistributionStatusChip.vue'
import type { DistributionCustomItem, DistributionJwItem, DistributionYoutubeItem } from '@/types/coreDam/Distribution'
import { useI18n } from 'vue-i18n'
import DistributionFailReasonChip from '@/views/coreDam/asset/detail/components/distribution/DistributionFailReasonChip.vue'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand All @@ -22,10 +23,15 @@ const emit = defineEmits<{
const { t } = useI18n()
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 26 in src/views/coreDam/asset/detail/components/distribution/DistributionListItemJw.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const serviceRequirements = computed(() => {
return damConfigExtSystem.value[props.assetType].distribution.distributionRequirements[props.item.distributionService]
return configExtSystem[props.assetType].distribution.distributionRequirements[props.item.distributionService]
})
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { DamDistributionServiceType } from '@anzusystems/common-admin'
import { type DamDistributionServiceType, isUndefined } from '@anzusystems/common-admin'
import { type DamAssetType, DamDistributionStatus, useDamConfigState } from '@anzusystems/common-admin'
import DistributionStatusChip from '@/views/coreDam/asset/detail/components/distribution/DistributionStatusChip.vue'
import type { DistributionCustomItem, DistributionJwItem, DistributionYoutubeItem } from '@/types/coreDam/Distribution'
import { useI18n } from 'vue-i18n'
import DistributionFailReasonChip from '@/views/coreDam/asset/detail/components/distribution/DistributionFailReasonChip.vue'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand All @@ -22,10 +23,15 @@ const emit = defineEmits<{
const { t } = useI18n()
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 26 in src/views/coreDam/asset/detail/components/distribution/DistributionListItemYoutube.vue

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const serviceRequirements = computed(() => {
return damConfigExtSystem.value[props.assetType].distribution.distributionRequirements[props.item.distributionService]
return configExtSystem[props.assetType].distribution.distributionRequirements[props.item.distributionService]
})
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed } from 'vue'
import type { DamAssetType } from '@anzusystems/common-admin'
import { type DamAssetType, isUndefined } from '@anzusystems/common-admin'
import {
ADialogToolbar,
DamDistributionServiceType,
Expand All @@ -14,6 +14,7 @@ import DistributionNewDialogCustom from '@/views/coreDam/asset/detail/components
import DistributionNewDialogEmpty from '@/views/coreDam/asset/detail/components/distribution/DistributionNewDialogEmpty.vue'
import { useI18n } from 'vue-i18n'
import { useAssetDetailDistributionDialog } from '@/views/coreDam/asset/detail/composables/assetDetailDistributionDialog'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -45,10 +46,15 @@ const closeDialog = () => {
emit('reloadList')
}
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const serviceRequirements = computed(() => {
return damConfigExtSystem.value[props.assetType].distribution.distributionRequirements
return configExtSystem[props.assetType].distribution.distributionRequirements
})
const activeConfig = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import type { DamAssetType, DamDistributionRequirementsConfig } from '@anzusystems/common-admin'
import { type DamAssetType, type DamDistributionRequirementsConfig, isUndefined } from '@anzusystems/common-admin'
import {
AFormDatetimePicker,
AssetFileProcessStatus,
Expand Down Expand Up @@ -64,7 +64,10 @@ const { loadDamConfigDistributionCustomFormElements, damConfigDistributionCustom
const loadFormData = async () => {
canDisplayForm.value = false
await loadDamConfigDistributionCustomFormElements(props.distributionServiceName)
if (!damConfigDistributionCustomFormElements.value[props.distributionServiceName]) return
const configDistributionCustomFormElements = damConfigDistributionCustomFormElements.value.get(
props.distributionServiceName
)
if (isUndefined(configDistributionCustomFormElements)) return
if (!assetFileId.value || assetFileStatus.value !== AssetFileProcessStatus.Processed) return
filter.distributionService.model = props.distributionServiceName
filter.id.model = redistributeId.value
Expand Down
15 changes: 11 additions & 4 deletions src/views/coreDam/author/composables/authorConfig.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import type { DamAssetType } from '@anzusystems/common-admin'
import { type DamAssetType, isUndefined } from '@anzusystems/common-admin'
import { useDamConfigState } from '@anzusystems/common-admin'
import { computed } from 'vue'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'

export const useAuthorAssetTypeConfig = (assetType: DamAssetType) => {
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 7 in src/views/coreDam/author/composables/authorConfig.ts

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()

const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}

const authorEnabled = computed(() => {
return damConfigExtSystem.value[assetType].authors.enabled
return configExtSystem[assetType].authors.enabled
})

const authorRequired = computed(() => {
return damConfigExtSystem.value[assetType].authors.required
return configExtSystem[assetType].authors.required
})

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { DistributionCategoryOption } from '@/types/coreDam/DistributionCat
import { computed } from 'vue'
import type { ErrorObject } from '@vuelidate/core'
import { useVuelidate } from '@vuelidate/core'
import { cloneDeep, useDamConfigState, useValidate } from '@anzusystems/common-admin'
import { cloneDeep, isUndefined, useDamConfigState, useValidate } from '@anzusystems/common-admin'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'
const props = withDefaults(
defineProps<{
Expand All @@ -28,11 +29,16 @@ const modelValueComputed = computed({
},
})
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const isRequired = computed(() => {
return (
damConfigExtSystem.value[props.select.type].distribution.distributionRequirements[props.select.serviceSlug]
configExtSystem[props.select.type].distribution.distributionRequirements[props.select.serviceSlug]
?.categorySelect?.required ?? false
)
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
isNull,
isString,
isString, isUndefined,
useAlerts,
useDamConfigState,
useFilterHelpers,
Expand All @@ -23,6 +23,7 @@ import { useExternalProviderAssetDetailStore } from '@/stores/coreDam/externalPr
import { ROUTE } from '@/router/routes'
import { useRoute, useRouter } from 'vue-router'
import { keyboardEventTargetIsAnyFormElement } from '@/utils/event'
import { useCurrentExtSystem } from '@/composables/system/currentExtSystem'

const { showWarning, showErrorsDefault } = useAlerts()

Expand All @@ -33,7 +34,12 @@ const { activeExternalProvider } = useExternalProviders()
const filterIsTouched = ref(false)

export function useExternalProviderAssetListActions(sidebarRight: Ref<boolean> | null = null) {
const { damConfigExtSystem } = useDamConfigState()
const { getDamConfigExtSystem } = useDamConfigState()

Check failure on line 37 in src/views/coreDam/externalProviderAsset/composables/externalProviderAssetListActions.ts

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Property 'getDamConfigExtSystem' does not exist on type '{ initialized: { damPubConfig: boolean; damPrvConfig: boolean; damConfigExtSystem: number | null; damConfigAssetCustomFormElements: number | null; }; damPubConfig: Ref<DamPubConfig> | ShallowRef<...>; ... 8 more ...; loadDamConfigDistributionCustomFormElements: (distributionServiceName: string) => Promise<...>; }'.
const { currentExtSystemId } = useCurrentExtSystem()
const configExtSystem = getDamConfigExtSystem(currentExtSystemId.value)
if (isUndefined(configExtSystem)) {
throw new Error('Ext system must be initialised.')
}
const assetDetailStore = useExternalProviderAssetDetailStore()
const externalProviderAssetListStore = useExternalProviderAssetListStore()
const uploadQueuesStore = useUploadQueuesStore()
Expand All @@ -44,7 +50,7 @@ export function useExternalProviderAssetListActions(sidebarRight: Ref<boolean> |
const fetchAssetList = async () => {
if (!activeExternalProvider.value) return
pagination.page = 1
pagination.rowsPerPage = damConfigExtSystem.value.assetExternalProviders[activeExternalProvider.value].listingLimit
pagination.rowsPerPage = configExtSystem.assetExternalProviders[activeExternalProvider.value].listingLimit
try {
externalProviderAssetListStore.showLoader('hard')
externalProviderAssetListStore.setList(
Expand All @@ -71,7 +77,7 @@ export function useExternalProviderAssetListActions(sidebarRight: Ref<boolean> |
}
if (!activeExternalProvider.value) return
pagination.page = pagination.page + 1
pagination.rowsPerPage = damConfigExtSystem.value.assetExternalProviders[activeExternalProvider.value].listingLimit
pagination.rowsPerPage = configExtSystem.assetExternalProviders[activeExternalProvider.value].listingLimit
try {
externalProviderAssetListStore.showLoader('soft')
externalProviderAssetListStore.appendList(
Expand Down Expand Up @@ -202,7 +208,7 @@ export function useExternalProviderAssetListActions(sidebarRight: Ref<boolean> |
const route = useRoute()
const router = useRouter()
const validateRouteProvider = async () => {
if (!(isString(route.params.provider) && damConfigExtSystem.value.assetExternalProviders[route.params.provider])) {
if (!(isString(route.params.provider) && configExtSystem.assetExternalProviders[route.params.provider])) {
await router.push({ name: ROUTE.SYSTEM.NOT_FOUND })
return
}
Expand Down
Loading

0 comments on commit b7e0cb3

Please sign in to comment.