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

View file

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