core: make application.meta_icon nullable

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

#949
This commit is contained in:
Jens Langhammer 2021-06-05 21:06:52 +02:00
parent d38f944435
commit 277c2f4aad
6 changed files with 54 additions and 9 deletions

View File

@ -0,0 +1,20 @@
# Generated by Django 3.2.3 on 2021-06-05 19:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("authentik_core", "0024_alter_token_identifier"),
]
operations = [
migrations.AlterField(
model_name="application",
name="meta_icon",
field=models.FileField(
default=None, null=True, upload_to="application-icons/"
),
),
]

View File

@ -220,7 +220,9 @@ class Application(PolicyBindingModel):
default="", blank=True, validators=[validators.URLValidator()]
)
# For template applications, this can be set to /static/authentik/applications/*
meta_icon = models.FileField(upload_to="application-icons/", default="", blank=True)
meta_icon = models.FileField(
upload_to="application-icons/", default=None, null=True
)
meta_description = models.TextField(default="", blank=True)
meta_publisher = models.TextField(default="", blank=True)

View File

@ -349,10 +349,12 @@ msgstr "Authorized application:"
msgid "Backends"
msgstr "Backends"
#: src/pages/flows/FlowForm.ts
#: src/pages/flows/FlowForm.ts
msgid "Background"
msgstr "Background"
#: src/pages/flows/FlowForm.ts
#: src/pages/flows/FlowForm.ts
#: src/pages/flows/FlowImportForm.ts
msgid "Background shown during execution."
@ -946,6 +948,10 @@ msgstr "Created {0}"
msgid "Creation Date"
msgstr "Creation Date"
#: src/pages/flows/FlowForm.ts
msgid "Currently set to:"
msgstr "Currently set to:"
#: src/interfaces/AdminInterface.ts
msgid "Customisation"
msgstr "Customisation"

View File

@ -345,10 +345,12 @@ msgstr ""
msgid "Backends"
msgstr ""
#:
#:
msgid "Background"
msgstr ""
#:
#:
#:
msgid "Background shown during execution."
@ -940,6 +942,10 @@ msgstr ""
msgid "Creation Date"
msgstr ""
#:
msgid "Currently set to:"
msgstr ""
#:
msgid "Customisation"
msgstr ""

View File

@ -178,15 +178,20 @@ export class ApplicationForm extends ModelForm<Application, string> {
<p class="pf-c-form__helper-text">${t`If left empty, authentik will try to extract the launch URL based on the selected provider.`}</p>
</ak-form-element-horizontal>
${until(config().then((c) => {
let type = "text";
if (c.capabilities.includes(CapabilitiesEnum.SaveMedia)) {
type = "file";
return html`<ak-form-element-horizontal
label=${t`Icon`}
name="metaIcon">
<input type="file" value="" class="pf-c-form-control">
${this.instance?.metaIcon ? html`
<p class="pf-c-form__helper-text">${t`Currently set to:`} ${this.instance?.metaIcon}</p>
`: html``}
</ak-form-element-horizontal>`;
}
return html`<ak-form-element-horizontal
label=${t`Icon`}
name="metaIcon">
<!-- @ts-ignore -->
<input type=${type} value="${first(this.instance?.metaIcon, "")}" class="pf-c-form-control">
<input type="text" value="${first(this.instance?.metaIcon, "")}" class="pf-c-form-control">
</ak-form-element-horizontal>`;
}))}
<ak-form-element-horizontal

View File

@ -134,15 +134,21 @@ export class FlowForm extends ModelForm<Flow, string> {
<p class="pf-c-form__helper-text">${t`Decides what this Flow is used for. For example, the Authentication flow is redirect to when an un-authenticated user visits authentik.`}</p>
</ak-form-element-horizontal>
${until(config().then((c) => {
let type = "text";
if (c.capabilities.includes(CapabilitiesEnum.SaveMedia)) {
type = "file";
return html`<ak-form-element-horizontal
label=${t`Background`}
name="background">
<input type="file" value="" class="pf-c-form-control">
${this.instance?.background ? html`
<p class="pf-c-form__helper-text">${t`Currently set to:`} ${this.instance?.background}</p>
`: html``}
<p class="pf-c-form__helper-text">${t`Background shown during execution.`}</p>
</ak-form-element-horizontal>`;
}
return html`<ak-form-element-horizontal
label=${t`Background`}
name="background">
<!-- @ts-ignore -->
<input type=${type} value="${first(this.instance?.background, "/static/dist/assets/images/flow_background.jpg")}" class="pf-c-form-control">
<input type="text" value="${first(this.instance?.background, "")}" class="pf-c-form-control">
<p class="pf-c-form__helper-text">${t`Background shown during execution.`}</p>
</ak-form-element-horizontal>`;
}))}