BREAKING: Make Elsa Studio service bus async
This commit is contained in:
parent
096760d5b6
commit
2c9b7eb17f
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@elsa-workflows/elsa-workflows-studio",
|
||||
"version": "2.2.5",
|
||||
"version": "2.2.7",
|
||||
"description": "Elsa Workflow Studio is a collection of web components to manage Elsa workflows stored on an Elsa Workflows server.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ export class ElsaStudioRoot {
|
|||
eventBus.detach(EventTypes.HideToastNotification, this.onHideToastNotification);
|
||||
}
|
||||
|
||||
componentWillLoad() {
|
||||
const elsaClientFactory: () => ElsaClient = () => createElsaClient(this.serverUrl);
|
||||
const httpClientFactory: () => AxiosInstance = () => createHttpClient(this.serverUrl);
|
||||
async componentWillLoad() {
|
||||
const elsaClientFactory: () => Promise<ElsaClient> = () => createElsaClient(this.serverUrl);
|
||||
const httpClientFactory: () => Promise<AxiosInstance> = () => createHttpClient(this.serverUrl);
|
||||
|
||||
const elsaStudio: ElsaStudio = {
|
||||
serverUrl: this.serverUrl,
|
||||
|
|
@ -65,7 +65,7 @@ export class ElsaStudioRoot {
|
|||
propertyDisplayManager,
|
||||
activityIconProvider,
|
||||
confirmDialogService,
|
||||
toastNotificationService,
|
||||
toastNotificationService,
|
||||
elsaClientFactory,
|
||||
httpClientFactory,
|
||||
getOrCreateProperty: getOrCreateProperty,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, EventEmitter, h, Host, Method, Prop, State, Watch, Event} from '@stencil/core';
|
||||
import {createElsaClient} from "../../../services/elsa-client";
|
||||
import {createElsaClient} from "../../../services";
|
||||
import Tunnel from '../../../data/workflow-editor';
|
||||
import {MonacoValueChangedArgs} from "../../controls/elsa-monaco/elsa-monaco";
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ export class ElsaExpressionEditor {
|
|||
}
|
||||
|
||||
async componentDidLoad() {
|
||||
const elsaClient = createElsaClient(this.serverUrl);
|
||||
const elsaClient = await createElsaClient(this.serverUrl);
|
||||
const libSource = await elsaClient.scriptingApi.getJavaScriptTypeDefinitions(this.workflowDefinitionId, this.context);
|
||||
const libUri = 'defaultLib:lib.es6.d.ts';
|
||||
await this.monacoEditor.addJavaScriptLib(libSource, libUri);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {Component, h, Prop, State} from '@stencil/core';
|
||||
import {ActivityDefinitionProperty, ActivityPropertyDescriptor} from "../../../../models";
|
||||
import {createElsaClient} from "../../../../services/elsa-client";
|
||||
import {createElsaClient} from "../../../../services";
|
||||
import Tunnel from '../../../../data/workflow-editor';
|
||||
import {MonacoValueChangedArgs} from "../../../controls/elsa-monaco/elsa-monaco";
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ export class ElsaScriptProperty {
|
|||
}
|
||||
|
||||
async componentDidLoad() {
|
||||
const elsaClient = createElsaClient(this.serverUrl);
|
||||
const elsaClient = await createElsaClient(this.serverUrl);
|
||||
const libSource = await elsaClient.scriptingApi.getJavaScriptTypeDefinitions(this.workflowDefinitionId, this.context);
|
||||
const libUri = 'defaultLib:lib.es6.d.ts';
|
||||
await this.monacoEditor.addJavaScriptLib(libSource, libUri);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ export class ElsaWorkflowBlueprintPropertiesPanel {
|
|||
}
|
||||
|
||||
async loadPublishedVersion() {
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
const {workflowBlueprint} = this;
|
||||
|
||||
const publishedWorkflowDefinitions = await elsaClient.workflowDefinitionsApi.getMany([workflowBlueprint.id], {isPublished: true});
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export class ElsaWorkflowBlueprintSidePanel {
|
|||
}
|
||||
|
||||
async loadWorkflowBlueprint(workflowId = this.workflowId) {
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
|
||||
this.workflowBlueprint = await elsaClient.workflowRegistryApi.get(workflowId, {isLatest: true});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export class ElsaWorkflowBlueprintViewerScreen {
|
|||
propertyStorageProviders: {}
|
||||
};
|
||||
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
|
||||
if (workflowDefinitionId && workflowDefinitionId.length > 0) {
|
||||
try {
|
||||
|
|
@ -88,7 +88,7 @@ export class ElsaWorkflowBlueprintViewerScreen {
|
|||
}
|
||||
|
||||
async loadActivityDescriptors() {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
state.activityDescriptors = await client.activitiesApi.list();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
|
||||
@Method()
|
||||
async exportWorkflow() {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
const workflowDefinition = this.workflowDefinition;
|
||||
const versionOptions: VersionOptions = {version: workflowDefinition.version};
|
||||
const response = await client.workflowDefinitionsApi.export(workflowDefinition.definitionId, versionOptions);
|
||||
|
|
@ -85,7 +85,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
|
||||
@Method()
|
||||
async importWorkflow(file: File) {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
|
||||
this.importing = true;
|
||||
this.imported = false;
|
||||
|
|
@ -99,7 +99,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
this.importing = false;
|
||||
this.imported = true;
|
||||
setTimeout(() => this.imported = false, 500);
|
||||
eventBus.emit(EventTypes.WorkflowImported, this, this.workflowDefinition);
|
||||
await eventBus.emit(EventTypes.WorkflowImported, this, this.workflowDefinition);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.importing = false;
|
||||
|
|
@ -114,7 +114,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
const workflowDefinitionId = newValue;
|
||||
let workflowDefinition: WorkflowDefinition = ElsaWorkflowDefinitionEditorScreen.createWorkflowDefinition();
|
||||
workflowDefinition.definitionId = workflowDefinitionId;
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
|
||||
if (workflowDefinitionId && workflowDefinitionId.length > 0) {
|
||||
try {
|
||||
|
|
@ -171,12 +171,12 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
t = (key: string) => this.i18next.t(key);
|
||||
|
||||
async loadActivityDescriptors() {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
state.activityDescriptors = await client.activitiesApi.list();
|
||||
}
|
||||
|
||||
async loadWorkflowStorageDescriptors() {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
state.workflowStorageDescriptors = await client.workflowStorageProvidersApi.list();
|
||||
}
|
||||
|
||||
|
|
@ -189,14 +189,14 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
this.publishing = true;
|
||||
await this.saveWorkflow(true);
|
||||
this.publishing = false;
|
||||
eventBus.emit(EventTypes.WorkflowPublished, this, this.workflowDefinition);
|
||||
await eventBus.emit(EventTypes.WorkflowPublished, this, this.workflowDefinition);
|
||||
}
|
||||
|
||||
async unPublishWorkflow() {
|
||||
this.unPublishing = true;
|
||||
await this.unpublishWorkflow();
|
||||
this.unPublishing = false;
|
||||
eventBus.emit(EventTypes.WorkflowRetracted, this, this.workflowDefinition);
|
||||
await eventBus.emit(EventTypes.WorkflowRetracted, this, this.workflowDefinition);
|
||||
}
|
||||
|
||||
async saveWorkflow(publish?: boolean) {
|
||||
|
|
@ -209,7 +209,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
|
||||
workflowModel = workflowModel || this.workflowModel;
|
||||
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
let workflowDefinition = this.workflowDefinition;
|
||||
const isNew = typeof workflowDefinition.definitionId === 'undefined' && typeof this.workflowDefinitionId === 'undefined';
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
}
|
||||
|
||||
async unpublishWorkflow() {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
const workflowDefinitionId = this.workflowDefinition.definitionId;
|
||||
this.unPublishing = true;
|
||||
|
||||
|
|
@ -336,8 +336,8 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
this.connectionContextMenuState = state;
|
||||
}
|
||||
|
||||
onShowWorkflowSettingsClick() {
|
||||
eventBus.emit(EventTypes.ShowWorkflowSettings);
|
||||
async onShowWorkflowSettingsClick() {
|
||||
await eventBus.emit(EventTypes.ShowWorkflowSettings);
|
||||
}
|
||||
|
||||
async onPublishClicked() {
|
||||
|
|
@ -360,7 +360,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
e.preventDefault();
|
||||
await this.designer.removeActivity(this.activityContextMenuState.activity);
|
||||
this.handleContextMenuChange({x: 0, y: 0, shown: false, activity: null});
|
||||
eventBus.emit(EventTypes.HideModalDialog);
|
||||
await eventBus.emit(EventTypes.HideModalDialog);
|
||||
}
|
||||
|
||||
async onEditActivityClick(e: Event) {
|
||||
|
|
@ -372,7 +372,7 @@ export class ElsaWorkflowDefinitionEditorScreen {
|
|||
async onPasteActivityClick(e: Event) {
|
||||
e.preventDefault();
|
||||
let activityModel = this.connectionContextMenuState.activity;
|
||||
eventBus.emit(EventTypes.PasteActivity, this, activityModel);
|
||||
await eventBus.emit(EventTypes.PasteActivity, this, activityModel);
|
||||
this.handleConnectionContextMenuChange({x: 0, y: 0, shown: false, activity: null});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export class ElsaWorkflowPropertiesPanel {
|
|||
}
|
||||
|
||||
async loadPublishedVersion() {
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
const {workflowDefinition} = this;
|
||||
|
||||
const publishedWorkflowDefinitions = await elsaClient.workflowDefinitionsApi.getMany([workflowDefinition.definitionId], {isPublished: true});
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export class ElsaWorkflowDefinitionSettingsModal {
|
|||
async componentWillLoad() {
|
||||
this.handleWorkflowDefinitionChanged(this.workflowDefinition);
|
||||
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
this.workflowChannels = await client.workflowChannelsApi.list();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ export class ElsaWorkflowDefinitionsListScreen {
|
|||
if (!result)
|
||||
return;
|
||||
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
await elsaClient.workflowDefinitionsApi.delete(workflowDefinition.definitionId);
|
||||
await this.loadWorkflowDefinitions();
|
||||
}
|
||||
|
||||
async loadWorkflowDefinitions() {
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
const page = 0;
|
||||
const pageSize = 50;
|
||||
const latestVersionOptions: VersionOptions = {isLatest: true};
|
||||
|
|
@ -153,4 +153,4 @@ export class ElsaWorkflowDefinitionsListScreen {
|
|||
}
|
||||
}
|
||||
|
||||
Tunnel.injectProps(ElsaWorkflowDefinitionsListScreen, ['serverUrl', 'culture', 'basePath']);
|
||||
Tunnel.injectProps(ElsaWorkflowDefinitionsListScreen, ['serverUrl', 'culture', 'basePath']);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
@State() currentSearchTerm?: string;
|
||||
|
||||
i18next: i18n;
|
||||
|
||||
|
||||
async componentWillLoad() {
|
||||
this.i18next = await loadTranslations(this.culture, resources);
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
name: 'Delete',
|
||||
}];
|
||||
|
||||
eventBus.emit(EventTypes.WorkflowInstanceBulkActionsLoading, this, {sender: this, bulkActions});
|
||||
await eventBus.emit(EventTypes.WorkflowInstanceBulkActionsLoading, this, {sender: this, bulkActions});
|
||||
|
||||
this.bulkActions = bulkActions;
|
||||
}
|
||||
|
|
@ -104,8 +104,8 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
@Watch("currentPageSize")
|
||||
async handlePageSizeChanged(value: number) {
|
||||
this.currentPageSize = value;
|
||||
this.currentPageSize = isNaN(this.currentPageSize) ? ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE : this.currentPageSize;
|
||||
this.currentPageSize = Math.max(Math.min(this.currentPageSize, ElsaWorkflowInstanceListScreen.MAX_PAGE_SIZE), ElsaWorkflowInstanceListScreen.MIN_PAGE_SIZE);
|
||||
this.currentPageSize = isNaN(this.currentPageSize) ? ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE : this.currentPageSize;
|
||||
this.currentPageSize = Math.max(Math.min(this.currentPageSize, ElsaWorkflowInstanceListScreen.MAX_PAGE_SIZE), ElsaWorkflowInstanceListScreen.MIN_PAGE_SIZE);
|
||||
await this.loadWorkflowInstances();
|
||||
}
|
||||
|
||||
|
|
@ -124,30 +124,30 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
this.selectedWorkflowStatus = query.status;
|
||||
this.selectedOrderByState = query.orderBy ?? OrderBy.Started;
|
||||
this.currentPage = !!query.page ? parseInt(query.page) : 0;
|
||||
this.currentPage = isNaN(this.currentPage) ? ElsaWorkflowInstanceListScreen.START_PAGE : this.currentPage;
|
||||
this.currentPage = isNaN(this.currentPage) ? ElsaWorkflowInstanceListScreen.START_PAGE : this.currentPage;
|
||||
this.currentPageSize = !!query.pageSize ? parseInt(query.pageSize) : ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE;
|
||||
this.currentPageSize = isNaN(this.currentPageSize) ? ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE : this.currentPageSize;
|
||||
this.currentPageSize = Math.max(Math.min(this.currentPageSize, ElsaWorkflowInstanceListScreen.MAX_PAGE_SIZE), ElsaWorkflowInstanceListScreen.MIN_PAGE_SIZE);
|
||||
this.currentPageSize = isNaN(this.currentPageSize) ? ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE : this.currentPageSize;
|
||||
this.currentPageSize = Math.max(Math.min(this.currentPageSize, ElsaWorkflowInstanceListScreen.MAX_PAGE_SIZE), ElsaWorkflowInstanceListScreen.MIN_PAGE_SIZE);
|
||||
}
|
||||
|
||||
async loadWorkflowBlueprints() {
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
const versionOptions: VersionOptions = {allVersions: true};
|
||||
const workflowBlueprintPagedList = await elsaClient.workflowRegistryApi.list(null, null, versionOptions);
|
||||
this.workflowBlueprints = workflowBlueprintPagedList.items;
|
||||
}
|
||||
|
||||
async loadWorkflowInstances() {
|
||||
this.currentPage = isNaN(this.currentPage) ? ElsaWorkflowInstanceListScreen.START_PAGE : this.currentPage;
|
||||
this.currentPage = Math.max(this.currentPage, ElsaWorkflowInstanceListScreen.START_PAGE);
|
||||
this.currentPageSize = isNaN(this.currentPageSize) ? ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE : this.currentPageSize;
|
||||
const elsaClient = this.createClient();
|
||||
this.currentPage = isNaN(this.currentPage) ? ElsaWorkflowInstanceListScreen.START_PAGE : this.currentPage;
|
||||
this.currentPage = Math.max(this.currentPage, ElsaWorkflowInstanceListScreen.START_PAGE);
|
||||
this.currentPageSize = isNaN(this.currentPageSize) ? ElsaWorkflowInstanceListScreen.DEFAULT_PAGE_SIZE : this.currentPageSize;
|
||||
const elsaClient = await this.createClient();
|
||||
this.workflowInstances = await elsaClient.workflowInstancesApi.list(this.currentPage, this.currentPageSize, this.selectedWorkflowId, this.selectedWorkflowStatus, this.selectedOrderByState, this.currentSearchTerm);
|
||||
const maxPage = Math.floor(this.workflowInstances.totalCount / this.currentPageSize);
|
||||
if (this.currentPage > maxPage) {
|
||||
const maxPage = Math.floor(this.workflowInstances.totalCount / this.currentPageSize);
|
||||
if (this.currentPage > maxPage) {
|
||||
this.currentPage = maxPage;
|
||||
this.workflowInstances = await elsaClient.workflowInstancesApi.list(this.currentPage, this.currentPageSize, this.selectedWorkflowId, this.selectedWorkflowStatus, this.selectedOrderByState, this.currentSearchTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createClient() {
|
||||
|
|
@ -175,11 +175,11 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
filters['page'] = this.currentPage.toString();
|
||||
|
||||
var newPageSize = !!pageSize ? pageSize : this.currentPageSize;
|
||||
newPageSize = Math.max(Math.min(newPageSize, 100), ElsaWorkflowInstanceListScreen.MIN_PAGE_SIZE);
|
||||
newPageSize = Math.max(Math.min(newPageSize, 100), ElsaWorkflowInstanceListScreen.MIN_PAGE_SIZE);
|
||||
filters['pageSize'] = newPageSize.toString();
|
||||
|
||||
|
||||
if (newPageSize != this.currentPageSize)
|
||||
filters['page'] = Math.floor(this.currentPage * this.currentPageSize / newPageSize).toString();
|
||||
filters['page'] = Math.floor(this.currentPage * this.currentPageSize / newPageSize).toString();
|
||||
|
||||
const queryString = collection.map(filters, (v, k) => `${k}=${v}`).join('&');
|
||||
return `/workflow-instances?${queryString}`;
|
||||
|
|
@ -251,7 +251,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
if (!result)
|
||||
return;
|
||||
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
await elsaClient.workflowInstancesApi.cancel(workflowInstance.id);
|
||||
await this.loadWorkflowInstances();
|
||||
}
|
||||
|
|
@ -263,7 +263,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
if (!result)
|
||||
return;
|
||||
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
await elsaClient.workflowInstancesApi.delete(workflowInstance.id);
|
||||
await this.loadWorkflowInstances();
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
if (!result)
|
||||
return;
|
||||
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
await elsaClient.workflowInstancesApi.bulkCancel({workflowInstanceIds: this.selectedWorkflowInstanceIds});
|
||||
this.selectedWorkflowInstanceIds = [];
|
||||
await this.loadWorkflowInstances();
|
||||
|
|
@ -289,7 +289,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
if (!result)
|
||||
return;
|
||||
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
await elsaClient.workflowInstancesApi.bulkDelete({workflowInstanceIds: this.selectedWorkflowInstanceIds});
|
||||
this.selectedWorkflowInstanceIds = [];
|
||||
await this.loadWorkflowInstances();
|
||||
|
|
@ -351,7 +351,8 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
<svg class="elsa-h-5 elsa-w-5 elsa-text-gray-500" width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"/>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
|
@ -657,7 +658,7 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
const history = this.history;
|
||||
|
||||
const items: Array<DropdownButtonItem> = pageSizes.map(x => {
|
||||
const text = ""+x;
|
||||
const text = "" + x;
|
||||
const item: DropdownButtonItem = {text: text, isSelected: x == currentPageSize, value: x};
|
||||
|
||||
if (!!history)
|
||||
|
|
@ -667,12 +668,15 @@ export class ElsaWorkflowInstanceListScreen {
|
|||
});
|
||||
|
||||
const renderIcon = function () {
|
||||
return <svg class="elsa-mr-3 elsa-h-5 elsa-w-5 elsa-text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
return <svg class="elsa-mr-3 elsa-h-5 elsa-w-5 elsa-text-gray-400" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h13M3 8h9m-9 8h9m-9 4h9m5"/>
|
||||
</svg>
|
||||
};
|
||||
|
||||
return <elsa-dropdown-button text={currentPageSizeText} items={items} icon={renderIcon()} origin={DropdownButtonOrigin.TopRight} onItemSelected={e => this.handlePageSizeChanged(e.detail.value)}/>
|
||||
return <elsa-dropdown-button text={currentPageSizeText} items={items} icon={renderIcon()}
|
||||
origin={DropdownButtonOrigin.TopRight}
|
||||
onItemSelected={e => this.handlePageSizeChanged(e.detail.value)}/>
|
||||
}
|
||||
|
||||
renderOrderByFilter() {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export class ElsaWorkflowInstanceJournal {
|
|||
@Watch('workflowInstanceId')
|
||||
async workflowInstanceIdChangedHandler(newValue: string) {
|
||||
const workflowInstanceId = newValue;
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
|
||||
if (workflowInstanceId && workflowInstanceId.length > 0) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export class ElsaWorkflowInstanceViewerScreen {
|
|||
propertyStorageProviders: {}
|
||||
};
|
||||
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
|
||||
if (workflowInstanceId && workflowInstanceId.length > 0) {
|
||||
try {
|
||||
|
|
@ -126,7 +126,7 @@ export class ElsaWorkflowInstanceViewerScreen {
|
|||
}
|
||||
|
||||
async loadActivityDescriptors() {
|
||||
const client = createElsaClient(this.serverUrl);
|
||||
const client = await createElsaClient(this.serverUrl);
|
||||
state.activityDescriptors = await client.activitiesApi.list();
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ export class ElsaWorkflowInstanceViewerScreen {
|
|||
return;
|
||||
}
|
||||
|
||||
const elsaClient = createElsaClient(this.serverUrl);
|
||||
const elsaClient = await createElsaClient(this.serverUrl);
|
||||
this.activityStats = await elsaClient.activityStatsApi.get(this.workflowInstanceId, e.detail.activity.activityId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export class ElsaWorkflowRegistryListScreen {
|
|||
|
||||
async componentWillLoad() {
|
||||
await this.loadWorkflowBlueprints();
|
||||
eventBus.emit(EventTypes.WorkflowRegistryLoadingColumns, this, this.workflowRegistryColumns);
|
||||
await eventBus.emit(EventTypes.WorkflowRegistryLoadingColumns, this, this.workflowRegistryColumns);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
|
|
@ -66,7 +66,7 @@ export class ElsaWorkflowRegistryListScreen {
|
|||
const workflowRegistryUpdating: ConfigureWorkflowRegistryUpdatingContext = {
|
||||
params: [workflowBlueprintId, key, value]
|
||||
};
|
||||
eventBus.emit(EventTypes.WorkflowRegistryUpdating, this, workflowRegistryUpdating);
|
||||
await eventBus.emit(EventTypes.WorkflowRegistryUpdating, this, workflowRegistryUpdating);
|
||||
}
|
||||
|
||||
async onLoadWorkflowBlueprints() {
|
||||
|
|
@ -74,7 +74,7 @@ export class ElsaWorkflowRegistryListScreen {
|
|||
}
|
||||
|
||||
async loadWorkflowBlueprints() {
|
||||
const elsaClient = this.createClient();
|
||||
const elsaClient = await this.createClient();
|
||||
const page = 0;
|
||||
const pageSize = 50;
|
||||
const versionOptions: VersionOptions = {allVersions: true};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {PluginManager, ActivityIconProvider, ConfirmDialogService, PropertyDisplayManager} from "../services";
|
||||
import {ElsaClient, ToastNotificationService} from "../services";
|
||||
import EventBus from "js-event-bus";
|
||||
import EventBus from "../services/custom-event-bus";
|
||||
import {AxiosInstance} from "axios";
|
||||
import {ActivityDefinitionProperty} from "./domain";
|
||||
import {ActivityModel} from "./view";
|
||||
|
|
@ -11,12 +11,12 @@ export interface ElsaStudio {
|
|||
featuresString: string;
|
||||
pluginManager: PluginManager;
|
||||
propertyDisplayManager: PropertyDisplayManager;
|
||||
elsaClientFactory: () => ElsaClient;
|
||||
httpClientFactory: () => AxiosInstance;
|
||||
elsaClientFactory: () => Promise<ElsaClient>;
|
||||
httpClientFactory: () => Promise<AxiosInstance>;
|
||||
eventBus: EventBus;
|
||||
activityIconProvider: ActivityIconProvider;
|
||||
confirmDialogService: ConfirmDialogService;
|
||||
toastNotificationService: ToastNotificationService;
|
||||
getOrCreateProperty: (activity: ActivityModel, name: string, defaultExpression?: () => string, defaultSyntax?: () => string) => ActivityDefinitionProperty;
|
||||
htmlToElement: (html: string) => Element;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {h} from '@stencil/core';
|
||||
import {createElsaWorkflowSettingsClient, SaveWorkflowSettingsRequest} from "../services/elsa-client";
|
||||
import {eventBus, ElsaPlugin, ElsaClient} from "../../../services";
|
||||
import {eventBus, ElsaPlugin} from "../../../services";
|
||||
import {
|
||||
EventTypes,
|
||||
ConfigureWorkflowRegistryColumnsContext,
|
||||
|
|
@ -10,11 +10,9 @@ import {
|
|||
|
||||
export class WorkflowSettingsPlugin implements ElsaPlugin {
|
||||
serverUrl: string;
|
||||
elsaClient: ElsaClient;
|
||||
|
||||
constructor(elsaStudio: ElsaStudio) {
|
||||
this.serverUrl = elsaStudio.serverUrl;
|
||||
this.elsaClient = elsaStudio.elsaClientFactory();
|
||||
|
||||
eventBus.on(EventTypes.WorkflowRegistryLoadingColumns, this.onLoadingColumns);
|
||||
eventBus.on(EventTypes.WorkflowRegistryUpdating, this.onUpdating);
|
||||
|
|
@ -29,7 +27,7 @@ export class WorkflowSettingsPlugin implements ElsaPlugin {
|
|||
|
||||
async onUpdating(context: ConfigureWorkflowRegistryUpdatingContext) {
|
||||
|
||||
const elsaClient = createElsaWorkflowSettingsClient(this.serverUrl);
|
||||
const elsaClient = await createElsaWorkflowSettingsClient(this.serverUrl);
|
||||
const workflowSettings = await elsaClient.workflowSettingsApi.list();
|
||||
|
||||
const workflowBlueprintSettings = workflowSettings.find(x => x.workflowBlueprintId == context.params[0] && x.key == context.params[1]);
|
||||
|
|
@ -43,6 +41,6 @@ export class WorkflowSettingsPlugin implements ElsaPlugin {
|
|||
};
|
||||
|
||||
await elsaClient.workflowSettingsApi.save(request);
|
||||
eventBus.emit(EventTypes.WorkflowRegistryUpdated, this);
|
||||
await eventBus.emit(EventTypes.WorkflowRegistryUpdated, this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,37 +24,37 @@ export const createHttpClient = function(baseAddress: string) : AxiosInstance
|
|||
const service = new Service(httpClient);
|
||||
|
||||
eventBus.emit(EventTypes.HttpClientCreated, this, {service, httpClient});
|
||||
|
||||
|
||||
return _httpClient = httpClient;
|
||||
}
|
||||
|
||||
export const createElsaWorkflowSettingsClient = function (serverUrl: string): ElsaWorkflowSettingsClient {
|
||||
export const createElsaWorkflowSettingsClient = async function (serverUrl: string): Promise<ElsaWorkflowSettingsClient> {
|
||||
|
||||
if (!!_elsaWorkflowSettingsClient)
|
||||
return _elsaWorkflowSettingsClient;
|
||||
|
||||
const httpClient: AxiosInstance = createHttpClient(serverUrl);
|
||||
const httpClient: AxiosInstance = await createHttpClient(serverUrl);
|
||||
|
||||
_elsaWorkflowSettingsClient = {
|
||||
workflowSettingsApi: {
|
||||
list: async () => {
|
||||
const response = await httpClient.get<Array<WorkflowSettings>>(`v1/workflow-settings`);
|
||||
return response.data;
|
||||
},
|
||||
},
|
||||
save: async request => {
|
||||
const response = await httpClient.post<WorkflowSettings>('v1/workflow-settings', request);
|
||||
return response.data;
|
||||
},
|
||||
delete: async id => {
|
||||
await httpClient.delete(`v1/workflow-settings/${id}`);
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return _elsaWorkflowSettingsClient;
|
||||
}
|
||||
|
||||
export interface ElsaWorkflowSettingsClient {
|
||||
export interface ElsaWorkflowSettingsClient {
|
||||
workflowSettingsApi: WorkflowSettingsApi;
|
||||
}
|
||||
|
||||
|
|
@ -72,4 +72,4 @@ export interface SaveWorkflowSettingsRequest {
|
|||
workflowBlueprintId?: string;
|
||||
key?: string;
|
||||
value?: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import {
|
|||
let _httpClient: AxiosInstance = null;
|
||||
let _elsaClient: ElsaClient = null;
|
||||
|
||||
export const createHttpClient = function (baseAddress: string): AxiosInstance {
|
||||
export const createHttpClient = async function (baseAddress: string): Promise<AxiosInstance> {
|
||||
if (!!_httpClient)
|
||||
return _httpClient;
|
||||
|
||||
|
|
@ -37,22 +37,22 @@ export const createHttpClient = function (baseAddress: string): AxiosInstance {
|
|||
baseURL: baseAddress
|
||||
};
|
||||
|
||||
eventBus.emit(EventTypes.HttpClientConfigCreated, this, {config});
|
||||
await eventBus.emit(EventTypes.HttpClientConfigCreated, this, {config});
|
||||
|
||||
const httpClient = axios.create(config);
|
||||
const service = new Service(httpClient);
|
||||
|
||||
eventBus.emit(EventTypes.HttpClientCreated, this, {service, httpClient});
|
||||
await eventBus.emit(EventTypes.HttpClientCreated, this, {service, httpClient});
|
||||
|
||||
return _httpClient = httpClient;
|
||||
}
|
||||
|
||||
export const createElsaClient = function (serverUrl: string): ElsaClient {
|
||||
export const createElsaClient = async function (serverUrl: string): Promise<ElsaClient> {
|
||||
|
||||
if (!!_elsaClient)
|
||||
return _elsaClient;
|
||||
|
||||
const httpClient: AxiosInstance = createHttpClient(serverUrl);
|
||||
const httpClient: AxiosInstance = await createHttpClient(serverUrl);
|
||||
|
||||
_elsaClient = {
|
||||
activitiesApi: {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import {ActivityPropertyDescriptor, RuntimeSelectListItemsProviderSettings, SelectListItem} from "../models";
|
||||
import {createElsaClient, ElsaClient} from "../services/elsa-client";
|
||||
import {createElsaClient, ElsaClient} from "../services";
|
||||
|
||||
async function fetchRuntimeItems(serverUrl: string, options: RuntimeSelectListItemsProviderSettings): Promise<Array<SelectListItem>> {
|
||||
const elsaClient = createElsaClient(serverUrl);
|
||||
const elsaClient = await createElsaClient(serverUrl);
|
||||
return await elsaClient.designerApi.runtimeSelectItemsApi.get(options.runtimeSelectListItemsProviderType, options.context || {});
|
||||
}
|
||||
|
||||
|
|
@ -17,4 +17,4 @@ export async function getSelectListItems(serverUrl: string, propertyDescriptor:
|
|||
}
|
||||
|
||||
return items || [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue