-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added support to jobs `jobImageCopy` and `jobAuthorCurrentOptimize` --------- Co-authored-by: Tomas Hermanek <[email protected]>
- Loading branch information
1 parent
9a34163
commit 6c6c833
Showing
10 changed files
with
274 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
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<JobResource> { | ||
podcastId: DocIdNullable | ||
fullSync: boolean | ||
} | ||
|
||
export type Job = JobUserDataDelete | JobPodcastSynchronizer | ||
export interface JobImageCopy extends JobBase<JobResource> { | ||
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<JobResource> { | ||
processAll: boolean | ||
authorId: DocIdNullable | ||
} | ||
|
||
export type Job = JobUserDataDelete | JobPodcastSynchronizer | JobImageCopy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/views/coreDam/job/components/JobAuthorCurrentOptimize.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script lang="ts" setup> | ||
import { ABooleanValue, AJobDetailCommon, ARow, useI18n } from '@anzusystems/common-admin' | ||
import type { JobAuthorCurrentOptimize } from '@/types/coreDam/Job' | ||
import JobResourceChip from '@/views/coreDam/job/components/JobResourceChip.vue' | ||
withDefaults( | ||
defineProps<{ | ||
job: JobAuthorCurrentOptimize | ||
loading?: boolean | ||
}>(), | ||
{ | ||
loading: false, | ||
} | ||
) | ||
const { t } = useI18n() | ||
</script> | ||
|
||
<template> | ||
<VRow> | ||
<VCol cols="6"> | ||
<AJobDetailCommon | ||
:job="job" | ||
:loading="loading" | ||
> | ||
<template #resource-name> | ||
<JobResourceChip :value="job._resourceName" /> | ||
</template> | ||
</AJobDetailCommon> | ||
</VCol> | ||
<VCol cols="6"> | ||
<template v-if="!loading"> | ||
<ARow :title="t('coreDam.job.model.authorId')"> | ||
{{ job.authorId }} | ||
</ARow> | ||
<ARow :title="t('coreDam.job.model.processAll')"> | ||
<ABooleanValue :value="job.processAll" /> | ||
</ARow> | ||
</template> | ||
</VCol> | ||
</VRow> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
src/views/coreDam/job/components/JobCreateFormAuthorCurrentOptimize.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<script lang="ts" setup> | ||
import { | ||
AFormTextField, | ||
ARow, | ||
useAlerts, | ||
useJobApi, | ||
useValidate, | ||
} from '@anzusystems/common-admin' | ||
import { useI18n } from 'vue-i18n' | ||
import { computed, ref } from 'vue' | ||
import { damClient } from '@/services/api/clients/damClient' | ||
import { SYSTEM_CORE_DAM } from '@/model/systems' | ||
import useVuelidate from '@vuelidate/core' | ||
import type { JobAuthorCurrentOptimize } from '@/types/coreDam/Job' | ||
import { useJobFactory } from '@/model/coreDam/factory/JobFactory' | ||
const emit = defineEmits<{ | ||
(e: 'onSuccess'): void | ||
(e: 'closeDialog'): void | ||
}>() | ||
const buttonLoading = ref(false) | ||
const { createAuthorCurrentOptimize } = useJobFactory() | ||
const job = ref<JobAuthorCurrentOptimize>(createAuthorCurrentOptimize()) | ||
const { t } = useI18n() | ||
const onCancel = () => { | ||
emit('closeDialog') | ||
} | ||
const { createJob } = useJobApi<JobAuthorCurrentOptimize>(damClient, SYSTEM_CORE_DAM) | ||
const { showRecordWas, showErrorsDefault, showValidationError } = useAlerts() | ||
const { required, minValue } = useValidate() | ||
const rules = computed(() => { | ||
if (!job.value.processAll) { | ||
return { | ||
job: { | ||
authorId: { | ||
required, | ||
minValue: minValue(1), | ||
} | ||
} | ||
} | ||
} | ||
return { job: {} } | ||
}) | ||
const v$ = useVuelidate(rules, { job }) | ||
const onConfirm = async () => { | ||
try { | ||
buttonLoading.value = true | ||
v$.value.$touch() | ||
if (v$.value.$invalid) { | ||
showValidationError() | ||
buttonLoading.value = false | ||
return | ||
} | ||
await createJob(job.value) | ||
showRecordWas('created') | ||
emit('onSuccess') | ||
} catch (error) { | ||
showErrorsDefault(error) | ||
} finally { | ||
buttonLoading.value = false | ||
emit('closeDialog') | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<VCardText> | ||
<ARow> | ||
<AFormTextField | ||
v-model="job.authorId" | ||
:label="t('coreDam.job.model.authorId')" | ||
data-cy="authorId" | ||
/> | ||
</ARow> | ||
<ARow> | ||
<VSwitch | ||
v-model="job.processAll" | ||
:label="t('coreDam.job.model.processAll')" | ||
data-cy="processAll" | ||
/> | ||
</ARow> | ||
</VCardText> | ||
<VCardActions> | ||
<VSpacer /> | ||
<ABtnTertiary @click.stop="onCancel"> | ||
{{ t('common.button.cancel') }} | ||
</ABtnTertiary> | ||
<ABtnPrimary | ||
:loading="buttonLoading" | ||
@click.stop="onConfirm" | ||
> | ||
{{ t('common.button.create') }} | ||
</ABtnPrimary> | ||
</VCardActions> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts" setup> | ||
import { AJobDetailCommon, ARow, useI18n } from '@anzusystems/common-admin' | ||
import type { JobImageCopy } from '@/types/coreDam/Job' | ||
import JobResourceChip from '@/views/coreDam/job/components/JobResourceChip.vue' | ||
withDefaults( | ||
defineProps<{ | ||
job: JobImageCopy | ||
loading?: boolean | ||
}>(), | ||
{ | ||
loading: false, | ||
} | ||
) | ||
const { t } = useI18n() | ||
</script> | ||
|
||
<template> | ||
<VRow> | ||
<VCol cols="6"> | ||
<AJobDetailCommon | ||
:job="job" | ||
:loading="loading" | ||
> | ||
<template #resource-name> | ||
<JobResourceChip :value="job._resourceName" /> | ||
</template> | ||
</AJobDetailCommon> | ||
</VCol> | ||
<VCol cols="6"> | ||
<template v-if="!loading"> | ||
<ARow :title="t('coreDam.job.model.licence')"> | ||
{{ job.licence }} | ||
</ARow> | ||
</template> | ||
</VCol> | ||
</VRow> | ||
</template> |