-
${msg("Browser Profiles")}
-
{
- this.dispatchEvent(
- new CustomEvent("select-new-dialog", {
- detail: "browser-profile",
- }) as SelectNewDialogEvent,
- );
- }}
- >
-
- ${msg("New Browser Profile")}
-
+
+
+ ${msg("Browser Profiles")}
+
+ ${when(
+ this.isCrawler,
+ () => html`
+ {
+ this.dispatchEvent(
+ new CustomEvent("select-new-dialog", {
+ detail: "browser-profile",
+ }) as SelectNewDialogEvent,
+ );
+ }}
+ >
+
+ ${msg("New Browser Profile")}
+
+ `,
+ )}
${this.renderTable()}
`;
@@ -65,17 +82,14 @@ export class BrowserProfilesList extends LiteElement {
private renderTable() {
return html`
-
- ${msg("Backed up status")}
-
-
+
${msg("Name")}
- ${msg("Date Created")}
+ ${msg("Last Updated")}
${msg("Visited URLs")}
@@ -84,21 +98,34 @@ export class BrowserProfilesList extends LiteElement {
${msg("Row Actions")}
- ${this.browserProfiles?.length
- ? html`
-
- ${this.browserProfiles.map(this.renderItem)}
-
- `
- : nothing}
+ ${when(this.browserProfiles, ({ total, items }) =>
+ total
+ ? html`
+
+ ${items.map(this.renderItem)}
+
+ `
+ : nothing,
+ )}
${when(
this.browserProfiles,
- (browserProfiles) =>
- browserProfiles.length
- ? nothing
+ ({ total, page, pageSize }) =>
+ total
+ ? html`
+
+ `
: html`
@@ -117,24 +144,12 @@ export class BrowserProfilesList extends LiteElement {
`;
private readonly renderItem = (data: Profile) => {
- const isBackedUp =
- data.resource?.replicas && data.resource.replicas.length > 0;
return html`
-
-
-
-
-
${data.name}
- ${data.description
- ? html``
- : nothing}
- ${data.origins.join(", ")}
+
+ ${data.origins[0]}${data.origins.length > 1
+ ? html`
+
+ ${msg(str`+${data.origins.length - 1}`)}
+
+ `
+ : nothing}
+
${this.renderActions(data)}
@@ -256,9 +282,7 @@ export class BrowserProfilesList extends LiteElement {
icon: "check2-circle",
});
- this.browserProfiles = this.browserProfiles!.filter(
- (p) => p.id !== profile.id,
- );
+ void this.fetchBrowserProfiles();
}
} catch (e) {
this.notify({
@@ -287,9 +311,17 @@ export class BrowserProfilesList extends LiteElement {
/**
* Fetch browser profiles and update internal state
*/
- private async fetchBrowserProfiles(): Promise {
+ private async fetchBrowserProfiles(
+ params?: APIPaginationQuery,
+ ): Promise {
try {
- const data = await this.getProfiles();
+ const data = await this.getProfiles({
+ page: params?.page || this.browserProfiles?.page || 1,
+ pageSize:
+ params?.pageSize ||
+ this.browserProfiles?.pageSize ||
+ INITIAL_PAGE_SIZE,
+ });
this.browserProfiles = data;
} catch (e) {
@@ -301,12 +333,16 @@ export class BrowserProfilesList extends LiteElement {
}
}
- private async getProfiles() {
+ private async getProfiles(params: APIPaginationQuery) {
+ const query = queryString.stringify(params, {
+ arrayFormat: "comma",
+ });
+
const data = await this.apiFetch>(
- `/orgs/${this.orgId}/profiles`,
+ `/orgs/${this.orgId}/profiles?${query}`,
this.authState!,
);
- return data.items;
+ return data;
}
}
diff --git a/frontend/src/pages/org/index.ts b/frontend/src/pages/org/index.ts
index ea1cf937..d7ba3583 100644
--- a/frontend/src/pages/org/index.ts
+++ b/frontend/src/pages/org/index.ts
@@ -659,6 +659,7 @@ export class Org extends LiteElement {
return html``;
}
diff --git a/frontend/src/types/crawler.ts b/frontend/src/types/crawler.ts
index 7f33009d..be965409 100644
--- a/frontend/src/types/crawler.ts
+++ b/frontend/src/types/crawler.ts
@@ -98,6 +98,9 @@ export type Profile = {
name: string;
description: string;
created: string;
+ createdByName: string | null;
+ modified: string | null;
+ modifiedByName: string | null;
origins: string[];
profileId: string;
baseProfileName: string;