Skip to content

Commit

Permalink
update licence picker for admin (#200)
Browse files Browse the repository at this point in the history
* asset filters from common

* translations

* update deps

* update authors and keywords dropdown

* update authors add reviewed flag

* update deps

* update grid item width

* add refresh button to upload queue item

* author and keyword dropdown update

* fix

* main file single use

* author and keyword validations

* update deps

* fix

* fix

* update deps

* update deps

* update deps

* fix dialog for licence switch

* fix dialog for licence switch

* fix dialog for licence switch

* increase selected icon

* update deps

* cached users moved to common admin

* licence switcher updated

---------

Co-authored-by: volar <[email protected]>
  • Loading branch information
volarname and volar authored Dec 17, 2024
1 parent 2ab0f8f commit 824981d
Show file tree
Hide file tree
Showing 17 changed files with 221 additions and 213 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"cy:open": "CYPRESS_CACHE_FOLDER='node_modules/.cache/Cypress' yarn cypress open -C cypress/config/cypress.config.ts"
},
"dependencies": {
"@anzusystems/common-admin": "1.47.0-beta.103",
"@anzusystems/common-admin": "1.47.0-beta.107",
"@mdi/font": "7.4.47",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "12.0.0",
"@vueuse/integrations": "12.0.0",
"axios": "^1.7.8",
"axios": "^1.7.9",
"cropperjs": "^1.6.2",
"jwt-decode": "^4.0.0",
"pinia": "^2.2.8",
"pinia": "^2.3.0",
"rusha": "^0.8.14",
"socket.io-client": "^4.8.1",
"sortablejs": "^1.15.6",
Expand All @@ -39,7 +39,7 @@
"vue": "3.5.13",
"vue-i18n": "^10.0.5",
"vue-router": "^4.5.0",
"vuetify": "^3.7.4"
"vuetify": "^3.7.5"
},
"devDependencies": {
"@cypress/grep": "^4.1.0",
Expand All @@ -55,22 +55,22 @@
"@vue/eslint-config-typescript": "^14.1.4",
"@vue/language-server": "2.1.10",
"@vue/tsconfig": "^0.5.1",
"cypress": "^13.16.0",
"cypress": "^13.16.1",
"cypress-downloadfile": "1.2.4",
"cypress-mochawesome-reporter": "^3.8.2",
"eslint": "9.15.0",
"eslint-plugin-vue": "^9.31.0",
"eslint": "9.16.0",
"eslint-plugin-vue": "^9.32.0",
"npm-run-all2": "^7.0.1",
"postcss": "^8.4.49",
"postcss-html": "^1.7.0",
"prettier": "^3.4.1",
"sass": "^1.81.0",
"prettier": "^3.4.2",
"sass": "^1.82.0",
"stylelint": "^16.11.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-config-standard-scss": "^14.0.0",
"typescript": "5.5.4",
"unplugin": "^1.16.0",
"vite": "^6.0.1",
"vite": "^6.0.2",
"vite-plugin-vuetify": "^2.0.4",
"vue-tsc": "2.1.10"
}
Expand Down
21 changes: 21 additions & 0 deletions src/components/ABtnAdvanced.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const modelValue = defineModel<boolean>({ required: true })
const { t } = useI18n()
</script>

<template>
<div
class="cursor-pointer"
@click.stop="modelValue = !modelValue"
>
<VIcon
class="mr-2"
size="small"
:icon="modelValue ? 'mdi-chevron-double-up' : 'mdi-chevron-double-down'"
/>
{{ t('common.button.advanced') }}
</div>
</template>
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
1 change: 0 additions & 1 deletion src/locales/en/system.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"podcasts": "Podcasts",
"videoShows": "Video shows",
"extSystemLicenceSwitch": {
"filters": "Filters",
"filter": {
"extSystemName": "External system name",
"extSystemId": "External system ID",
Expand Down
1 change: 0 additions & 1 deletion src/locales/sk/system.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"podcasts": "Podcasty",
"videoShows": "Video relácie",
"extSystemLicenceSwitch": {
"filters": "Filtre",
"filter": {
"extSystemName": "Meno externého systému",
"extSystemId": "ID externého systému",
Expand Down
2 changes: 1 addition & 1 deletion src/services/api/coreDam/userApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { DamCurrentUserDto } from '@anzusystems/common-admin'
import { apiAnyRequest } from '@anzusystems/common-admin'
import type { UpdateCurrentUserDto } from '@/types/coreDam/CurrentUser'

const END_POINT = '/adm/v1/user'
const END_POINT = '/adm/users'
export const CURRENT_USER_END_POINT = END_POINT + '/current'
export const ENTITY = 'user'

Expand Down
6 changes: 3 additions & 3 deletions src/styles/components/dam-image-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ $bg-color-actions-dark: #1a1a1a;

.selected-triangle {
position: absolute;
top: 11px;
right: 11px;
top: 10px;
right: 10px;
z-index: 1;

&__bg {
content: '';
width: 0;
height: 0;
border-style: solid;
border-width: 0 30px 30px 0;
border-width: 0 60px 60px 0;
border-color: transparent #608a32 transparent transparent;
top: 0;
right: 0;
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import useVuelidate, { type ErrorObject } from '@vuelidate/core'
import { storeToRefs } from 'pinia'
import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ABtnAdvanced from '@/components/ABtnAdvanced.vue'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -54,6 +55,8 @@ const dialog = computed({
const { t } = useI18n()
const showAdvanced = ref(false)
const { currentExtSystemId } = useCurrentExtSystem()
const { currentAssetLicenceId } = useCurrentAssetLicence()
const { useCurrentUser } = useAuth()
Expand Down Expand Up @@ -125,6 +128,7 @@ const { showValidationError, showRecordWas, showErrorsDefault } = useAlerts()
const onConfirm = async () => {
saving.value = true
validateLicence.value.$touch()
console.log(validateLicence.value)
if (
validateLicence.value.$invalid ||
!selectedLicence.value ||
Expand Down Expand Up @@ -166,6 +170,7 @@ const onSelectedLicenceSearchChange = (value: IntegerIdNullable | IntegerId[]) =
return
}
if (isInt(value) || isNull(value)) selectedLicence.value = value
console.log(selectedLicence.value)
}
const onSelectedLicenceSearchByExtIdChange = (value: IntegerIdNullable | IntegerId[]) => {
Expand All @@ -183,6 +188,8 @@ const onSelectedLicenceSearchByExtIdChange = (value: IntegerIdNullable | Integer
onMounted(async () => {
selectedExtSystem.value = currentExtSystemId.value
selectedLicence.value = currentAssetLicenceId.value
selectedExtSystemSearch.value = currentExtSystemId.value
selectedLicenceSearch.value = currentAssetLicenceId.value
})
</script>

Expand All @@ -199,42 +206,22 @@ onMounted(async () => {
{{ t('system.mainBar.extSystemLicenceSwitch.title') }}
</ADialogToolbar>
<VCardText v-if="isSuperAdmin">
<div class="mb-4 text-caption">
{{ t('system.mainBar.extSystemLicenceSwitch.currentExtSystem') }}: {{ currentExtSystemId }} ({{
extSystemName
}})<br />
{{ t('system.mainBar.extSystemLicenceSwitch.currentLicence') }}: {{ currentAssetLicenceId }} ({{
licenceName
}})<br />
</div>
<ASystemEntityScope
:system="SYSTEM_CORE_DAM"
:subject="ENTITY"
>
<VRow>
<VCol class="text-caption font-weight-bold mb-4">
{{ t('system.mainBar.extSystemLicenceSwitch.filters') }}
</VCol>
</VRow>
<VRow>
<VCol class="pt-2">
<DamExtSystemRemoteAutocomplete
v-model="selectedExtSystemSearch"
:client="damClient"
:label="t('system.mainBar.extSystemLicenceSwitch.filter.extSystemName')"
hide-details
clearable
data-cy="field-name-ext-sys"
@update:model-value="onSelectedExtSystemSearchChange"
/>
</VCol>
<VCol>
<VTextField
v-model="selectedExtSystem"
hide-details
data-cy="field-id-ext-sys"
:label="t('system.mainBar.extSystemLicenceSwitch.filter.extSystemId')"
/>
</VCol>
</VRow>
<VRow>
<VCol>
Expand All @@ -244,22 +231,46 @@ onMounted(async () => {
:label="t('system.mainBar.extSystemLicenceSwitch.filter.licenceName')"
:ext-system-id="selectedExtSystem"
hide-details
clearable
data-cy="field-name-licence"
@update:model-value="onSelectedLicenceSearchChange"
/>
</VCol>
</VRow>
<VRow>
<VCol>
<AssetLicenceByExtIdRemoteAutocomplete
v-model="selectedLicenceSearchByExtId"
:label="t('system.mainBar.extSystemLicenceSwitch.filter.licenceExtId')"
:ext-system-id="selectedExtSystem"
hide-details
data-cy="field-id-licence"
@update:model-value="onSelectedLicenceSearchByExtIdChange"
/>
<ABtnAdvanced class="mt-2 mb-4" v-model="showAdvanced" />
</VCol>
</VRow>
<div class="d-flex align-center w-100 mt-8">
<div
v-show="showAdvanced"
>
<VRow>
<VCol>
<div class="text-caption">
{{ t('system.mainBar.extSystemLicenceSwitch.currentExtSystem') }}: {{ currentExtSystemId }} ({{
extSystemName
}})<br />
{{ t('system.mainBar.extSystemLicenceSwitch.currentLicence') }}: {{ currentAssetLicenceId }} ({{
licenceName
}})<br />
</div>
</VCol>
</VRow>
<VRow class="mb-4">
<VCol>
<AssetLicenceByExtIdRemoteAutocomplete
v-model="selectedLicenceSearchByExtId"
:label="t('system.mainBar.extSystemLicenceSwitch.filter.licenceExtId')"
:ext-system-id="selectedExtSystem"
hide-details
data-cy="field-id-licence"
@update:model-value="onSelectedLicenceSearchByExtIdChange"
/>
</VCol>
</VRow>
</div>
<div class="d-flex align-center w-100">
<div class="text-caption font-weight-bold">
{{ t('system.mainBar.extSystemLicenceSwitch.changeToLicenceId') }}: <span class="text-error">*</span>
</div>
Expand Down Expand Up @@ -319,6 +330,7 @@ onMounted(async () => {
</ABtnTertiary>
<ABtnPrimary
v-if="allowSelect"
:disabled="isNull(selectedLicence)"
data-cy="button-confirm"
@click.stop="onConfirm"
>
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
2 changes: 1 addition & 1 deletion src/views/coreDam/asset/list/components/AssetListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const selectMultiple = () => {
class="selected-triangle__icon"
icon="mdi-check"
color="white"
size="x-small"
size="large"
/>
</div>
<AssetImage
Expand Down
Loading

0 comments on commit 824981d

Please sign in to comment.