web/admin: fix execute button on flow view

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-29 22:30:57 +02:00
parent e96d2fa666
commit 3945dc9f3f
2 changed files with 12 additions and 4 deletions

View File

@ -88,7 +88,7 @@ export class FlowListPage extends TablePage<Flow> {
</button> </button>
</ak-forms-delete> </ak-forms-delete>
<button <button
class="pf-c-button pf-m-secondary ak-root-link" class="pf-c-button pf-m-secondary"
@click=${() => { @click=${() => {
new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecute({ new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecute({
slug: item.slug slug: item.slug
@ -98,7 +98,7 @@ export class FlowListPage extends TablePage<Flow> {
}}> }}>
${gettext("Execute")} ${gettext("Execute")}
</button> </button>
<a class="pf-c-button pf-m-secondary ak-root-link" href="${`${DEFAULT_CONFIG.basePath}/flows/instances/${item.slug}/export/`}"> <a class="pf-c-button pf-m-secondary" href="${`${DEFAULT_CONFIG.basePath}/flows/instances/${item.slug}/export/`}">
${gettext("Export")} ${gettext("Export")}
</a>`, </a>`,
]; ];

View File

@ -80,9 +80,17 @@ export class FlowViewPage extends LitElement {
</dt> </dt>
<dd class="pf-c-description-list__description"> <dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text"> <div class="pf-c-description-list__text">
<a class="pf-c-button pf-m-secondary ak-root-link" href="${AdminURLManager.flows(`${this.flow.pk}/execute/?next=/%23${window.location.href}`)}"> <button
class="pf-c-button pf-m-secondary"
@click=${() => {
new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecute({
slug: flow.slug
}).then(link => {
window.location.assign(`${link.link}?next=/%23${window.location.href}`);
});
}}>
${gettext("Execute")} ${gettext("Execute")}
</a> </button>
</div> </div>
</dd> </dd>
</div> </div>