Skip to content

Commit

Permalink
cached users moved to common admin
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Dec 4, 2024
1 parent b58e03a commit 5367ac4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 51 deletions.
12 changes: 9 additions & 3 deletions src/components/CachedDamUserChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
import { computed, shallowRef, watch } from 'vue'
import { ROUTE } from '@/router/routes'
import { useRouter } from 'vue-router'
import { COMMON_CONFIG, type IntegerId, isNull, isUndefined, AAnzuUserAvatar } from '@anzusystems/common-admin'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
import {
AAnzuUserAvatar,
COMMON_CONFIG,
type IntegerId,
isNull,
isUndefined,
useDamCachedUsers,
} from '@anzusystems/common-admin'
import type { UserMinimal } from '@/types/coreDam/User'
const props = withDefaults(
Expand All @@ -17,7 +23,7 @@ const router = useRouter()
const cached = shallowRef<undefined | UserMinimal>(undefined)
const loaded = shallowRef<boolean>(false)
const { getCachedUser } = useCachedUsers()
const { getCachedUser } = useDamCachedUsers()
const item = computed(() => {
return getCachedUser(props.id)
Expand Down
6 changes: 3 additions & 3 deletions src/views/coreDam/asset/components/AssetCreateButton.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script lang="ts" setup>
import { ref } from 'vue'
import type { AssetDetailItemDto } from '@anzusystems/common-admin'
import {
ADialogToolbar,
AFormValueObjectOptionsSelect,
ARow,
type AssetDetailItemDto,
ASystemEntityScope,
useAlerts,
useDamCachedUsers,
} from '@anzusystems/common-admin'
import { SYSTEM_CORE_DAM } from '@/model/systems'
import { ENTITY } from '@/services/api/coreDam/authorApi'
Expand All @@ -16,7 +17,6 @@ import { useI18n } from 'vue-i18n'
import { createAsset } from '@/services/api/coreDam/assetApi'
import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore'
import { useCurrentAssetLicence } from '@/composables/system/currentExtSystem'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
import type { AssetCreateDto } from '@/types/coreDam/Asset'
const emit = defineEmits<{
Expand All @@ -26,7 +26,7 @@ const emit = defineEmits<{
const { t } = useI18n()
const { currentAssetLicenceId } = useCurrentAssetLicence()
const assetDetailStore = useAssetDetailStore()
const { addToCachedUsers, fetchCachedUsers } = useCachedUsers()
const { addToCachedUsers, fetchCachedUsers } = useDamCachedUsers()
const { createCreateDto } = useAssetFactory()
const asset = ref<AssetCreateDto>(createCreateDto())
Expand Down
5 changes: 2 additions & 3 deletions src/views/coreDam/asset/detail/AssetDetailView.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { useRoute, useRouter } from 'vue-router'
import { nextTick, onMounted, ref } from 'vue'
import { type DocId, isDocId, isString, useAlerts, useTheme } from '@anzusystems/common-admin'
import { type DocId, isDocId, isString, useAlerts, useDamCachedUsers, useTheme } from '@anzusystems/common-admin'
import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore'
import { storeToRefs } from 'pinia'
import AssetImageRoiSelect from '@/views/coreDam/asset/detail/components/AssetImageRoiSelect.vue'
Expand All @@ -13,7 +13,6 @@ import { useI18n } from 'vue-i18n'
import { useAssetListStore } from '@/stores/coreDam/assetListStore'
import { ROUTE } from '@/router/routes'
import { useAssetDetailActions } from '@/views/coreDam/asset/detail/composables/assetDetailActions'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
defineEmits<{
(e: 'mainRouteChanged'): void
Expand All @@ -28,7 +27,7 @@ const assetListStore = useAssetListStore()
const { asset } = storeToRefs(assetDetailStore)
const { toolbarColor } = useTheme()
const { activeTab } = useAssetDetailTab()
const { fetchCachedUsers, addToCachedUsers } = useCachedUsers()
const { fetchCachedUsers, addToCachedUsers } = useDamCachedUsers()
const {
toggleSidebar,
sidebar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
import { computed, ref, watch } from 'vue'
import { useAssetDetailActions } from '@/views/coreDam/asset/detail/composables/assetDetailActions'
import { updateAssetMetadata } from '@/services/api/coreDam/assetApi'
import { browserHistoryReplaceUrlByRouter, DamAssetStatus, isNull, useAlerts } from '@anzusystems/common-admin'
import {
browserHistoryReplaceUrlByRouter,
DamAssetStatus,
isNull,
useAlerts,
useDamCachedUsers,
} from '@anzusystems/common-admin'
import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore'
import { useI18n } from 'vue-i18n'
import AssetMetadata from '@/views/coreDam/asset/components/AssetMetadata.vue'
Expand All @@ -12,7 +18,6 @@ import { AssetMetadataValidationScopeSymbol } from '@/components/validationScope
import { useMainWrapper } from '@/composables/wrappers/useMainWrapper'
import { ROUTE } from '@/router/routes'
import { useRouter } from 'vue-router'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
import { ACL } from '@/composables/auth/auth'
const emit = defineEmits<{
Expand All @@ -28,7 +33,7 @@ const { t } = useI18n()
const { asset, loader, metadataUnTouch, metadataAreTouched, mainFileSingleUse } = useAssetDetailActions()
const { fetchCachedUsers, addToCachedUsers } = useCachedUsers()
const { fetchCachedUsers, addToCachedUsers } = useDamCachedUsers()
const assetDetailStore = useAssetDetailStore()
Expand Down
14 changes: 10 additions & 4 deletions src/views/coreDam/asset/list/components/AssetTableRowItem.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<script lang="ts" setup>
import type { AssetListItem } from '@/stores/coreDam/assetListStore'
import AssetImage from '@/views/coreDam/asset/components/AssetImage.vue'
import type { DocId } from '@anzusystems/common-admin'
import { AChipNoLink, ADatetime, ATableCopyIdButton, ATableEditButton, prettyBytes } from '@anzusystems/common-admin'
import {
AChipNoLink,
ADatetime,
ATableCopyIdButton,
ATableEditButton,
type DocId,
prettyBytes,
useDamCachedUsers,
} from '@anzusystems/common-admin'
import { useI18n } from 'vue-i18n'
import CachedDamUserChip from '@/components/CachedDamUserChip.vue'
import { useAssetItemActions } from '@/views/coreDam/asset/list/composables/assetItemActions'
import AssetImageMetaIcons from '@/views/coreDam/asset/components/AssetImageMetaIcons.vue'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
import { onMounted } from 'vue'
import CachedPodcastChip from '@/views/coreDam/podcast/components/CachedPodcastChip.vue'
import { useCachedPodcasts } from '@/views/coreDam/podcast/composables/cachedPodcasts'
Expand Down Expand Up @@ -36,7 +42,7 @@ const { t } = useI18n()
const IMAGE_HEIGHT = 72
const IMAGE_WIDTH = 128
const { fetchCachedUsers, addToCachedUsers } = useCachedUsers()
const { fetchCachedUsers, addToCachedUsers } = useDamCachedUsers()
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
const { asset, assetType, assetStatus, tableImageProperties } = useAssetItemActions(props.item)
Expand Down
4 changes: 2 additions & 2 deletions src/views/coreDam/asset/list/composables/assetListActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore'
import { useAssetListStore } from '@/stores/coreDam/assetListStore'
import { useUploadQueuesStore } from '@/stores/coreDam/uploadQueuesStore'
import { keyboardEventTargetIsAnyFormElement } from '@/utils/event'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
import type { AssetSearchListItemDto, DamAssetTypeType, DocId } from '@anzusystems/common-admin'
import {
arrayItemToggle,
browserHistoryReplaceUrlByRouter,
DamAssetType,
isNull,
useAlerts,
useDamCachedUsers,
useFilterHelpers,
usePagination,
} from '@anzusystems/common-admin'
Expand Down Expand Up @@ -43,7 +43,7 @@ export function useAssetListActions(sidebarRight: Ref<boolean> | null = null) {
const { list, loader, activeItemIndex } = storeToRefs(assetListStore)
const { resetFilter } = useFilterHelpers()
const { currentAssetLicenceId } = useCurrentAssetLicence()
const { fetchCachedUsers, addToCachedUsers } = useCachedUsers()
const { fetchCachedUsers, addToCachedUsers } = useDamCachedUsers()
const { maxSelectedItems } = useBetaTestFeatures()
const showMetaIcons = ref(true)

Expand Down
5 changes: 2 additions & 3 deletions src/views/coreDam/extSystem/composables/extSystemActions.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { ref } from 'vue'
import type { DamExtSystem, FilterBag, Pagination } from '@anzusystems/common-admin'
import { fetchDamExtSystemList, useAlerts } from '@anzusystems/common-admin'
import { fetchDamExtSystemList, useAlerts, useDamCachedUsers } from '@anzusystems/common-admin'
import { fetchExtSystem, updateExtSystem } from '@/services/api/coreDam/extSystemApi'
import { storeToRefs } from 'pinia'
import { useExtSystemOneStore } from '@/stores/coreDam/extSystemStore'
import useVuelidate from '@vuelidate/core'
import { useRouter } from 'vue-router'
import { ROUTE } from '@/router/routes'
import { useCachedUsers } from '@/views/coreDam/user/composables/cachedUsers'
import { damClient } from '@/services/api/clients/damClient'

const { showValidationError, showRecordWas, showErrorsDefault } = useAlerts()

const { fetchCachedUsers, addToCachedUsers } = useCachedUsers()
const { fetchCachedUsers, addToCachedUsers } = useDamCachedUsers()

const datatableHiddenColumns = ref<Array<string>>(['id'])
const listLoading = ref(false)
Expand Down
30 changes: 0 additions & 30 deletions src/views/coreDam/user/composables/cachedUsers.ts

This file was deleted.

0 comments on commit 5367ac4

Please sign in to comment.