ApiLogicServer 15.0.24__py3-none-any.whl → 15.0.25__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.
- api_logic_server_cli/api_logic_server.py +2 -2
- api_logic_server_cli/genai/genai_admin_app.py +35 -31
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt copy.md +203 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +149 -76
- {apilogicserver-15.0.24.dist-info → apilogicserver-15.0.25.dist-info}/METADATA +1 -1
- {apilogicserver-15.0.24.dist-info → apilogicserver-15.0.25.dist-info}/RECORD +10 -9
- {apilogicserver-15.0.24.dist-info → apilogicserver-15.0.25.dist-info}/WHEEL +0 -0
- {apilogicserver-15.0.24.dist-info → apilogicserver-15.0.25.dist-info}/entry_points.txt +0 -0
- {apilogicserver-15.0.24.dist-info → apilogicserver-15.0.25.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-15.0.24.dist-info → apilogicserver-15.0.25.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.
|
|
15
|
+
__version__ = "15.00.25" # last public release: 15.00.22 (15.00.12)
|
|
16
16
|
recent_changes = \
|
|
17
17
|
f'\n\nRecent Changes:\n' +\
|
|
18
|
-
"\t06/
|
|
18
|
+
"\t06/24/2024 - 15.00.25: Tech Preview: als genai-app w/ sra provider+model+grid, 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"\
|
|
@@ -97,14 +97,27 @@ class GenAIAdminApp:
|
|
|
97
97
|
|
|
98
98
|
def a_generate_resource_files(self):
|
|
99
99
|
|
|
100
|
-
def
|
|
100
|
+
def fix_resource(raw_source: str) -> str:
|
|
101
101
|
''' Remove code occasional begin/end code markers <br>
|
|
102
|
+
And horrific override of ChatGPT refusal to generate imports AS DIRECTED!
|
|
102
103
|
ToDo: lint, and repeat generation if errors detected
|
|
103
104
|
'''
|
|
105
|
+
mandatory_imports = '''
|
|
106
|
+
// begin MANDATORY imports (always generated EXACTLY)
|
|
107
|
+
import React from 'react';
|
|
108
|
+
import { List, FunctionField, Datagrid, TextField, DateField, NumberField } from 'react-admin';
|
|
109
|
+
import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
110
|
+
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
111
|
+
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
112
|
+
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
113
|
+
import { Grid, Typography, Box, Divider } from '@mui/material';
|
|
114
|
+
// end mandatory imports
|
|
115
|
+
|
|
116
|
+
// generate pages and components...
|
|
117
|
+
'''
|
|
104
118
|
source_lines = raw_source.splitlines()
|
|
105
|
-
result_lines = [
|
|
106
|
-
|
|
107
|
-
found_from_react_admin = False
|
|
119
|
+
result_lines = []
|
|
120
|
+
imports_done = False
|
|
108
121
|
for each_line in source_lines:
|
|
109
122
|
if each_line.startswith("```"):
|
|
110
123
|
if each_line.startswith("```jsx") or each_line.startswith("```javascript"):
|
|
@@ -112,34 +125,20 @@ class GenAIAdminApp:
|
|
|
112
125
|
continue
|
|
113
126
|
else:
|
|
114
127
|
break
|
|
115
|
-
if
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
result_lines.append(each_line)
|
|
120
|
-
|
|
128
|
+
if do_mandatory_imports := True and not imports_done and '= (props) =>' in each_line:
|
|
129
|
+
result_lines = mandatory_imports.split('\n')
|
|
130
|
+
imports_done = True
|
|
131
|
+
result_lines.append(each_line)
|
|
121
132
|
# return source_lines as a string
|
|
122
133
|
return "\n".join(result_lines)
|
|
123
134
|
|
|
124
135
|
|
|
125
136
|
for each_resource_name, each_resource in self.resources.items():
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
"type": "text",
|
|
130
|
-
"text": "Here is a screenshot of the desired admin app layout. Use this as a visual guide to generate a React-Admin app that mimics the layout, structure, and joins."
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
"type": "image_url",
|
|
134
|
-
"image_url": {
|
|
135
|
-
"url": "https://apilogicserver.github.io/Docs/images/ui-admin/Order-Page-Learning.png"
|
|
136
|
-
# "url": f"attachment:/{str(self.image_url)}"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
]
|
|
137
|
+
learning = self.admin_app_resource_learning
|
|
138
|
+
learning = learning.replace('{{resource.js}}', f'{each_resource_name}.js')
|
|
140
139
|
messages = [
|
|
141
140
|
{"role": "user", "content": "You are a helpful expert in react and JavaScript"},
|
|
142
|
-
{"role": "user", "content":
|
|
141
|
+
{"role": "user", "content": learning},
|
|
143
142
|
# {"role": "user", "content": example_image_content},
|
|
144
143
|
# {"role": "user", "content": f'Schema:\n{self.schema_yaml}'},
|
|
145
144
|
{"role": "user", "content": f'Schema:\n{self.schema}'},
|
|
@@ -151,7 +150,7 @@ class GenAIAdminApp:
|
|
|
151
150
|
response_as=JSResponseFormat)
|
|
152
151
|
response_dict = json.loads(output)
|
|
153
152
|
target_file = self.ui_src_path / f"{each_resource_name}.js"
|
|
154
|
-
source_code =
|
|
153
|
+
source_code = fix_resource(response_dict['code'])
|
|
155
154
|
utils.write_file(target_file, source_code)
|
|
156
155
|
log.info(f"\n✅ Wrote: {target_file}")
|
|
157
156
|
|
|
@@ -163,12 +162,17 @@ class GenAIAdminApp:
|
|
|
163
162
|
'''
|
|
164
163
|
source_lines = raw_source.splitlines()
|
|
165
164
|
result_lines = []
|
|
166
|
-
data_provider_import = False
|
|
167
|
-
do_fixup = False
|
|
168
165
|
for each_line in source_lines:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
if each_line.startswith("```"):
|
|
167
|
+
if each_line.startswith("```jsx") or each_line.startswith("```javascript"):
|
|
168
|
+
result_lines = []
|
|
169
|
+
continue
|
|
170
|
+
else:
|
|
171
|
+
break
|
|
172
|
+
result_lines.append(each_line)
|
|
173
|
+
|
|
174
|
+
# return source_lines as a string
|
|
175
|
+
return "\n".join(result_lines)
|
|
172
176
|
|
|
173
177
|
messages = []
|
|
174
178
|
messages = [
|
|
@@ -0,0 +1,203 @@
|
|
|
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
|
+
### Per-Resource Files (Required)
|
|
9
|
+
|
|
10
|
+
For each resource (`Customer`, `Order` etc):
|
|
11
|
+
|
|
12
|
+
* Create a source file under `src/`, e.g., `Customer.js`
|
|
13
|
+
* Each file must **fully** implement:
|
|
14
|
+
* `CustomerList`
|
|
15
|
+
* `CustomerShow`
|
|
16
|
+
* `CustomerCreate`
|
|
17
|
+
* `CustomerEdit`
|
|
18
|
+
|
|
19
|
+
Use:
|
|
20
|
+
|
|
21
|
+
- `<ReferenceField>` for foreign key displays
|
|
22
|
+
- `<ReferenceInput>` for foreign key input
|
|
23
|
+
- `<ReferenceManyField>` for tabbed child lists
|
|
24
|
+
- For show pages
|
|
25
|
+
|
|
26
|
+
* Always start with `<SimpleShowLayout>`, followed by a `<TabbedShowLayout>` for related data
|
|
27
|
+
* DO NOT start with `<TabbedShowLayout>`
|
|
28
|
+
|
|
29
|
+
Use the attribute order from the schema.
|
|
30
|
+
|
|
31
|
+
You may add other imports, but be sure imports below are included.
|
|
32
|
+
|
|
33
|
+
DO NOT use `<EmailInput>` - use `<TextInput>`.
|
|
34
|
+
|
|
35
|
+
DO NOT put `<ReferenceField>` in `<Datagrid>`.
|
|
36
|
+
|
|
37
|
+
Do **not leave any file empty**.
|
|
38
|
+
|
|
39
|
+
Sample code for each resource (follow these guidelines EXACTLY):
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
import React from 'react';
|
|
43
|
+
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, Labeled } from 'react-admin'; // mandatory imports
|
|
44
|
+
|
|
45
|
+
import { Grid, Typography, Box, Divider } from '@mui/material';
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Filter for Customer List
|
|
49
|
+
const CustomerFilter = (props) => (
|
|
50
|
+
<Filter {...props}>
|
|
51
|
+
<TextInput label="Search" source="name" alwaysOn />
|
|
52
|
+
<BooleanInput label="Email Opt Out" source="email_opt_out" />
|
|
53
|
+
</Filter>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Customer List
|
|
57
|
+
export const CustomerList = (props) => {
|
|
58
|
+
return (
|
|
59
|
+
<List filters={<CustomerFilter />} {...props} sort={{ field: 'name', order: 'ASC' }} pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
|
|
60
|
+
<Datagrid rowClick="show">
|
|
61
|
+
<TextField source="name" label="Name" />
|
|
62
|
+
<NumberField source="balance" label="Balance" />
|
|
63
|
+
...
|
|
64
|
+
</Datagrid>
|
|
65
|
+
</List>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// Customer Show
|
|
71
|
+
export const CustomerShow = (props) => {
|
|
72
|
+
return (
|
|
73
|
+
<Show {...props}>
|
|
74
|
+
<SimpleShowLayout>
|
|
75
|
+
<Box sx={{ mb: 3 }}>
|
|
76
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
77
|
+
Customer Information
|
|
78
|
+
</Typography>
|
|
79
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
80
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
81
|
+
<Box sx={{ p: 1 }}>
|
|
82
|
+
<Labeled label="Name">
|
|
83
|
+
<TextField source="name" />
|
|
84
|
+
</Labeled>
|
|
85
|
+
</Box>
|
|
86
|
+
</Grid>
|
|
87
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
88
|
+
<Box sx={{ p: 1 }}>
|
|
89
|
+
<Labeled label="Balance">
|
|
90
|
+
<NumberField source="balance" options={{ style: 'currency', currency: 'USD' }} />
|
|
91
|
+
</Labeled>
|
|
92
|
+
</Box>
|
|
93
|
+
</Grid>
|
|
94
|
+
</Grid>
|
|
95
|
+
...
|
|
96
|
+
<Divider sx={{ my: 2 }} />
|
|
97
|
+
</Box>
|
|
98
|
+
</SimpleShowLayout>
|
|
99
|
+
<TabbedShowLayout>
|
|
100
|
+
<Tab label="Orders">
|
|
101
|
+
<ReferenceManyField reference="Order" target="customer_id" addLabel={false} pagination={<Pagination />}>
|
|
102
|
+
<Datagrid rowClick="show">
|
|
103
|
+
<TextField source="id" label="Order ID" />
|
|
104
|
+
<TextField source="notes" label="Notes" />
|
|
105
|
+
<DateField source="CreatedOn" label="Created On" />
|
|
106
|
+
<NumberField source="amount_total" label="Amount Total" options={{ style: 'currency', currency: 'USD' }} />
|
|
107
|
+
<DateField source="date_shipped" label="Date Shipped" />
|
|
108
|
+
</Datagrid>
|
|
109
|
+
</ReferenceManyField>
|
|
110
|
+
</Tab>
|
|
111
|
+
...
|
|
112
|
+
</TabbedShowLayout>
|
|
113
|
+
</Show>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// generate similar multi-column blocks (e.g., box) for edit and create, using <Edit {...props} redirect={false}>
|
|
118
|
+
|
|
119
|
+
export default {
|
|
120
|
+
list: CustomerList,
|
|
121
|
+
show: CustomerShow,
|
|
122
|
+
create: CustomerCreate,
|
|
123
|
+
edit: CustomerEdit,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## App Features
|
|
131
|
+
|
|
132
|
+
### Multi-Page
|
|
133
|
+
|
|
134
|
+
For each resource:
|
|
135
|
+
|
|
136
|
+
- Create a **List page** showing 7 user-friendly columns
|
|
137
|
+
- Add **pagination**, **sorting**, and **filtering**
|
|
138
|
+
- Link each row to a **Display (Show) page**
|
|
139
|
+
|
|
140
|
+
### Multi-Resource
|
|
141
|
+
|
|
142
|
+
Each **Display Page** should:
|
|
143
|
+
|
|
144
|
+
- Show all fields in a **multi-column layout**
|
|
145
|
+
- Include a **tab sheet** (`<TabbedShowLayout>`) for each related resource using `<ReferenceManyField>`
|
|
146
|
+
- Link child rows to their own display page
|
|
147
|
+
|
|
148
|
+
Example:
|
|
149
|
+
|
|
150
|
+
- Customer Display has tab for OrderList
|
|
151
|
+
|
|
152
|
+
- The tab (with OrderList) is shown *below* all the Customer fields.
|
|
153
|
+
- Each Order in the tab links to Order Display
|
|
154
|
+
|
|
155
|
+
### Automatic Joins
|
|
156
|
+
|
|
157
|
+
For foreign keys:
|
|
158
|
+
|
|
159
|
+
- Display joined value (e.g., `product.name` instead of `product_id`)
|
|
160
|
+
- Use first string field from parent table containing `name`, `title`, or `description`
|
|
161
|
+
|
|
162
|
+
Numeric Primary key fields:
|
|
163
|
+
|
|
164
|
+
- Display at the end of forms/lists
|
|
165
|
+
|
|
166
|
+
### Lookups (Foreign Keys)
|
|
167
|
+
|
|
168
|
+
For foreign key fields:
|
|
169
|
+
|
|
170
|
+
- Provide auto-complete dropdown (`<ReferenceInput>`)
|
|
171
|
+
- For numeric foreign keys, use the joined string field as lookup text
|
|
172
|
+
|
|
173
|
+
### Cascade Add
|
|
174
|
+
|
|
175
|
+
When adding a child row as a detail in a Master / Detail,
|
|
176
|
+
default the Foreign Key to the Parent (Master) Primary Key.
|
|
177
|
+
|
|
178
|
+
## Implementation
|
|
179
|
+
|
|
180
|
+
### Architecture
|
|
181
|
+
|
|
182
|
+
- **Framework**: React 18 + react-admin 4.x
|
|
183
|
+
- **Data Provider**: Custom pre-built in src/rav4-jsonapi-client
|
|
184
|
+
- **CORS**: Ensure API allows `http://localhost:3000`
|
|
185
|
+
|
|
186
|
+
```py
|
|
187
|
+
from flask_cors import CORS
|
|
188
|
+
CORS(app, origins='*') # or restrict to localhost:3000
|
|
189
|
+
```
|
|
190
|
+
- **Project Setup**:
|
|
191
|
+
|
|
192
|
+
- Use `create-react-app`
|
|
193
|
+
- Include: `react-admin`, `@mui/material`, `@emotion/react`, `@emotion/styled`, `react-router-dom`
|
|
194
|
+
- Do not use any deprecated or unmaintained libraries
|
|
195
|
+
- Include complete and correct `App.js`, `index.js`, `dataProvider.js`, and `index.html`
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Response Format
|
|
199
|
+
|
|
200
|
+
Format the response as a JSResponseFormat:
|
|
201
|
+
|
|
202
|
+
class JSResponseFormat(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
|
|
203
|
+
code : str # generated javascript code (only)
|
|
@@ -1,17 +1,159 @@
|
|
|
1
1
|
## Context
|
|
2
2
|
|
|
3
|
-
Generate
|
|
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
|
-
|
|
3
|
+
Generate the {{resource.js}} file for a React Admin application using the following instructions.
|
|
6
4
|
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
### Per-Resource Files (Required)
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Sample code (follow these guidelines EXACTLY):
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
<sample-code>
|
|
12
|
+
// begin MANDATORY imports (always generated EXACTLY)
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { List, FunctionField, Datagrid, TextField, DateField, NumberField } from 'react-admin';
|
|
15
|
+
import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
16
|
+
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
17
|
+
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
18
|
+
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
19
|
+
import { Grid, Typography, Box, Divider } from '@mui/material';
|
|
20
|
+
// end mandatory imports
|
|
21
|
+
|
|
22
|
+
// Filter for Customer List
|
|
23
|
+
const CustomerFilter = (props) => (
|
|
24
|
+
<Filter {...props}>
|
|
25
|
+
<TextInput label="Search" source="name" alwaysOn />
|
|
26
|
+
<BooleanInput label="Email Opt Out" source="email_opt_out" />
|
|
27
|
+
</Filter>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Customer List
|
|
31
|
+
export const CustomerList = (props) => {
|
|
32
|
+
return (
|
|
33
|
+
<List filters={<CustomerFilter />} {...props} sort={{ field: 'name', order: 'ASC' }} pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
|
|
34
|
+
<Datagrid rowClick="show">
|
|
35
|
+
<TextField source="name" label="Name" />
|
|
36
|
+
<NumberField source="balance" label="Balance" />
|
|
37
|
+
...
|
|
38
|
+
</Datagrid>
|
|
39
|
+
</List>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// Customer Show
|
|
45
|
+
export const CustomerShow = (props) => {
|
|
46
|
+
return (
|
|
47
|
+
<Show {...props}>
|
|
48
|
+
<SimpleShowLayout>
|
|
49
|
+
<Box sx={{ mb: 3 }}>
|
|
50
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
51
|
+
Customer Information
|
|
52
|
+
</Typography>
|
|
53
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
54
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
55
|
+
<Box sx={{ p: 1 }}>
|
|
56
|
+
<Labeled label="Name">
|
|
57
|
+
<TextField source="name" />
|
|
58
|
+
</Labeled>
|
|
59
|
+
</Box>
|
|
60
|
+
</Grid>
|
|
61
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
62
|
+
<Box sx={{ p: 1 }}>
|
|
63
|
+
<Labeled label="Balance">
|
|
64
|
+
<NumberField source="balance" options={{ style: 'currency', currency: 'USD' }} />
|
|
65
|
+
</Labeled>
|
|
66
|
+
</Box>
|
|
67
|
+
</Grid>
|
|
68
|
+
</Grid>
|
|
69
|
+
...
|
|
70
|
+
<Divider sx={{ my: 2 }} />
|
|
71
|
+
</Box>
|
|
72
|
+
</SimpleShowLayout>
|
|
73
|
+
<TabbedShowLayout>
|
|
74
|
+
<Tab label="Orders">
|
|
75
|
+
<ReferenceManyField reference="Order" target="customer_id" addLabel={false} pagination={<Pagination />}>
|
|
76
|
+
<Datagrid rowClick="show">
|
|
77
|
+
<TextField source="id" label="Order ID" />
|
|
78
|
+
<TextField source="notes" label="Notes" />
|
|
79
|
+
<DateField source="CreatedOn" label="Created On" />
|
|
80
|
+
<NumberField source="amount_total" label="Amount Total" options={{ style: 'currency', currency: 'USD' }} />
|
|
81
|
+
<DateField source="date_shipped" label="Date Shipped" />
|
|
82
|
+
</Datagrid>
|
|
83
|
+
</ReferenceManyField>
|
|
84
|
+
</Tab>
|
|
85
|
+
...
|
|
86
|
+
</TabbedShowLayout>
|
|
87
|
+
</Show>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Customer Create
|
|
92
|
+
export const CustomerCreate = (props) => {
|
|
93
|
+
return (
|
|
94
|
+
<Create {...props}>
|
|
95
|
+
<SimpleForm>
|
|
96
|
+
<Box sx={{ mb: 3 }}>
|
|
97
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
98
|
+
Create New Customer
|
|
99
|
+
</Typography>
|
|
100
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
101
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
102
|
+
<Box sx={{ p: 1 }}>
|
|
103
|
+
<TextInput source="name" label="Name" fullWidth />
|
|
104
|
+
</Box>
|
|
105
|
+
</Grid>
|
|
106
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
107
|
+
<Box sx={{ p: 1 }}>
|
|
108
|
+
<NumberInput source="balance" label="Balance" fullWidth />
|
|
109
|
+
</Box>
|
|
110
|
+
</Grid>
|
|
111
|
+
...
|
|
112
|
+
</Grid>
|
|
113
|
+
</Box>
|
|
114
|
+
</SimpleForm>
|
|
115
|
+
</Create>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Customer Edit
|
|
120
|
+
export const CustomerEdit = (props) => {
|
|
121
|
+
return (
|
|
122
|
+
<Edit {...props} redirect={false}>
|
|
123
|
+
<SimpleForm>
|
|
124
|
+
<Box sx={{ mb: 3 }}>
|
|
125
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
126
|
+
Edit Customer
|
|
127
|
+
</Typography>
|
|
128
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
129
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
130
|
+
<Box sx={{ p: 1 }}>
|
|
131
|
+
<TextInput source="name" label="Name" fullWidth />
|
|
132
|
+
</Box>
|
|
133
|
+
</Grid>
|
|
134
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
135
|
+
<Box sx={{ p: 1 }}>
|
|
136
|
+
<NumberInput source="balance" label="Balance" fullWidth />
|
|
137
|
+
</Box>
|
|
138
|
+
</Grid>
|
|
139
|
+
...
|
|
140
|
+
</Grid>
|
|
141
|
+
</Box>
|
|
142
|
+
</SimpleForm>
|
|
143
|
+
</Edit>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
list: CustomerList,
|
|
149
|
+
show: CustomerShow,
|
|
150
|
+
create: CustomerCreate,
|
|
151
|
+
edit: CustomerEdit,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
</sample-code>
|
|
155
|
+
|
|
156
|
+
For each resource (`Customer`, `Order` etc) and **fully** implement:
|
|
15
157
|
* `CustomerList`
|
|
16
158
|
* `CustomerShow`
|
|
17
159
|
* `CustomerCreate`
|
|
@@ -22,77 +164,15 @@ Use:
|
|
|
22
164
|
- `<ReferenceField>` for foreign key displays
|
|
23
165
|
- `<ReferenceInput>` for foreign key input
|
|
24
166
|
- `<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
167
|
|
|
32
|
-
|
|
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.
|
|
168
|
+
Use the attribute order from the schema.
|
|
37
169
|
|
|
38
170
|
DO NOT use `<EmailInput>` - use `<TextInput>`.
|
|
39
171
|
|
|
40
172
|
DO NOT put `<ReferenceField>` in `<Datagrid>`.
|
|
41
173
|
|
|
42
|
-
Do **not leave any file empty**.
|
|
43
|
-
|
|
44
174
|
---
|
|
45
175
|
|
|
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
176
|
### Architecture
|
|
97
177
|
|
|
98
178
|
- **Framework**: React 18 + react-admin 4.x
|
|
@@ -103,13 +183,6 @@ default the Foreign Key to the Parent (Master) Primary Key.
|
|
|
103
183
|
from flask_cors import CORS
|
|
104
184
|
CORS(app, origins='*') # or restrict to localhost:3000
|
|
105
185
|
```
|
|
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
186
|
|
|
114
187
|
## Response Format
|
|
115
188
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
api_logic_server_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
api_logic_server_cli/api_logic_server.py,sha256=
|
|
2
|
+
api_logic_server_cli/api_logic_server.py,sha256=3wWWl50qub5ryRBWJusrB42CIOuoIBOE1e09HjNKMkE,96384
|
|
3
3
|
api_logic_server_cli/api_logic_server_info.yaml,sha256=Rmy2DSMNBLtlV9PP_hqmn2FojD2AAinPVOfnTbwu6oE,128
|
|
4
4
|
api_logic_server_cli/cli.py,sha256=bSc3sj9df94pIx0HyRYKOojOv3M360UNQgieJAgg9IM,85002
|
|
5
5
|
api_logic_server_cli/cli_args_base.py,sha256=lr27KkOB7_WpZwTs7LgiK8LKDIHMKQkoZCTnE99BFxw,3280
|
|
@@ -476,7 +476,7 @@ api_logic_server_cli/genai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
476
476
|
api_logic_server_cli/genai/client.py,sha256=36gyz-dqxj4dJj1SGtO9NZsy9-cfnf4d7uahHimwqHk,772
|
|
477
477
|
api_logic_server_cli/genai/genai.py,sha256=rt4XW_xmo-D5fLD8DQBHMjrU7Teflw43S8lR-tJd4KU,47014
|
|
478
478
|
api_logic_server_cli/genai/genai_admin_app copy.py,sha256=d1E6kNVhq-xqhUh2j52V4cOTJxEiZgWhja1_kLJXKX8,4665
|
|
479
|
-
api_logic_server_cli/genai/genai_admin_app.py,sha256=
|
|
479
|
+
api_logic_server_cli/genai/genai_admin_app.py,sha256=GWtgynqOzUJOK1n_AalJPbzWxjGrqcc9Bw4rCQ5mfas,9627
|
|
480
480
|
api_logic_server_cli/genai/genai_fatal_excp.py,sha256=1FmDVcXVRqmG0JMVZ7l4KqMOdpff3KGZ2LPAGtw304Q,179
|
|
481
481
|
api_logic_server_cli/genai/genai_graphics.py,sha256=9ao0os6rUKY5u2caeLtgyDsNEuVQXq4KcKV575fNC58,20610
|
|
482
482
|
api_logic_server_cli/genai/genai_logic_builder.py,sha256=u_89UtrALIfcMtW6p0SZ78lCmwRqerA5igyY2hDvjlk,26150
|
|
@@ -1210,7 +1210,8 @@ api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv-
|
|
|
1210
1210
|
api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.ps1,sha256=_-LfKkLw5HOkZsF59BGCqM9Zsk3n1oDIyDb4emy0O08,698
|
|
1211
1211
|
api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.sh,sha256=aWX9fa8fe6aO9ifBIZEgGY5UGh4I0arOoCwBzDsxgU8,893
|
|
1212
1212
|
api_logic_server_cli/prototypes/manager/system/genai/.DS_Store,sha256=ndrcwHjeXXcVbvjdiQNuyCtmI6m-kvDLoEnr0fFJsuY,6148
|
|
1213
|
-
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=
|
|
1213
|
+
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt copy.md,sha256=cDkLjSRPZxfmgDZhObilm1K67ZweOv9TkGT6cTpZNOM,6741
|
|
1214
|
+
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=9smWe64B73X6xnxkPU-rLD4l2x692iAVf2zf0NAfsB4,6899
|
|
1214
1215
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-js-Learning-Prompt.md,sha256=75FA3txqJ1viIyqt9O6nGpi17As7aSgVyUJ1rImriKc,2054
|
|
1215
1216
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-config-prompt.md,sha256=fyP8X1q9tM3i6bTVioa7ieM_aTUfk4GPo08aOWZ60-0,932
|
|
1216
1217
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-json-api-model-prompt.md,sha256=5Zp9q_lpY225qceQ3UhF4Fyd-85hDKkD-r3BWYmcs6Y,2890
|
|
@@ -2274,9 +2275,9 @@ api_logic_server_cli/tools/mini_skel/database/system/SAFRSBaseX.py,sha256=p8C7AF
|
|
|
2274
2275
|
api_logic_server_cli/tools/mini_skel/database/system/TestDataBase.py,sha256=U02SYqThsbY5g3DX7XGaiMxjZBuOpzvtPS6RfI1WQFg,371
|
|
2275
2276
|
api_logic_server_cli/tools/mini_skel/logic/declare_logic.py,sha256=fTrlHyqMeZsw_TyEXFa1VlYBL7fzjZab5ONSXO7aApo,175
|
|
2276
2277
|
api_logic_server_cli/tools/mini_skel/logic/load_verify_rules.py,sha256=Rr5bySJpYCZmNPF2h-phcPJ53nAOPcT_ohZpCD93-a0,7530
|
|
2277
|
-
apilogicserver-15.0.
|
|
2278
|
-
apilogicserver-15.0.
|
|
2279
|
-
apilogicserver-15.0.
|
|
2280
|
-
apilogicserver-15.0.
|
|
2281
|
-
apilogicserver-15.0.
|
|
2282
|
-
apilogicserver-15.0.
|
|
2278
|
+
apilogicserver-15.0.25.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
|
|
2279
|
+
apilogicserver-15.0.25.dist-info/METADATA,sha256=S1JbGhtzVFAiIu32hv3hVni1sa6t11SxWQJVdfg8ucE,6553
|
|
2280
|
+
apilogicserver-15.0.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
2281
|
+
apilogicserver-15.0.25.dist-info/entry_points.txt,sha256=KiLloZJ3c_RW-nIDqBtoE0WEsQTnZ3dELwHLWi23LMA,103
|
|
2282
|
+
apilogicserver-15.0.25.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
|
|
2283
|
+
apilogicserver-15.0.25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|