Skip to content

Commit cadd6dd

Browse files
[cueweb] Collapse Pause/Unpause to a single state-aware toggle
- Job context menu now shows one entry instead of two: label and icon flip with the row's isPaused flag (Pause when running, Unpause when paused). - Existing destructiveActive flag already handles the disabled cases (FINISHED jobs and the global Disable Job Interaction safety flag), so no new gating logic is needed. - Toolbar buttons are unchanged - the multi-row selection can mix paused and running jobs, so it still needs both Pause Jobs and Unpause Jobs. - Docs updated: reference + developer-guide carry the state matrix and code snippet; user-guide, tutorial, quick-start, and other-guides describe the user-facing toggle behavior.
1 parent 66e29ac commit cadd6dd

7 files changed

Lines changed: 141 additions & 32 deletions

File tree

cueweb/components/ui/context_menus/action-context-menu.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ export const JobContextMenu: React.FC<JobContextMenuProps> = ({
228228
const editable = !jobInteractionDisabled;
229229
const grayIfDisabled = (active: boolean) => (active ? undefined : "gray");
230230

231+
// Pause/Unpause is a single toggle (CueGUI parity): show "Unpause" when
232+
// the job is paused, "Pause" otherwise. destructiveActive already
233+
// disables the entry on FINISHED jobs and when the global safety flag
234+
// is set, so In Progress / Failing / Dependency all behave correctly.
235+
const isJobPaused = !!contextMenuState.row?.original.isPaused;
236+
231237
// CueGUI parity: order + grouping mirror cuegui.MenuActions.JobActions
232238
const menuItems: MenuItem[] = [
233239
// -- Top group: identity + lookup actions ----------------------
@@ -376,18 +382,16 @@ export const JobContextMenu: React.FC<JobContextMenuProps> = ({
376382

377383
sep("group-pause"),
378384

379-
// -- Pause / Unpause ------------------------------------------
380-
{
381-
label: "Pause",
382-
onClick: pauseJobGivenRow,
383-
isActive: destructiveActive,
384-
component: <TbPlayerPause className="mr-1" size={14} color={grayIfDisabled(destructiveActive)} />,
385-
},
385+
// -- Pause / Unpause (single toggle) --------------------------
386386
{
387-
label: "Unpause",
388-
onClick: unpauseJobGivenRow,
387+
label: isJobPaused ? "Unpause" : "Pause",
388+
onClick: isJobPaused ? unpauseJobGivenRow : pauseJobGivenRow,
389389
isActive: destructiveActive,
390-
component: <TbPlayerPlay className="mr-1" size={14} color={grayIfDisabled(destructiveActive)} />,
390+
component: isJobPaused ? (
391+
<TbPlayerPlay className="mr-1" size={14} color={grayIfDisabled(destructiveActive)} />
392+
) : (
393+
<TbPlayerPause className="mr-1" size={14} color={grayIfDisabled(destructiveActive)} />
394+
),
391395
},
392396

393397
sep("group-eat-kill"),

docs/_docs/developer-guide/cueweb-development.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,81 @@ If the fetch rejects, `layers` is set to `[]` and the prelude reads `(no layers
527527

528528
---
529529

530+
## Pause / Unpause Toggle (Job Context Menu)
531+
532+
The job context menu's **Pause / Unpause** entry is a single toggle: the
533+
label, icon, and click handler all flip based on the row's `isPaused`
534+
flag. CueGUI's `MonitorJobs` widget does the same thing, so this is a
535+
parity item.
536+
537+
Files involved:
538+
539+
```bash
540+
cueweb/
541+
├── app/utils/action_utils.ts # pauseJobGivenRow / unpauseJobGivenRow
542+
└── components/ui/context_menus/action-context-menu.tsx # The toggle entry
543+
```
544+
545+
### State derivation
546+
547+
Inside `JobContextMenu` (`components/ui/context_menus/action-context-menu.tsx`):
548+
549+
```tsx
550+
const isJobPaused = !!contextMenuState.row?.original.isPaused;
551+
```
552+
553+
### The toggle entry
554+
555+
The menuItems array contains a single Pause/Unpause entry instead of two
556+
static ones:
557+
558+
```tsx
559+
{
560+
label: isJobPaused ? "Unpause" : "Pause",
561+
onClick: isJobPaused ? unpauseJobGivenRow : pauseJobGivenRow,
562+
isActive: destructiveActive,
563+
component: isJobPaused ? (
564+
<TbPlayerPlay className="mr-1" size={14} color={grayIfDisabled(destructiveActive)} />
565+
) : (
566+
<TbPlayerPause className="mr-1" size={14} color={grayIfDisabled(destructiveActive)} />
567+
),
568+
},
569+
```
570+
571+
### Disabled-state matrix
572+
573+
`destructiveActive` is already defined as:
574+
575+
```tsx
576+
const isActive = contextMenuState.row ? contextMenuState.row.original.state !== "FINISHED" : false;
577+
const destructiveActive = isActive && !jobInteractionDisabled;
578+
```
579+
580+
So the toggle resolves like this:
581+
582+
| Job state | `isPaused` | Label shown | Active? |
583+
|-----------|------------|-------------|---------|
584+
| In Progress | `false` | **Pause** | yes |
585+
| Failing | `false` | **Pause** | yes |
586+
| Dependency | `false` | **Pause** | yes |
587+
| Paused | `true` | **Unpause** | yes |
588+
| Finished | `false` | **Pause** | no (state-gated) |
589+
| Any state + global safety flag on | - | shown label | no (flag-gated) |
590+
591+
No additional code is needed to handle Finished or the global safety flag
592+
- both fall out of the existing `destructiveActive` boolean.
593+
594+
### Toolbar buttons
595+
596+
The Jobs toolbar still surfaces separate **Pause Jobs** / **Unpause Jobs**
597+
buttons (`pauseJobsFromSelectedRows` / `unpauseJobsFromSelectedRows` in
598+
`action_utils.ts`) because the toolbar acts on the multi-row checkbox
599+
selection - those rows can have mixed `isPaused` states, so a single
600+
toggle would be ambiguous. Only the single-row right-click menu collapses
601+
to one entry.
602+
603+
---
604+
530605
## Development Workflow
531606

532607
### Running in Development Mode

docs/_docs/other-guides/cueweb.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ CueWeb replicates the core functionality of [CueGUI](https://www.opencue.io/docs
8888
17. **CueWeb actions and context menu (CueGUI parity):**
8989
- Right-clicking any row in the Jobs, Layers, or Frames tables opens a context menu that mirrors the CueGUI Monitor Jobs / Monitor Job Details menus.
9090
- On touch devices, every row has a small **`` Actions** button as its leftmost cell. Tapping it opens the same menu the desktop right-click opens.
91-
- **Job actions** include: Unmonitor, View Job, **View Job Details** (opens the tabbed `/jobs/<jobName>` page with Overview / Layers / Frames / Comments / Dependencies), **Copy Job Name**, Email Artist, Request Cores, Subscribe to Job, Comments, View Dependencies, Dependency Wizard, Drop External / Internal Dependencies, Set / Clear User Color, **Set Priority...** (themed 1-100 slider + number input), Set Max Retries, Reorder / Stagger Frames, Pause / Unpause, Auto-Eat On / Off, Retry / Eat Dead Frames, Unbook, Kill, Show Progress Bar.
91+
- **Job actions** include: Unmonitor, View Job, **View Job Details** (opens the tabbed `/jobs/<jobName>` page with Overview / Layers / Frames / Comments / Dependencies), **Copy Job Name**, Email Artist, Request Cores, Subscribe to Job, Comments, View Dependencies, Dependency Wizard, Drop External / Internal Dependencies, Set / Clear User Color, **Set Priority...** (themed 1-100 slider + number input), Set Max Retries, Reorder / Stagger Frames, **Pause / Unpause** (single toggle - the label and icon flip with the job's paused state, and the entry is grayed out for Finished jobs), Auto-Eat On / Off, Retry / Eat Dead Frames, Unbook, Kill, Show Progress Bar.
9292
- **Layer actions** include: View Layer, **Copy Layer Name**, dependency items, Reorder / Stagger Frames, Properties, Kill, Eat, Retry, Retry Dead Frames.
9393
- **Frame actions** include: **Tail Log / View Log** (in-browser viewer), **View Log on \<editor\>** (external editor - see item 23), **Copy Log Path**, **Copy Frame Name**, View Host, dependency items, Filter Selected Layers, Reorder, Preview All, Retry, Eat, Kill, Eat and Mark done, View Processes.
9494
- All copy actions work whether CueWeb is reached at `localhost` or at a LAN IP over plain HTTP.
@@ -427,7 +427,9 @@ Selecting **Other -> Show Shortcuts** opens an overlay listing the available key
427427

428428
### CueWeb Actions for Jobs / Layers / Frames
429429

430-
The CueWeb system includes actions like `eat dead frames`, `retry dead frames`, `pause`, `unpause`, and `kill` for selected jobs in the table. Also, the ability to right-click jobs, layers, and frames to get a context menu popup with actions for that object type.
430+
The CueWeb system includes actions like `eat dead frames`, `retry dead frames`, `pause`, `unpause`, and `kill` for selected jobs in the table. Also, the ability to right-click jobs, layers, and frames to get a context menu popup with actions for that object type.
431+
432+
The Pause / Unpause entry in the job context menu is a single toggle: it reads **Pause** when the job is running (In Progress, Failing, Dependency), **Unpause** when the job is already paused, and is shown disabled (grayed) when the job is Finished.
431433

432434
Figure 52 shows the `job` context menu with options to `un-monitor`, `comments`, `pause`, `retry dead frames`, `eat dead frames` and `kill` jobs and Figure 53 shows the successful message after selecting `kill` a job.
433435

docs/_docs/quick-starts/quick-start-cueweb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Click a job row to reveal the inline Layers and Frames panels below the jobs tab
214214

215215
### Job Management
216216

217-
- **Pause/Resume**: Click the pause/play button for individual jobs
217+
- **Pause/Resume**: Right-click a job and pick **Pause** (or **Unpause** if the job is already paused). The same entry toggles between the two labels based on the job's current state, and is grayed out for Finished jobs.
218218
- **Kill Jobs**: Use the stop button to terminate jobs
219219
- **Job Details (inline)**: Click on a job row to reveal the inline Layers + Frames panel below the Jobs table.
220220
- **Job Details (tabbed page)**: Right-click a job and choose **View Job Details** to open the tabbed `/jobs/<jobName>` page with Overview / Layers / Frames / Comments / Dependencies tabs. The active tab is stored in the URL so the page is bookmarkable.

docs/_docs/reference/cueweb.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ All three context menus (`JobContextMenu`, `LayerContextMenu`, `FrameContextMenu
420420
| **Set Priority...** | Open a themed dialog with a 1-100 slider + number input to adjust the job's dispatch priority. Higher numbers dispatch first; default is 100. After Apply the Jobs table updates the Priority column optimistically (no wait for the 5s poll). |
421421
| **Set Max Retries** | Edit the per-frame retry budget. |
422422
| **Reorder Frames** / **Stagger Frames** | Open the reorder / stagger dialogs. *(placeholder)* |
423-
| **Pause** / **Unpause** | Pause or resume the job. |
423+
| **Pause** / **Unpause** | Single toggle entry: shows **Pause** when the job is running and **Unpause** when the job is already paused. The label, icon (`TbPlayerPause` / `TbPlayerPlay`) and dispatched action all flip on the row's `isPaused` flag. The entry is shown disabled (grayed) when the job's `state === "FINISHED"` (a terminal state can't be paused), and when the global *Disable Job Interaction* safety flag is on. Active in all other states (In Progress, Failing, Dependency). |
424424
| **Auto-Eat On** / **Auto-Eat Off** | Toggle Auto-Eat. |
425425
| **Retry Dead Frames** | Retry every dead frame. |
426426
| **Eat Dead Frames** | Mark every dead frame as eaten. |
@@ -906,9 +906,10 @@ When the flag is on:
906906
Pause, Unpause, Kill) disable themselves visually and ignore clicks.
907907
*Unmonitor* is non-destructive and remains active.
908908
- The right-click context menus on **job**, **layer**, and **frame** rows
909-
dim every destructive item (Pause / Retry / Retry Dead Frames / Eat /
910-
Eat Dead Frames / Kill). *Unmonitor* and *Comments* on the job menu
911-
remain active.
909+
dim every destructive item (Pause / Unpause / Retry / Retry Dead Frames
910+
/ Eat / Eat Dead Frames / Kill). The Pause/Unpause entry is a single
911+
toggle whose label flips on `isPaused` - both flavors are dimmed the
912+
same way. *Unmonitor* and *Comments* on the job menu remain active.
912913

913914
![CueWeb read-only banner when job interaction is disabled](/assets/images/cueweb/cueweb_file_disable_job_interaction_enabled.png)
914915

docs/_docs/tutorials/cueweb-tutorial.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,42 @@ Jobs are color-coded for quick identification:
146146

147147
### Pausing and Resuming Jobs
148148

149-
Sometimes you need to pause jobs to free up resources or fix issues.
149+
Sometimes you need to pause jobs to free up resources or fix issues. The
150+
context menu shows a single Pause/Unpause entry whose label reflects the
151+
job's current state - **Pause** when the job is running, **Unpause** when
152+
the job is already paused, and grayed out when the job is Finished.
150153

151154
#### Pause a Job
152155

153-
1. Find the job you want to pause
154-
2. Click the **Pause** button in the Actions menu
155-
3. The job status should change to "PAUSED" with a blue indicator
156+
1. Find the job you want to pause (anything that is not already Finished
157+
or Paused).
158+
2. Right-click the row - the entry will read **Pause**.
159+
3. Click **Pause**.
160+
4. The job status changes to "Paused" with a blue indicator, and the next
161+
time you right-click the row the same entry will read **Unpause**.
156162

157163
#### Resume a Job
158164

159-
1. Find a paused job (blue indicator)
160-
2. Click the **Unpause** button in the Actions menu
161-
3. The job should return to "PENDING" or "RUNNING"
165+
1. Find a paused job (blue indicator).
166+
2. Right-click the row - the entry will read **Unpause**.
167+
3. Click **Unpause**.
168+
4. The job returns to In Progress (or Failing / Dependency if it has dead
169+
frames or unmet dependencies).
170+
171+
#### What you'll see in other states
172+
173+
- **In Progress, Failing, Dependency**: entry reads **Pause** and is active.
174+
- **Paused**: entry reads **Unpause** and is active.
175+
- **Finished**: entry reads **Pause** but is grayed out - a completed job
176+
cannot be paused.
162177

163178
### Pause and Resume Practice
164179

165-
1. Find an active job with running frames
166-
2. Pause the job and watch the status change
167-
3. Wait 30 seconds for the interface to refresh
168-
4. Resume the job
169-
5. Observe how the job returns to the queue
180+
1. Find an active job with running frames.
181+
2. Right-click and choose **Pause** - watch the status change to Paused.
182+
3. Wait 30 seconds for the interface to refresh.
183+
4. Right-click again - the entry now reads **Unpause**.
184+
5. Choose **Unpause** and observe how the job returns to the queue.
170185

171186
### Adjusting Priority
172187

docs/_docs/user-guides/cueweb-user-guide.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,20 @@ Jobs are color-coded by status:
290290

291291
#### Pause/Resume Jobs
292292

293-
1. **Single Job**: Click the `Pause`/`Unpause` button in the Actions menu
294-
2. **Multiple Jobs**: Select jobs using checkboxes, then use the `Pause`/`Unpause` button
293+
The right-click menu shows a single entry that reflects the job's current
294+
state:
295+
296+
- The entry reads **Pause** when the job is running (In Progress, Failing,
297+
or Dependency) - clicking it pauses the job.
298+
- The entry reads **Unpause** when the job is already paused - clicking
299+
it resumes the job.
300+
- The entry is shown disabled (grayed) when the job is Finished, since a
301+
completed job cannot be paused.
302+
303+
1. **Single Job**: Right-click the row and pick **Pause** / **Unpause**, or
304+
click the toolbar button in the Actions menu.
305+
2. **Multiple Jobs**: Select jobs using checkboxes, then use the
306+
**Pause Jobs** / **Unpause Jobs** toolbar buttons.
295307

296308
#### Kill Jobs
297309

@@ -316,7 +328,7 @@ Jobs can be added or removed from monitoring:
316328

317329
Right-click on a job, layer, or frame row to open a CueGUI-parity context menu. The full menu structure for each type is listed in the reference doc; common entries:
318330

319-
- **Job menu**: Unmonitor, **View Job Details** (tabbed detail page with Overview / Layers / Frames / Comments / Dependencies), **Copy Job Name**, Comments, Pause / Unpause, Retry / Eat Dead Frames, Kill, **Set Priority...**, Set Max Retries, Auto-Eat On / Off, Drop External / Internal Dependencies.
331+
- **Job menu**: Unmonitor, **View Job Details** (tabbed detail page with Overview / Layers / Frames / Comments / Dependencies), **Copy Job Name**, Comments, **Pause / Unpause** (single toggle - the label flips with the job's paused state and is grayed out for Finished jobs), Retry / Eat Dead Frames, Kill, **Set Priority...**, Set Max Retries, Auto-Eat On / Off, Drop External / Internal Dependencies.
320332

321333
### Adjusting job priority (Set Priority)
322334

0 commit comments

Comments
 (0)