data-primals-engine 1.5.0 → 1.5.2
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.
- package/README.md +37 -0
- package/client/src/AddWidgetTypeModal.jsx +47 -43
- package/client/src/App.jsx +2 -6
- package/client/src/App.scss +13 -1
- package/client/src/AssistantChat.jsx +363 -323
- package/client/src/AssistantChat.scss +27 -10
- package/client/src/Dashboard.jsx +480 -396
- package/client/src/Dashboard.scss +1 -1
- package/client/src/DashboardHtmlViewItem.jsx +147 -0
- package/client/src/DashboardView.jsx +654 -569
- package/client/src/DataEditor.jsx +10 -3
- package/client/src/DataLayout.jsx +807 -755
- package/client/src/DataLayout.scss +14 -0
- package/client/src/DataTable.jsx +39 -75
- package/client/src/Dialog.scss +1 -1
- package/client/src/Field.jsx +2057 -1825
- package/client/src/FlexViewCard.jsx +44 -0
- package/client/src/HistoryDialog.jsx +69 -14
- package/client/src/HtmlViewBuilderModal.jsx +91 -0
- package/client/src/HtmlViewBuilderModal.scss +18 -0
- package/client/src/HtmlViewCard.jsx +44 -0
- package/client/src/HtmlViewCard.scss +35 -0
- package/client/src/KanbanCard.jsx +1 -2
- package/client/src/ModelCreator.jsx +5 -4
- package/client/src/ModelCreatorField.jsx +51 -4
- package/client/src/ModelList.jsx +280 -236
- package/client/src/Notification.jsx +136 -136
- package/client/src/Notification.scss +0 -18
- package/client/src/Pagination.jsx +5 -3
- package/client/src/RelationField.jsx +354 -258
- package/client/src/RelationSelectorWidget.jsx +173 -0
- package/client/src/contexts/ModelContext.jsx +10 -1
- package/client/src/contexts/UIContext.jsx +72 -63
- package/client/src/filter.js +263 -212
- package/client/src/hooks/useValidation.js +75 -0
- package/client/src/translations.js +24 -24
- package/package.json +7 -6
- package/src/constants.js +1 -1
- package/src/core.js +8 -1
- package/src/defaultModels.js +1596 -1544
- package/src/engine.js +85 -43
- package/src/events.js +137 -113
- package/src/i18n.js +710 -10
- package/src/index.js +3 -0
- package/src/modules/assistant/assistant.js +253 -134
- package/src/modules/assistant/constants.js +2 -1
- package/src/modules/bucket.js +2 -1
- package/src/modules/data/data.core.js +118 -92
- package/src/modules/data/data.history.js +555 -492
- package/src/modules/data/data.js +3 -53
- package/src/modules/data/data.operations.js +3381 -3231
- package/src/modules/data/data.relations.js +686 -686
- package/src/modules/data/data.routes.js +1879 -1821
- package/src/modules/data/data.validation.js +81 -2
- package/src/modules/file.js +247 -238
- package/src/modules/user.js +1 -0
- package/src/modules/workflow.js +2 -2
- package/src/openai.jobs.js +3 -2
- package/src/packs.js +5482 -5478
- package/src/sso.js +2 -2
- package/src/workers/import-export-worker.js +1 -1
- package/test/data.history.integration.test.js +264 -192
- package/test/data.integration.test.js +149 -3
package/README.md
CHANGED
|
@@ -111,6 +111,26 @@ MONGO_DB_URL=mongodb://127.0.0.1:27017
|
|
|
111
111
|
| CERT | Path to cert file. | certs/cert.pem |
|
|
112
112
|
| CERT_KEY | Path to the key file for your certificate. | certs/key.pem |
|
|
113
113
|
|
|
114
|
+
### Programmatic Configuration
|
|
115
|
+
|
|
116
|
+
In addition to environment variables, you can programmatically override most of the application's internal constants at runtime. This is useful for fine-tuning performance, limits, or behavior without restarting the server.
|
|
117
|
+
|
|
118
|
+
The engine exposes a `Config` object for this purpose. You can modify any constant defined in `src/constants.js`.
|
|
119
|
+
|
|
120
|
+
To override a constant, use the `Config.Set()` method **before** initializing the engine:
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
import express from "express";
|
|
124
|
+
import { Engine, Config } from 'data-primals-engine';
|
|
125
|
+
|
|
126
|
+
// Override default constants before engine initialization
|
|
127
|
+
Config.Set("maxRequestData", 1000); // Increase max data per request
|
|
128
|
+
Config.Set("maxFileSize", 50 * 1024 * 1024); // Allow larger file uploads (50MB)
|
|
129
|
+
|
|
130
|
+
const app = express();
|
|
131
|
+
const engine = await Engine.Create({ app });
|
|
132
|
+
```
|
|
133
|
+
|
|
114
134
|
### Start the server
|
|
115
135
|
```bash
|
|
116
136
|
# Development mode
|
|
@@ -410,6 +430,21 @@ await editData(
|
|
|
410
430
|
);
|
|
411
431
|
```
|
|
412
432
|
|
|
433
|
+
```javascript
|
|
434
|
+
await editData(
|
|
435
|
+
"resource",
|
|
436
|
+
{ source: "507f1f77bcf86cd799439011" },
|
|
437
|
+
{ "file[]": {
|
|
438
|
+
"path": "C:/Users/.../test-upload-on-insert.txt",
|
|
439
|
+
"name": 'test-upload-on-insert.txt',
|
|
440
|
+
"type": 'text/plain',
|
|
441
|
+
"size": 1524,
|
|
442
|
+
"lastModifiedDate": new Date(),
|
|
443
|
+
}}, // No files
|
|
444
|
+
currentUser
|
|
445
|
+
);
|
|
446
|
+
```
|
|
447
|
+
|
|
413
448
|
### patchData(modelName, filter, data, files, user)
|
|
414
449
|
|
|
415
450
|
> Partially updates data (only modifies specified fields).
|
|
@@ -828,6 +863,8 @@ Event.Listen("OnDataAdded", (engine, data) => {
|
|
|
828
863
|
| OnDataValidate | Triggered to override validation check. | System | internal | (value, field, data) |
|
|
829
864
|
| OnDataFilter | Triggered to override data filtering operation. | System | internal | (filteredValue, field, data) |
|
|
830
865
|
| OnEmailTemplate | Triggered to override custom email templates | System | internal | (templateData, lang) |
|
|
866
|
+
| OnSystemPrompt | Triggered to override assistant system prompt | User | handleChatRequest | (user) |
|
|
867
|
+
| OnChatAction | Triggered when an action is created by the AI | User | handleChatRequest | (action, params, parsedResponse, user) |
|
|
831
868
|
|
|
832
869
|
### Triggering events
|
|
833
870
|
|
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
// src/components/AddWidgetTypeModal.jsx
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { FaChartBar, FaTachometerAlt, FaThLarge } from 'react-icons/fa';
|
|
6
|
-
import './AddWidgetTypeModal.scss';
|
|
7
|
-
import {Dialog} from "./Dialog.jsx"; // Créez ce fichier SCSS
|
|
8
|
-
|
|
9
|
-
const AddWidgetTypeModal = ({ onClose, onSelectType }) => {
|
|
10
|
-
const { t } = useTranslation();
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Dialog className={"add-widget-type-modal-content"} isModal={true} isClosable={true} onClose={onClose} title={t('dashboard.addWidgetTitle', 'Ajouter un élément au tableau de bord')}>
|
|
14
|
-
<>
|
|
15
|
-
<div className="flex widget-type-options">
|
|
16
|
-
<button onClick={() => onSelectType('KPI')} className="widget-type-button">
|
|
17
|
-
<FaTachometerAlt size={40} />
|
|
18
|
-
<span>{t('dashboard.addKPI', 'Ajouter un KPI')}</span>
|
|
19
|
-
</button>
|
|
20
|
-
<button onClick={() => onSelectType('Chart')} className="widget-type-button">
|
|
21
|
-
<FaChartBar size={40} />
|
|
22
|
-
<span>{t('dashboard.addChart', 'Ajouter un Graphique')}</span>
|
|
23
|
-
</button>
|
|
24
|
-
<button disabled={false} onClick={() => onSelectType('FlexView')} className="widget-type-button">
|
|
25
|
-
<FaThLarge size={40} />
|
|
26
|
-
<span>{t('dashboard.addFlexView', 'Ajouter une Vue Flex')}</span>
|
|
27
|
-
</button>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
// src/components/AddWidgetTypeModal.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { FaChartBar, FaTachometerAlt, FaThLarge, FaFileCode } from 'react-icons/fa';
|
|
6
|
+
import './AddWidgetTypeModal.scss';
|
|
7
|
+
import {Dialog} from "./Dialog.jsx"; // Créez ce fichier SCSS
|
|
8
|
+
|
|
9
|
+
const AddWidgetTypeModal = ({ onClose, onSelectType }) => {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Dialog className={"add-widget-type-modal-content"} isModal={true} isClosable={true} onClose={onClose} title={t('dashboard.addWidgetTitle', 'Ajouter un élément au tableau de bord')}>
|
|
14
|
+
<>
|
|
15
|
+
<div className="flex widget-type-options">
|
|
16
|
+
<button onClick={() => onSelectType('KPI')} className="widget-type-button">
|
|
17
|
+
<FaTachometerAlt size={40} />
|
|
18
|
+
<span>{t('dashboard.addKPI', 'Ajouter un KPI')}</span>
|
|
19
|
+
</button>
|
|
20
|
+
<button onClick={() => onSelectType('Chart')} className="widget-type-button">
|
|
21
|
+
<FaChartBar size={40} />
|
|
22
|
+
<span>{t('dashboard.addChart', 'Ajouter un Graphique')}</span>
|
|
23
|
+
</button>
|
|
24
|
+
<button disabled={false} onClick={() => onSelectType('FlexView')} className="widget-type-button">
|
|
25
|
+
<FaThLarge size={40} />
|
|
26
|
+
<span>{t('dashboard.addFlexView', 'Ajouter une Vue Flex')}</span>
|
|
27
|
+
</button>
|
|
28
|
+
<button onClick={() => onSelectType('HtmlView')} className="widget-type-button">
|
|
29
|
+
<FaFileCode size={40} />
|
|
30
|
+
<span>{t('dashboard.addHtmlView', 'Ajouter une Vue HTML')}</span>
|
|
31
|
+
</button>
|
|
32
|
+
</div>
|
|
33
|
+
<div className={"flex actions center"}>
|
|
34
|
+
<button onClick={onClose} className="btn-close-modal">
|
|
35
|
+
{t('btns.cancel', 'Annuler')}
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
</>
|
|
39
|
+
</Dialog>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
AddWidgetTypeModal.propTypes = {
|
|
44
|
+
onClose: PropTypes.func.isRequired,
|
|
45
|
+
onSelectType: PropTypes.func.isRequired,
|
|
46
|
+
};
|
|
47
|
+
|
|
44
48
|
export default AddWidgetTypeModal;
|
package/client/src/App.jsx
CHANGED
|
@@ -90,9 +90,7 @@ function Layout ({header, routes, body, footer,refreshUI}) {
|
|
|
90
90
|
const lang = (i18n.resolvedLanguage || i18n.language).split(/[-_]/)?.[0];
|
|
91
91
|
const {models= [], setGeneratedModels } = useModelContext();
|
|
92
92
|
const { me, setMe } = useAuthContext();
|
|
93
|
-
|
|
94
|
-
const [assistantConfig, setAssistantConfig] = useState(null);
|
|
95
|
-
|
|
93
|
+
const { assistantConfig, setAssistantConfig} = useUI();
|
|
96
94
|
const promotionalMessages = [
|
|
97
95
|
{ text: t('promo.rotation.6') },
|
|
98
96
|
{ text: t('promo.rotation.1') },
|
|
@@ -312,7 +310,6 @@ function Layout ({header, routes, body, footer,refreshUI}) {
|
|
|
312
310
|
const myInputRef = useRef(null);
|
|
313
311
|
|
|
314
312
|
return <div className={['ar', 'fa'].includes(lang)? 'rtl' : 'ltr'}>
|
|
315
|
-
<NotificationList />
|
|
316
313
|
<><Helmet><title>
|
|
317
314
|
{t('seo.title', seoTitle)}</title></Helmet></>
|
|
318
315
|
<Routes>
|
|
@@ -408,7 +405,6 @@ function Layout ({header, routes, body, footer,refreshUI}) {
|
|
|
408
405
|
<footer className="flex flex-centered">
|
|
409
406
|
{footer}
|
|
410
407
|
</footer>
|
|
411
|
-
{me && <AssistantChat config={assistantConfig} />}
|
|
412
408
|
</div>;
|
|
413
409
|
}
|
|
414
410
|
|
|
@@ -574,7 +570,7 @@ const BaseLayout=()=>{
|
|
|
574
570
|
</div>
|
|
575
571
|
<div className="flex">
|
|
576
572
|
<FaQuestion data-tooltip-id="header" data-tooltip-content="Documentation" onClick={()=> {
|
|
577
|
-
window.open("
|
|
573
|
+
window.open("/en/documentation/", "_blank");
|
|
578
574
|
}} />
|
|
579
575
|
</div>
|
|
580
576
|
</header>} />
|
package/client/src/App.scss
CHANGED
|
@@ -110,6 +110,18 @@ h2 {
|
|
|
110
110
|
border-bottom: 1px solid #969696;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
.p-1 {
|
|
114
|
+
padding: 4px;
|
|
115
|
+
}
|
|
116
|
+
.p-2 {
|
|
117
|
+
padding: 8px;
|
|
118
|
+
}
|
|
119
|
+
.p-3 {
|
|
120
|
+
padding: 16px;
|
|
121
|
+
}
|
|
122
|
+
.p-4 {
|
|
123
|
+
padding: 32px;
|
|
124
|
+
}
|
|
113
125
|
.prior {
|
|
114
126
|
position: relative;
|
|
115
127
|
text-align: center;
|
|
@@ -1563,4 +1575,4 @@ select[multiple]{
|
|
|
1563
1575
|
}
|
|
1564
1576
|
.gap-4 {
|
|
1565
1577
|
gap: 32px;
|
|
1566
|
-
}
|
|
1578
|
+
}
|