diff --git a/app/javascript/dashboard/components-next/AssignmentPolicy/components/ExclusionRules.vue b/app/javascript/dashboard/components-next/AssignmentPolicy/components/ExclusionRules.vue index 3ac7dfd5f..6282e18c9 100644 --- a/app/javascript/dashboard/components-next/AssignmentPolicy/components/ExclusionRules.vue +++ b/app/javascript/dashboard/components-next/AssignmentPolicy/components/ExclusionRules.vue @@ -20,7 +20,7 @@ const excludedLabels = defineModel('excludedLabels', { const excludeOlderThanMinutes = defineModel('excludeOlderThanMinutes', { type: Number, - default: 10, + default: null, }); // Duration limits: 10 minutes to 999 days (in minutes) diff --git a/app/javascript/dashboard/components-next/input/DurationInput.vue b/app/javascript/dashboard/components-next/input/DurationInput.vue index 7a9fbc12d..b0597648a 100644 --- a/app/javascript/dashboard/components-next/input/DurationInput.vue +++ b/app/javascript/dashboard/components-next/input/DurationInput.vue @@ -32,6 +32,7 @@ const convertToMinutes = newValue => { const transformedValue = computed({ get() { + if (duration.value == null) return null; if (unit.value === DURATION_UNITS.MINUTES) return duration.value; if (unit.value === DURATION_UNITS.HOURS) return Math.floor(duration.value / 60); @@ -41,6 +42,10 @@ const transformedValue = computed({ return 0; }, set(newValue) { + if (newValue == null || newValue === '') { + duration.value = null; + return; + } let minuteValue = convertToMinutes(newValue); duration.value = Math.min(Math.max(minuteValue, props.min), props.max); @@ -53,6 +58,7 @@ const transformedValue = computed({ // this might create some confusion, especially when saving // this watcher fixes it by rounding the duration basically, to the nearest unit value watch(unit, () => { + if (duration.value == null) return; let adjustedValue = convertToMinutes(transformedValue.value); duration.value = Math.min(Math.max(adjustedValue, props.min), props.max); }); diff --git a/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/AgentCapacityEditPage.vue b/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/AgentCapacityEditPage.vue index 390608733..31d0fa3e1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/AgentCapacityEditPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/AgentCapacityEditPage.vue @@ -81,7 +81,7 @@ const formData = computed(() => ({ ...(selectedPolicy.value?.exclusionRules?.excludedLabels || []), ], excludeOlderThanHours: - selectedPolicy.value?.exclusionRules?.excludeOlderThanHours || 10, + selectedPolicy.value?.exclusionRules?.excludeOlderThanHours ?? null, }, inboxCapacityLimits: selectedPolicy.value?.inboxCapacityLimits?.map(limit => ({ diff --git a/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/components/AgentCapacityPolicyForm.vue b/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/components/AgentCapacityPolicyForm.vue index 24c4f0a38..ec82e0c16 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/components/AgentCapacityPolicyForm.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/assignmentPolicy/pages/components/AgentCapacityPolicyForm.vue @@ -17,7 +17,7 @@ const props = defineProps({ enabled: false, exclusionRules: { excludedLabels: [], - excludeOlderThanHours: 10, + excludeOlderThanHours: null, }, inboxCapacityLimits: [], }), @@ -84,7 +84,7 @@ const state = reactive({ description: '', exclusionRules: { excludedLabels: [], - excludeOlderThanHours: 10, + excludeOlderThanHours: null, }, inboxCapacityLimits: [], }); @@ -120,7 +120,7 @@ const resetForm = () => { description: '', exclusionRules: { excludedLabels: [], - excludeOlderThanHours: 10, + excludeOlderThanHours: null, }, inboxCapacityLimits: [], });