Added config workflow

This commit is contained in:
Scott Duensing 2026-06-18 20:13:55 -05:00
parent d196c47eb0
commit 0177cfaef8
4 changed files with 40 additions and 3 deletions

View file

@ -10,6 +10,7 @@ const { backfillAll } = require("./lib/entityIds");
const { ensureManagedSchema } = require("./lib/rowIdentity");
const { installAllWraps } = require("./lib/wrap");
const { routes } = require("./lib/routes");
const { configurationWorkflow } = require("./lib/configWorkflow");
const log = (msg) => {
@ -108,6 +109,9 @@ const onLoad = async (cfg) => {
module.exports = {
sc_plugin_api_version: 1,
plugin_name: PLUGIN_NAME,
configuration_workflow: configurationWorkflow,
onLoad: onLoad,
routes: routes
// With configuration_workflow present, Saltcorn invokes capability keys as
// (cfg)=>value (state.ts withCfg), so routes must be a function, not the array.
routes: () => routes
};

33
lib/configWorkflow.js Normal file
View file

@ -0,0 +1,33 @@
// Minimal configuration_workflow. Its only job is to make dev-deploy show the
// standard "Configure" cog on the Settings -> Plugins list, consistent with
// other plugins (the cog renders iff the module exports configuration_workflow
// -- see server/routes/plugins.js cfg_link). dev-deploy is actually configured
// from its own dashboard under /admin/dev-deploy/, so the single step just links
// there.
const Workflow = require("@saltcorn/data/models/workflow");
const Form = require("@saltcorn/data/models/form");
const DASHBOARD_URL = "/admin/dev-deploy/";
const configurationWorkflow = () =>
new Workflow({
steps: [
{
name: "dev-deploy",
form: async () =>
new Form({
blurb:
"dev-deploy is configured from its own dashboard " +
"(environments, peers, plan, journal, conflicts).<br><br>" +
`<a class="btn btn-primary" role="button" href="${DASHBOARD_URL}">` +
"Open the dev-deploy dashboard</a>",
fields: []
})
}
]
});
module.exports = { configurationWorkflow };

View file

@ -1,7 +1,7 @@
// Compile-time constants for the dev-deploy plugin.
const PLUGIN_NAME = "dev-deploy";
const PLUGIN_VERSION = "0.0.1";
const PLUGIN_VERSION = "0.0.2";
// Namespace UUID for deterministic IDs derived from (kind, name).
// Generated once via crypto.randomUUID() and frozen here forever.

View file

@ -1,6 +1,6 @@
{
"name": "dev-deploy",
"version": "0.0.1",
"version": "0.0.2",
"description": "Saltcorn plugin: migrate metadata changes (tables, fields, views, pages, triggers, roles, library, tags) across Dev/Test/Prod environments via an ops journal with stable UUIDs and HMAC-authenticated peer endpoints. Detects concurrent-edit conflicts and offers theirs/mine resolution. User-table row data is never touched.",
"main": "index.js",
"scripts": {