parent
9de1a3a003
commit
d7c0877403
@ -383,9 +383,7 @@ export class App extends LiteElement {
|
||||
.userInfo=${this.userInfo}
|
||||
.viewStateData=${this.viewState.data}
|
||||
archiveId=${this.viewState.params.id}
|
||||
archiveTab=${this.viewState.params.crawlConfigId
|
||||
? "crawl-templates"
|
||||
: (this.viewState.params.tab as ArchiveTab)}
|
||||
archiveTab=${this.viewState.params.tab as ArchiveTab}
|
||||
crawlConfigId=${this.viewState.params.crawlConfigId}
|
||||
crawlId=${this.viewState.params.crawlId}
|
||||
?isAddingMember=${this.viewState.route === "archiveAddMember"}
|
||||
@ -480,6 +478,9 @@ export class App extends LiteElement {
|
||||
event.stopPropagation();
|
||||
|
||||
this.navigate(event.detail.url, event.detail.state);
|
||||
|
||||
// Scroll to top of page
|
||||
window.scrollTo({ top: 0 });
|
||||
}
|
||||
|
||||
onUserInfoChange(event: CustomEvent<Partial<CurrentUser>>) {
|
||||
|
@ -153,7 +153,7 @@ export class CrawlDetail extends LiteElement {
|
||||
? html`
|
||||
<a
|
||||
class="font-medium hover:underline"
|
||||
href=${`/archives/${this.archiveId}/crawl-templates/${this.crawl.cid}`}
|
||||
href=${`/archives/${this.archiveId}/crawl-templates/config/${this.crawl.cid}`}
|
||||
@click=${this.navLink}
|
||||
>${this.crawl.configName}</a
|
||||
>
|
||||
|
@ -218,9 +218,11 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
? html`
|
||||
<sl-button
|
||||
size="small"
|
||||
href=${`/archives/${this.archiveId}/crawl-templates/${
|
||||
this.crawlTemplate.id
|
||||
}${this.isEditing ? "" : "?edit=true"}`}
|
||||
href=${`/archives/${
|
||||
this.archiveId
|
||||
}/crawl-templates/config/${this.crawlTemplate.id}${
|
||||
this.isEditing ? "" : "?edit=true"
|
||||
}`}
|
||||
@click=${(e: any) => {
|
||||
const hasChanges =
|
||||
this.isEditing && this.editedSchedule;
|
||||
@ -470,7 +472,9 @@ export class CrawlTemplatesDetail extends LiteElement {
|
||||
});
|
||||
|
||||
this.navTo(
|
||||
`/archives/${this.archiveId}/crawl-templates/${this.crawlTemplate!.id}`
|
||||
`/archives/${this.archiveId}/crawl-templates/config/${
|
||||
this.crawlTemplate!.id
|
||||
}`
|
||||
);
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
|
@ -95,13 +95,13 @@ export class CrawlTemplatesList extends LiteElement {
|
||||
role="button"
|
||||
@click=${() => {
|
||||
this.navTo(
|
||||
`/archives/${this.archiveId}/crawl-templates/${t.id}`
|
||||
`/archives/${this.archiveId}/crawl-templates/config/${t.id}`
|
||||
);
|
||||
}}
|
||||
>
|
||||
<header class="flex">
|
||||
<a
|
||||
href=${`/archives/${this.archiveId}/crawl-templates/${t.id}`}
|
||||
href=${`/archives/${this.archiveId}/crawl-templates/config/${t.id}`}
|
||||
class="block flex-1 px-3 pt-3 font-medium whitespace-nowrap truncate mb-1"
|
||||
title=${t.name}
|
||||
@click=${(e: any) => {
|
||||
|
@ -412,7 +412,7 @@ export class CrawlsList extends LiteElement {
|
||||
role="menuitem"
|
||||
@click=${(e: any) => {
|
||||
this.navTo(
|
||||
`/archives/${this.archiveId}/crawl-templates/${crawl.cid}`
|
||||
`/archives/${this.archiveId}/crawl-templates/config/${crawl.cid}`
|
||||
);
|
||||
}}
|
||||
>
|
||||
|
@ -89,6 +89,29 @@ export class Archive extends LiteElement {
|
||||
|
||||
const showMembersTab = Boolean(this.archive.users);
|
||||
|
||||
let tabPanelContent = "" as any;
|
||||
|
||||
switch (this.archiveTab) {
|
||||
case "crawls":
|
||||
tabPanelContent = this.renderCrawls();
|
||||
break;
|
||||
case "crawl-templates":
|
||||
tabPanelContent = this.renderCrawlTemplates();
|
||||
break;
|
||||
case "members":
|
||||
if (this.isAddingMember) {
|
||||
tabPanelContent = this.renderAddMember();
|
||||
} else {
|
||||
tabPanelContent = this.renderMembers();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
tabPanelContent = html`<btrix-not-found
|
||||
class="flex items-center justify-center"
|
||||
></btrix-not-found>`;
|
||||
break;
|
||||
}
|
||||
|
||||
return html`<article class="grid gap-4">
|
||||
<nav class="font-medium text-sm text-gray-500">
|
||||
<a
|
||||
@ -102,56 +125,47 @@ export class Archive extends LiteElement {
|
||||
</nav>
|
||||
|
||||
<main>
|
||||
<sl-tab-group @sl-tab-show=${this.updateUrl}>
|
||||
<sl-tab
|
||||
slot="nav"
|
||||
panel="crawls"
|
||||
?active=${this.archiveTab === "crawls"}
|
||||
@click=${() => this.navTo(`/archives/${this.archiveId}/crawls`)}
|
||||
>${msg("Crawls")}
|
||||
</sl-tab>
|
||||
<sl-tab
|
||||
slot="nav"
|
||||
panel="crawl-templates"
|
||||
?active=${this.archiveTab === "crawl-templates"}
|
||||
@click=${() =>
|
||||
this.navTo(`/archives/${this.archiveId}/crawl-templates`)}
|
||||
>${msg("Crawl Templates")}
|
||||
</sl-tab>
|
||||
<nav class="flex items-end overflow-x-auto">
|
||||
${this.renderNavTab({ tabName: "crawls", label: msg("Crawls") })}
|
||||
${this.renderNavTab({
|
||||
tabName: "crawl-templates",
|
||||
label: msg("Crawl Templates"),
|
||||
})}
|
||||
${showMembersTab
|
||||
? html`<sl-tab
|
||||
slot="nav"
|
||||
panel="members"
|
||||
?active=${this.archiveTab === "members"}
|
||||
>${msg("Members")}</sl-tab
|
||||
>`
|
||||
? this.renderNavTab({ tabName: "members", label: msg("Members") })
|
||||
: ""}
|
||||
<hr class="flex-1 border-t-2" />
|
||||
</nav>
|
||||
|
||||
<sl-tab-panel name="crawls" ?active=${this.archiveTab === "crawls"}
|
||||
>${this.renderCrawls()}</sl-tab-panel
|
||||
>
|
||||
<sl-tab-panel
|
||||
name="crawl-templates"
|
||||
?active=${this.archiveTab === "crawl-templates"}
|
||||
>${this.renderCrawlTemplates()}</sl-tab-panel
|
||||
>
|
||||
${showMembersTab
|
||||
? html`<sl-tab-panel
|
||||
name="members"
|
||||
?active=${this.archiveTab === "members"}
|
||||
>
|
||||
${this.isAddingMember
|
||||
? this.renderAddMember()
|
||||
: this.renderMembers()}
|
||||
</sl-tab-panel>`
|
||||
: ""}
|
||||
</sl-tab-group>
|
||||
<div class="my-5" aria-labelledby="${this.archiveTab}-tab">
|
||||
${tabPanelContent}
|
||||
</div>
|
||||
</main>
|
||||
</article>`;
|
||||
}
|
||||
|
||||
private renderSettings() {
|
||||
return html` TODO `;
|
||||
private renderNavTab({
|
||||
tabName,
|
||||
label,
|
||||
}: {
|
||||
tabName: ArchiveTab;
|
||||
label: string;
|
||||
}) {
|
||||
const isActive = this.archiveTab === tabName;
|
||||
|
||||
return html`
|
||||
<a
|
||||
id="${tabName}-tab"
|
||||
class="block flex-shrink-0 text-sm font-medium p-3 md:px-5 border-b-2 transition-colors ${isActive
|
||||
? "border-primary text-primary"
|
||||
: "text-0-600"}"
|
||||
href=${`/archives/${this.archiveId}/${tabName}`}
|
||||
aria-selected=${isActive}
|
||||
@click=${this.navLink}
|
||||
>
|
||||
${label}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
private renderCrawls() {
|
||||
|
@ -15,8 +15,8 @@ export const ROUTES = {
|
||||
archiveNewResourceTab: "/archives/:id/:tab/new",
|
||||
archiveAddMember: "/archives/:id/:tab/add-member",
|
||||
crawl: "/archives/:id/:tab/crawl/:crawlId",
|
||||
crawlTemplate: "/archives/:id/crawl-templates/:crawlConfigId",
|
||||
crawlTemplateEdit: "/archives/:id/crawl-templates/:crawlConfigId?edit",
|
||||
crawlTemplate: "/archives/:id/:tab/config/:crawlConfigId",
|
||||
crawlTemplateEdit: "/archives/:id/:tab/config/:crawlConfigId?edit",
|
||||
users: "/users",
|
||||
usersInvite: "/users/invite",
|
||||
} as const;
|
||||
|
Loading…
Reference in New Issue
Block a user