@genesislcap/blank-app-seed 2.5.10 → 2.7.0
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/.genx/configure.js +18 -6
- package/.genx/package.json +1 -1
- package/.genx/prompts/server.js +23 -1
- package/.genx/prompts.js +2 -1
- package/.genx/templates/csv.hbs +1 -0
- package/.genx/templates/entityManager.hbs +26 -4
- package/.genx/templates/form.hbs +9 -1
- package/.genx/templates/grid.hbs +5 -0
- package/.genx/utils.js +36 -1
- package/.github/pull_request_template.md +6 -1
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
package/.genx/configure.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const versions = require('./versions.json');
|
|
2
|
-
const { registerPartials, generateRoute } = require('./utils');
|
|
2
|
+
const { registerPartials, generateRoute, generateEmptyCsv, formatRouteData } = require('./utils');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Signature is `async (data: inquirer.Answers, utils: SeedConfigurationUtils)`
|
|
@@ -14,10 +14,22 @@ module.exports = async (data, utils) => {
|
|
|
14
14
|
|
|
15
15
|
registerPartials(utils);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
data.routes
|
|
18
|
+
.forEach((route) => {
|
|
19
|
+
if (!route.name) {
|
|
20
|
+
console.warn('Invalid route - missing name', route);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const routeData = formatRouteData(route);
|
|
24
|
+
generateRoute(routeData, utils);
|
|
25
|
+
});
|
|
22
26
|
|
|
27
|
+
data.csv
|
|
28
|
+
.map(entity => ({
|
|
29
|
+
name: entity.name.toUpperCase(),
|
|
30
|
+
fields: entity.fields.map( (field, index) => ({name: field.toUpperCase(), isLast: index === (entity.fields.length -1) }))
|
|
31
|
+
}))
|
|
32
|
+
.forEach(entity => {
|
|
33
|
+
generateEmptyCsv(entity, data.appName, utils);
|
|
34
|
+
});
|
|
23
35
|
};
|
package/.genx/package.json
CHANGED
package/.genx/prompts/server.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
const {mavenArtifactVersionRegex} = require('./validators');
|
|
2
2
|
|
|
3
|
+
const parsecsv = (inputEntities) => {
|
|
4
|
+
if (!inputEntities){
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(inputEntities);
|
|
9
|
+
} catch (error) {
|
|
10
|
+
console.error("Error parsing `csv` parameter as JSON:", error.message);
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
module.exports = async (inquirer, prevAns = {}) => {
|
|
4
16
|
const {
|
|
5
17
|
groupId = prevAns.groupId,
|
|
6
18
|
applicationVersion = prevAns.applicationVersion,
|
|
7
|
-
enableDeployPlugin = prevAns.enableDeployPlugin
|
|
19
|
+
enableDeployPlugin = prevAns.enableDeployPlugin,
|
|
20
|
+
csv = prevAns.csv,
|
|
8
21
|
} = await inquirer.prompt([
|
|
9
22
|
{
|
|
10
23
|
name: 'groupId',
|
|
@@ -28,10 +41,19 @@ module.exports = async (inquirer, prevAns = {}) => {
|
|
|
28
41
|
when: prevAns.enableDeployPlugin === undefined,
|
|
29
42
|
default: prevAns.enableDeployPlugin || false
|
|
30
43
|
},
|
|
44
|
+
{
|
|
45
|
+
name: 'csv',
|
|
46
|
+
type: 'input',
|
|
47
|
+
message: 'Generate empty CSV for entities? (config in json format)',
|
|
48
|
+
when: !prevAns.csv,
|
|
49
|
+
default: '[]'
|
|
50
|
+
},
|
|
31
51
|
]);
|
|
52
|
+
|
|
32
53
|
return {
|
|
33
54
|
groupId,
|
|
34
55
|
applicationVersion,
|
|
35
56
|
enableDeployPlugin,
|
|
57
|
+
csv: parsecsv(csv)
|
|
36
58
|
};
|
|
37
59
|
};
|
package/.genx/prompts.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = async (inquirer, prevAns = {}) => {
|
|
|
12
12
|
License: ${license}`);
|
|
13
13
|
|
|
14
14
|
const {apiHost, enableSSO} = await apiPrompts(inquirer, prevAns)
|
|
15
|
-
const {groupId, applicationVersion, enableDeployPlugin} = await genesisServerPrompts(inquirer, prevAns);
|
|
15
|
+
const {groupId, applicationVersion, enableDeployPlugin, csv} = await genesisServerPrompts(inquirer, prevAns);
|
|
16
16
|
const {routes} = await uiPrompts(inquirer, prevAns);
|
|
17
17
|
|
|
18
18
|
return {
|
|
@@ -22,5 +22,6 @@ module.exports = async (inquirer, prevAns = {}) => {
|
|
|
22
22
|
groupId,
|
|
23
23
|
applicationVersion,
|
|
24
24
|
enableDeployPlugin,
|
|
25
|
+
csv,
|
|
25
26
|
};
|
|
26
27
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{#each entity.fields}}{{this.name}}{{#unless this.isLast }},{{/unless}}{{/each}}
|
|
@@ -3,16 +3,38 @@
|
|
|
3
3
|
title="{{ config.title }}"
|
|
4
4
|
{{/if}}
|
|
5
5
|
resourceName="{{ config.resourceName }}"
|
|
6
|
+
{{#if config.createEvent}}
|
|
7
|
+
createEvent="{{ config.createEvent }}"
|
|
8
|
+
{{#if config.createFormUiSchema}}
|
|
9
|
+
:createFormUiSchema=${() => (
|
|
10
|
+
{{{ config.createFormUiSchema }}}
|
|
11
|
+
)}
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{/if}}
|
|
6
14
|
{{#if config.updateEvent}}
|
|
7
15
|
updateEvent="{{ config.updateEvent }}"
|
|
16
|
+
{{#if config.updateFormUiSchema}}
|
|
17
|
+
:updateFormUiSchema=${() => (
|
|
18
|
+
{{{ config.updateFormUiSchema }}}
|
|
19
|
+
)}
|
|
20
|
+
{{/if}}
|
|
8
21
|
{{/if}}
|
|
9
22
|
{{#if config.deleteEvent}}
|
|
10
23
|
deleteEvent="{{ config.deleteEvent }}"
|
|
11
24
|
{{/if}}
|
|
12
|
-
{{#if config.createEvent}}
|
|
13
|
-
createEvent="{{ config.createEvent }}"
|
|
14
|
-
{{/if}}
|
|
15
25
|
{{#if config.snapshot}}
|
|
16
|
-
:datasourceConfig
|
|
26
|
+
:datasourceConfig=${() => ({isSnapshot: {{ config.snapshot }} })}
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#if config.columns}}
|
|
29
|
+
:columns=${() => {{{ config.columns }}} }
|
|
30
|
+
{{/if}}
|
|
31
|
+
{{#if config.modalPosition}}
|
|
32
|
+
modal-position="{{ config.modalPosition }}"
|
|
33
|
+
{{/if}}
|
|
34
|
+
{{#if config.sizeColumnsToFit}}
|
|
35
|
+
size-columns-to-fit
|
|
36
|
+
{{/if}}
|
|
37
|
+
{{#if config.enableSearchBar}}
|
|
38
|
+
enable-search-bar
|
|
17
39
|
{{/if}}
|
|
18
40
|
></entity-management>
|
package/.genx/templates/form.hbs
CHANGED
package/.genx/templates/grid.hbs
CHANGED
package/.genx/utils.js
CHANGED
|
@@ -22,8 +22,43 @@ const generateRoute = (route, { writeFileWithData, changeCase }) => {
|
|
|
22
22
|
writeFileWithData(resolve(__dirname, `../client/src/routes/${routeName}/${routeName}.styles.ts`), {route}, resolve(__dirname, 'templates/route.styles.hbs'));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
const generateEmptyCsv = (entity, appName, { writeFileWithData }) => {
|
|
26
|
+
writeFileWithData(resolve(__dirname, `../server/{{appName}}-app/src/main/genesis/data/${entity.name}.csv`), {entity}, resolve(__dirname, 'templates/csv.hbs'));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const formatJSONValue = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
return value ? JSON.stringify(value, null, 2) : undefined;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.warn('Could not serialise value to JSON', value, e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const formatRouteData = (route) => {
|
|
38
|
+
const layoutKey = route?.layoutKey || `${route.name}_${Date.now()}`;
|
|
39
|
+
const tiles = route.tiles?.map(tile => ({
|
|
40
|
+
...tile,
|
|
41
|
+
config: {
|
|
42
|
+
...(tile.config || {}),
|
|
43
|
+
createFormUiSchema: formatJSONValue(tile.config?.createFormUiSchema),
|
|
44
|
+
updateFormUiSchema: formatJSONValue(tile.config?.updateFormUiSchema),
|
|
45
|
+
deferredGridOptions: formatJSONValue(tile.config?.deferredGridOptions),
|
|
46
|
+
uischema: formatJSONValue(tile.config?.uischema),
|
|
47
|
+
columns: formatJSONValue(tile.config?.columns)
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
...route,
|
|
53
|
+
layoutKey,
|
|
54
|
+
tiles
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
25
58
|
module.exports = {
|
|
26
59
|
makeDirectory,
|
|
27
60
|
registerPartials,
|
|
28
|
-
generateRoute
|
|
61
|
+
generateRoute,
|
|
62
|
+
generateEmptyCsv,
|
|
63
|
+
formatRouteData,
|
|
29
64
|
};
|
|
@@ -26,13 +26,18 @@ Add file / directory pointers.
|
|
|
26
26
|
|
|
27
27
|
📑 **How should this be tested?**
|
|
28
28
|
|
|
29
|
+
### Defaults
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
```
|
|
32
|
-
npx -y @genesislcap/genx@latest init
|
|
33
|
+
rm -rf blankappseedtest && npx -y @genesislcap/genx@latest init blankappseedtest -x --ref YOUR-BRANCH-NAME --no-npm
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
### Route and CSV parameter handling test
|
|
35
37
|
|
|
38
|
+
```
|
|
39
|
+
rm -rf blankappseedtest && npx -y @genesislcap/genx@latest init blankappseedtest --ref YOUR-BRANCH-NAME --no-npm -x --routes '[{"name":"Home","tiles":[{"title":"Entity manager","type":"entity-manager","config":{ "modalPosition": "centre", "sizeColumnsToFit": true, "enableSearchBar": true, "resourceName":"ALL_POSITIONS","title":"My Positions","updateEvent":"EVENT_COUNTERPARTY_MODIFY","deleteEvent":"EVENT_COUNTERPARTY_DELETE","createEvent":"EVENT_COUNTERPARTY_INSERT", "createFormUiSchema": {"type":"VerticalLayout","elements":[{"type":"Control","label":"Inline create schema - main contact","scope":"#/properties/MAIN_CONTACT"},{"type":"Control","label":"Issuer Name - Local Schema","scope":"#/properties/ISSUER_NAME","options":{"readonly":true}},{"type":"Control","label":"Price","scope":"#/properties/PRICE"},{"type":"Control","scope":"#/properties/COUNTERPARTY","options":{"allOptionsResourceName":"ALL_COUNTERPARTYS","valueField":"COUNTERPARTY_ID","labelField":"COUNTERPARTY_ID"}},{"type":"Control","label":"Password","scope":"#/properties/PASSWORD","options":{"isPassword":true}},{"type":"Control","label":"Password","scope":"#/properties/PASSWORD","options":{"textarea":true}}]}, "updateFormUiSchema": {"type":"VerticalLayout","elements":[{"type":"Control","label":"Inline update schema - main contact","scope":"#/properties/MAIN_CONTACT"},{"type":"Control","label":"Issuer Name - Local Schema","scope":"#/properties/ISSUER_NAME","options":{"readonly":true}},{"type":"Control","label":"Price","scope":"#/properties/PRICE"},{"type":"Control","scope":"#/properties/COUNTERPARTY","options":{"allOptionsResourceName":"ALL_COUNTERPARTYS","valueField":"COUNTERPARTY_ID","labelField":"COUNTERPARTY_ID"}},{"type":"Control","label":"Password","scope":"#/properties/PASSWORD","options":{"isPassword":true}},{"type":"Control","label":"Password","scope":"#/properties/PASSWORD","options":{"textarea":true}}]}, "columns": [{"field":"INSTRUMENT_NAME","headerName":"Instrument Name"},{"field":"VALUE","headerName":"Inline coldef - VALUE"},{"field":"QUANTITY","headerName":"Quantity"},{"field":"PNL","headerName":"PNL"}] }},{"title":"Grid","type":"grid-pro","config":{"resourceName":"ALL_TRADES", "deferredGridOptions": {"columnDefs":[{"field":"INSTRUMENT_NAME","headerName":"Instrument Name"},{"field":"VALUE","headerName":"Inline coldef - VALUE"},{"field":"QUANTITY","headerName":"Quantity"},{"field":"PNL","headerName":"PNL"}]} }},{"title":"Form","type":"smart-form","config":{"resourceName":"EVENT_COUNTERPARTY_INSERT", "uischema": {"type":"VerticalLayout","elements":[{"type":"Control","label":"Inline form schema - main contact","scope":"#/properties/MAIN_CONTACT"},{"type":"Control","label":"Issuer Name - Local Schema","scope":"#/properties/ISSUER_NAME","options":{"readonly":true}},{"type":"Control","label":"Price","scope":"#/properties/PRICE"},{"type":"Control","scope":"#/properties/COUNTERPARTY","options":{"allOptionsResourceName":"ALL_COUNTERPARTYS","valueField":"COUNTERPARTY_ID","labelField":"COUNTERPARTY_ID"}},{"type":"Control","label":"Password","scope":"#/properties/PASSWORD","options":{"isPassword":true}},{"type":"Control","label":"Password","scope":"#/properties/PASSWORD","options":{"textarea":true}}]} }}]}, {"name":"Realtime Dashboard","tiles":[{"title":"Entity manager tile","type":"entity-manager","config":{"resourceName":"ALL_COUNTERPARTYS","title":"Counterparty Management","updateEvent":"EVENT_COUNTERPARTY_MODIFY","deleteEvent":"EVENT_COUNTERPARTY_DELETE","createEvent":"EVENT_COUNTERPARTY_INSERT"}},{"title":"Form tile","type":"smart-form","config":{"resourceName":"EVENT_COUNTERPARTY_INSERT"}}]},{"name":"Analytics","tiles":[{"title":"Grid Tile","type":"grid-pro","config":{"resourceName":"ALL_POSITIONS"}},{"title":"Charts Tile 1","type":"chart","config":{"type":"line","resourceName":"ALL_POSITIONS","xField":"INSTRUMENT_NAME","yField":"VALUE"}},{"title":"Charts Tile 2","type":"chart","config":{"type":"pie","resourceName":"ALL_POSITIONS","xField":"INSTRUMENT_NAME","yField":"VALUE"}},{"title":"Charts Tile 3","type":"chart","config":{"type":"column","resourceName":"ALL_POSITIONS","xField":"INSTRUMENT_ID","yField":"VALUE"}}]}]' --csv '[{"name": "trade", "fields": ["a", "B"]}, {"name": "position", "fields": ["id", "TYPE"]} ]' --apiHost 'wss://public-foundation.genesislab.global/gwf/' --no-shell && cd blankappseedtest/client && npm run bootstrap && npm run dev
|
|
40
|
+
```
|
|
36
41
|
|
|
37
42
|
✅ **Checklist**
|
|
38
43
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.7.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.6.0...v2.7.0) (2024-04-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* support for overriding default column definitions and form schemas GENC-242 (#176) 297c408
|
|
9
|
+
|
|
10
|
+
## [2.6.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.10...v2.6.0) (2024-04-10)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* support to generate empty data csvs (GENC-280) (#175) a992a91
|
|
16
|
+
|
|
3
17
|
## [2.5.10](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.9...v2.5.10) (2024-04-09)
|
|
4
18
|
|
|
5
19
|
|