web/admin: fix urls not showing when pre-selected provider is used

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-01 23:33:59 +02:00
parent 3af48a81e2
commit 9900cc5c81
1 changed files with 4 additions and 10 deletions

View File

@ -181,16 +181,8 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
<select class="pf-c-form-control" @change=${(ev: Event) => {
const el = (ev.target as HTMLSelectElement);
const selected = el.selectedOptions[0];
if ("data-urls-custom" in selected.attributes) {
this.showUrlOptions = true;
} else {
this.showUrlOptions = false;
}
if ("data-request-token" in selected.attributes) {
this.showRequestTokenURL = true;
} else {
this.showRequestTokenURL = false;
}
this.showUrlOptions = "data-urls-custom" in selected.attributes;
this.showRequestTokenURL = "data-request-token" in selected.attributes;
if (!this.instance) {
this.instance = {} as OAuthSource;
}
@ -204,6 +196,8 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
if (!this.instance?.pk) {
if (modelSlug === typeSlug) {
selected = true;
this.showUrlOptions = type.urlsCustomizable;
this.showRequestTokenURL = type.requestTokenUrl !== null;
}
}
return html`<option