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
8 changes: 0 additions & 8 deletions common.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
4 changes: 2 additions & 2 deletions main-code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 9 additions & 0 deletions react_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
buildSafeViewName,
buildAndUpdateView,
handleUserCode,
reactViewSystemPrompt,
} = require("./common");

const get_state_fields = () => [];
Expand Down Expand Up @@ -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,
};
Loading