web/admin: fix application form's provider selection not working

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-11 13:33:35 +02:00
parent 8df29235bb
commit ab4569e5d6
4 changed files with 8 additions and 13 deletions

View file

@ -100,8 +100,3 @@ class ProxyOutpostConfigViewSet(ReadOnlyModelViewSet):
queryset = ProxyProvider.objects.filter(application__isnull=False)
serializer_class = ProxyOutpostConfigSerializer
ordering = ["name"]
def get_queryset(self):
qs = super().get_queryset()
print(qs)
return qs

View file

@ -72,7 +72,7 @@ export class ApplicationForm extends Form<Application> {
${Array.from(m).map(([group, providers]) => {
return html`<optgroup label=${group}>
${providers.map(p => {
const selected = (this.application?.provider?.pk === p.pk) || (this.provider === p.pk);
const selected = (this.application?.provider === p.pk) || (this.provider === p.pk);
return html`<option ?selected=${selected} value=${ifDefined(p.pk)}>${p.name}</option>`;
})}
</optgroup>`;
@ -98,7 +98,7 @@ export class ApplicationForm extends Form<Application> {
</ak-form-element-horizontal>
<ak-form-element-horizontal
label=${t`Provider`}
name="parent">
name="provider">
<select class="pf-c-form-control">
<option value="" ?selected=${this.application?.provider === undefined}>---------</option>
${until(new ProvidersApi(DEFAULT_CONFIG).providersAllList({}).then(providers => {

View file

@ -75,11 +75,11 @@ export class ApplicationListPage extends TablePage<Application> {
</a>`,
html`<code>${item.slug}</code>`,
item.provider ?
html`<a href="#/core/providers/${item.provider.pk}">
${item.provider?.name}
html`<a href="#/core/providers/${item.providerObj?.pk}">
${item.providerObj?.name}
</a>` :
html`-`,
html`${item.provider?.verboseName || "-"}`,
html`${item.providerObj?.verboseName || "-"}`,
html`
<ak-forms-modal>
<span slot="submit">

View file

@ -81,15 +81,15 @@ export class ApplicationViewPage extends LitElement {
<div class="pf-c-card__title">${t`Related`}</div>
<div class="pf-c-card__body">
<dl class="pf-c-description-list">
${this.application.provider ?
${this.application.providerObj ?
html`<div class="pf-c-description-list__group">
<dt class="pf-c-description-list__term">
<span class="pf-c-description-list__text">${t`Provider`}</span>
</dt>
<dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text">
<a href="#/core/providers/${this.application.provider.pk}">
${this.application.provider.name}
<a href="#/core/providers/${this.application.providerObj?.pk}">
${this.application.providerObj?.name}
</a>
</div>
</dd>