From d83756b4d990837b622d4dd28d674acd207a4ffa Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 4 Apr 2021 16:20:49 +0200 Subject: [PATCH] web/admin: use expandable for Task list Signed-off-by: Jens Langhammer --- .../pages/system-tasks/SystemTaskListPage.ts | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/web/src/pages/system-tasks/SystemTaskListPage.ts b/web/src/pages/system-tasks/SystemTaskListPage.ts index 1b818d1ad..4c875cd8e 100644 --- a/web/src/pages/system-tasks/SystemTaskListPage.ts +++ b/web/src/pages/system-tasks/SystemTaskListPage.ts @@ -1,7 +1,8 @@ import { t } from "@lingui/macro"; -import { customElement, html, property, TemplateResult } from "lit-element"; +import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { TablePage } from "../../elements/table/TablePage"; +import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css"; import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/ActionButton"; @@ -24,9 +25,15 @@ export class SystemTaskListPage extends TablePage { return "pf-icon pf-icon-automation"; } + expandable = true; + @property() order = "slug"; + static get styles(): CSSResult[] { + return super.styles.concat(PFDescriptionList); + } + apiEndpoint(page: number): Promise> { return new AdminApi(DEFAULT_CONFIG).adminSystemTasksList().then((tasks) => { return { @@ -48,7 +55,6 @@ export class SystemTaskListPage extends TablePage { new TableColumn("Description"), new TableColumn("Last run"), new TableColumn("Status"), - new TableColumn("Messages"), new TableColumn(""), ]; } @@ -66,15 +72,36 @@ export class SystemTaskListPage extends TablePage { } } + renderExpanded(item: Task): TemplateResult { + return html` + +
+
+
+
+ ${t`Messages`} +
+
+
+ ${item.messages.map(m => { + return html`
  • ${m}
  • `; + })} +
    +
    +
    +
    +
    + + + `; + } + row(item: Task): TemplateResult[] { return [ html`${item.taskName}`, html`${item.taskDescription}`, html`${item.taskFinishTimestamp.toLocaleString()}`, this.taskStatus(item), - html`${item.messages.map(m => { - return html`
  • ${m}
  • `; - })}`, html` { return new AdminApi(DEFAULT_CONFIG).adminSystemTasksRetry({