Skip to content

Commit

Permalink
added dropdown for job class
Browse files Browse the repository at this point in the history
  • Loading branch information
RalkeyOfficial committed Nov 25, 2024
1 parent 61af185 commit 0acee37
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/modals/Job/EditJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import { jobStore, navigationStore } from '../../store/store.js'
label="Description"
:value.sync="jobItem.description" />

<NcTextField
label="Job Class"
maxlength="255"
:value.sync="jobItem.jobClass" />
<NcSelect v-bind="classOptions"
v-model="classOptions.value"
input-label="Job Class"
:multiple="false"
:clearable="false" />

<NcInputField
type="number"
Expand Down Expand Up @@ -112,6 +113,7 @@ import { jobStore, navigationStore } from '../../store/store.js'
import {
NcButton,
NcModal,
NcSelect,
NcTextField,
NcTextArea,
NcLoadingIcon,
Expand All @@ -126,6 +128,7 @@ export default {
name: 'EditJob',
components: {
NcModal,
NcSelect,
NcTextField,
NcTextArea,
NcButton,
Expand All @@ -142,7 +145,7 @@ export default {
jobItem: {
name: '',
description: '',
jobClass: 'OCA\\OpenConnector\\Action\\PingAction',
jobClass: '',
interval: '3600',
executionTime: '3600',
timeSensitive: false,
Expand All @@ -157,6 +160,13 @@ export default {
success: false,
loading: false,
error: false,
classOptions: {
options: [
{ label: 'OCA\\OpenConnector\\Action\\SynchronizationAction' },
{ label: 'OCA\\OpenConnector\\Action\\PingAction' },
],
value: { label: 'OCA\\OpenConnector\\Action\\SynchronizationAction' },
},
statusOptions: [
{ label: 'Open', value: 'open' },
{ label: 'In Progress', value: 'in_progress' },
Expand All @@ -177,10 +187,12 @@ export default {
},
methods: {
initializeJobItem() {
if (jobStore.jobItem?.id) {
const scheduleAfter = jobStore.jobItem.scheduleAfter ? new Date(jobStore.jobItem.scheduleAfter.date) || '' : null
const activeJobClass = this.classOptions.options.find(option => option.label === jobStore.jobItem.jobClass)
activeJobClass && (this.classOptions.value = activeJobClass)
this.jobItem = {
...jobStore.jobItem,
name: jobStore.jobItem.name || '',
Expand Down Expand Up @@ -221,11 +233,15 @@ export default {
errorRetention: '86400',
userId: '',
}
this.classOptions.value = this.classOptions.options[0]
},
async editJob() {
this.loading = true
try {
await jobStore.saveJob({ ...this.jobItem })
await jobStore.saveJob({
...this.jobItem,
jobClass: this.classOptions.value.label,
})
// Close modal or show success message
this.success = true
this.loading = false
Expand Down

0 comments on commit 0acee37

Please sign in to comment.