web: remove more until (#5057)
* more cleanup Signed-off-by: Jens Langhammer <jens@goauthentik.io> * don't dynamically import duo form Signed-off-by: Jens Langhammer <jens@goauthentik.io> * migrate more Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix import Signed-off-by: Jens Langhammer <jens@goauthentik.io> * properly send evens when tab isn't switched Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix loop on tabs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * migrate more Signed-off-by: Jens Langhammer <jens@goauthentik.io> * don't bubble tab events Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove most other uses of until() Signed-off-by: Jens Langhammer <jens@goauthentik.io> * cleanup user settings Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only use stale for issues Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -12,8 +12,7 @@ import "@goauthentik/elements/forms/ModalForm";
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { until } from "lit/directives/until.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";
|
||||
@ -24,7 +23,7 @@ import PFPage from "@patternfly/patternfly/components/Page/page.css";
|
||||
import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css";
|
||||
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
||||
|
||||
import { LDAPSource, SourcesApi, TaskStatusEnum } from "@goauthentik/api";
|
||||
import { LDAPSource, SourcesApi, Task, TaskStatusEnum } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-source-ldap-view")
|
||||
export class LDAPSourceViewPage extends AKElement {
|
||||
@ -42,6 +41,9 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
@property({ attribute: false })
|
||||
source!: LDAPSource;
|
||||
|
||||
@state()
|
||||
syncState: Task[] = [];
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return [PFBase, PFPage, PFButton, PFGrid, PFContent, PFCard, PFDescriptionList, PFList];
|
||||
}
|
||||
@ -63,6 +65,15 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
slot="page-overview"
|
||||
data-tab-title="${t`Overview`}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
@activate=${() => {
|
||||
new SourcesApi(DEFAULT_CONFIG)
|
||||
.sourcesLdapSyncStatusList({
|
||||
slug: this.source.slug,
|
||||
})
|
||||
.then((state) => {
|
||||
this.syncState = state;
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
@ -123,39 +134,31 @@ export class LDAPSourceViewPage extends AKElement {
|
||||
<p>${t`Sync status`}</p>
|
||||
</div>
|
||||
<div class="pf-c-card__body">
|
||||
${until(
|
||||
new SourcesApi(DEFAULT_CONFIG)
|
||||
.sourcesLdapSyncStatusList({
|
||||
slug: this.source.slug,
|
||||
})
|
||||
.then((tasks) => {
|
||||
if (tasks.length < 1) {
|
||||
return html`<p>${t`Not synced yet.`}</p>`;
|
||||
}
|
||||
return html`<ul class="pf-c-list">
|
||||
${tasks.map((task) => {
|
||||
let header = "";
|
||||
if (task.status === TaskStatusEnum.Warning) {
|
||||
header = t`Task finished with warnings`;
|
||||
} else if (task.status === TaskStatusEnum.Error) {
|
||||
header = t`Task finished with errors`;
|
||||
} else {
|
||||
header = t`Last sync: ${task.taskFinishTimestamp.toLocaleString()}`;
|
||||
}
|
||||
return html`<li>
|
||||
<p>${task.taskName}</p>
|
||||
<ul class="pf-c-list">
|
||||
<li>${header}</li>
|
||||
${task.messages.map((m) => {
|
||||
return html`<li>${m}</li>`;
|
||||
})}
|
||||
</ul>
|
||||
</li> `;
|
||||
})}
|
||||
</ul>`;
|
||||
}),
|
||||
"loading",
|
||||
)}
|
||||
${this.syncState.length < 1
|
||||
? html`<p>${t`Not synced yet.`}</p>`
|
||||
: html`
|
||||
<ul class="pf-c-list">
|
||||
${this.syncState.map((task) => {
|
||||
let header = "";
|
||||
if (task.status === TaskStatusEnum.Warning) {
|
||||
header = t`Task finished with warnings`;
|
||||
} else if (task.status === TaskStatusEnum.Error) {
|
||||
header = t`Task finished with errors`;
|
||||
} else {
|
||||
header = t`Last sync: ${task.taskFinishTimestamp.toLocaleString()}`;
|
||||
}
|
||||
return html`<li>
|
||||
<p>${task.taskName}</p>
|
||||
<ul class="pf-c-list">
|
||||
<li>${header}</li>
|
||||
${task.messages.map((m) => {
|
||||
return html`<li>${m}</li>`;
|
||||
})}
|
||||
</ul>
|
||||
</li> `;
|
||||
})}
|
||||
</ul>
|
||||
`}
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<ak-action-button
|
||||
|
||||
@ -12,9 +12,8 @@ import "@goauthentik/elements/forms/ModalForm";
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
import { until } from "lit/directives/until.js";
|
||||
|
||||
import PFButton from "@patternfly/patternfly/components/Button/button.css";
|
||||
import PFCard from "@patternfly/patternfly/components/Card/card.css";
|
||||
@ -24,7 +23,7 @@ import PFPage from "@patternfly/patternfly/components/Page/page.css";
|
||||
import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css";
|
||||
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
||||
|
||||
import { SAMLSource, SourcesApi } from "@goauthentik/api";
|
||||
import { SAMLMetadata, SAMLSource, SourcesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-source-saml-view")
|
||||
export class SAMLSourceViewPage extends AKElement {
|
||||
@ -42,6 +41,9 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
@property({ attribute: false })
|
||||
source?: SAMLSource;
|
||||
|
||||
@state()
|
||||
metadata?: SAMLMetadata;
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return [PFBase, PFPage, PFGrid, PFButton, PFContent, PFCard, PFDescriptionList];
|
||||
}
|
||||
@ -152,35 +154,34 @@ export class SAMLSourceViewPage extends AKElement {
|
||||
slot="page-metadata"
|
||||
data-tab-title="${t`Metadata`}"
|
||||
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
||||
@activate=${() => {
|
||||
new SourcesApi(DEFAULT_CONFIG)
|
||||
.sourcesSamlMetadataRetrieve({
|
||||
slug: this.source?.slug || "",
|
||||
})
|
||||
.then((metadata) => {
|
||||
this.metadata = metadata;
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col">
|
||||
${until(
|
||||
new SourcesApi(DEFAULT_CONFIG)
|
||||
.sourcesSamlMetadataRetrieve({
|
||||
slug: this.source.slug,
|
||||
})
|
||||
.then((m) => {
|
||||
return html`
|
||||
<div class="pf-c-card__body">
|
||||
<ak-codemirror
|
||||
mode="xml"
|
||||
?readOnly=${true}
|
||||
value="${ifDefined(m.metadata)}"
|
||||
></ak-codemirror>
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<a
|
||||
class="pf-c-button pf-m-primary"
|
||||
target="_blank"
|
||||
href=${ifDefined(m.downloadUrl)}
|
||||
>
|
||||
${t`Download`}
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}),
|
||||
)}
|
||||
<div class="pf-c-card__body">
|
||||
<ak-codemirror
|
||||
mode="xml"
|
||||
?readOnly=${true}
|
||||
value="${ifDefined(this.metadata?.metadata)}"
|
||||
></ak-codemirror>
|
||||
</div>
|
||||
<div class="pf-c-card__footer">
|
||||
<a
|
||||
class="pf-c-button pf-m-primary"
|
||||
target="_blank"
|
||||
href=${ifDefined(this.metadata?.downloadUrl)}
|
||||
>
|
||||
${t`Download`}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user