From 08d1f5a13bb7a1fd1dfdad7c7c4c804fae3a85cf Mon Sep 17 00:00:00 2001 From: Tomas Hermanek Date: Mon, 2 Dec 2024 16:56:50 +0100 Subject: [PATCH] Added support to jobs `jobImageCopy` and `jobAuthorCurrentOptimize` --- src/locales/en/coreDam/job.json | 9 +- src/locales/sk/coreDam/job.json | 9 +- src/model/coreDam/factory/JobFactory.ts | 19 +++- src/model/coreDam/valueObject/JobResource.ts | 12 +- src/types/coreDam/Job.ts | 34 +++++- src/views/coreDam/job/JobDetailView.vue | 12 +- .../components/JobAuthorCurrentOptimize.vue | 42 +++++++ .../job/components/JobCreateButton.vue | 4 + .../JobCreateFormAuthorCurrentOptimize.vue | 103 ++++++++++++++++++ .../coreDam/job/components/JobImageCopy.vue | 39 +++++++ 10 files changed, 273 insertions(+), 10 deletions(-) create mode 100644 src/views/coreDam/job/components/JobAuthorCurrentOptimize.vue create mode 100644 src/views/coreDam/job/components/JobCreateFormAuthorCurrentOptimize.vue create mode 100644 src/views/coreDam/job/components/JobImageCopy.vue diff --git a/src/locales/en/coreDam/job.json b/src/locales/en/coreDam/job.json index 636f3a19..a98c572a 100644 --- a/src/locales/en/coreDam/job.json +++ b/src/locales/en/coreDam/job.json @@ -1,9 +1,14 @@ { "model": { "podcastId": "Podcast Id", - "fullSync": "Full synchronization" + "fullSync": "Full synchronization", + "authorId": "Author Id", + "processAll": "Process all", + "licence": "Licence" }, "jobResource": { - "jobPodcastSynchronizer": "Podcast synchronizer" + "jobPodcastSynchronizer": "Podcast synchronizer", + "jobAuthorCurrentOptimize": "Author current optimize", + "jobImageCopy": "Image copy" } } diff --git a/src/locales/sk/coreDam/job.json b/src/locales/sk/coreDam/job.json index 3a9849cf..2f1b6a2c 100644 --- a/src/locales/sk/coreDam/job.json +++ b/src/locales/sk/coreDam/job.json @@ -1,9 +1,14 @@ { "model": { "podcastId": "Podcast Id", - "fullSync": "Plná synchronizácia" + "fullSync": "Plná synchronizácia", + "authorId": "Autor ID", + "processAll": "Spracuj všetko", + "licence": "Licencia Id" }, "jobResource": { - "jobPodcastSynchronizer": "Podcastový synchronizátor" + "jobPodcastSynchronizer": "Podcastový synchronizátor", + "jobAuthorCurrentOptimize": "Optimalizácia autorov", + "jobImageCopy": "Kopírovanie obrázkov" } } diff --git a/src/model/coreDam/factory/JobFactory.ts b/src/model/coreDam/factory/JobFactory.ts index 2de1bf6c..705299ab 100644 --- a/src/model/coreDam/factory/JobFactory.ts +++ b/src/model/coreDam/factory/JobFactory.ts @@ -1,7 +1,11 @@ import { SYSTEM_CORE_DAM } from '@/model/systems' import { useCommonJobFactory } from '@anzusystems/common-admin' -import type { JobPodcastSynchronizer } from '@/types/coreDam/Job' -import { JOB_RESOURCE_PODCAST_SYNCHRONIZER } from '@/model/coreDam/valueObject/JobResource' +import type { JobAuthorCurrentOptimize, JobImageCopy, JobPodcastSynchronizer } from '@/types/coreDam/Job' +import { + JOB_AUTHOR_CURRENT_OPTIMIZE, + JOB_RESOURCE_IMAGE_COPY, + JOB_RESOURCE_PODCAST_SYNCHRONIZER +} from '@/model/coreDam/valueObject/JobResource' export function useJobFactory() { const { createBase } = useCommonJobFactory() @@ -15,7 +19,18 @@ export function useJobFactory() { } } + const createAuthorCurrentOptimize = (): JobAuthorCurrentOptimize => { + return { + ...createBase(JOB_AUTHOR_CURRENT_OPTIMIZE, SYSTEM_CORE_DAM), + ...{ + processAll: false, + authorId: null, + }, + } + } + return { createPodcastSynchronizer, + createAuthorCurrentOptimize, } } diff --git a/src/model/coreDam/valueObject/JobResource.ts b/src/model/coreDam/valueObject/JobResource.ts index 2a7cde7e..d4c2a58d 100644 --- a/src/model/coreDam/valueObject/JobResource.ts +++ b/src/model/coreDam/valueObject/JobResource.ts @@ -2,8 +2,10 @@ import { type JobBaseResource, useJobBaseResource } from '@anzusystems/common-ad import { useI18n } from 'vue-i18n' export const JOB_RESOURCE_PODCAST_SYNCHRONIZER = 'jobPodcastSynchronizer' +export const JOB_AUTHOR_CURRENT_OPTIMIZE = 'jobAuthorCurrentOptimize' +export const JOB_RESOURCE_IMAGE_COPY = 'jobImageCopy' -export type JobResource = typeof JOB_RESOURCE_PODCAST_SYNCHRONIZER | JobBaseResource +export type JobResource = typeof JOB_RESOURCE_PODCAST_SYNCHRONIZER | typeof JOB_RESOURCE_IMAGE_COPY | typeof JOB_AUTHOR_CURRENT_OPTIMIZE| JobBaseResource export function useJobResource() { const { t } = useI18n() @@ -13,5 +15,13 @@ export function useJobResource() { title: t('coreDam.job.jobResource.jobPodcastSynchronizer'), value: 'jobPodcastSynchronizer', }, + { + title: t('coreDam.job.jobResource.jobImageCopy'), + value: 'jobImageCopy', + }, + { + title: t('coreDam.job.jobResource.jobAuthorCurrentOptimize'), + value: 'jobAuthorCurrentOptimize', + }, ]) } diff --git a/src/types/coreDam/Job.ts b/src/types/coreDam/Job.ts index 36bd5c8a..f706b576 100644 --- a/src/types/coreDam/Job.ts +++ b/src/types/coreDam/Job.ts @@ -1,4 +1,10 @@ -import type { DocIdNullable, JobBase, JobUserDataDelete } from '@anzusystems/common-admin' +import type { + DocIdNullable, + IntegerId, + IntegerIdNullable, + JobBase, + JobUserDataDelete +} from '@anzusystems/common-admin' import type { JobResource } from '@/model/coreDam/valueObject/JobResource' export interface JobPodcastSynchronizer extends JobBase { @@ -6,4 +12,28 @@ export interface JobPodcastSynchronizer extends JobBase { fullSync: boolean } -export type Job = JobUserDataDelete | JobPodcastSynchronizer +export interface JobImageCopy extends JobBase { + licence: DocIdNullable +} + +export interface JobImageCopyItem { + id: IntegerId + sourceAssetId: DocIdNullable + targetAssetId: DocIdNullable + status: AssetFileCopyStatus + job: IntegerIdNullable +} + +export enum AssetFileCopyStatus { + Exists = 'exists', + Copy = 'copy', + NotAllowed = 'notAllowed', + Unassigned = 'unassigned', +} + +export interface JobAuthorCurrentOptimize extends JobBase { + processAll: boolean + authorId: DocIdNullable +} + +export type Job = JobUserDataDelete | JobPodcastSynchronizer | JobImageCopy diff --git a/src/views/coreDam/job/JobDetailView.vue b/src/views/coreDam/job/JobDetailView.vue index 53201753..79dcbeaa 100644 --- a/src/views/coreDam/job/JobDetailView.vue +++ b/src/views/coreDam/job/JobDetailView.vue @@ -14,7 +14,13 @@ import { useJobDetailActions } from '@/views/coreDam/job/composables/jobActions' import ActionbarWrapper from '@/components/wrappers/ActionbarWrapper.vue' import JobDetailPodcastSynchronizer from '@/views/coreDam/job/components/JobDetailPodcastSynchronizer.vue' import JobDetailUserDataDelete from '@/views/coreDam/job/components/JobDetailUserDataDelete.vue' -import { JOB_RESOURCE_PODCAST_SYNCHRONIZER } from '@/model/coreDam/valueObject/JobResource' +import { + JOB_AUTHOR_CURRENT_OPTIMIZE, + JOB_RESOURCE_IMAGE_COPY, + JOB_RESOURCE_PODCAST_SYNCHRONIZER +} from '@/model/coreDam/valueObject/JobResource' +import JobAuthorCurrentOptimize from '@/views/coreDam/job/components/JobAuthorCurrentOptimize.vue' +import JobImageCopy from '@/views/coreDam/job/components/JobImageCopy.vue' const { detailLoading, fetchData, resetStore, job } = useJobDetailActions() @@ -30,6 +36,10 @@ const jobComponent = computed(() => { switch (job.value._resourceName) { case JOB_RESOURCE_PODCAST_SYNCHRONIZER: return JobDetailPodcastSynchronizer + case JOB_AUTHOR_CURRENT_OPTIMIZE: + return JobAuthorCurrentOptimize + case JOB_RESOURCE_IMAGE_COPY: + return JobImageCopy case JOB_RESOURCE_USER_DATA_DELETE: return JobDetailUserDataDelete default: diff --git a/src/views/coreDam/job/components/JobAuthorCurrentOptimize.vue b/src/views/coreDam/job/components/JobAuthorCurrentOptimize.vue new file mode 100644 index 00000000..342f77b8 --- /dev/null +++ b/src/views/coreDam/job/components/JobAuthorCurrentOptimize.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/views/coreDam/job/components/JobCreateButton.vue b/src/views/coreDam/job/components/JobCreateButton.vue index eb0dbf74..3a202050 100644 --- a/src/views/coreDam/job/components/JobCreateButton.vue +++ b/src/views/coreDam/job/components/JobCreateButton.vue @@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n' import { ADialogToolbar, AFormValueObjectOptionsSelect, JOB_RESOURCE_USER_DATA_DELETE } from '@anzusystems/common-admin' import { computed, ref } from 'vue' import { + JOB_AUTHOR_CURRENT_OPTIMIZE, JOB_RESOURCE_PODCAST_SYNCHRONIZER, type JobResource, useJobResource, @@ -10,6 +11,7 @@ import { import JobCreateFormPodcastSynchronizer from '@/views/coreDam/job/components/JobCreateFormPodcastSynchronizer.vue' import JobCreateFormUserDataDelete from '@/views/coreDam/job/components/JobCreateFormUserDataDelete.vue' import JobCreateFormDefault from '@/views/coreDam/job/components/JobCreateFormDefault.vue' +import JobCreateFormAuthorCurrentOptimize from '@/views/coreDam/job/components/JobCreateFormAuthorCurrentOptimize.vue' withDefaults( defineProps<{ @@ -39,6 +41,8 @@ const jobComponent = computed(() => { return JobCreateFormUserDataDelete case JOB_RESOURCE_PODCAST_SYNCHRONIZER: return JobCreateFormPodcastSynchronizer + case JOB_AUTHOR_CURRENT_OPTIMIZE: + return JobCreateFormAuthorCurrentOptimize default: console.error('Unsupported type.') return JobCreateFormDefault diff --git a/src/views/coreDam/job/components/JobCreateFormAuthorCurrentOptimize.vue b/src/views/coreDam/job/components/JobCreateFormAuthorCurrentOptimize.vue new file mode 100644 index 00000000..8a862824 --- /dev/null +++ b/src/views/coreDam/job/components/JobCreateFormAuthorCurrentOptimize.vue @@ -0,0 +1,103 @@ + + + diff --git a/src/views/coreDam/job/components/JobImageCopy.vue b/src/views/coreDam/job/components/JobImageCopy.vue new file mode 100644 index 00000000..121cc92a --- /dev/null +++ b/src/views/coreDam/job/components/JobImageCopy.vue @@ -0,0 +1,39 @@ + + +