update UX: badge→modal flow, orange update button, Update All, toast notifications, workflow triggers

This commit is contained in:
Hermes
2026-05-27 23:57:32 -07:00
parent 11823a1466
commit 588188edb5
4 changed files with 125 additions and 17 deletions
+16 -5
View File
@@ -10,9 +10,10 @@ const { success } = require('../response-helpers');
* @param {Object} deps.docker - Docker client wrapper (client, pull methods)
* @param {Object} deps.log - Logger instance
* @param {Function} deps.asyncHandler - Async route handler wrapper
* @param {Object} deps.workflowEngine - WorkflowEngine instance (optional)
* @returns {express.Router}
*/
module.exports = function({ docker, log, asyncHandler }) {
module.exports = function({ docker, log, asyncHandler, workflowEngine }) {
const router = express.Router();
// Helper: verify container exists before operating on it
@@ -66,6 +67,11 @@ module.exports = function({ docker, log, asyncHandler }) {
log.info('docker', `Pulling latest image: ${imageName}`);
await docker.pull(imageName);
// Trigger pre-update workflow (backup before update)
if (workflowEngine) {
try { await workflowEngine.triggerEvent('pre-update', { containerId: containerId, containerName, imageName }); } catch (w) { log.warn('workflow', 'pre-update trigger failed: ' + w.message); }
}
// Get current container config for recreation
const hostConfig = containerInfo.HostConfig;
const config = {
@@ -135,10 +141,15 @@ module.exports = function({ docker, log, asyncHandler }) {
}
success(res, {
message: `Container ${containerName} updated successfully`,
newContainerId: newContainerInfo.Id
});
}, 'container-update'));
message: `Container ${containerName} updated successfully`,
newContainerId: newContainerInfo.Id
});
// Trigger post-update workflow
if (workflowEngine) {
try { await workflowEngine.triggerEvent('post-update', { containerId: containerId, containerName, imageName, newContainerId: newContainerInfo.Id }); } catch (w) { log.warn('workflow', 'post-update trigger failed: ' + w.message); }
}
}, 'container-update'));
// Check for available updates (compares local and remote image digests)
router.get('/:id/check-update', asyncHandler(async (req, res) => {