11import { localized , msg , str } from "@lit/localize" ;
22import type { SlSelect } from "@shoelace-style/shoelace" ;
3- import { html , type PropertyValues , type TemplateResult } from "lit" ;
3+ import { html , nothing , type PropertyValues , type TemplateResult } from "lit" ;
44import { customElement , property , state } from "lit/decorators.js" ;
55import { choose } from "lit/directives/choose.js" ;
66import { ifDefined } from "lit/directives/if-defined.js" ;
@@ -646,25 +646,7 @@ export class WorkflowDetail extends BtrixElement {
646646 </sl-button>
647647 </sl-button-group>
648648 ` ,
649- ( ) => html `
650- <sl-tooltip
651- content=${ msg (
652- "Org Storage Full or Monthly Execution Minutes Reached" ,
653- ) }
654- ?disabled=${ ! this . org ?. storageQuotaReached &&
655- ! this . org ?. execMinutesQuotaReached }
656- >
657- <sl-button
658- size="small"
659- variant="primary"
660- ?disabled=${ archivingDisabled }
661- @click=${ ( ) => void this . runNow ( ) }
662- >
663- <sl-icon name="play" slot="prefix"></sl-icon>
664- <span>${ msg ( "Run Crawl" ) } </span>
665- </sl-button>
666- </sl-tooltip>
667- ` ,
649+ this . renderRunNowButton ,
668650 ) }
669651
670652 <sl-dropdown placement="bottom-end" distance="4" hoist>
@@ -1097,23 +1079,25 @@ export class WorkflowDetail extends BtrixElement {
10971079 ></sl-icon>
10981080 ${ msg ( "Replay Latest Crawl" ) } </sl-button
10991081 >
1082+
1083+ ${ when (
1084+ this . isCrawler ,
1085+ ( ) =>
1086+ html ` <sl-button
1087+ href=${ `${ this . navigate . orgBasePath } /workflows/${ workflow . id } /crawls/${ workflow . lastCrawlId } #qa` }
1088+ size="small"
1089+ @click=${ this . navigate . link }
1090+ >
1091+ <sl-icon
1092+ slot="prefix"
1093+ name="clipboard2-data-fill"
1094+ library="default"
1095+ ></sl-icon>
1096+ ${ msg ( "QA Latest Crawl" ) }
1097+ </sl-button>` ,
1098+ ) }
11001099 ` ,
1101- ) }
1102- ${ when (
1103- this . isCrawler && this . workflow ,
1104- ( workflow ) =>
1105- html ` <sl-button
1106- href=${ `${ this . navigate . orgBasePath } /workflows/${ workflow . id } /crawls/${ workflow . lastCrawlId } #qa` }
1107- size="small"
1108- @click=${ this . navigate . link }
1109- >
1110- <sl-icon
1111- slot="prefix"
1112- name="clipboard2-data-fill"
1113- library="default"
1114- ></sl-icon>
1115- ${ msg ( "QA Latest Crawl" ) }
1116- </sl-button>` ,
1100+ ( ) => ( this . isCrawler ? this . renderRunNowButton ( ) : nothing ) ,
11171101 ) }
11181102 </div>
11191103 </section>
@@ -1161,6 +1145,27 @@ export class WorkflowDetail extends BtrixElement {
11611145 ` ;
11621146 }
11631147
1148+ private readonly renderRunNowButton = ( ) => {
1149+ return html `
1150+ <sl-tooltip
1151+ content=${ msg ( "Org Storage Full or Monthly Execution Minutes Reached" ) }
1152+ ?disabled=${ ! this . org ?. storageQuotaReached &&
1153+ ! this . org ?. execMinutesQuotaReached }
1154+ >
1155+ <sl-button
1156+ size="small"
1157+ variant="primary"
1158+ ?disabled=${ this . org ?. storageQuotaReached ||
1159+ this . org ?. execMinutesQuotaReached }
1160+ @click=${ ( ) => void this . runNow ( ) }
1161+ >
1162+ <sl-icon name="play" slot="prefix"></sl-icon>
1163+ ${ msg ( "Run Crawl" ) }
1164+ </sl-button>
1165+ </sl-tooltip>
1166+ ` ;
1167+ } ;
1168+
11641169 private renderNoCrawlLogs ( ) {
11651170 return html `
11661171 <section
@@ -1169,26 +1174,10 @@ export class WorkflowDetail extends BtrixElement {
11691174 <p class="text-base font-medium">
11701175 ${ msg ( "Logs will show here after you run a crawl." ) }
11711176 </p>
1172- <div class="mt-4">
1173- <sl-tooltip
1174- content=${ msg (
1175- "Org Storage Full or Monthly Execution Minutes Reached" ,
1176- ) }
1177- ?disabled=${ ! this . org ?. storageQuotaReached &&
1178- ! this . org ?. execMinutesQuotaReached }
1179- >
1180- <sl-button
1181- size="small"
1182- variant="primary"
1183- ?disabled=${ this . org ?. storageQuotaReached ||
1184- this . org ?. execMinutesQuotaReached }
1185- @click=${ ( ) => void this . runNow ( ) }
1186- >
1187- <sl-icon name="play" slot="prefix"></sl-icon>
1188- ${ msg ( "Run Crawl" ) }
1189- </sl-button>
1190- </sl-tooltip>
1191- </div>
1177+ ${ when (
1178+ this . isCrawler ,
1179+ ( ) => html ` <div class="mt-4">${ this . renderRunNowButton ( ) } </div> ` ,
1180+ ) }
11921181 </section>
11931182 ` ;
11941183 }
0 commit comments