@@ -184,26 +164,6 @@ export class CrawlTemplates extends LiteElement {
`;
}
- private renderList() {
- return html`
-
-
- this.navTo(`/archives/${this.archiveId}/crawl-templates/new`)}
- >
-
- ${msg("Create new crawl template")}
-
-
-
-
- ${this.crawlTemplates?.map(
- (template) => html`
${template.id}
`
- )}
-
- `;
- }
-
private renderBasicSettings() {
return html`
@@ -605,3 +565,5 @@ export class CrawlTemplates extends LiteElement {
return schedule;
}
}
+
+customElements.define("btrix-crawl-templates-new", CrawlTemplatesNew);
diff --git a/frontend/src/pages/archive/index.ts b/frontend/src/pages/archive/index.ts
index 6d8b4720..e9848d33 100644
--- a/frontend/src/pages/archive/index.ts
+++ b/frontend/src/pages/archive/index.ts
@@ -7,12 +7,11 @@ import type { ArchiveData } from "../../utils/archives";
import LiteElement, { html } from "../../utils/LiteElement";
import { needLogin } from "../../utils/auth";
import { isOwner } from "../../utils/archives";
-import { CrawlTemplates } from "./crawl-templates";
-
-customElements.define("btrix-crawl-templates", CrawlTemplates);
+import type { CrawlTemplate } from "./types";
+import "./crawl-templates-list";
+import "./crawl-templates-new";
export type ArchiveTab = "crawl-templates" | "settings" | "members";
-type CrawlTemplate = any; // TODO
const defaultTab = "settings";
@@ -153,16 +152,34 @@ export class Archive extends LiteElement {
}
private renderCrawlTemplates() {
- if (!this.isNewResourceTab && !this.crawlTemplates) {
- return html` TODO `;
+ if (this.isNewResourceTab) {
+ return html`
+
+ `;
}
- return html`
`;
+ >`;
}
private renderMembers() {
diff --git a/frontend/src/pages/archive/types.ts b/frontend/src/pages/archive/types.ts
new file mode 100644
index 00000000..a230f6ca
--- /dev/null
+++ b/frontend/src/pages/archive/types.ts
@@ -0,0 +1,12 @@
+export type CrawlTemplate = {
+ id?: string;
+ name: string;
+ schedule: string;
+ runNow: boolean;
+ crawlTimeout?: number;
+ config: {
+ seeds: string[];
+ scopeType?: string;
+ limit?: number;
+ };
+};