static: fix flow-shell-card not working correctly

This commit is contained in:
Jens Langhammer 2020-11-21 20:43:05 +01:00
parent aa1b99204a
commit 6a2ae67c31
4 changed files with 13 additions and 13 deletions

View File

@ -21,8 +21,8 @@
{% endblock %} {% endblock %}
{% block main_container %} {% block main_container %}
<flow-shell-card <pb-flow-shell-card
class="pf-c-login__main" class="pf-c-login__main"
flowBodyUrl="{{ exec_url }}"> flowBodyUrl="{{ exec_url }}">
</flow-shell-card> </pb-flow-shell-card>
{% endblock %} {% endblock %}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,8 @@ import { LitElement, html, customElement, property } from 'lit-element';
import { updateMessages } from "./Messages"; import { updateMessages } from "./Messages";
enum ResponseType { enum ResponseType {
redirect, redirect = "redirect",
template template = "template"
} }
interface Response { interface Response {
@ -12,7 +12,7 @@ interface Response {
body?: string; body?: string;
} }
@customElement("flow-shell-card") @customElement("pb-flow-shell-card")
export class FlowShellCard extends LitElement { export class FlowShellCard extends LitElement {
@property() @property()
@ -32,9 +32,9 @@ export class FlowShellCard extends LitElement {
} }
return r; return r;
}).then((r) => { }).then((r) => {
return r.json() return r.json();
}).then((r) => { }).then((r) => {
this.updateCard(r) this.updateCard(r);
}).catch((e) => { }).catch((e) => {
// Catch JSON or Update errors // Catch JSON or Update errors
this.errorMessage(e); this.errorMessage(e);
@ -54,6 +54,7 @@ export class FlowShellCard extends LitElement {
this.loadFormCode(); this.loadFormCode();
this.setFormSubmitHandlers(); this.setFormSubmitHandlers();
default: default:
console.log(`passbook/flows: unexpected data type ${data.type}`);
break; break;
} }
}; };
@ -77,7 +78,7 @@ export class FlowShellCard extends LitElement {
for (let index = 0; index < form.elements.length; index++) { for (let index = 0; index < form.elements.length; index++) {
const element = <HTMLInputElement>form.elements[index]; const element = <HTMLInputElement>form.elements[index];
if (element.value === form.action) { if (element.value === form.action) {
console.log("pb-flow: Found Form action URL in form elements, not changing form action."); console.log("passbook/flows: Found Form action URL in form elements, not changing form action.");
return false; return false;
} }
} }
@ -151,9 +152,8 @@ export class FlowShellCard extends LitElement {
} }
render() { render() {
if (this.flowBody !== undefined) { if (this.flowBody) {
// return html(<TemplateStringsArray>[this.flowBody]); return html(<TemplateStringsArray><unknown>[this.flowBody]);
return html`${this.flowBody}`;
} }
return this.loading(); return this.loading();
} }