2021-02-08 18:04:19 +00:00
|
|
|
import { gettext } from "django";
|
|
|
|
import { customElement, property } from "lit-element";
|
|
|
|
import { html, TemplateResult } from "lit-html";
|
2021-02-09 16:04:55 +00:00
|
|
|
import { AKResponse } from "../../api/Client";
|
2021-02-08 18:04:19 +00:00
|
|
|
import { Outpost } from "../../api/Outposts";
|
|
|
|
import { TableColumn } from "../../elements/table/Table";
|
|
|
|
import { TablePage } from "../../elements/table/TablePage";
|
|
|
|
|
|
|
|
import "./OutpostHealth";
|
|
|
|
import "../../elements/buttons/SpinnerButton";
|
|
|
|
import "../../elements/buttons/ModalButton";
|
2021-02-08 22:10:45 +00:00
|
|
|
import "../../elements/buttons/TokenCopyButton";
|
2021-02-08 18:04:19 +00:00
|
|
|
|
|
|
|
@customElement("ak-outpost-list")
|
|
|
|
export class OutpostListPage extends TablePage<Outpost> {
|
|
|
|
pageTitle(): string {
|
|
|
|
return "Outposts";
|
|
|
|
}
|
|
|
|
pageDescription(): string | undefined {
|
|
|
|
return "Outposts are deployments of authentik components to support different environments and protocols, like reverse proxies.";
|
|
|
|
}
|
|
|
|
pageIcon(): string {
|
|
|
|
return "pf-icon pf-icon-zone";
|
|
|
|
}
|
|
|
|
searchEnabled(): boolean {
|
|
|
|
return true;
|
|
|
|
}
|
2021-02-09 16:04:55 +00:00
|
|
|
apiEndpoint(page: number): Promise<AKResponse<Outpost>> {
|
2021-02-08 18:04:19 +00:00
|
|
|
return Outpost.list({
|
|
|
|
ordering: this.order,
|
|
|
|
page: page,
|
|
|
|
search: this.search || "",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
columns(): TableColumn[] {
|
|
|
|
return [
|
|
|
|
new TableColumn("Name", "name"),
|
|
|
|
new TableColumn("Providers"),
|
|
|
|
new TableColumn("Health and Version"),
|
|
|
|
new TableColumn(""),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
@property()
|
|
|
|
order = "name";
|
|
|
|
|
|
|
|
row(item: Outpost): TemplateResult[] {
|
|
|
|
return [
|
|
|
|
html`${item.name}`,
|
2021-02-08 18:51:46 +00:00
|
|
|
html`<ul>${item.providers_obj.map((p) => {
|
2021-02-19 18:29:17 +00:00
|
|
|
return html`<li><a href="#/core/providers/${p.pk}">${p.name}</a></li>`;
|
2021-02-08 18:04:19 +00:00
|
|
|
})}</ul>`,
|
|
|
|
html`<ak-outpost-health outpostId=${item.pk}></ak-outpost-health>`,
|
|
|
|
html`
|
2021-02-12 10:56:14 +00:00
|
|
|
<ak-modal-button href="${Outpost.adminUrl(`${item.pk}/update/`)}">
|
2021-02-08 18:04:19 +00:00
|
|
|
<ak-spinner-button slot="trigger" class="pf-m-secondary">
|
|
|
|
${gettext("Edit")}
|
|
|
|
</ak-spinner-button>
|
|
|
|
<div slot="modal"></div>
|
2021-02-09 08:57:59 +00:00
|
|
|
</ak-modal-button>
|
2021-02-12 10:56:14 +00:00
|
|
|
<ak-modal-button href="${Outpost.adminUrl(`${item.pk}/delete/`)}">
|
2021-02-08 18:04:19 +00:00
|
|
|
<ak-spinner-button slot="trigger" class="pf-m-danger">
|
|
|
|
${gettext("Delete")}
|
|
|
|
</ak-spinner-button>
|
|
|
|
<div slot="modal"></div>
|
2021-02-17 19:49:58 +00:00
|
|
|
</ak-modal-button>
|
2021-02-08 18:04:19 +00:00
|
|
|
<ak-modal-button>
|
|
|
|
<button slot="trigger" class="pf-c-button pf-m-tertiary">
|
2021-02-08 18:42:49 +00:00
|
|
|
${gettext("View Deployment Info")}
|
2021-02-08 18:04:19 +00:00
|
|
|
</button>
|
|
|
|
<div slot="modal">
|
|
|
|
<div class="pf-c-modal-box__header">
|
2021-02-08 18:42:49 +00:00
|
|
|
<h1 class="pf-c-title pf-m-2xl" id="modal-title">${gettext("Outpost Deployment Info")}</h1>
|
2021-02-08 18:04:19 +00:00
|
|
|
</div>
|
|
|
|
<div class="pf-c-modal-box__body" id="modal-description">
|
2021-02-08 18:42:49 +00:00
|
|
|
<p><a href="https://goauthentik.io/docs/outposts/outposts/#deploy">${gettext("View deployment documentation")}</a></p>
|
2021-02-08 18:04:19 +00:00
|
|
|
<form class="pf-c-form">
|
|
|
|
<div class="pf-c-form__group">
|
|
|
|
<label class="pf-c-form__label" for="help-text-simple-form-name">
|
|
|
|
<span class="pf-c-form__label-text">AUTHENTIK_HOST</span>
|
|
|
|
</label>
|
|
|
|
<input class="pf-c-form-control" readonly type="text" value="${document.location.toString()}" />
|
|
|
|
</div>
|
|
|
|
<div class="pf-c-form__group">
|
|
|
|
<label class="pf-c-form__label" for="help-text-simple-form-name">
|
|
|
|
<span class="pf-c-form__label-text">AUTHENTIK_TOKEN</span>
|
|
|
|
</label>
|
|
|
|
<div>
|
|
|
|
<ak-token-copy-button identifier="${item.token_identifier}">
|
2021-02-08 18:42:49 +00:00
|
|
|
${gettext("Click to copy token")}
|
2021-02-08 18:04:19 +00:00
|
|
|
</ak-token-copy-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-08 18:42:49 +00:00
|
|
|
<h3>${gettext("If your authentik Instance is using a self-signed certificate, set this value.")}</h3>
|
2021-02-08 18:04:19 +00:00
|
|
|
<div class="pf-c-form__group">
|
|
|
|
<label class="pf-c-form__label" for="help-text-simple-form-name">
|
|
|
|
<span class="pf-c-form__label-text">AUTHENTIK_INSECURE</span>
|
|
|
|
</label>
|
|
|
|
<input class="pf-c-form-control" readonly type="text" value="true" />
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<footer class="pf-c-modal-box__footer pf-m-align-left">
|
2021-02-08 18:42:49 +00:00
|
|
|
<a class="pf-c-button pf-m-primary">${gettext("Close")}</a>
|
2021-02-08 18:04:19 +00:00
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</ak-modal-button>`,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
renderToolbar(): TemplateResult {
|
|
|
|
return html`
|
|
|
|
<ak-modal-button href=${Outpost.adminUrl("create/")}>
|
|
|
|
<ak-spinner-button slot="trigger" class="pf-m-primary">
|
|
|
|
${gettext("Create")}
|
|
|
|
</ak-spinner-button>
|
|
|
|
<div slot="modal"></div>
|
|
|
|
</ak-modal-button>
|
|
|
|
${super.renderToolbar()}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|