Fix unpublish button
This commit is contained in:
parent
56d8ac539d
commit
20d9b79abe
|
|
@ -131,6 +131,7 @@ export class WorkflowDefinitionsPlugin implements Plugin {
|
|||
|
||||
public showWorkflowDefinitionEditor = (workflowDefinition: WorkflowDefinition) => {
|
||||
toolbarComponentStore.components = [() => <elsa-workflow-publish-button onPublishClicked={this.onPublishClicked}
|
||||
onUnPublishClicked={this.onUnPublishClicked}
|
||||
onExportClicked={this.onExportClicked}
|
||||
onImportClicked={this.onImportClicked}/>];
|
||||
studioComponentStore.activeComponentFactory = () => <elsa-workflow-definition-editor
|
||||
|
|
@ -238,6 +239,29 @@ export class WorkflowDefinitionsPlugin implements Plugin {
|
|||
});
|
||||
}
|
||||
|
||||
private onUnPublishClicked = async (e: CustomEvent) => {
|
||||
const definition = await this.workflowDefinitionEditorElement.getWorkflowDefinition();
|
||||
|
||||
const notification = NotificationService.createNotification({
|
||||
title: 'Unpublishing',
|
||||
id: uuid(),
|
||||
text: 'Unpublishing the workflow. Please wait.',
|
||||
type: NotificationDisplayType.InProgress
|
||||
});
|
||||
|
||||
await this.workflowDefinitionManager.retractWorkflow(definition)
|
||||
.then(async () => {
|
||||
NotificationService.updateNotification(notification, {title: 'Workflow unpublished', text: 'Unpublished!'})
|
||||
await this.activityDescriptorManager.refresh();
|
||||
}).catch(() => {
|
||||
NotificationService.updateNotification(notification, {
|
||||
title: 'Error while unpublishing',
|
||||
text: <span>Workflow {definition.definitionId} could not be unpublished.</span>,
|
||||
type: NotificationDisplayType.Error
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private onExportClicked = async (e: CustomEvent) => {
|
||||
const workflowDefinition = await this.workflowDefinitionEditorElement.getWorkflowDefinition();
|
||||
await this.workflowDefinitionManager.exportWorkflow(workflowDefinition);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export class WorkflowDefinitionsApi {
|
|||
|
||||
async retract(request: RetractWorkflowDefinitionRequest): Promise<WorkflowDefinition> {
|
||||
const httpClient = await this.getHttpClient();
|
||||
const response = await httpClient.post<WorkflowDefinition>(`workflow-definitions/${request.definitionId}/retract`);
|
||||
const response = await httpClient.post<WorkflowDefinition>(`workflow-definitions/${request.definitionId}/retract`, request);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
WorkflowExecutionLogRecord,
|
||||
Workflow
|
||||
} from '../../../models';
|
||||
import {PluginRegistry, ActivityNameFormatter, ActivityDriverRegistry, EventBus, ActivityNode} from '../../../services';
|
||||
import {ActivityDriverRegistry, EventBus, ActivityNode} from '../../../services';
|
||||
import {MonacoEditorSettings} from "../../../services/monaco-editor-settings";
|
||||
import {WorkflowDefinition} from "../../workflow-definitions/models/entities";
|
||||
import {WorkflowEditorEventTypes} from "../../workflow-definitions/models/ui";
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ using Elsa.Common.Models;
|
|||
using Elsa.Workflows.Api.Mappers;
|
||||
using Elsa.Workflows.Api.Models;
|
||||
using Elsa.Workflows.Management.Contracts;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.Retract;
|
||||
|
||||
[PublicAPI]
|
||||
internal class Retract : ElsaEndpoint<Request, WorkflowDefinitionResponse, WorkflowDefinitionMapper>
|
||||
{
|
||||
private readonly IWorkflowDefinitionStore _store;
|
||||
|
|
|
|||
Loading…
Reference in a new issue