web/admin: add sync status refresh button (#13678)
* web/admin: add refresh button to sync status card Signed-off-by: Jens Langhammer <jens@goauthentik.io> * auto-expand if there's just one task Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -11,6 +11,7 @@ import { msg } from "@lit/localize"; | |||||||
| import { CSSResult, TemplateResult, css, html } from "lit"; | import { CSSResult, TemplateResult, css, html } from "lit"; | ||||||
| import { customElement, property, state } from "lit/decorators.js"; | import { customElement, property, state } from "lit/decorators.js"; | ||||||
|  |  | ||||||
|  | import PFButton from "@patternfly/patternfly/components/Button/button.css"; | ||||||
| import PFCard from "@patternfly/patternfly/components/Card/card.css"; | import PFCard from "@patternfly/patternfly/components/Card/card.css"; | ||||||
| import PFTable from "@patternfly/patternfly/components/Table/table.css"; | import PFTable from "@patternfly/patternfly/components/Table/table.css"; | ||||||
| import PFBase from "@patternfly/patternfly/patternfly-base.css"; | import PFBase from "@patternfly/patternfly/patternfly-base.css"; | ||||||
| @ -34,6 +35,9 @@ export class SyncStatusTable extends Table<SystemTask> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     async apiEndpoint(): Promise<PaginatedResponse<SystemTask>> { |     async apiEndpoint(): Promise<PaginatedResponse<SystemTask>> { | ||||||
|  |         if (this.tasks.length === 1) { | ||||||
|  |             this.expandedElements = this.tasks; | ||||||
|  |         } | ||||||
|         return { |         return { | ||||||
|             pagination: { |             pagination: { | ||||||
|                 next: 0, |                 next: 0, | ||||||
| @ -104,7 +108,7 @@ export class SyncStatusCard extends AKElement { | |||||||
|     triggerSync!: () => Promise<unknown>; |     triggerSync!: () => Promise<unknown>; | ||||||
|  |  | ||||||
|     static get styles(): CSSResult[] { |     static get styles(): CSSResult[] { | ||||||
|         return [PFBase, PFCard, PFTable]; |         return [PFBase, PFButton, PFCard, PFTable]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     firstUpdated() { |     firstUpdated() { | ||||||
| @ -133,7 +137,20 @@ export class SyncStatusCard extends AKElement { | |||||||
|  |  | ||||||
|     render(): TemplateResult { |     render(): TemplateResult { | ||||||
|         return html`<div class="pf-c-card"> |         return html`<div class="pf-c-card"> | ||||||
|  |             <div class="pf-c-card__header"> | ||||||
|  |                 <div class="pf-c-card__actions"> | ||||||
|  |                     <button | ||||||
|  |                         class="pf-c-button pf-m-plain" | ||||||
|  |                         type="button" | ||||||
|  |                         @click=${() => { | ||||||
|  |                             this.fetch(); | ||||||
|  |                         }} | ||||||
|  |                     > | ||||||
|  |                         <i class="fa fa-sync"></i> | ||||||
|  |                     </button> | ||||||
|  |                 </div> | ||||||
|                 <div class="pf-c-card__title">${msg("Sync status")}</div> |                 <div class="pf-c-card__title">${msg("Sync status")}</div> | ||||||
|  |             </div> | ||||||
|             <div class="pf-c-card__body">${this.renderSyncStatus()}</div> |             <div class="pf-c-card__body">${this.renderSyncStatus()}</div> | ||||||
|             <div class="pf-c-card__footer"> |             <div class="pf-c-card__footer"> | ||||||
|                 <ak-action-button |                 <ak-action-button | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Jens L.
					Jens L.