Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Dec 4, 2024
1 parent 712f610 commit 34634e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/components/ACachedUserChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import { isNull, isUndefined } from '@/utils/common'
import { COMMON_CONFIG } from '@/model/commonConfig'
import AAnzuUserAvatar from '@/components/AAnzuUserAvatar.vue'
import { useRouter } from 'vue-router'
import { replaceUrlParameters } from '@/services/api/apiHelper'
const props = withDefaults(
defineProps<{
id: null | undefined | IntegerId
routeName?: string | undefined
externalUrl?: string | undefined
externalUrlTemplate?: string | undefined
cachedUsers?: CollabCachedUsersMap | undefined
}>(),
{
routeName: undefined,
externalUrl: undefined,
externalUrlTemplate: undefined,
cachedUsers: undefined,
}
)
Expand All @@ -41,7 +42,7 @@ const text = computed(() => {
})
const appendIcon = computed(() => {
if (props.externalUrl) {
if (props.externalUrlTemplate) {
return COMMON_CONFIG.CHIP.ICON.LINK
}
if (props.routeName) {
Expand All @@ -51,8 +52,9 @@ const appendIcon = computed(() => {
})
const onClick = () => {
if (props.externalUrl) {
window.open(props.externalUrl, '_blank')
if (props.externalUrlTemplate && props.id) {
const url = replaceUrlParameters(props.externalUrlTemplate, { id: props.id })
window.open(url, '_blank')
return
}
if (!props.routeName) return
Expand Down Expand Up @@ -84,6 +86,7 @@ watch(
<VChip
v-else
class="pl-1"
:class="appendIcon ? '' : 'non-clickable'"
size="small"
:append-icon="appendIcon"
@click.stop="onClick"
Expand All @@ -105,3 +108,9 @@ watch(
</VChip>
</div>
</template>

<style lang="scss" scoped>
.non-clickable {
cursor: default;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useDamCachedAuthors } from '@/components/damImage/uploadQueue/author/ca
import { useDamCachedKeywords } from '@/components/damImage/uploadQueue/keyword/cachedKeywords'
import { useExtSystemIdForCached } from '@/components/damImage/uploadQueue/composables/extSystemIdForCached'
import { isUndefined } from '@/utils/common'
import { useDamCachedUsers } from '@/components/damImage/uploadQueue/author/cachedUsers'

const filter = useAssetListFilter()
const pagination = usePagination()
Expand All @@ -24,7 +25,7 @@ const detailLoading = ref(false)

export function useAssetSelectActions(
configName = 'default',
onDetailLoadedCallback?: ((asset: AssetDetailItemDto) => void)
onDetailLoadedCallback?: (asset: AssetDetailItemDto) => void
) {
const { damClient } = useCommonAdminCoreDamOptions(configName)

Expand Down Expand Up @@ -64,6 +65,7 @@ export function useAssetSelectActions(

const { addToCachedAuthors, fetchCachedAuthors } = useDamCachedAuthors()
const { addToCachedKeywords, fetchCachedKeywords } = useDamCachedKeywords()
const { addToCachedUsers, fetchCachedUsers } = useDamCachedUsers()

const onItemClick = async (data: { assetId: DocId; index: number }, extSystem: IntegerId) => {
const { cachedExtSystemId } = useExtSystemIdForCached()
Expand All @@ -75,8 +77,10 @@ export function useAssetSelectActions(
cachedExtSystemId.value = extSystem
addToCachedAuthors(asset.authors)
addToCachedKeywords(asset.keywords)
addToCachedUsers(asset.modifiedBy, asset.createdBy)
fetchCachedAuthors()
fetchCachedKeywords()
fetchCachedUsers()
if (!isUndefined(onDetailLoadedCallback)) onDetailLoadedCallback(asset)
assetDetailStore.setAsset(asset)
} catch (e) {
Expand Down

0 comments on commit 34634e1

Please sign in to comment.