Skip to content

Commit ea7b05a

Browse files
ikreymerSuaYoo
authored andcommitted
rename for clarity, use resume instead of unpause consistently
1 parent e8c1aee commit ea7b05a

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

backend/btrixcloud/crawlmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ async def shutdown_crawl(self, crawl_id: str, graceful=True) -> dict:
389389
async def pause_resume_crawl(
390390
self, crawl_id: str, paused_at: Optional[datetime] = None
391391
) -> dict:
392-
"""pause or unpause a crawl"""
392+
"""pause or resume a crawl"""
393393
return await self._patch_job(
394394
crawl_id, {"pausedAt": date_to_str(paused_at) if paused_at else ""}
395395
)

backend/btrixcloud/crawls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ async def get_crawl_stats(
772772
async def pause_crawl(
773773
self, crawl_id: str, org: Organization, pause: bool
774774
) -> Dict[str, bool]:
775-
"""pause or unpause a crawl temporarily"""
775+
"""pause or resume a crawl temporarily"""
776776
crawl = await self.get_base_crawl(crawl_id, org)
777777
if crawl and crawl.type != "crawl":
778778
raise HTTPException(status_code=400, detail="not_a_crawl")
@@ -1284,11 +1284,11 @@ async def pause_crawl(crawl_id, org: Organization = Depends(org_crawl_dep)):
12841284
return await ops.pause_crawl(crawl_id, org, pause=True)
12851285

12861286
@app.post(
1287-
"/orgs/{oid}/crawls/{crawl_id}/unpause",
1287+
"/orgs/{oid}/crawls/{crawl_id}/resume",
12881288
tags=["crawls"],
12891289
response_model=SuccessResponse,
12901290
)
1291-
async def unpause_crawl(crawl_id, org: Organization = Depends(org_crawl_dep)):
1291+
async def resume_crawl(crawl_id, org: Organization = Depends(org_crawl_dep)):
12921292
return await ops.pause_crawl(crawl_id, org, pause=False)
12931293

12941294
@app.post(

frontend/src/pages/org/workflow-detail.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,15 @@ export class WorkflowDetail extends BtrixElement {
563563

564564
const archivingDisabled = isArchivingDisabled(this.org, true);
565565
const paused = workflow.lastCrawlState === "paused";
566-
const hidePause =
566+
567+
const hidePauseResume =
567568
!this.lastCrawlId ||
568569
this.isCancelingOrStoppingCrawl ||
569570
this.workflow.lastCrawlStopping;
570-
const disablePause =
571+
// disable pause/resume button if desired state is already in the process of being set.
572+
// if crawl is running, and already pausing, don't allow clicking Pausing
573+
// if crawl not running, and already unpausing (lastCrawlPausing is false), don't allow clicking Resume
574+
const disablePauseResume =
571575
this.workflow.lastCrawlPausing ===
572576
(this.workflow.lastCrawlState === "running");
573577

@@ -577,12 +581,12 @@ export class WorkflowDetail extends BtrixElement {
577581
() => html`
578582
<sl-button-group>
579583
${when(
580-
!hidePause,
584+
!hidePauseResume,
581585
() => html`
582586
<sl-button
583587
size="small"
584-
@click=${this.pauseUnpause}
585-
?disabled=${disablePause}
588+
@click=${this.pauseResume}
589+
?disabled=${disablePauseResume}
586590
variant=${ifDefined(paused ? "primary" : undefined)}
587591
>
588592
<sl-icon
@@ -1680,14 +1684,14 @@ export class WorkflowDetail extends BtrixElement {
16801684
}
16811685
}
16821686

1683-
private async pauseUnpause() {
1687+
private async pauseResume() {
16841688
if (!this.lastCrawlId) return;
16851689

16861690
const pause = this.workflow?.lastCrawlState !== "paused";
16871691

16881692
try {
16891693
const data = await this.api.fetch<{ success: boolean }>(
1690-
`/orgs/${this.orgId}/crawls/${this.lastCrawlId}/${pause ? "pause" : "unpause"}`,
1694+
`/orgs/${this.orgId}/crawls/${this.lastCrawlId}/${pause ? "pause" : "resume"}`,
16911695
{
16921696
method: "POST",
16931697
},
@@ -1702,7 +1706,7 @@ export class WorkflowDetail extends BtrixElement {
17021706
message: pause ? msg("Pausing crawl.") : msg("Resuming paused crawl."),
17031707
variant: "success",
17041708
icon: "check2-circle",
1705-
id: "crawl-pause-unpause-status",
1709+
id: "crawl-pause-resume-status",
17061710
});
17071711
} catch {
17081712
this.notify.toast({
@@ -1711,7 +1715,7 @@ export class WorkflowDetail extends BtrixElement {
17111715
: msg("Something went wrong, couldn't resume paused crawl."),
17121716
variant: "danger",
17131717
icon: "exclamation-octagon",
1714-
id: "crawl-pause-unpause-status",
1718+
id: "crawl-pause-resume-status",
17151719
});
17161720
}
17171721
}

0 commit comments

Comments
 (0)