ApiLogicServer 15.0.19__py3-none-any.whl → 15.0.22__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. api_logic_server_cli/api_logic_server.py +4 -4
  2. api_logic_server_cli/api_logic_server_info.yaml +2 -2
  3. api_logic_server_cli/genai/genai_admin_app.py +33 -9
  4. api_logic_server_cli/prototypes/.DS_Store +0 -0
  5. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +119 -0
  6. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-js-Learning-Prompt.md +71 -0
  7. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/{Admin-App-Learning-Prompt.md → z-unused-Admin-App-Learning-Prompt.md} +60 -35
  8. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json +3 -0
  9. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/Config.js +527 -0
  10. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/app_loader.js +24 -0
  11. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/.eslintrc +5 -0
  12. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/.yarnrc.yml +4 -0
  13. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/default-settings.js +25 -0
  14. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/default-settings.ts +25 -0
  15. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/errors.js +116 -0
  16. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/errors.ts +116 -0
  17. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/index.test.tsx +7 -0
  18. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/index.tsx +11 -0
  19. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/ra-jsonapi-client.js +577 -0
  20. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/ra-jsonapi-client.ts +577 -0
  21. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/resourceLookup.js +124 -0
  22. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/resourceLookup.ts +124 -0
  23. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/styles.module.css +9 -0
  24. api_logic_server_cli/prototypes/nw/.DS_Store +0 -0
  25. api_logic_server_cli/prototypes/nw/ui/.DS_Store +0 -0
  26. api_logic_server_cli/prototypes/nw/ui/react_admin/.DS_Store +0 -0
  27. api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.js +30 -31
  28. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Category.js +62 -62
  29. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Customer.js +143 -48
  30. api_logic_server_cli/prototypes/nw/ui/react_admin/src/CustomerDemographic.js +20 -37
  31. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Department.js +38 -39
  32. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Employee.js +85 -134
  33. api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeAudit.js +89 -77
  34. api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeTerritory.js +59 -59
  35. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Location.js +45 -49
  36. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Order.js +42 -60
  37. api_logic_server_cli/prototypes/nw/ui/react_admin/src/OrderDetail.js +97 -106
  38. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Product.js +60 -62
  39. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Region.js +36 -41
  40. api_logic_server_cli/prototypes/nw/ui/react_admin/src/SampleDBVersion.js +73 -0
  41. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Shipper.js +57 -54
  42. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Supplier.js +71 -87
  43. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Territory.js +47 -41
  44. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Union.js +18 -34
  45. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.22.dist-info}/METADATA +1 -1
  46. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.22.dist-info}/RECORD +50 -31
  47. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/dataProvider.js +0 -110
  48. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.22.dist-info}/WHEEL +0 -0
  49. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.22.dist-info}/entry_points.txt +0 -0
  50. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.22.dist-info}/licenses/LICENSE +0 -0
  51. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.22.dist-info}/top_level.txt +0 -0
@@ -12,10 +12,10 @@ ApiLogicServer CLI: given a database url, create [and run] customizable ApiLogic
12
12
  Called from api_logic_server_cli.py, by instantiating the ProjectRun object.
13
13
  '''
14
14
 
15
- __version__ = "15.00.19" # last public release: 15.00.19 (15.00.12)
15
+ __version__ = "15.00.22" # last public release: 15.00.19 (15.00.12)
16
16
  recent_changes = \
17
17
  f'\n\nRecent Changes:\n' +\
18
- "\t06/17/2024 - 15.00.19: Tech Preview: als genai-app \n"\
18
+ "\t06/22/2024 - 15.00.21: Tech Preview: als genai-app w/ sra provider, import fix, bug [96] \n"\
19
19
  "\t06/10/2024 - 15.00.12: MCP Security, win fixes for readme, graphics quotes \n"\
20
20
  "\t06/08/2024 - 15.00.10: MCP, optional shortening of stacktrace lines, bugfix[92] \n"\
21
21
  "\t05/16/2024 - 14.05.00: safrs 3.1.7, running mcp preview \n"\
@@ -1174,7 +1174,7 @@ from database import <project.bind_key>_models
1174
1174
  @staticmethod
1175
1175
  def set_provider(from_value: str, to_value: str, config_file: str) -> None:
1176
1176
  """ update import statement to set provider type in config.py """
1177
- if from_value == to_value:
1177
+ if from_value == to_value or to_value == "None":
1178
1178
  pass
1179
1179
  # log.debug(f'.. .. (provider type unchanged)')
1180
1180
  else:
@@ -1243,7 +1243,7 @@ from database import <project.bind_key>_models
1243
1243
  provider_note = f"Setting security provider type = {self.auth_provider_type}, @server = {self.auth_db_url} \n"
1244
1244
  # f'(was: {was_provider_type}, {is_enabled_note})\n'
1245
1245
 
1246
- if self.auth_provider_type == 'none': # none means disable
1246
+ if self.auth_provider_type in ['none', 'None']: # none means disable
1247
1247
  if is_enabled:
1248
1248
  log.info(f'\n\n.. ..Disabling security for current provider type: {was_provider_type}\n')
1249
1249
  create_utils.assign_value_to_key_in_file(value=False,
@@ -1,3 +1,3 @@
1
- last_created_date: June 17, 2025 12:36:00
1
+ last_created_date: June 22, 2025 16:02:13
2
2
  last_created_project_name: ../../../servers/basic_demo
3
- last_created_version: 15.00.18
3
+ last_created_version: 15.00.20
@@ -53,7 +53,9 @@ class GenAIAdminApp:
53
53
  self.app_templates_path = genai_svcs.get_manager_path(use_env=True).joinpath('system/genai/app_templates')
54
54
  self.react_admin_template_path = self.app_templates_path / 'react-admin-template'
55
55
  self.prompts_path = self.app_templates_path / "app_learning"
56
- self.admin_app_learning = utils.read_file(self.prompts_path / "Admin-App-Learning-Prompt.md")
56
+ # self.admin_app_learning = utils.read_file(self.prompts_path / "Admin-App-Learning-Prompt.md")
57
+ self.admin_app_resource_learning = utils.read_file(self.prompts_path / "Admin-App-Resource-Learning-Prompt.md")
58
+ self.admin_app_js_learning = utils.read_file(self.prompts_path / "Admin-App-js-Learning-Prompt.md")
57
59
  self.image_url = self.prompts_path / 'Order-Page.png' # did not seem to help, made it 2x slower
58
60
 
59
61
  # self.schema = utils.read_file(self.dbml_path)
@@ -77,7 +79,7 @@ class GenAIAdminApp:
77
79
 
78
80
  log.info(f"✅ Next Steps:\n")
79
81
  log.info('Start the API Logic Project: F5')
80
- log.info('> cd ui/react-admin')
82
+ log.info(f'> cd ui/{app_name}')
81
83
  log.info('> npm install')
82
84
  log.info('> npm start')
83
85
 
@@ -85,10 +87,13 @@ class GenAIAdminApp:
85
87
  def a_generate_resource_files(self):
86
88
 
87
89
  def fix_source(raw_source: str) -> str:
88
- ''' remove code occasional begin/end code markers '''
90
+ ''' Remove code occasional begin/end code markers <br>
91
+ ToDo: lint, and repeat generation if errors detected
92
+ '''
89
93
  source_lines = raw_source.splitlines()
90
- result_lines = []
91
- found_start_marker = False
94
+ result_lines = ["import React from 'react';",
95
+ "import { List, FunctionField, Datagrid, TextField, DateField, NumberField, ReferenceField, ReferenceManyField, Show, TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput, ReferenceInput, SelectInput, Create, SimpleForm, Edit, Filter, Pagination, BooleanField, BooleanInput } from 'react-admin'; // mandatory import"]
96
+ found_from_react_admin = False
92
97
  for each_line in source_lines:
93
98
  if each_line.startswith("```"):
94
99
  if each_line.startswith("```jsx") or each_line.startswith("```javascript"):
@@ -96,7 +101,11 @@ class GenAIAdminApp:
96
101
  continue
97
102
  else:
98
103
  break
99
- result_lines.append(each_line)
104
+ if "from 'react-admin'" in each_line: # sigh: missing imports 20% of the time - override
105
+ found_from_react_admin = True
106
+ continue
107
+ if found_from_react_admin == True:
108
+ result_lines.append(each_line)
100
109
 
101
110
  # return source_lines as a string
102
111
  return "\n".join(result_lines)
@@ -119,7 +128,7 @@ class GenAIAdminApp:
119
128
  ]
120
129
  messages = [
121
130
  {"role": "user", "content": "You are a helpful expert in react and JavaScript"},
122
- {"role": "user", "content": self.admin_app_learning},
131
+ {"role": "user", "content": self.admin_app_resource_learning},
123
132
  # {"role": "user", "content": example_image_content},
124
133
  {"role": "user", "content": f'Schema:\n{self.schema_yaml}'},
125
134
  {"role": "user", "content": f'Generate the full javascript source code for the `{each_resource_name}.js` React Admin file, formatted as a JSResponseFormat'}]
@@ -136,10 +145,23 @@ class GenAIAdminApp:
136
145
 
137
146
 
138
147
  def b_generate_app_js(self):
148
+
149
+ def fix_app(raw_source: str) -> str:
150
+ ''' Remove code occasional begin/end code markers <br>
151
+ '''
152
+ source_lines = raw_source.splitlines()
153
+ result_lines = []
154
+ data_provider_import = False
155
+ do_fixup = False
156
+ for each_line in source_lines:
157
+ # fixes here
158
+ result_lines.append(each_line)
159
+ return "\n".join(result_lines) # return source_lines as a string
160
+
139
161
  messages = []
140
162
  messages = [
141
163
  {"role": "user", "content": "You are a helpful expert in react and JavaScript"},
142
- {"role": "user", "content": self.admin_app_learning},
164
+ {"role": "user", "content": self.admin_app_js_learning},
143
165
  {"role": "user", "content": f'Schema:\n{self.schema_yaml}'},
144
166
  {"role": "user", "content": f'Generate the complete App.js that wires together the above resources. for the `app.js` React Admin file, formatted as a JSResponseFormat.'}]
145
167
  save_response = self.project_root / f"docs/admin_app/app.js"
@@ -149,7 +171,9 @@ class GenAIAdminApp:
149
171
  response_as=JSResponseFormat)
150
172
  response_dict = json.loads(output)
151
173
  target_file = self.ui_src_path / "App.js"
152
- utils.write_file(target_file, response_dict['code'])
174
+ source_code = response_dict['code']
175
+ source_code = fix_app(source_code)
176
+ utils.write_file(target_file, source_code)
153
177
 
154
178
  log.info(f"✅ Wrote: {target_file}\n")
155
179
 
Binary file
@@ -0,0 +1,119 @@
1
+ ## Context
2
+
3
+ Generate a per-resource file for a React Admin application using the following instructions.
4
+ The result must be a runnable React app (`npm start`) that connects to the supplied JSON:API, with fully implemented components (no placeholders or empty files).
5
+
6
+
7
+ ---
8
+
9
+ ### Per-Resource Files (Required)
10
+
11
+ For each resource (`Customer`, `Order` etc):
12
+
13
+ * Create a source file under `src/`, e.g., `Customer.js`
14
+ * Each file must **fully** implement:
15
+ * `CustomerList`
16
+ * `CustomerShow`
17
+ * `CustomerCreate`
18
+ * `CustomerEdit`
19
+
20
+ Use:
21
+
22
+ - `<ReferenceField>` for foreign key displays
23
+ - `<ReferenceInput>` for foreign key input
24
+ - `<ReferenceManyField>` for tabbed child lists
25
+ - For show pages
26
+
27
+ * Always start with `<SimpleShowLayout>`, followed by a `<TabbedShowLayout>` for related data
28
+ * DO NOT start with `<TabbedShowLayout>`
29
+
30
+ ALWAYS include these 2 imports at the top of the file, with this EXACT formatting, whether or not they are used:
31
+
32
+ ```jsx
33
+ import React from 'react';
34
+ import { List, FunctionField, Datagrid, TextField, DateField, NumberField, ReferenceField, ReferenceManyField, Show, TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput, ReferenceInput, SelectInput, Create, SimpleForm, Edit, Filter, Pagination, BooleanField, BooleanInput } from 'react-admin'; // mandatory import
35
+ ```
36
+ You may add other imports, but be sure all those are included.
37
+
38
+ DO NOT use `<EmailInput>` - use `<TextInput>`.
39
+
40
+ DO NOT put `<ReferenceField>` in `<Datagrid>`.
41
+
42
+ Do **not leave any file empty**.
43
+
44
+ ---
45
+
46
+ ## App Features
47
+
48
+ ### Multi-Page
49
+
50
+ For each resource:
51
+
52
+ - Create a **List page** showing 7 user-friendly columns
53
+ - Add **pagination**, **sorting**, and **filtering**
54
+ - Link each row to a **Display (Show) page**
55
+
56
+ ### Multi-Resource
57
+
58
+ Each **Display Page** should:
59
+
60
+ - Show all fields in a **multi-column layout**
61
+ - Include a **tab sheet** (`<TabbedShowLayout>`) for each related resource using `<ReferenceManyField>`
62
+ - Link child rows to their own display page
63
+
64
+ Example:
65
+
66
+ - Customer Display has tab for OrderList
67
+
68
+ - The tab (with OrderList) is shown *below* all the Customer fields.
69
+ - Each Order in the tab links to Order Display
70
+
71
+ ### Automatic Joins
72
+
73
+ For foreign keys:
74
+
75
+ - Display joined value (e.g., `product.name` instead of `product_id`)
76
+ - Use first string field from parent table containing `name`, `title`, or `description`
77
+
78
+ Numeric Primary key fields:
79
+
80
+ - Display at the end of forms/lists
81
+
82
+ ### Lookups (Foreign Keys)
83
+
84
+ For foreign key fields:
85
+
86
+ - Provide auto-complete dropdown (`<ReferenceInput>`)
87
+ - For numeric foreign keys, use the joined string field as lookup text
88
+
89
+ ### Cascade Add
90
+
91
+ When adding a child row as a detail in a Master / Detail,
92
+ default the Foreign Key to the Parent (Master) Primary Key.
93
+
94
+ ## Implementation
95
+
96
+ ### Architecture
97
+
98
+ - **Framework**: React 18 + react-admin 4.x
99
+ - **Data Provider**: Custom pre-built in src/rav4-jsonapi-client
100
+ - **CORS**: Ensure API allows `http://localhost:3000`
101
+
102
+ ```py
103
+ from flask_cors import CORS
104
+ CORS(app, origins='*') # or restrict to localhost:3000
105
+ ```
106
+ - **Project Setup**:
107
+
108
+ - Use `create-react-app`
109
+ - Include: `react-admin`, `@mui/material`, `@emotion/react`, `@emotion/styled`, `react-router-dom`
110
+ - Do not use any deprecated or unmaintained libraries
111
+ - Include complete and correct `App.js`, `index.js`, `dataProvider.js`, and `index.html`
112
+ ---
113
+
114
+ ## Response Format
115
+
116
+ Format the response as a JSResponseFormat:
117
+
118
+ class JSResponseFormat(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
119
+ code : str # generated javascript code (only)
@@ -0,0 +1,71 @@
1
+
2
+
3
+ ### App Wiring
4
+
5
+ Sample code for react `App.js` (follow these guidelines EXACTLY):
6
+
7
+ ```jsx
8
+ // begin constant imports (always included) -- generate this code EXACTLY
9
+ import React from 'react';
10
+ import { Admin, Resource, Loading } from 'react-admin'; // val? loading
11
+ import { jsonapiClient } from "./rav4-jsonapi-client/ra-jsonapi-client";
12
+ import { createTheme } from '@mui/material/styles';
13
+ import { useConf, loadHomeConf } from "./Config"; // val ??
14
+ // end constant imports
15
+
16
+ // import each resource, e.g.
17
+ import { CustomerList, CustomerShow, CustomerCreate, CustomerEdit } from './Customer';
18
+ ...
19
+
20
+ const theme = createTheme({
21
+ palette: {
22
+ primary: { main: '#1976d2' }, // Material-UI default blue
23
+ secondary: { main: '#1565c0' }, // A darker blue, or choose another color
24
+ },
25
+ typography: { fontSize: 14 },
26
+ });
27
+
28
+ const App = () => {
29
+ const [conf, setConf] = React.useState({});
30
+
31
+ React.useEffect(() => {
32
+ const fetchData = async () => {
33
+ try {
34
+ console.log('loading HomeConf-1')
35
+ const conf = await loadHomeConf()
36
+ setConf(conf)
37
+ setLoading(false);
38
+ console.log('AppConf0: ', conf);
39
+ } catch (error) {
40
+ console.error('Error fetching data:', error);
41
+ sessionStorage.removeItem("raSpa");
42
+ }
43
+ };
44
+ fetchData();
45
+ }, []);
46
+
47
+ if (loading) {
48
+ return <Loading loadingPrimary="Loading..." loadingSecondary="Please wait" />;
49
+ }
50
+ const dataProvider = jsonapiClient(conf.api_root, { conf: {} }, null);
51
+
52
+ return (
53
+ // register each resource (do NOT generate {dataProvider(conf.api_root)}...
54
+ <Admin dataProvider={dataProvider} theme={theme}>
55
+ <Resource name="Customer" list={CustomerList} show={CustomerShow} edit={CustomerEdit} create={CustomerCreate} />
56
+ ...
57
+ </Admin>
58
+ );
59
+ };
60
+
61
+ export default App;
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Response Format
67
+
68
+ Format the response as a JSResponseFormat:
69
+
70
+ class JSResponseFormat(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
71
+ code : str # generated javascript code (only)
@@ -8,6 +8,7 @@ The result must be a runnable React app (`npm start`) that connects to the suppl
8
8
  ### Multi-Page
9
9
 
10
10
  For each resource:
11
+
11
12
  - Create a **List page** showing 7 user-friendly columns
12
13
  - Add **pagination**, **sorting**, and **filtering**
13
14
  - Link each row to a **Display (Show) page**
@@ -15,27 +16,33 @@ For each resource:
15
16
  ### Multi-Resource
16
17
 
17
18
  Each **Display Page** should:
19
+
18
20
  - Show all fields in a **multi-column layout**
19
21
  - Include a **tab sheet** (`<TabbedShowLayout>`) for each related resource using `<ReferenceManyField>`
20
22
  - Link child rows to their own display page
21
23
 
22
24
  Example:
25
+
23
26
  - Customer Display has tab for OrderList
27
+
24
28
  - The tab (with OrderList) is shown *below* all the Customer fields.
25
29
  - Each Order in the tab links to Order Display
26
30
 
27
31
  ### Automatic Joins
28
32
 
29
33
  For foreign keys:
34
+
30
35
  - Display joined value (e.g., `product.name` instead of `product_id`)
31
36
  - Use first string field from parent table containing `name`, `title`, or `description`
32
37
 
33
38
  Numeric Primary key fields:
39
+
34
40
  - Display at the end of forms/lists
35
41
 
36
42
  ### Lookups (Foreign Keys)
37
43
 
38
44
  For foreign key fields:
45
+
39
46
  - Provide auto-complete dropdown (`<ReferenceInput>`)
40
47
  - For numeric foreign keys, use the joined string field as lookup text
41
48
 
@@ -46,20 +53,18 @@ default the Foreign Key to the Parent (Master) Primary Key.
46
53
 
47
54
  ## Implementation
48
55
 
49
-
50
56
  ### Architecture
51
57
 
52
58
  - **Framework**: React 18 + react-admin 4.x
53
- - **Data Provider**: Custom `dataProvider.js` using `fetchUtils` (no external `ra-jsonapi-client`)
54
- - Must support: `getList`, `getOne`, `getMany`, `getManyReference`, `create`, `update`, `delete`
55
- - Must support: filters, joins, sorting, pagination
56
- - **Backend**: JSON:API per `mcp_discovery.json`
59
+ - **Data Provider**: Custom pre-built in src/rav4-jsonapi-client
57
60
  - **CORS**: Ensure API allows `http://localhost:3000`
58
- ```py
61
+
62
+ ```py
59
63
  from flask_cors import CORS
60
64
  CORS(app, origins='*') # or restrict to localhost:3000
61
- ```
65
+ ```
62
66
  - **Project Setup**:
67
+
63
68
  - Use `create-react-app`
64
69
  - Include: `react-admin`, `@mui/material`, `@emotion/react`, `@emotion/styled`, `react-router-dom`
65
70
  - Do not use any deprecated or unmaintained libraries
@@ -70,31 +75,35 @@ default the Foreign Key to the Parent (Master) Primary Key.
70
75
  ### Per-Resource Files (Required)
71
76
 
72
77
  For each resource (`Customer`, `Order` etc):
73
- - Create a source file under `src/`, e.g., `Customer.js`
74
- - **Each file must fully implement**:
75
- - `CustomerList`
76
- - `CustomerShow`
77
- - `CustomerCreate`
78
- - `CustomerEdit`
78
+
79
+ * Create a source file under `src/`, e.g., `Customer.js`
80
+ * Each file must **fully** implement:
81
+ * `CustomerList`
82
+ * `CustomerShow`
83
+ * `CustomerCreate`
84
+ * `CustomerEdit`
79
85
 
80
86
  Use:
87
+
81
88
  - `<ReferenceField>` for foreign key displays
82
89
  - `<ReferenceInput>` for foreign key input
83
90
  - `<ReferenceManyField>` for tabbed child lists
84
91
  - For show pages
85
- - Always start with <SimpleShowLayout>, followed by a <TabbedShowLayout> for related data
86
- - DO NOT start with <TabbedShowLayout>
87
92
 
88
- Be sure to include all required imports. ALWAYS use the following AS IS, plus whatever else is required:
93
+ * Always start with `<SimpleShowLayout>`, followed by a `<TabbedShowLayout>` for related data
94
+ * DO NOT start with `<TabbedShowLayout>`
95
+
96
+ ALWAYS include these 2 imports at the top of the file, with this EXACT formatting, whether or not they are used:
89
97
 
90
98
  ```jsx
91
- import { List, FunctionField, Datagrid, TextField, DateField, NumberField, ReferenceField, ReferenceManyField, Show, TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput, ReferenceInput, SelectInput, Create, SimpleForm, Edit, Filter, Pagination, BooleanField, BooleanInput } from 'react-admin';
99
+ import React from 'react';
100
+ import { List, FunctionField, Datagrid, TextField, DateField, NumberField, ReferenceField, ReferenceManyField, Show, TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput, ReferenceInput, SelectInput, Create, SimpleForm, Edit, Filter, Pagination, BooleanField, BooleanInput } from 'react-admin'; // mandatory import
92
101
  ```
93
102
  You may add other imports, but be sure all those are included.
94
103
 
95
- DO NOT use <EmailInput> - use <TextInput>.
104
+ DO NOT use `<EmailInput>` - use `<TextInput>`.
96
105
 
97
- DO NOT put <ReferenceField> in <Datagrid>.
106
+ DO NOT put `<ReferenceField>` in `<Datagrid>`.
98
107
 
99
108
  Do **not leave any file empty**.
100
109
 
@@ -102,19 +111,19 @@ Do **not leave any file empty**.
102
111
 
103
112
  ### App Wiring
104
113
 
105
- Sample code for `App.js`:
106
-
114
+ Sample code for `App.js` (follow these guidelines EXACTLY):
107
115
 
108
116
  ```jsx
117
+ // begin constant imports (always included) -- generate this code EXACTLY
109
118
  import React from 'react';
110
- import { Admin, Resource } from 'react-admin';
119
+ import { Admin, Resource, Loading } from 'react-admin'; // val? loading
111
120
  import { createTheme } from '@mui/material/styles';
121
+ import { useConf, loadHomeConf } from "./Config"; // val ??
122
+ // end constant imports
112
123
 
113
- // import each resource
124
+ // import each resource, e.g.
114
125
  import { CustomerList, CustomerShow, CustomerCreate, CustomerEdit } from './Customer';
115
126
  ...
116
- // import the data provider
117
- import { dataProvider } from './dataProvider';
118
127
 
119
128
  const theme = createTheme({
120
129
  palette: {
@@ -125,8 +134,32 @@ const theme = createTheme({
125
134
  });
126
135
 
127
136
  const App = () => {
128
- return (
129
- <Admin dataProvider={dataProvider}> // register each resource...
137
+ const [conf, setConf] = React.useState({});
138
+
139
+ React.useEffect(() => {
140
+ const fetchData = async () => {
141
+ try {
142
+ console.log('loading HomeConf-1')
143
+ const conf = await loadHomeConf()
144
+ setConf(conf)
145
+ setLoading(false);
146
+ console.log('AppConf0: ', conf);
147
+ } catch (error) {
148
+ console.error('Error fetching data:', error);
149
+ sessionStorage.removeItem("raSpa");
150
+ }
151
+ };
152
+ fetchData();
153
+ }, []);
154
+
155
+ if (loading) {
156
+ return <Loading loadingPrimary="Loading..." loadingSecondary="Please wait" />;
157
+ }
158
+ const dataProvider = jsonapiClient(conf.api_root, { conf: {} }, null);
159
+
160
+ return (
161
+ // register each resource (do NOT generate {dataProvider(conf.api_root)}...
162
+ <Admin dataProvider={dataProvider} theme={theme}>
130
163
  <Resource name="Customer" list={CustomerList} show={CustomerShow} edit={CustomerEdit} create={CustomerCreate} />
131
164
  ...
132
165
  </Admin>
@@ -136,14 +169,6 @@ const App = () => {
136
169
  export default App;
137
170
  ```
138
171
 
139
- For dataProvider:
140
- 1 - be sure it includes the braces: import { dataProvider }
141
- 2 - Do Not generate either:
142
- ```jsx
143
- import jsonServerProvider from 'ra-data-json-server'
144
- const dataProvider = jsonServerProvider('http://api.example.com');
145
- ```
146
-
147
172
  ---
148
173
 
149
174
  ## Response Format
@@ -10,11 +10,14 @@
10
10
  "@testing-library/jest-dom": "^6.6.3",
11
11
  "@testing-library/react": "^16.3.0",
12
12
  "@testing-library/user-event": "^13.5.0",
13
+ "compare-versions": "^6.1.1",
14
+ "keycloak-js": "^26.2.0",
13
15
  "react": "^19.1.0",
14
16
  "react-admin": "^5.8.3",
15
17
  "react-dom": "^19.1.0",
16
18
  "react-router-dom": "^7.6.2",
17
19
  "react-scripts": "5.0.1",
20
+ "url-join": "^5.0.0",
18
21
  "web-vitals": "^2.1.4"
19
22
  },
20
23
  "scripts": {