dev-ui.zeebe.components.zeebe-instance-create-dialog.js Maven / Gradle / Ivy
import { JsonRpc } from 'jsonrpc';
import { notifier } from 'notifier';
import { LitElement, html } from 'lit';
import { dialogRenderer, dialogFooterRenderer } from '@vaadin/dialog/lit.js';
export class ZeebeInstanceCreateDialog extends LitElement {
static properties = {
_opened: { state: true },
context: {},
_key: { state: true },
_variables: { state: true },
}
connectedCallback() {
super.connectedCallback();
this._opened = false;
this.jsonRpc = new JsonRpc(this.context.extension);
}
open(key ) {
this._key = key;
this._variables = null;
this._opened = true;
}
render() {
return html`
{this._opened = e.detail.value;}}
${dialogRenderer(() => this._render(), [this._key, this._variables])}
${dialogFooterRenderer(this._footer, [])}
>
`;
}
_footer = () => html`
Cancel
Create
`;
_close() {
this._opened = false
}
_action() {
let variables = {};
if (this._variables) {
try {
variables = JSON.parse(this._variables);
} catch (e) {
notifier.showErrorMessage(e.message, null);
return;
}
}
this.jsonRpc.createProcessInstance({processDefinitionKey: this._key, variables: variables})
.then(response => {
console.log(response);
this._close();
})
.catch(e => {
console.log(e);
notifier.showErrorMessage('Create process instance error: ' + e.error.code + ' message: ' + e.error.message, null)
});
}
_render() {
return html`
{this._variables = e.detail.value;}}
>
`;
}
}
customElements.define('zeebe-instance-create-dialog', ZeebeInstanceCreateDialog);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy