web/admin: auto-select keypair in oauth provider creation when only 1 keypair exists
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
928c2bf0d6
commit
e6431593f7
|
@ -192,7 +192,11 @@ export class OAuth2ProviderFormPage extends Form<OAuth2Provider> {
|
||||||
hasKey: "true",
|
hasKey: "true",
|
||||||
}).then(keys => {
|
}).then(keys => {
|
||||||
return keys.results.map(key => {
|
return keys.results.map(key => {
|
||||||
return html`<option value=${ifDefined(key.pk)} ?selected=${this.provider?.rsaKey === key.pk}>${key.name}</option>`;
|
let selected = this.provider?.rsaKey === key.pk;
|
||||||
|
if (keys.results.length === 1) {
|
||||||
|
selected = true;
|
||||||
|
}
|
||||||
|
return html`<option value=${ifDefined(key.pk)} ?selected=${selected}>${key.name}</option>`;
|
||||||
});
|
});
|
||||||
}), html`<option>${t`Loading...`}</option>`)}
|
}), html`<option>${t`Loading...`}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
|
|
Reference in New Issue