Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/engine/universal/core/src/engine/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ class Engine {
}
}

/**
* Returns whether the given process version is currently deployed in the NeoBPMN Engine
*
* @param {string} versionId the version of the process to check
* @returns {boolean} true if the version is deployed, false if it is known but not active
*/
async isProcessVersionDeployed(versionId) {
return this._versionProcessMapping[versionId]?.isDeployed() ?? false;
}

/**
* Starts the execution of a BPMN process version. This can involve the creation of
* multiple instances of the process, if the process contains such events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,28 @@ module.exports = (path, management) => {
response: '{}',
};
});

network.get(`${path}/:definitionId/versions/:version/active`, { cors: true }, async (req) => {
const { definitionId, version } = req.params;

try {
await db.getProcessVersion(definitionId, version);
} catch {
return {
statusCode: 404,
mimeType: 'text/plain',
response: 'The requested version is not found in this engine.',
};
}

const engine = management.getEngineWithDefinitionId(definitionId);

return {
statusCode: 200,
mimeType: 'application/json',
response: JSON.stringify({
active: engine ? await engine.isProcessVersionDeployed(version) : false,
}),
};
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@
.StopIcon {
color: #ff4d4f;
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

.SpinIcon {
animation: spin 2s linear infinite;
display: flex;
align-items: center;
}
Loading
Loading