All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev-ui.zeebe.components.zeebe-user-task-complete-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 ZeebeUserTasksCompleteDialog extends LitElement {

    static properties = {
        _opened: { state: true },
        context: {},
        _item: { state: true },
        _variables: { state: true },
    }

    connectedCallback() {
        super.connectedCallback();
        this._opened = false;
        this.jsonRpc = new JsonRpc(this.context.extension);
    }

    open(item) {
        this._item = item;
        this._variables = null;
        this._opened = true;
    }

    render() {
        return html`
             {this._opened = e.detail.value;}}
                           ${dialogRenderer(() => this._render(), [this._item, this._variables])}
                           ${dialogFooterRenderer(this._footer, [])}
            >
                        
        `;
    }

    _render() {
        return html`
            
                
                
                
                

                 {this._variables = e.detail.value;}}                        
                >
                           
        `;
    }

    _footer = () => html`
        Cancel
        Complete        
    `;

    _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.userTaskComplete({key: this._item.record.key, variables: variables})
            .then(response => {
                console.log(response);
                this._close();
            })
            .catch(e => {
                console.log(e);
                notifier.showErrorMessage('Complete user task error: ' + e.error.code + ' detail: ' + e.error.message, null);
            });
    }

}

customElements.define('zeebe-user-task-complete-dialog', ZeebeUserTasksCompleteDialog);




© 2015 - 2025 Weber Informatics LLC | Privacy Policy