Skip to content

Commit 1ffaa47

Browse files
Myesterychristian-byrne
authored andcommitted
[refactor] Rename queueIndex variables to reflect job.priority usage (#9258)
## Summary Rename `lastHistoryQueueIndex` → `lastJobHistoryPriority` and `currentQueueIndex` → `currentJobPriority` to reflect that these variables now read `job.priority` directly. ## Changes - **queueStore.ts**: `lastHistoryQueueIndex` → `lastJobHistoryPriority` - **JobDetailsPopover.vue**: `currentQueueIndex` → `currentJobPriority` - **queueStore.test.ts**: Updated references and test descriptions Fixes #9246 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9258-refactor-Rename-queueIndex-variables-to-reflect-job-priority-usage-3136d73d36508126989dd464f7dad9a1) by [Unito](https://www.unito.io)
1 parent 341a919 commit 1ffaa47

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/components/queue/job/JobDetailsPopover.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ const queuedAtValue = computed(() =>
166166
: ''
167167
)
168168
169-
const currentQueueIndex = computed<number | null>(() => {
169+
const currentJobPriority = computed<number | null>(() => {
170170
const task = taskForJob.value
171171
return task ? Number(task.job.priority) : null
172172
})
173173
174174
const jobsAhead = computed<number | null>(() => {
175-
const idx = currentQueueIndex.value
175+
const idx = currentJobPriority.value
176176
if (idx == null) return null
177177
const ahead = queueStore.pendingTasks.filter(
178178
(t: TaskItemImpl) => Number(t.job.priority) < idx

src/stores/queueStore.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ describe('useQueueStore', () => {
271271
expect(store.tasks).toEqual([])
272272
expect(store.flatTasks).toEqual([])
273273
expect(store.hasPendingTasks).toBe(false)
274-
expect(store.lastHistoryQueueIndex).toBe(-1)
274+
expect(store.lastJobHistoryPriority).toBe(-1)
275275
})
276276
})
277277

@@ -686,7 +686,7 @@ describe('useQueueStore', () => {
686686
expect(store.hasPendingTasks).toBe(false)
687687
})
688688

689-
it('lastHistoryQueueIndex should return highest queue index', async () => {
689+
it('lastJobHistoryPriority should return highest job priority', async () => {
690690
const hist1 = createHistoryJob(10, 'hist-1')
691691
const hist2 = createHistoryJob(25, 'hist-2')
692692
const hist3 = createHistoryJob(15, 'hist-3')
@@ -695,15 +695,15 @@ describe('useQueueStore', () => {
695695
mockGetHistory.mockResolvedValue([hist1, hist2, hist3])
696696

697697
await store.update()
698-
expect(store.lastHistoryQueueIndex).toBe(25)
698+
expect(store.lastJobHistoryPriority).toBe(25)
699699
})
700700

701-
it('lastHistoryQueueIndex should be -1 when no history', async () => {
701+
it('lastJobHistoryPriority should be -1 when no history', async () => {
702702
mockGetQueue.mockResolvedValue({ Running: [], Pending: [] })
703703
mockGetHistory.mockResolvedValue([])
704704

705705
await store.update()
706-
expect(store.lastHistoryQueueIndex).toBe(-1)
706+
expect(store.lastJobHistoryPriority).toBe(-1)
707707
})
708708
})
709709

src/stores/queueStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ export const useQueueStore = defineStore('queue', () => {
495495
tasks.value.flatMap((task: TaskItemImpl) => task.flatten())
496496
)
497497

498-
const lastHistoryQueueIndex = computed<number>(() =>
498+
const lastJobHistoryPriority = computed<number>(() =>
499499
historyTasks.value.length ? historyTasks.value[0].job.priority : -1
500500
)
501501

@@ -607,7 +607,7 @@ export const useQueueStore = defineStore('queue', () => {
607607

608608
tasks,
609609
flatTasks,
610-
lastHistoryQueueIndex,
610+
lastJobHistoryPriority,
611611
hasPendingTasks,
612612
activeJobsCount,
613613

0 commit comments

Comments
 (0)