offer heavy spread placement
This commit is contained in:
parent
0a7848a342
commit
d2aad964d2
2 changed files with 11 additions and 29 deletions
|
|
@ -14,7 +14,6 @@ import { useSetLayoutStore } from '@/stores/setLayout'
|
|||
|
||||
type ScheduleField = 'levelId' | 'startDate' | 'targetDate'
|
||||
type ScheduleFieldErrors = Partial<Record<ScheduleField, string>>
|
||||
type PackedWorkloadPlacement = Exclude<WorkloadPlacement, 'spread'>
|
||||
type PlacementContext = 'unavailable' | 'sparse' | 'heavy' | 'balanced'
|
||||
|
||||
const route = useRoute()
|
||||
|
|
@ -30,17 +29,18 @@ const form = reactive({
|
|||
targetDate: '',
|
||||
})
|
||||
const sparseWorkloadPlacement = ref<WorkloadPlacement>('spread')
|
||||
const heavyWorkloadPlacement = ref<PackedWorkloadPlacement>('middle')
|
||||
const heavyWorkloadPlacement = ref<WorkloadPlacement>('middle')
|
||||
const fieldErrors = ref<ScheduleFieldErrors>({})
|
||||
|
||||
const levels = computed(() =>
|
||||
(layout.value?.levels ?? []).filter((level) => level.elementCount > 0),
|
||||
)
|
||||
const selectedLevel = computed(() => levels.value.find((level) => level.id === form.levelId))
|
||||
const packedWorkloadPlacementOptions: Array<{
|
||||
value: PackedWorkloadPlacement
|
||||
const workloadPlacementOptions: Array<{
|
||||
value: WorkloadPlacement
|
||||
label: string
|
||||
}> = [
|
||||
{ value: 'spread', label: 'Spread evenly' },
|
||||
{ value: 'start', label: 'At the start' },
|
||||
{ value: 'middle', label: 'In the middle' },
|
||||
{ value: 'end', label: 'At the end' },
|
||||
|
|
@ -78,15 +78,6 @@ const placementContext = computed<PlacementContext>(() => {
|
|||
const showWorkloadPlacement = computed(
|
||||
() => placementContext.value === 'sparse' || placementContext.value === 'heavy',
|
||||
)
|
||||
const workloadPlacementOptions = computed<Array<{ value: WorkloadPlacement; label: string }>>(
|
||||
() => {
|
||||
if (placementContext.value === 'sparse') {
|
||||
return [{ value: 'spread', label: 'Spread evenly' }, ...packedWorkloadPlacementOptions]
|
||||
}
|
||||
|
||||
return packedWorkloadPlacementOptions
|
||||
},
|
||||
)
|
||||
const selectedWorkloadPlacement = computed<WorkloadPlacement>({
|
||||
get() {
|
||||
if (placementContext.value === 'sparse') {
|
||||
|
|
@ -102,9 +93,7 @@ const selectedWorkloadPlacement = computed<WorkloadPlacement>({
|
|||
return
|
||||
}
|
||||
|
||||
if (value !== 'spread') {
|
||||
heavyWorkloadPlacement.value = value
|
||||
}
|
||||
heavyWorkloadPlacement.value = value
|
||||
},
|
||||
})
|
||||
|
||||
|
|
@ -290,14 +279,10 @@ async function retry(): Promise<void> {
|
|||
Spread assignments across the schedule or keep them on consecutive days.
|
||||
</p>
|
||||
<p v-else>
|
||||
Some days need one extra assignment. Choose where those days appear in the schedule.
|
||||
Spread heavier days across the schedule or keep them together at the start, middle, or
|
||||
end.
|
||||
</p>
|
||||
<div
|
||||
class="workload-placement__options"
|
||||
:class="{
|
||||
'workload-placement__options--sparse': placementContext === 'sparse',
|
||||
}"
|
||||
>
|
||||
<div class="workload-placement__options">
|
||||
<label
|
||||
v-for="option in workloadPlacementOptions"
|
||||
:key="option.value"
|
||||
|
|
@ -433,12 +418,8 @@ h1 {
|
|||
|
||||
.workload-placement__options {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.workload-placement__options--sparse {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.workload-placement__option {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue