diff --git a/common.js b/common.js index 01bcb90..4f8837b 100644 --- a/common.js +++ b/common.js @@ -1,13 +1,5 @@ -const Workflow = require("@saltcorn/data/models/workflow"); -const Form = require("@saltcorn/data/models/form"); -const Table = require("@saltcorn/data/models/table"); const View = require("@saltcorn/data/models/view"); -const { div, script } = require("@saltcorn/markup/tags"); const { getState } = require("@saltcorn/data/db/state"); -const { - stateFieldsToWhere, - readState, -} = require("@saltcorn/data/plugin-helper"); const db = require("@saltcorn/data/db"); const { spawn } = require("child_process"); diff --git a/main-code/index.js b/main-code/index.js index a3a0b36..1465873 100644 --- a/main-code/index.js +++ b/main-code/index.js @@ -43,8 +43,8 @@ const initMain = async () => { : `/plugins/public/react/${tenant}/${viewName}_remote.js` : // TODO get the version from the plugin, for now hardcoded in any release timestamp - ? `http://localhost/sc_plugins/public/react@0.1.6/${tenant}/${viewName}_${timestamp}/${viewName}_remote.js` - : `http://localhost/sc_plugins/public/react@0.1.6/${tenant}/${viewName}_remote.js`, + ? `http://localhost/sc_plugins/public/react@0.1.7/${tenant}/${viewName}_${timestamp}/${viewName}_remote.js` + : `http://localhost/sc_plugins/public/react@0.1.7/${tenant}/${viewName}_remote.js`, }); } diff --git a/package.json b/package.json index d8da964..3bc9277 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@saltcorn/react", - "version": "0.1.6", + "version": "0.1.7", "description": "integrate React components in your Saltcorn application", "main": "index.js", "scripts": { diff --git a/react_view.js b/react_view.js index af0bdb4..68dbccd 100644 --- a/react_view.js +++ b/react_view.js @@ -10,6 +10,7 @@ const { buildSafeViewName, buildAndUpdateView, handleUserCode, + reactViewSystemPrompt, } = require("./common"); const get_state_fields = () => []; @@ -152,5 +153,13 @@ module.exports = { configuration_workflow, run, routes: { build_user_code }, + copilot_generate_view_prompt: async () => reactViewSystemPrompt, + copilot_post_create: async ({ name, configuration }) => { + await buildAndUpdateView( + configuration.user_code || defaultUserCode(configuration.table_id), + configuration.build_mode || "production", + name + ); + }, table_optional: true, };