diff --git a/packages/client/src/constate/Collections.ts b/packages/client/src/constate/Collections.ts index 9f7634fe4..cfb559819 100644 --- a/packages/client/src/constate/Collections.ts +++ b/packages/client/src/constate/Collections.ts @@ -22,7 +22,7 @@ const [CollectionsProvider, useCollectionsContext] = constate( const collection = result?.data?.find( (item) => item.name === collectionName, ); - return collection?.generalFields; + return collection?.generalFields || []; }, }; }, diff --git a/packages/client/src/schemas/form/Field.DesignableBar.tsx b/packages/client/src/schemas/form/Field.DesignableBar.tsx index 93d2c19c8..e2b32dd7c 100644 --- a/packages/client/src/schemas/form/Field.DesignableBar.tsx +++ b/packages/client/src/schemas/form/Field.DesignableBar.tsx @@ -42,6 +42,7 @@ import SwitchMenuItem from '../../components/SwitchMenuItem'; import { DragHandle } from '../../components/Sortable'; import { set } from 'lodash'; import { useTranslation } from 'react-i18next'; +import { useCompile } from '../../hooks/useCompile'; export const FieldDesignableBar = observer((props) => { const { t } = useTranslation(); @@ -54,6 +55,7 @@ export const FieldDesignableBar = observer((props) => { const fieldName = schema['x-component-props']?.['fieldName']; const { getField } = useCollectionContext(); const { getFieldsByCollection } = useCollectionsContext(); + const compile = useCompile(); const collectionField = getField(fieldName); @@ -178,7 +180,7 @@ export const FieldDesignableBar = observer((props) => { options={getFieldsByCollection(collectionField.target) .filter((f) => f?.uiSchema?.title) .map((field) => ({ - label: field?.uiSchema?.title || field.name, + label: compile(field?.uiSchema?.title || field.name), value: field.name, }))} /> diff --git a/packages/client/src/schemas/select/index.tsx b/packages/client/src/schemas/select/index.tsx index 73c9ac832..5f0768281 100644 --- a/packages/client/src/schemas/select/index.tsx +++ b/packages/client/src/schemas/select/index.tsx @@ -35,10 +35,12 @@ import { useRequest } from 'ahooks'; import constate from 'constate'; import './index.less'; +import { useCompile } from '../../hooks/useCompile'; export const Select: any = connect( (props) => { const { options = [], ...others } = props; + const compile = useCompile(); return ( {options.map((option: any, key: any) => { @@ -47,7 +49,7 @@ export const Select: any = connect( {option.children.map((child: any, childKey: any) => ( - {child.label} + {compile(child.label)} ))} @@ -55,7 +57,7 @@ export const Select: any = connect( } else { return ( - {option.label} + {compile(option.label)} ); } @@ -86,6 +88,7 @@ export const Select: any = connect( if (!isValid(props.value)) { return
; } + const compile = useCompile(); const field = useField(); if (isArrayField(field) && field?.value?.length === 0) { return
; @@ -111,7 +114,7 @@ export const Select: any = connect(
{options.map((option, key) => ( - {option.label} + {compile(option.label)} ))}
@@ -365,8 +368,8 @@ Select.Drawer = connect( // setSelectedRows(toArr(field.value)); }; // const selectedKeys = toArr(optionValue).map((item) => item.value); - console.log({ optionValue, value }); const collectionField = useContext(CollectionFieldContext); + // console.log({ optionValue, value, schema, collectionField }); return ( @@ -399,6 +402,12 @@ Select.Drawer = connect( onlyRenderProperties schema={schema} filterProperties={(s) => { + if (s['x-component'] === 'Select.Options.Drawer') { + const prop = Object.values(s.properties).shift(); + if (prop) { + prop['x-component-props']['rowKey'] = collectionField?.targetKey || 'id'; + } + } return s['x-component'] === 'Select.Options.Drawer'; }} /> diff --git a/packages/client/src/schemas/table/index.tsx b/packages/client/src/schemas/table/index.tsx index f4b1988cd..2d4320149 100644 --- a/packages/client/src/schemas/table/index.tsx +++ b/packages/client/src/schemas/table/index.tsx @@ -2088,6 +2088,7 @@ Table.Column = observer((props: any) => { Table.Column.DesignableBar = () => { const field = useField(); const { t } = useTranslation(); + const compile = useCompile(); const { service, refresh: refreshTable } = useTable(); // const fieldSchema = useFieldSchema(); const { schema, remove, refresh, insertAfter } = useDesignable(); @@ -2200,7 +2201,7 @@ Table.Column.DesignableBar = () => { options={getFieldsByCollection(collectionField.target) .filter((f) => f?.uiSchema?.title) .map((field) => ({ - label: field?.uiSchema?.title || field.name, + label: compile(field?.uiSchema?.title || field.name), value: field.name, }))} /> diff --git a/packages/plugin-client/src/db/en-US/part1/01-ui_schemas.sql b/packages/plugin-client/src/db/en-US/part1/01-ui_schemas.sql index 57c5928ce..c27c9fdb9 100644 --- a/packages/plugin-client/src/db/en-US/part1/01-ui_schemas.sql +++ b/packages/plugin-client/src/db/en-US/part1/01-ui_schemas.sql @@ -1567,3 +1567,7 @@ INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "option ('b4mdjxweb8m', '78xasyzpukz', NULL, 'array', 'Table', '{"_isJSONSchemaObject":true,"version":"2.0","x-designable-bar":"Table.DesignableBar","x-decorator":"CardItem","default":[],"x-component-props":{"rowKey":"id","dragSort":true,"showIndex":true,"refreshRequestOnChange":true,"pagination":{"pageSize":10},"resource":"t_geso7fru7a9","collectionName":"t_geso7fru7a9"}}', '0', 1, '2021-09-28 07:32:16.642+00', '2021-09-28 07:32:34.482+00', NULL); INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "options", "async", "sort", "created_at", "updated_at", "parent_key") VALUES ('17mcgd6s6d7', 'liia3b09auv', 'Star on GitHub', 'void', 'Menu.URL', '{"version":"2.0","x-designable-bar":"Menu.DesignableBar","x-component-props":{"href":"https://github.com/nocobase/nocobase","icon":"githuboutlined"}}', '0', 12, '2021-11-08 14:27:02.538+00', '2021-11-08 14:27:02.538+00', 'qqzzjakwkwl'); +INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "options", "async", "sort", "created_at", "updated_at", "parent_key") VALUES +('sarppf56eim', NULL, '{{t("Roles")}}', 'array', 'Select.Drawer', '{"x-component-props":{},"x-decorator":"FormItem","x-designable-bar":"Select.Drawer.DesignableBar"}', '0', 4, '2021-11-16 08:32:08.041+00', '2021-11-16 08:32:08.041+00', NULL); +INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "options", "async", "sort", "created_at", "updated_at", "parent_key") VALUES +('bhqy0xdfiog', NULL, '{{t("Role name")}}', 'string', 'Input', '{}', '0', 5, '2021-11-16 09:32:00.3+00', '2021-11-16 09:32:00.3+00', NULL); diff --git a/packages/plugin-client/src/db/en-US/part1/02-collections.sql b/packages/plugin-client/src/db/en-US/part1/02-collections.sql index 95bb88b07..ba2dd138f 100644 --- a/packages/plugin-client/src/db/en-US/part1/02-collections.sql +++ b/packages/plugin-client/src/db/en-US/part1/02-collections.sql @@ -4,3 +4,5 @@ INSERT INTO "collections" ("name", "logging", "title", "privilege", "sortable", ('t_fsveob6p269', '1', 'Customers', NULL, '"sort"', '{}', 5, '2021-09-12 01:05:52.722+00', '2021-09-18 04:15:23.113+00', NULL), ('t_geso7fru7a9', '1', 'Orders', NULL, '"sort"', '{}', 4, '2021-09-12 01:06:05.19+00', '2021-09-18 04:15:42.566+00', NULL), ('t_2uhu4szs1kq', '1', 'Tasks', NULL, '"sort"', '{}', 3, '2021-09-03 08:17:30.495+00', '2021-09-18 04:15:42.572+00', NULL); +INSERT INTO "collections" ("name", "logging", "title", "privilege", "sortable", "options", "sort", "created_at", "updated_at", "ui_schema_key") VALUES +('roles', '1', '{{t("Roles")}}', NULL, '"sort"', '{}', 2, '2021-11-16 09:25:52.28+00', '2021-11-16 09:25:52.28+00', NULL); diff --git a/packages/plugin-client/src/db/en-US/part1/03-fields.sql b/packages/plugin-client/src/db/en-US/part1/03-fields.sql index 7456ca772..8bf6e1803 100644 --- a/packages/plugin-client/src/db/en-US/part1/03-fields.sql +++ b/packages/plugin-client/src/db/en-US/part1/03-fields.sql @@ -50,3 +50,13 @@ INSERT INTO "fields" ("key", "name", "interface", "data_type", "privilege", "sta ('t6knha71oq1', 'fcgtvpd3jr9', 'createdBy', 'belongsTo', 'undelete', 1, '{"target":"users","foreignKey":"created_by_id"}', 2, '2021-09-12 01:06:55.154+00', '2021-09-18 04:16:11.834+00', NULL, NULL, 'ya58lec57fp', NULL), ('drhtax7pxlw', 'nbxtd3jzbw1', 'updatedAt', 'date', 'undelete', 1, '{"field":"updated_at"}', 2, '2021-09-12 01:06:55.14+00', '2021-09-12 01:06:55.149+00', NULL, NULL, '1l9qav1f97v', NULL), ('sbrf1cdkpb9', 'h1f9o1xvevb', 'createdAt', 'date', 'undelete', 1, '{"field":"created_at"}', 1, '2021-09-12 01:06:55.123+00', '2021-09-12 01:06:55.133+00', NULL, NULL, 'oo7ejuze28i', NULL); + +INSERT INTO "fields" ("key", "name", "interface", "data_type", "privilege", "state", "options", "sort", "created_at", "updated_at", "parent_key", "collection_name", "reverse_key", "ui_schema_key") VALUES +('f_v3j9yv454ch', 'roles', 'linkTo', 'belongsToMany', NULL, 1, '{"target":"roles","foreignKey":"user_id","otherKey":"role_id","sourceKey":"id","targetKey":"id"}', NULL, '2021-11-16 08:32:08.033+00', '2021-11-16 08:32:08.049+00', NULL, 'users', NULL, 'sarppf56eim'), +('f_jd6k0hxqe91', 'title', 'string', 'string', NULL, 1, '{}', NULL, '2021-11-16 08:32:08.096+00', '2021-11-16 08:32:08.113+00', NULL, 'roles', NULL, 'bhqy0xdfiog'), +('f_9jeplea2nwz', 'name', NULL, 'uid', NULL, 0, '{"unique":true,"prefix":"r_"}', NULL, '2021-11-16 08:32:08.121+00', '2021-11-16 08:32:08.121+00', NULL, 'roles', NULL, NULL), +('f_no8fg9nvnuk', 'actionPermissions', NULL, 'hasMany', NULL, 0, '{"target":"action_permissions"}', NULL, '2021-11-16 08:32:08.128+00', '2021-11-16 08:32:08.128+00', NULL, 'roles', NULL, NULL), +('f_1786eilo0q0', 'users', NULL, 'belongsToMany', NULL, 0, '{"target":"users","through":"roles_users"}', NULL, '2021-11-16 08:32:08.135+00', '2021-11-16 08:32:08.135+00', NULL, 'roles', NULL, NULL), +('f_g0o9uh9soxb', 'ui_schemas', NULL, 'belongsToMany', NULL, 0, '{"target":"ui_schemas","through":"roles_ui_schemas"}', NULL, '2021-11-16 08:32:08.142+00', '2021-11-16 08:32:08.142+00', NULL, 'roles', NULL, NULL), +('f_d1ta9cp5308', 'createdBy', NULL, 'createdBy', NULL, 0, '{"target":"users"}', NULL, '2021-11-16 08:32:08.148+00', '2021-11-16 08:32:08.148+00', NULL, 'roles', NULL, NULL), +('f_2dmbnljurjx', 'updatedBy', NULL, 'updatedBy', NULL, 0, '{"target":"users"}', NULL, '2021-11-16 08:32:08.154+00', '2021-11-16 08:32:08.154+00', NULL, 'roles', NULL, NULL); diff --git a/packages/plugin-client/src/db/en-US/part2/12-roles.sql b/packages/plugin-client/src/db/en-US/part2/12-roles.sql index b515b20a7..b8f94518c 100644 --- a/packages/plugin-client/src/db/en-US/part2/12-roles.sql +++ b/packages/plugin-client/src/db/en-US/part2/12-roles.sql @@ -1,4 +1,4 @@ DELETE FROM "roles"; -INSERT INTO "roles" ("name", "title", "sort", "created_at", "updated_at", "created_by_id", "updated_by_id") VALUES -('r_tfs4qtaxjcs', 'Admin', 1, '2021-09-14 02:12:19.98+00', '2021-09-14 02:12:19.98+00', 1, 1), -('r_np59b00ex8z', 'Member', 2, '2021-09-14 02:12:35.799+00', '2021-09-14 02:12:35.799+00', 1, 1); +INSERT INTO "roles" ("id", "name", "title", "sort", "created_at", "updated_at", "created_by_id", "updated_by_id") VALUES +(1, 'r_tfs4qtaxjcs', 'Admin', 1, '2021-09-14 02:12:19.98+00', '2021-09-14 02:12:19.98+00', 1, 1), +(2, 'r_np59b00ex8z', 'Member', 2, '2021-09-14 02:12:35.799+00', '2021-09-14 02:12:35.799+00', 1, 1); diff --git a/packages/plugin-client/src/db/en-US/part2/13-action_permissions.sql b/packages/plugin-client/src/db/en-US/part2/13-action_permissions.sql index e435f4a6e..7fb085b45 100644 --- a/packages/plugin-client/src/db/en-US/part2/13-action_permissions.sql +++ b/packages/plugin-client/src/db/en-US/part2/13-action_permissions.sql @@ -1,5 +1,5 @@ DELETE FROM "action_permissions"; -INSERT INTO "action_permissions" ("id", "action_name", "created_at", "updated_at", "collection_name", "user_id", "created_by_id", "updated_by_id", "role_name", "scope_id") VALUES +INSERT INTO "action_permissions" ("id", "action_name", "created_at", "updated_at", "collection_name", "user_id", "created_by_id", "updated_by_id", "role_id", "scope_id") VALUES (1, 'create', '2021-09-14 02:19:38.019+00', '2021-09-14 02:19:45.64+00', 't_geso7fru7a9', NULL, 1, 1, NULL, NULL), (2, 'get', '2021-09-14 02:19:38.04+00', '2021-09-14 02:19:45.64+00', 't_geso7fru7a9', NULL, 1, 1, NULL, NULL), (3, 'update', '2021-09-14 02:19:38.053+00', '2021-09-14 02:19:45.64+00', 't_geso7fru7a9', NULL, 1, 1, NULL, NULL), @@ -8,10 +8,10 @@ INSERT INTO "action_permissions" ("id", "action_name", "created_at", "updated_at (6, 'get', '2021-09-14 02:19:45.616+00', '2021-09-14 02:19:53.3+00', 't_2uhu4szs1kq', NULL, 1, 1, NULL, NULL), (7, 'update', '2021-09-14 02:19:45.625+00', '2021-09-14 02:19:53.3+00', 't_2uhu4szs1kq', NULL, 1, 1, NULL, NULL), (8, 'destroy', '2021-09-14 02:19:45.633+00', '2021-09-14 02:19:53.3+00', 't_2uhu4szs1kq', NULL, 1, 1, NULL, NULL), -(13, 'create', '2021-09-14 02:20:00.337+00', '2021-09-14 02:20:00.337+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), -(14, 'get', '2021-09-14 02:20:00.347+00', '2021-09-14 02:20:00.347+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), -(15, 'update', '2021-09-14 02:20:00.356+00', '2021-09-14 02:20:00.356+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), -(16, 'destroy', '2021-09-14 02:20:00.364+00', '2021-09-14 02:20:00.364+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), +(13, 'create', '2021-09-14 02:20:00.337+00', '2021-09-14 02:20:00.337+00', 'users', NULL, 1, 1, 1, NULL), +(14, 'get', '2021-09-14 02:20:00.347+00', '2021-09-14 02:20:00.347+00', 'users', NULL, 1, 1, 1, NULL), +(15, 'update', '2021-09-14 02:20:00.356+00', '2021-09-14 02:20:00.356+00', 'users', NULL, 1, 1, 1, NULL), +(16, 'destroy', '2021-09-14 02:20:00.364+00', '2021-09-14 02:20:00.364+00', 'users', NULL, 1, 1, 1, NULL), (9, 'create', '2021-09-14 02:19:53.259+00', '2021-09-14 02:20:00.371+00', 't_fsveob6p269', NULL, 1, 1, NULL, NULL), (10, 'get', '2021-09-14 02:19:53.274+00', '2021-09-14 02:20:00.371+00', 't_fsveob6p269', NULL, 1, 1, NULL, NULL), (11, 'update', '2021-09-14 02:19:53.284+00', '2021-09-14 02:20:00.371+00', 't_fsveob6p269', NULL, 1, 1, NULL, NULL), diff --git a/packages/plugin-client/src/db/en-US/part2/15-roles_ui_schemas.sql b/packages/plugin-client/src/db/en-US/part2/15-roles_ui_schemas.sql index 6b8c3443a..691967497 100644 --- a/packages/plugin-client/src/db/en-US/part2/15-roles_ui_schemas.sql +++ b/packages/plugin-client/src/db/en-US/part2/15-roles_ui_schemas.sql @@ -1,52 +1,52 @@ DELETE FROM "roles_ui_schemas"; -INSERT INTO "roles_ui_schemas" ("created_at", "updated_at", "ui_schema_key", "role_name") VALUES -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '0b73gccskc2', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'hall72478p5', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'im4un32remd', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'wfa10dg0vyl', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'k33sn747t75', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6chv7wh9gy9', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h41g5aiikz1', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '66g7jbpqsen', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'on7wtx4zj4i', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2fmrebsf4gp', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'p5e092zc0ot', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2eacz1979l5', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'ouuvop86xkn', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6zdy7upftb2', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h3irsnu3clo', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2891oprcahh', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'tqpxc3hilti', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'kme85fmbfdp', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '75uiuzj3a2y', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'o6vjinhjhad', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'knyew80qe7m', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'gd7t6lt75n9', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '1i8da3k889z', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'mqr5sytnrex', 'r_tfs4qtaxjcs'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'im4un32remd', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'wfa10dg0vyl', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'k33sn747t75', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6chv7wh9gy9', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h41g5aiikz1', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '66g7jbpqsen', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'on7wtx4zj4i', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2fmrebsf4gp', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'p5e092zc0ot', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2eacz1979l5', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'ouuvop86xkn', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6zdy7upftb2', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h3irsnu3clo', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2891oprcahh', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'tqpxc3hilti', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'kme85fmbfdp', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '75uiuzj3a2y', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'o6vjinhjhad', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'knyew80qe7m', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '43f9otxtq42', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'dhye1xbbr3n', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '1i8da3k889z', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'mqr5sytnrex', 'r_np59b00ex8z'), -('2021-09-14 02:22:46.7+00', '2021-09-14 02:22:46.7+00', '0b73gccskc2', 'r_np59b00ex8z'), -('2021-09-14 02:22:53.939+00', '2021-09-14 02:22:53.939+00', 'hall72478p5', 'r_np59b00ex8z'), -('2021-09-14 02:26:04.313+00', '2021-09-14 02:26:04.313+00', 'gd7t6lt75n9', 'r_np59b00ex8z'); +INSERT INTO "roles_ui_schemas" ("created_at", "updated_at", "ui_schema_key", "role_id") VALUES +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '0b73gccskc2', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'hall72478p5', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'im4un32remd', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'wfa10dg0vyl', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'k33sn747t75', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6chv7wh9gy9', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h41g5aiikz1', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '66g7jbpqsen', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'on7wtx4zj4i', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2fmrebsf4gp', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'p5e092zc0ot', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2eacz1979l5', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'ouuvop86xkn', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6zdy7upftb2', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h3irsnu3clo', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2891oprcahh', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'tqpxc3hilti', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'kme85fmbfdp', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '75uiuzj3a2y', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'o6vjinhjhad', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'knyew80qe7m', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'gd7t6lt75n9', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '1i8da3k889z', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'mqr5sytnrex', 1), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'im4un32remd', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'wfa10dg0vyl', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'k33sn747t75', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6chv7wh9gy9', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h41g5aiikz1', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '66g7jbpqsen', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'on7wtx4zj4i', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2fmrebsf4gp', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'p5e092zc0ot', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2eacz1979l5', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'ouuvop86xkn', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6zdy7upftb2', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h3irsnu3clo', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2891oprcahh', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'tqpxc3hilti', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'kme85fmbfdp', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '75uiuzj3a2y', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'o6vjinhjhad', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'knyew80qe7m', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '43f9otxtq42', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'dhye1xbbr3n', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '1i8da3k889z', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'mqr5sytnrex', 2), +('2021-09-14 02:22:46.7+00', '2021-09-14 02:22:46.7+00', '0b73gccskc2', 2), +('2021-09-14 02:22:53.939+00', '2021-09-14 02:22:53.939+00', 'hall72478p5', 2), +('2021-09-14 02:26:04.313+00', '2021-09-14 02:26:04.313+00', 'gd7t6lt75n9', 2); diff --git a/packages/plugin-client/src/db/zh-CN/part1/01-ui_schemas.sql b/packages/plugin-client/src/db/zh-CN/part1/01-ui_schemas.sql index 111e9ba07..52f6d46c8 100644 --- a/packages/plugin-client/src/db/zh-CN/part1/01-ui_schemas.sql +++ b/packages/plugin-client/src/db/zh-CN/part1/01-ui_schemas.sql @@ -1567,3 +1567,7 @@ INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "option ('b4mdjxweb8m', '78xasyzpukz', NULL, 'array', 'Table', '{"_isJSONSchemaObject":true,"version":"2.0","x-designable-bar":"Table.DesignableBar","x-decorator":"CardItem","default":[],"x-component-props":{"rowKey":"id","dragSort":true,"showIndex":true,"refreshRequestOnChange":true,"pagination":{"pageSize":10},"resource":"t_geso7fru7a9","collectionName":"t_geso7fru7a9"}}', '0', 1, '2021-09-28 07:32:16.642+00', '2021-09-28 07:32:34.482+00', NULL); INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "options", "async", "sort", "created_at", "updated_at", "parent_key") VALUES ('17mcgd6s6d7', 'liia3b09auv', '关注 GitHub', 'void', 'Menu.URL', '{"version":"2.0","x-designable-bar":"Menu.DesignableBar","x-component-props":{"href":"https://github.com/nocobase/nocobase","icon":"githuboutlined"}}', '0', 12, '2021-11-08 14:27:02.538+00', '2021-11-08 14:27:02.538+00', 'qqzzjakwkwl'); +INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "options", "async", "sort", "created_at", "updated_at", "parent_key") VALUES +('sarppf56eim', NULL, '{{t("Roles")}}', 'array', 'Select.Drawer', '{"x-component-props":{},"x-decorator":"FormItem","x-designable-bar":"Select.Drawer.DesignableBar"}', '0', 4, '2021-11-16 08:32:08.041+00', '2021-11-16 08:32:08.041+00', NULL); +INSERT INTO "ui_schemas" ("key", "name", "title", "type", "x-component", "options", "async", "sort", "created_at", "updated_at", "parent_key") VALUES +('bhqy0xdfiog', NULL, '{{t("Role name")}}', 'string', 'Input', '{}', '0', 5, '2021-11-16 09:32:00.3+00', '2021-11-16 09:32:00.3+00', NULL); diff --git a/packages/plugin-client/src/db/zh-CN/part1/02-collections.sql b/packages/plugin-client/src/db/zh-CN/part1/02-collections.sql index f5f3484ba..ad77ef1ca 100644 --- a/packages/plugin-client/src/db/zh-CN/part1/02-collections.sql +++ b/packages/plugin-client/src/db/zh-CN/part1/02-collections.sql @@ -4,3 +4,5 @@ INSERT INTO "collections" ("name", "logging", "title", "privilege", "sortable", ('t_fsveob6p269', '1', '顾客', NULL, '"sort"', '{}', 5, '2021-09-12 01:05:52.722+00', '2021-09-18 04:15:23.113+00', NULL), ('t_geso7fru7a9', '1', '订单', NULL, '"sort"', '{}', 4, '2021-09-12 01:06:05.19+00', '2021-09-18 04:15:42.566+00', NULL), ('t_2uhu4szs1kq', '1', '任务', NULL, '"sort"', '{}', 3, '2021-09-03 08:17:30.495+00', '2021-09-18 04:15:42.572+00', NULL); +INSERT INTO "collections" ("name", "logging", "title", "privilege", "sortable", "options", "sort", "created_at", "updated_at", "ui_schema_key") VALUES +('roles', '1', '{{t("Roles")}}', NULL, '"sort"', '{}', 2, '2021-11-16 09:25:52.28+00', '2021-11-16 09:25:52.28+00', NULL); diff --git a/packages/plugin-client/src/db/zh-CN/part1/03-fields.sql b/packages/plugin-client/src/db/zh-CN/part1/03-fields.sql index 8d04a5abb..ad8c2210e 100644 --- a/packages/plugin-client/src/db/zh-CN/part1/03-fields.sql +++ b/packages/plugin-client/src/db/zh-CN/part1/03-fields.sql @@ -50,3 +50,13 @@ INSERT INTO "fields" ("key", "name", "interface", "data_type", "privilege", "sta ('t6knha71oq1', 'fcgtvpd3jr9', 'createdBy', 'belongsTo', 'undelete', 1, '{"target":"users","foreignKey":"created_by_id"}', 2, '2021-09-12 01:06:55.154+00', '2021-09-18 04:16:11.834+00', NULL, NULL, 'ya58lec57fp', NULL), ('drhtax7pxlw', 'nbxtd3jzbw1', 'updatedAt', 'date', 'undelete', 1, '{"field":"updated_at"}', 2, '2021-09-12 01:06:55.14+00', '2021-09-12 01:06:55.149+00', NULL, NULL, '1l9qav1f97v', NULL), ('sbrf1cdkpb9', 'h1f9o1xvevb', 'createdAt', 'date', 'undelete', 1, '{"field":"created_at"}', 1, '2021-09-12 01:06:55.123+00', '2021-09-12 01:06:55.133+00', NULL, NULL, 'oo7ejuze28i', NULL); + +INSERT INTO "fields" ("key", "name", "interface", "data_type", "privilege", "state", "options", "sort", "created_at", "updated_at", "parent_key", "collection_name", "reverse_key", "ui_schema_key") VALUES +('f_v3j9yv454ch', 'roles', 'linkTo', 'belongsToMany', NULL, 1, '{"target":"roles","foreignKey":"user_id","otherKey":"role_id","sourceKey":"id","targetKey":"id"}', NULL, '2021-11-16 08:32:08.033+00', '2021-11-16 08:32:08.049+00', NULL, 'users', NULL, 'sarppf56eim'), +('f_jd6k0hxqe91', 'title', 'string', 'string', NULL, 1, '{}', NULL, '2021-11-16 08:32:08.096+00', '2021-11-16 08:32:08.113+00', NULL, 'roles', NULL, 'bhqy0xdfiog'), +('f_9jeplea2nwz', 'name', NULL, 'uid', NULL, 0, '{"unique":true,"prefix":"r_"}', NULL, '2021-11-16 08:32:08.121+00', '2021-11-16 08:32:08.121+00', NULL, 'roles', NULL, NULL), +('f_no8fg9nvnuk', 'actionPermissions', NULL, 'hasMany', NULL, 0, '{"target":"action_permissions"}', NULL, '2021-11-16 08:32:08.128+00', '2021-11-16 08:32:08.128+00', NULL, 'roles', NULL, NULL), +('f_1786eilo0q0', 'users', NULL, 'belongsToMany', NULL, 0, '{"target":"users","through":"roles_users"}', NULL, '2021-11-16 08:32:08.135+00', '2021-11-16 08:32:08.135+00', NULL, 'roles', NULL, NULL), +('f_g0o9uh9soxb', 'ui_schemas', NULL, 'belongsToMany', NULL, 0, '{"target":"ui_schemas","through":"roles_ui_schemas"}', NULL, '2021-11-16 08:32:08.142+00', '2021-11-16 08:32:08.142+00', NULL, 'roles', NULL, NULL), +('f_d1ta9cp5308', 'createdBy', NULL, 'createdBy', NULL, 0, '{"target":"users"}', NULL, '2021-11-16 08:32:08.148+00', '2021-11-16 08:32:08.148+00', NULL, 'roles', NULL, NULL), +('f_2dmbnljurjx', 'updatedBy', NULL, 'updatedBy', NULL, 0, '{"target":"users"}', NULL, '2021-11-16 08:32:08.154+00', '2021-11-16 08:32:08.154+00', NULL, 'roles', NULL, NULL); diff --git a/packages/plugin-client/src/db/zh-CN/part2/12-roles.sql b/packages/plugin-client/src/db/zh-CN/part2/12-roles.sql index c203402d0..9542ecf5e 100644 --- a/packages/plugin-client/src/db/zh-CN/part2/12-roles.sql +++ b/packages/plugin-client/src/db/zh-CN/part2/12-roles.sql @@ -1,4 +1,4 @@ DELETE FROM "roles"; -INSERT INTO "roles" ("name", "title", "sort", "created_at", "updated_at", "created_by_id", "updated_by_id") VALUES -('r_tfs4qtaxjcs', '管理员', 1, '2021-09-14 02:12:19.98+00', '2021-09-14 02:12:19.98+00', 1, 1), -('r_np59b00ex8z', '普通成员', 2, '2021-09-14 02:12:35.799+00', '2021-09-14 02:12:35.799+00', 1, 1); +INSERT INTO "roles" ("id", "name", "title", "sort", "created_at", "updated_at", "created_by_id", "updated_by_id") VALUES +(1, 'r_tfs4qtaxjcs', '管理员', 1, '2021-09-14 02:12:19.98+00', '2021-09-14 02:12:19.98+00', 1, 1), +(2, 'r_np59b00ex8z', '普通成员', 2, '2021-09-14 02:12:35.799+00', '2021-09-14 02:12:35.799+00', 1, 1); diff --git a/packages/plugin-client/src/db/zh-CN/part2/13-action_permissions.sql b/packages/plugin-client/src/db/zh-CN/part2/13-action_permissions.sql index e435f4a6e..7fb085b45 100644 --- a/packages/plugin-client/src/db/zh-CN/part2/13-action_permissions.sql +++ b/packages/plugin-client/src/db/zh-CN/part2/13-action_permissions.sql @@ -1,5 +1,5 @@ DELETE FROM "action_permissions"; -INSERT INTO "action_permissions" ("id", "action_name", "created_at", "updated_at", "collection_name", "user_id", "created_by_id", "updated_by_id", "role_name", "scope_id") VALUES +INSERT INTO "action_permissions" ("id", "action_name", "created_at", "updated_at", "collection_name", "user_id", "created_by_id", "updated_by_id", "role_id", "scope_id") VALUES (1, 'create', '2021-09-14 02:19:38.019+00', '2021-09-14 02:19:45.64+00', 't_geso7fru7a9', NULL, 1, 1, NULL, NULL), (2, 'get', '2021-09-14 02:19:38.04+00', '2021-09-14 02:19:45.64+00', 't_geso7fru7a9', NULL, 1, 1, NULL, NULL), (3, 'update', '2021-09-14 02:19:38.053+00', '2021-09-14 02:19:45.64+00', 't_geso7fru7a9', NULL, 1, 1, NULL, NULL), @@ -8,10 +8,10 @@ INSERT INTO "action_permissions" ("id", "action_name", "created_at", "updated_at (6, 'get', '2021-09-14 02:19:45.616+00', '2021-09-14 02:19:53.3+00', 't_2uhu4szs1kq', NULL, 1, 1, NULL, NULL), (7, 'update', '2021-09-14 02:19:45.625+00', '2021-09-14 02:19:53.3+00', 't_2uhu4szs1kq', NULL, 1, 1, NULL, NULL), (8, 'destroy', '2021-09-14 02:19:45.633+00', '2021-09-14 02:19:53.3+00', 't_2uhu4szs1kq', NULL, 1, 1, NULL, NULL), -(13, 'create', '2021-09-14 02:20:00.337+00', '2021-09-14 02:20:00.337+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), -(14, 'get', '2021-09-14 02:20:00.347+00', '2021-09-14 02:20:00.347+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), -(15, 'update', '2021-09-14 02:20:00.356+00', '2021-09-14 02:20:00.356+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), -(16, 'destroy', '2021-09-14 02:20:00.364+00', '2021-09-14 02:20:00.364+00', 'users', NULL, 1, 1, 'r_tfs4qtaxjcs', NULL), +(13, 'create', '2021-09-14 02:20:00.337+00', '2021-09-14 02:20:00.337+00', 'users', NULL, 1, 1, 1, NULL), +(14, 'get', '2021-09-14 02:20:00.347+00', '2021-09-14 02:20:00.347+00', 'users', NULL, 1, 1, 1, NULL), +(15, 'update', '2021-09-14 02:20:00.356+00', '2021-09-14 02:20:00.356+00', 'users', NULL, 1, 1, 1, NULL), +(16, 'destroy', '2021-09-14 02:20:00.364+00', '2021-09-14 02:20:00.364+00', 'users', NULL, 1, 1, 1, NULL), (9, 'create', '2021-09-14 02:19:53.259+00', '2021-09-14 02:20:00.371+00', 't_fsveob6p269', NULL, 1, 1, NULL, NULL), (10, 'get', '2021-09-14 02:19:53.274+00', '2021-09-14 02:20:00.371+00', 't_fsveob6p269', NULL, 1, 1, NULL, NULL), (11, 'update', '2021-09-14 02:19:53.284+00', '2021-09-14 02:20:00.371+00', 't_fsveob6p269', NULL, 1, 1, NULL, NULL), diff --git a/packages/plugin-client/src/db/zh-CN/part2/15-roles_ui_schemas.sql b/packages/plugin-client/src/db/zh-CN/part2/15-roles_ui_schemas.sql index 6b8c3443a..691967497 100644 --- a/packages/plugin-client/src/db/zh-CN/part2/15-roles_ui_schemas.sql +++ b/packages/plugin-client/src/db/zh-CN/part2/15-roles_ui_schemas.sql @@ -1,52 +1,52 @@ DELETE FROM "roles_ui_schemas"; -INSERT INTO "roles_ui_schemas" ("created_at", "updated_at", "ui_schema_key", "role_name") VALUES -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '0b73gccskc2', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'hall72478p5', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'im4un32remd', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'wfa10dg0vyl', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'k33sn747t75', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6chv7wh9gy9', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h41g5aiikz1', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '66g7jbpqsen', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'on7wtx4zj4i', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2fmrebsf4gp', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'p5e092zc0ot', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2eacz1979l5', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'ouuvop86xkn', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6zdy7upftb2', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h3irsnu3clo', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2891oprcahh', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'tqpxc3hilti', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'kme85fmbfdp', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '75uiuzj3a2y', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'o6vjinhjhad', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'knyew80qe7m', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'gd7t6lt75n9', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '1i8da3k889z', 'r_tfs4qtaxjcs'), -('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'mqr5sytnrex', 'r_tfs4qtaxjcs'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'im4un32remd', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'wfa10dg0vyl', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'k33sn747t75', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6chv7wh9gy9', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h41g5aiikz1', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '66g7jbpqsen', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'on7wtx4zj4i', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2fmrebsf4gp', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'p5e092zc0ot', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2eacz1979l5', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'ouuvop86xkn', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6zdy7upftb2', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h3irsnu3clo', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2891oprcahh', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'tqpxc3hilti', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'kme85fmbfdp', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '75uiuzj3a2y', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'o6vjinhjhad', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'knyew80qe7m', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '43f9otxtq42', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'dhye1xbbr3n', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '1i8da3k889z', 'r_np59b00ex8z'), -('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'mqr5sytnrex', 'r_np59b00ex8z'), -('2021-09-14 02:22:46.7+00', '2021-09-14 02:22:46.7+00', '0b73gccskc2', 'r_np59b00ex8z'), -('2021-09-14 02:22:53.939+00', '2021-09-14 02:22:53.939+00', 'hall72478p5', 'r_np59b00ex8z'), -('2021-09-14 02:26:04.313+00', '2021-09-14 02:26:04.313+00', 'gd7t6lt75n9', 'r_np59b00ex8z'); +INSERT INTO "roles_ui_schemas" ("created_at", "updated_at", "ui_schema_key", "role_id") VALUES +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '0b73gccskc2', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'hall72478p5', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'im4un32remd', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'wfa10dg0vyl', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'k33sn747t75', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6chv7wh9gy9', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h41g5aiikz1', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '66g7jbpqsen', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'on7wtx4zj4i', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2fmrebsf4gp', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'p5e092zc0ot', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2eacz1979l5', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'ouuvop86xkn', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '6zdy7upftb2', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'h3irsnu3clo', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '2891oprcahh', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'tqpxc3hilti', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'kme85fmbfdp', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '75uiuzj3a2y', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'o6vjinhjhad', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'knyew80qe7m', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'gd7t6lt75n9', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', '1i8da3k889z', 1), +('2021-09-14 02:19:13.669+00', '2021-09-14 02:19:13.669+00', 'mqr5sytnrex', 1), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'im4un32remd', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'wfa10dg0vyl', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'k33sn747t75', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6chv7wh9gy9', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h41g5aiikz1', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '66g7jbpqsen', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'on7wtx4zj4i', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2fmrebsf4gp', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'p5e092zc0ot', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2eacz1979l5', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'ouuvop86xkn', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '6zdy7upftb2', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'h3irsnu3clo', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '2891oprcahh', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'tqpxc3hilti', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'kme85fmbfdp', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '75uiuzj3a2y', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'o6vjinhjhad', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'knyew80qe7m', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '43f9otxtq42', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'dhye1xbbr3n', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', '1i8da3k889z', 2), +('2021-09-14 02:20:09.49+00', '2021-09-14 02:20:09.49+00', 'mqr5sytnrex', 2), +('2021-09-14 02:22:46.7+00', '2021-09-14 02:22:46.7+00', '0b73gccskc2', 2), +('2021-09-14 02:22:53.939+00', '2021-09-14 02:22:53.939+00', 'hall72478p5', 2), +('2021-09-14 02:26:04.313+00', '2021-09-14 02:26:04.313+00', 'gd7t6lt75n9', 2); diff --git a/packages/plugin-collections/src/server.ts b/packages/plugin-collections/src/server.ts index 40b2f6af8..6d17c671b 100644 --- a/packages/plugin-collections/src/server.ts +++ b/packages/plugin-collections/src/server.ts @@ -23,7 +23,7 @@ export default { }); this.app.on('db.init', async () => { - const tableNames = ['users', 'applications']; + const tableNames = ['users', 'applications', 'roles']; const Collection = database.getModel('collections'); for (const tableName of tableNames) { const table = database.getTable(tableName); diff --git a/packages/plugin-permissions/src/collections/roles.ts b/packages/plugin-permissions/src/collections/roles.ts index f4d59e46c..9778698eb 100644 --- a/packages/plugin-permissions/src/collections/roles.ts +++ b/packages/plugin-permissions/src/collections/roles.ts @@ -3,33 +3,45 @@ import { TableOptions } from '@nocobase/database'; export default { name: 'roles', sortable: 'sort', + title: '{{t("Roles")}}', fields: [ { type: 'uid', name: 'name', - primaryKey: true, + unique: true, + // primaryKey: true, prefix: 'r_', + state: 0, }, { + interface: 'string', type: 'string', name: 'title', + uiSchema: { + type: 'string', + title: '{{t("Role name")}}', + 'x-component': 'Input', + }, }, { type: 'hasMany', name: 'actionPermissions', target: 'action_permissions', + state: 0, }, { type: 'belongsToMany', name: 'users', target: 'users', - through: 'roles_users' + through: 'roles_users', + state: 0, }, { type: 'belongsToMany', name: 'ui_schemas', target: 'ui_schemas', - through: 'roles_ui_schemas' + through: 'roles_ui_schemas', + state: 0, }, ], } as TableOptions; diff --git a/packages/plugin-users/src/collections/users.ts b/packages/plugin-users/src/collections/users.ts index 115191eba..cbebfacbd 100644 --- a/packages/plugin-users/src/collections/users.ts +++ b/packages/plugin-users/src/collections/users.ts @@ -52,6 +52,24 @@ export default { 'x-component': 'Password', }, }, + { + interface: 'linkTo', + type: 'belongsToMany', + name: 'roles', + target: 'roles', + foreignKey: 'user_id', + otherKey: 'role_id', + sourceKey: 'id', + targetKey: 'id', + uiSchema: { + type: 'array', + title: '{{t("Roles")}}', + 'x-component': 'Select.Drawer', + 'x-component-props': {}, + 'x-decorator': 'FormItem', + 'x-designable-bar': 'Select.Drawer.DesignableBar', + }, + }, { interface: 'select', type: 'string', diff --git a/packages/plugin-users/src/server.ts b/packages/plugin-users/src/server.ts index 24a7062b7..619089403 100644 --- a/packages/plugin-users/src/server.ts +++ b/packages/plugin-users/src/server.ts @@ -29,6 +29,7 @@ export default { type: 'createdBy', name: typeof createdBy === 'string' ? createdBy : 'createdBy', target: 'users', + state: 0, }); } if (updatedBy !== false) { @@ -36,6 +37,7 @@ export default { type: 'updatedBy', name: typeof updatedBy === 'string' ? updatedBy : 'updatedBy', target: 'users', + state: 0, }); } });