@@ -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