From f90ef071de06182f670311e48b669c46057f1873 Mon Sep 17 00:00:00 2001 From: sua yoo Date: Mon, 11 Apr 2022 13:00:17 -0700 Subject: [PATCH] enable opening crawl in new tab --- frontend/src/pages/archive/crawls-list.ts | 402 +++++++++++----------- frontend/src/utils/LiteElement.ts | 6 +- 2 files changed, 201 insertions(+), 207 deletions(-) diff --git a/frontend/src/pages/archive/crawls-list.ts b/frontend/src/pages/archive/crawls-list.ts index 90f889de..f3d804b6 100644 --- a/frontend/src/pages/archive/crawls-list.ts +++ b/frontend/src/pages/archive/crawls-list.ts @@ -248,215 +248,207 @@ export class CrawlsList extends LiteElement { } private renderCrawlItem = ({ item: crawl }: CrawlSearchResult) => { - return html`
  • this.navTo(`${this.crawlsBaseUrl}/crawl/${crawl.id}`)} - title=${crawl.configName || crawl.cid} - > -
  • + +
    +
    ${crawl.configName || crawl.cid}
    +
    + +
    -
    - -
    - -
    - e.stopPropagation()}> - +
    + e.preventDefault()}> + - - -
    -
    -
    - - - ● - -
    -
    -
    - ${crawl.state.replace(/_/g, " ")} -
    -
    - ${crawl.finished - ? html` - - ` - : html``} -
    -
    -
    -
    - ${crawl.finished - ? html` -
    - - - - - (${crawl.fileCount === 1 - ? msg(str`${crawl.fileCount} file`) - : msg(str`${crawl.fileCount} files`)}) - -
    -
    - ${msg( - str`in ${RelativeDuration.humanize( - new Date(`${crawl.finished}Z`).valueOf() - - new Date(`${crawl.started}Z`).valueOf() - )}` - )} -
    - ` - : crawl.stats - ? html` -
  • + +
    + ` + : ""} + + + + + +
    +
    + + + ● + +
    +
    +
    + ${crawl.state.replace(/_/g, " ")} +
    +
    + ${crawl.finished + ? html` + + ` + : html``} +
    +
    +
    +
    + ${crawl.finished + ? html` +
    + + + + + (${crawl.fileCount === 1 + ? msg(str`${crawl.fileCount} file`) + : msg(str`${crawl.fileCount} files`)}) + +
    +
    + ${msg( + str`in ${RelativeDuration.humanize( + new Date(`${crawl.finished}Z`).valueOf() - + new Date(`${crawl.started}Z`).valueOf() + )}` + )} +
    + ` + : crawl.stats + ? html` +
    -
    -
    - ${msg(str`by ${crawl.userName || crawl.userid}`)} -
    - ` - : html` -
    - ${msg("Scheduled Run")} -
    - `} -
    + ${this.numberFormatter.format(+crawl.stats.done)} + / + ${this.numberFormatter.format(+crawl.stats.found)} + +
    + ${msg("pages crawled")} +
    + ` + : ""} + +
    + ${crawl.manual + ? html` +
    + ${msg("Manual Start")} +
    +
    + ${msg(str`by ${crawl.userName || crawl.userid}`)} +
    + ` + : html` +
    + ${msg("Scheduled Run")} +
    + `} +
    +
    `; }; diff --git a/frontend/src/utils/LiteElement.ts b/frontend/src/utils/LiteElement.ts index 4ffa86df..d0dd1cd2 100644 --- a/frontend/src/utils/LiteElement.ts +++ b/frontend/src/utils/LiteElement.ts @@ -66,12 +66,14 @@ export default class LiteElement extends LitElement { * @param event Click event */ navLink(event: MouseEvent, href?: string): void { - // Detect keypress for opening in a new tab if ( + // Detect keypress for opening in a new tab event.ctrlKey || event.shiftKey || event.metaKey || - (event.button && event.button == 1) + (event.button && event.button == 1) || + // Account for event prevented on anchor tag + event.defaultPrevented ) { return; }