Frontend more upload path fixes (#961)

* additional fixes for #935:
- don't use artifactType for detail pages, ensure correct artifact selected based on path

* naming tweaks:
- from uploads detail, return to 'All Uploads' with filter
- from crawls detail, return to 'All Crawls' with filter
- rename general to 'All Archived Data'
This commit is contained in:
Ilya Kreymer 2023-07-07 15:41:03 -07:00 committed by GitHub
parent 478719d59a
commit 8eeb66e11f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 9 deletions

View File

@ -226,9 +226,9 @@ export class CrawlListItem extends LitElement {
return html`<a return html`<a
class="item row" class="item row"
role="button" role="button"
href=${`${this.baseUrl || `/orgs/${this.crawl?.oid}/artifacts/${typePath}`}/${ href="${this.baseUrl || `/orgs/${this.crawl?.oid}/artifacts/${typePath}`}/${
this.crawl?.id this.crawl?.id
}?artifactType=${artifactType}${hash}`} }"
@click=${async (e: MouseEvent) => { @click=${async (e: MouseEvent) => {
e.preventDefault(); e.preventDefault();
await this.updateComplete; await this.updateComplete;

View File

@ -235,7 +235,7 @@ export class CrawlDetail extends LiteElement {
<div class="mb-7"> <div class="mb-7">
<a <a
class="text-neutral-500 hover:text-neutral-600 text-sm font-medium" class="text-neutral-500 hover:text-neutral-600 text-sm font-medium"
href=${this.crawlsBaseUrl} href="${this.crawlsBaseUrl}?artifactType=${this.crawl?.type}"
@click=${this.navLink} @click=${this.navLink}
> >
<sl-icon <sl-icon
@ -245,7 +245,9 @@ export class CrawlDetail extends LiteElement {
<span class="inline-block align-middle" <span class="inline-block align-middle"
>${isWorkflowArtifact >${isWorkflowArtifact
? msg("Back to Crawl Workflow") ? msg("Back to Crawl Workflow")
: msg("Back to Archived Data")}</span : (this.crawl?.type === "upload" ?
msg("Back to All Uploads") : msg("Back to All Crawls"))
}</span
> >
</a> </a>
</div> </div>

View File

@ -270,7 +270,7 @@ export class CrawlsList extends LiteElement {
<main> <main>
<header class="contents"> <header class="contents">
<div class="flex w-full pb-3 mb-3 border-b"> <div class="flex w-full pb-3 mb-3 border-b">
<h1 class="text-xl font-semibold h-8">${msg("Archived Data")}</h1> <h1 class="text-xl font-semibold h-8">${msg("All Archived Data")}</h1>
</div> </div>
<div class="flex gap-2 mb-3"> <div class="flex gap-2 mb-3">
${listTypes.map(({ label, artifactType, icon }) => { ${listTypes.map(({ label, artifactType, icon }) => {
@ -579,7 +579,7 @@ export class CrawlsList extends LiteElement {
() => html` () => html`
<sl-menu-item <sl-menu-item
@click=${() => @click=${() =>
this.navTo(`/orgs/${crawl.oid}/artifacts/crawl/${crawl.id}`)} this.navTo(`/orgs/${crawl.oid}/artifacts/${crawl.type === "upload" ? "upload" : "crawl"}/${crawl.id}`)}
> >
${msg("View Crawl Details")} ${msg("View Crawl Details")}
</sl-menu-item> </sl-menu-item>

View File

@ -178,7 +178,7 @@ export class Org extends LiteElement {
})} })}
${this.renderNavTab({ ${this.renderNavTab({
tabName: "artifacts", tabName: "artifacts",
label: msg("Archived Data"), label: msg("All Archived Data"),
path: "artifacts/crawls", path: "artifacts/crawls",
})} })}
${this.renderNavTab({ ${this.renderNavTab({
@ -239,6 +239,8 @@ export class Org extends LiteElement {
const crawlsAPIBaseUrl = `/orgs/${this.orgId}/crawls`; const crawlsAPIBaseUrl = `/orgs/${this.orgId}/crawls`;
const crawlsBaseUrl = `/orgs/${this.orgId}/artifacts/crawls`; const crawlsBaseUrl = `/orgs/${this.orgId}/artifacts/crawls`;
const artifactType = this.orgPath.includes("/artifacts/upload") ? "upload" : "crawl";
if (this.params.crawlOrWorkflowId) { if (this.params.crawlOrWorkflowId) {
return html` <btrix-crawl-detail return html` <btrix-crawl-detail
.authState=${this.authState!} .authState=${this.authState!}
@ -246,7 +248,7 @@ export class Org extends LiteElement {
crawlId=${this.params.crawlOrWorkflowId} crawlId=${this.params.crawlOrWorkflowId}
crawlsAPIBaseUrl=${crawlsAPIBaseUrl} crawlsAPIBaseUrl=${crawlsAPIBaseUrl}
crawlsBaseUrl=${crawlsBaseUrl} crawlsBaseUrl=${crawlsBaseUrl}
artifactType=${this.params.artifactType || "crawl"} artifactType=${artifactType || "crawl"}
?isCrawler=${this.isCrawler} ?isCrawler=${this.isCrawler}
></btrix-crawl-detail>`; ></btrix-crawl-detail>`;
} }

View File

@ -781,7 +781,7 @@ export class WorkflowDetail extends LiteElement {
pill pill
multiple multiple
max-options-visible="1" max-options-visible="1"
placeholder=${msg("Archived Data")} placeholder=${msg("All Crawls")}
@sl-change=${async (e: CustomEvent) => { @sl-change=${async (e: CustomEvent) => {
const value = (e.target as SlSelect).value as CrawlState[]; const value = (e.target as SlSelect).value as CrawlState[];
await this.updateComplete; await this.updateComplete;