web/admin: show warning on provider when not used with outpost

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-05 01:05:43 +01:00
parent 909461e533
commit 3005ca17bd
9 changed files with 80 additions and 3 deletions

View File

@ -11,7 +11,7 @@ from authentik.providers.ldap.models import LDAPProvider
class LDAPProviderSerializer(ProviderSerializer):
"""LDAPProvider Serializer"""
outpost_set = ListField(child=CharField(), read_only=True)
outpost_set = ListField(child=CharField(), read_only=True, source="outpost_set.all")
class Meta:

View File

@ -36,7 +36,7 @@ class ProxyProviderSerializer(ProviderSerializer):
"""ProxyProvider Serializer"""
redirect_uris = CharField(read_only=True)
outpost_set = ListField(child=CharField(), read_only=True)
outpost_set = ListField(child=CharField(), read_only=True, source="outpost_set.all")
def validate(self, attrs) -> dict[Any, str]:
"""Check that internal_host is set when mode is Proxy"""

View File

@ -100,6 +100,7 @@ export class Tabs extends LitElement {
${pages.map((page) => this.renderTab(page))}
</ul>
</div>
<slot name="header"></slot>
<slot name="${ifDefined(this.currentPage)}"></slot>`;
}
}

View File

@ -5475,10 +5475,25 @@ msgstr "Wait (min)"
msgid "Warning"
msgstr "Warning"
#: src/pages/stages/invitation/InvitationListPage.ts
msgid "Warning: No invitation stage is bound to any flow. Invitations will not work as expected."
msgstr "Warning: No invitation stage is bound to any flow. Invitations will not work as expected."
#: src/pages/policies/PolicyListPage.ts
msgid "Warning: Policy is not assigned."
msgstr "Warning: Policy is not assigned."
#: src/pages/providers/ldap/LDAPProviderViewPage.ts
#: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts
#: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Warning: Provider is not used by an Application."
msgstr "Warning: Provider is not used by an Application."
#: src/pages/providers/ldap/LDAPProviderViewPage.ts
#: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Warning: Provider is not used by any Outpost."
msgstr "Warning: Provider is not used by any Outpost."
#: src/pages/providers/ProviderListPage.ts
msgid "Warning: Provider not assigned to any application."
msgstr "Warning: Provider not assigned to any application."

View File

@ -5414,10 +5414,25 @@ msgstr "Attente (min)"
msgid "Warning"
msgstr "Avertissement"
#: src/pages/stages/invitation/InvitationListPage.ts
msgid "Warning: No invitation stage is bound to any flow. Invitations will not work as expected."
msgstr ""
#: src/pages/policies/PolicyListPage.ts
msgid "Warning: Policy is not assigned."
msgstr "Avertissement : la politique n'est pas assignée."
#: src/pages/providers/ldap/LDAPProviderViewPage.ts
#: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts
#: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Warning: Provider is not used by an Application."
msgstr ""
#: src/pages/providers/ldap/LDAPProviderViewPage.ts
#: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Warning: Provider is not used by any Outpost."
msgstr ""
#: src/pages/providers/ProviderListPage.ts
msgid "Warning: Provider not assigned to any application."
msgstr "Avertissement : le fournisseur n'est assigné à aucune application."

View File

@ -5460,10 +5460,25 @@ msgstr ""
msgid "Warning"
msgstr ""
#: src/pages/stages/invitation/InvitationListPage.ts
msgid "Warning: No invitation stage is bound to any flow. Invitations will not work as expected."
msgstr ""
#: src/pages/policies/PolicyListPage.ts
msgid "Warning: Policy is not assigned."
msgstr ""
#: src/pages/providers/ldap/LDAPProviderViewPage.ts
#: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts
#: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Warning: Provider is not used by an Application."
msgstr ""
#: src/pages/providers/ldap/LDAPProviderViewPage.ts
#: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Warning: Provider is not used by any Outpost."
msgstr ""
#: src/pages/providers/ProviderListPage.ts
msgid "Warning: Provider not assigned to any application."
msgstr ""

View File

@ -4,6 +4,7 @@ import { CSSResult, LitElement, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import AKGlobal from "../../../authentik.css";
import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";
import PFButton from "@patternfly/patternfly/components/Button/button.css";
import PFCard from "@patternfly/patternfly/components/Card/card.css";
import PFContent from "@patternfly/patternfly/components/Content/content.css";
@ -58,6 +59,7 @@ export class LDAPProviderViewPage extends LitElement {
PFCard,
PFDescriptionList,
PFSizing,
PFBanner,
AKGlobal,
];
}
@ -75,6 +77,16 @@ export class LDAPProviderViewPage extends LitElement {
return html``;
}
return html`<ak-tabs>
${this.provider?.assignedApplicationName
? html``
: html`<div slot="header" class="pf-c-banner pf-m-warning">
${t`Warning: Provider is not used by an Application.`}
</div>`}
${this.provider?.outpostSet.length < 1
? html`<div slot="header" class="pf-c-banner pf-m-warning">
${t`Warning: Provider is not used by any Outpost.`}
</div>`
: html``}
<section
slot="page-overview"
data-tab-title="${t`Overview`}"

View File

@ -4,6 +4,7 @@ import { CSSResult, LitElement, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import AKGlobal from "../../../authentik.css";
import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";
import PFButton from "@patternfly/patternfly/components/Button/button.css";
import PFCard from "@patternfly/patternfly/components/Card/card.css";
import PFContent from "@patternfly/patternfly/components/Content/content.css";
@ -67,6 +68,7 @@ export class OAuth2ProviderViewPage extends LitElement {
PFSizing,
PFForm,
PFFormControl,
PFBanner,
AKGlobal,
];
}
@ -84,6 +86,11 @@ export class OAuth2ProviderViewPage extends LitElement {
return html``;
}
return html`<ak-tabs>
${this.provider?.assignedApplicationName
? html``
: html`<div slot="header" class="pf-c-banner pf-m-warning">
${t`Warning: Provider is not used by an Application.`}
</div>`}
<section
slot="page-overview"
data-tab-title="${t`Overview`}"

View File

@ -4,6 +4,7 @@ import { CSSResult, LitElement, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import AKGlobal from "../../../authentik.css";
import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";
import PFButton from "@patternfly/patternfly/components/Button/button.css";
import PFCard from "@patternfly/patternfly/components/Card/card.css";
import PFContent from "@patternfly/patternfly/components/Content/content.css";
@ -55,6 +56,7 @@ export class ProxyProviderViewPage extends LitElement {
PFContent,
PFCard,
PFDescriptionList,
PFBanner,
AKGlobal,
];
}
@ -71,7 +73,17 @@ export class ProxyProviderViewPage extends LitElement {
if (!this.provider) {
return html``;
}
return html`<ak-tabs>
return html` <ak-tabs>
${this.provider?.assignedApplicationName
? html``
: html`<div slot="header" class="pf-c-banner pf-m-warning">
${t`Warning: Provider is not used by an Application.`}
</div>`}
${this.provider?.outpostSet.length < 1
? html`<div slot="header" class="pf-c-banner pf-m-warning">
${t`Warning: Provider is not used by any Outpost.`}
</div>`
: html``}
<section
slot="page-overview"
data-tab-title="${t`Overview`}"