Skip to content

Commit

Permalink
MakeImagePublic action now does not need any payload (#171)
Browse files Browse the repository at this point in the history
* `MakeImagePublic` action now does not need any payload

* clickable assetId chip in `VideoShowEpisodeDetail`
  • Loading branch information
TomasHermanek authored Jan 19, 2024
1 parent b29a1a0 commit f30af7b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.3.1](https://github.com/anzusystems/admin-dam/compare/1.2.0...1.3.0) (2024-01-19)

### Features
* `MakeImagePublic` action now does not need any payload
* clickable assetId chip in `VideoShowEpisodeDetail`

## [1.3.0](https://github.com/anzusystems/admin-dam/compare/1.2.0...1.3.0) (2024-01-10)

### Features
Expand Down
2 changes: 1 addition & 1 deletion src/services/api/coreDam/fileApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ export const makePublicFile = (assetType: DamAssetType, assetFileId: DocId, slug
return new Promise<AssetFileRoute>((resolve, reject) => {
switch (assetType) {
case DamAssetType.Image:
imageMakePublic(assetFileId, slug)
imageMakePublic(assetFileId)
.then((res) => {
resolve(res)
})
Expand Down
9 changes: 2 additions & 7 deletions src/services/api/coreDam/imageApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,11 @@ export const rotateImage = (imageId: DocId, angle: 90 | 270) => {
})
}

export const makePublic = (imageId: DocId, slug: string) => {
export const makePublic = (imageId: DocId) => {
return new Promise<AssetFileRoute>((resolve, reject) => {
const url = END_POINT + '/' + imageId + '/make-public'
damClient()
.patch(
url,
JSON.stringify({
slug,
})
)
.patch(url)
.then((res) => {
if (res.status === HTTP_STATUS_OK) {
resolve(res.data)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import type { DamAssetType, DocId } from '@anzusystems/common-admin'
import { ADialogToolbar, AFormTextField, stringToSlug, useAlerts, useValidate } from '@anzusystems/common-admin'
import {
ADialogToolbar,
AFormTextField,
type DamAssetType,
DamAssetType as DamAssetTypeValue,
type DocId,
stringToSlug,
useAlerts,
useValidate
} from '@anzusystems/common-admin'
import { makePublicFile } from '@/services/api/coreDam/fileApi'
import useVuelidate from '@vuelidate/core'
Expand Down Expand Up @@ -92,6 +100,7 @@ const onConfirm = async () => {
</ADialogToolbar>
<VCardText>
<AFormTextField
v-if="assetType !== DamAssetTypeValue.Image"
v-model="slug"
:label="t('coreDam.asset.assetFilePublicLink.model.slug')"
:v="v$"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<script lang="ts" setup>
import { ACopyText, ARow, AUserAndTimeTrackingFields } from '@anzusystems/common-admin'
import { ACopyText, ARow, AUserAndTimeTrackingFields, COMMON_CONFIG } from '@anzusystems/common-admin'
import { useI18n } from 'vue-i18n'
import { storeToRefs } from 'pinia'
import { useVideoShowEpisodeOneStore } from '@/stores/coreDam/videoShowEpisodeStore'
import { ROUTE } from '@/router/routes'
import { useRouter } from 'vue-router'
const { videoShowEpisode } = storeToRefs(useVideoShowEpisodeOneStore())
const { t } = useI18n()
const router = useRouter()
// const imageSrc = computed(() => {
// return videoShowEpisode.value.links ? videoShowEpisode.value.links.image_list.url : undefined
// })
const onAssetChipClick = () => {
router.push({ name: ROUTE.DAM.ASSET.DETAIL, params: { id: videoShowEpisode.value.asset } })
}
</script>

<template>
Expand All @@ -33,7 +40,14 @@ const { t } = useI18n()
<!-- <AssetImage :src="imageSrc" use-component />-->
<!-- </ARow>-->
<ARow :title="t('coreDam.videoShowEpisode.model.asset')">
{{ videoShowEpisode.asset }}
<VChip
size="small"
:append-icon="COMMON_CONFIG.CHIP.ICON.LINK"
label
@click.stop="onAssetChipClick"
>
{{ videoShowEpisode.asset }}
</VChip>
</ARow>
<AUserAndTimeTrackingFields :data="videoShowEpisode" />
</VCol>
Expand Down

0 comments on commit f30af7b

Please sign in to comment.