${pageHeader({
title: msg("Crawl Workflows"),
actions: html`
${when(
this.appState.isAdmin,
() =>
html`
`,
)}
${when(
this.appState.isCrawler,
() => html`
this.navigate.to(
`${this.navigate.orgBasePath}/workflows/new`,
{
scopeType:
this.appState.userPreferences?.newWorkflowScopeType,
},
)}
>
${msg("New Workflow")}
{
const { value } = e.detail.item;
if (value) {
this.dispatchEvent(
new CustomEvent(
"select-job-type",
{
detail: value as SelectJobTypeEvent["detail"],
},
),
);
}
}}
>
${msg("Scope options")}
${msg("Page Crawl")}
${scopeTypeLabels[ScopeType.Page]}
${scopeTypeLabels[NewWorkflowOnlyScopeType.PageList]}
${scopeTypeLabels[ScopeType.SPA]}
${msg("Site Crawl")}
${scopeTypeLabels[ScopeType.Prefix]}
${scopeTypeLabels[ScopeType.Host]}
${scopeTypeLabels[ScopeType.Domain]}
${scopeTypeLabels[ScopeType.Custom]}
`,
)}
`,
classNames: tw`border-b-transparent`,
})}
${this.renderControls()}
${when(
this.fetchErrorStatusCode,
() => html`
${this.workflows
? this.workflows.total
? this.renderWorkflowList()
: this.renderEmptyState()
: this.renderLoading()}
`,
)}
${this.renderDialogs()}
`;
}
private renderDialogs() {
return html`
${when(
this.workflowToDelete,
(workflow) => html`
${this.renderSearch()}
{
const field = (e.target as HTMLSelectElement).value as SortField;
this.orderBy = {
field: field,
direction:
sortableFields[field].defaultDirection ||
this.orderBy.direction,
};
}}
>
${Object.entries(sortableFields).map(
([value, { label }]) => html`
${label}
`,
)}
{
this.orderBy = {
...this.orderBy,
direction: this.orderBy.direction === "asc" ? "desc" : "asc",
};
}}
>
${this.renderFilters()}
`;
}
private renderFilters() {
return html`