web/elements: Fix display in deleteform when object has no name
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
a13d89fcde
commit
fb409a73a1
|
@ -101,9 +101,11 @@ class PolicyBindingSerializer(ModelSerializer):
|
||||||
class PolicyBindingViewSet(ModelViewSet):
|
class PolicyBindingViewSet(ModelViewSet):
|
||||||
"""PolicyBinding Viewset"""
|
"""PolicyBinding Viewset"""
|
||||||
|
|
||||||
queryset = PolicyBinding.objects.all().select_related(
|
queryset = (
|
||||||
"target", "group", "user"
|
PolicyBinding.objects.all()
|
||||||
).prefetch_related("policy") # prefetching policy so we resolve the subclass
|
.select_related("target", "group", "user")
|
||||||
|
.prefetch_related("policy")
|
||||||
|
) # prefetching policy so we resolve the subclass
|
||||||
serializer_class = PolicyBindingSerializer
|
serializer_class = PolicyBindingSerializer
|
||||||
filterset_fields = ["policy", "target", "enabled", "order", "timeout"]
|
filterset_fields = ["policy", "target", "enabled", "order", "timeout"]
|
||||||
search_fields = ["policy__name"]
|
search_fields = ["policy__name"]
|
||||||
|
|
|
@ -49,6 +49,12 @@ export class DeleteForm extends ModalButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderModalInner(): TemplateResult {
|
renderModalInner(): TemplateResult {
|
||||||
|
let objName = this.obj?.name;
|
||||||
|
if (objName) {
|
||||||
|
objName = ` "${objName}"`;
|
||||||
|
} else {
|
||||||
|
objName = "";
|
||||||
|
}
|
||||||
return html`<section class="pf-c-page__main-section pf-m-light">
|
return html`<section class="pf-c-page__main-section pf-m-light">
|
||||||
<div class="pf-c-content">
|
<div class="pf-c-content">
|
||||||
<h1 class="pf-c-title pf-m-2xl">
|
<h1 class="pf-c-title pf-m-2xl">
|
||||||
|
@ -59,7 +65,7 @@ export class DeleteForm extends ModalButton {
|
||||||
<section class="pf-c-page__main-section pf-m-light">
|
<section class="pf-c-page__main-section pf-m-light">
|
||||||
<form class="pf-c-form pf-m-horizontal">
|
<form class="pf-c-form pf-m-horizontal">
|
||||||
<p>
|
<p>
|
||||||
${t`Are you sure you want to delete ${this.objectLabel} "${this.obj?.name}"?`}
|
${t`Are you sure you want to delete ${this.objectLabel} ${objName} ?`}
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -188,9 +188,9 @@ msgstr ""
|
||||||
"Are you sure you want to clear the policy cache?\n"
|
"Are you sure you want to clear the policy cache?\n"
|
||||||
"This will cause all policies to be re-evaluated on their next usage."
|
"This will cause all policies to be re-evaluated on their next usage."
|
||||||
|
|
||||||
#: src/elements/forms/DeleteForm.ts:62
|
#: src/elements/forms/DeleteForm.ts:69
|
||||||
msgid "Are you sure you want to delete {0} \"{1}\"?"
|
msgid "Are you sure you want to delete {0} {objName} ?"
|
||||||
msgstr "Are you sure you want to delete {0} \"{1}\"?"
|
msgstr "Are you sure you want to delete {0} {objName} ?"
|
||||||
|
|
||||||
#: src/pages/users/UserActiveForm.ts:52
|
#: src/pages/users/UserActiveForm.ts:52
|
||||||
msgid "Are you sure you want to update {0} \"{1}\"?"
|
msgid "Are you sure you want to update {0} \"{1}\"?"
|
||||||
|
@ -385,7 +385,7 @@ msgid "Can be in the format of 'unix://' when connecting to a local docker daemo
|
||||||
msgstr "Can be in the format of 'unix://' when connecting to a local docker daemon, or 'https://:2376' when connecting to a remote system."
|
msgstr "Can be in the format of 'unix://' when connecting to a local docker daemon, or 'https://:2376' when connecting to a remote system."
|
||||||
|
|
||||||
#: src/elements/forms/ConfirmationForm.ts:75
|
#: src/elements/forms/ConfirmationForm.ts:75
|
||||||
#: src/elements/forms/DeleteForm.ts:79
|
#: src/elements/forms/DeleteForm.ts:86
|
||||||
#: src/elements/forms/ModalForm.ts:71
|
#: src/elements/forms/ModalForm.ts:71
|
||||||
#: src/pages/users/UserActiveForm.ts:73
|
#: src/pages/users/UserActiveForm.ts:73
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
|
@ -813,7 +813,7 @@ msgstr "Decides what this Flow is used for. For example, the Authentication flow
|
||||||
msgid "Define how notifications are sent to users, like Email or Webhook."
|
msgid "Define how notifications are sent to users, like Email or Webhook."
|
||||||
msgstr "Define how notifications are sent to users, like Email or Webhook."
|
msgstr "Define how notifications are sent to users, like Email or Webhook."
|
||||||
|
|
||||||
#: src/elements/forms/DeleteForm.ts:72
|
#: src/elements/forms/DeleteForm.ts:79
|
||||||
#: src/pages/applications/ApplicationListPage.ts:102
|
#: src/pages/applications/ApplicationListPage.ts:102
|
||||||
#: src/pages/crypto/CertificateKeyPairListPage.ts:86
|
#: src/pages/crypto/CertificateKeyPairListPage.ts:86
|
||||||
#: src/pages/events/RuleListPage.ts:82
|
#: src/pages/events/RuleListPage.ts:82
|
||||||
|
@ -861,7 +861,7 @@ msgstr "Delete account"
|
||||||
msgid "Delete temporary users after"
|
msgid "Delete temporary users after"
|
||||||
msgstr "Delete temporary users after"
|
msgstr "Delete temporary users after"
|
||||||
|
|
||||||
#: src/elements/forms/DeleteForm.ts:55
|
#: src/elements/forms/DeleteForm.ts:62
|
||||||
msgid "Delete {0}"
|
msgid "Delete {0}"
|
||||||
msgstr "Delete {0}"
|
msgstr "Delete {0}"
|
||||||
|
|
||||||
|
|
|
@ -184,8 +184,8 @@ msgid ""
|
||||||
"This will cause all policies to be re-evaluated on their next usage."
|
"This will cause all policies to be re-evaluated on their next usage."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/elements/forms/DeleteForm.ts:62
|
#: src/elements/forms/DeleteForm.ts:69
|
||||||
msgid "Are you sure you want to delete {0} \"{1}\"?"
|
msgid "Are you sure you want to delete {0} {objName} ?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/users/UserActiveForm.ts:52
|
#: src/pages/users/UserActiveForm.ts:52
|
||||||
|
@ -381,7 +381,7 @@ msgid "Can be in the format of 'unix://' when connecting to a local docker daemo
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/elements/forms/ConfirmationForm.ts:75
|
#: src/elements/forms/ConfirmationForm.ts:75
|
||||||
#: src/elements/forms/DeleteForm.ts:79
|
#: src/elements/forms/DeleteForm.ts:86
|
||||||
#: src/elements/forms/ModalForm.ts:71
|
#: src/elements/forms/ModalForm.ts:71
|
||||||
#: src/pages/users/UserActiveForm.ts:73
|
#: src/pages/users/UserActiveForm.ts:73
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
|
@ -809,7 +809,7 @@ msgstr ""
|
||||||
msgid "Define how notifications are sent to users, like Email or Webhook."
|
msgid "Define how notifications are sent to users, like Email or Webhook."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/elements/forms/DeleteForm.ts:72
|
#: src/elements/forms/DeleteForm.ts:79
|
||||||
#: src/pages/applications/ApplicationListPage.ts:102
|
#: src/pages/applications/ApplicationListPage.ts:102
|
||||||
#: src/pages/crypto/CertificateKeyPairListPage.ts:86
|
#: src/pages/crypto/CertificateKeyPairListPage.ts:86
|
||||||
#: src/pages/events/RuleListPage.ts:82
|
#: src/pages/events/RuleListPage.ts:82
|
||||||
|
@ -857,7 +857,7 @@ msgstr ""
|
||||||
msgid "Delete temporary users after"
|
msgid "Delete temporary users after"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/elements/forms/DeleteForm.ts:55
|
#: src/elements/forms/DeleteForm.ts:62
|
||||||
msgid "Delete {0}"
|
msgid "Delete {0}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Reference in New Issue