@genesislcap/blank-app-seed 2.6.0 → 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.
@@ -1,5 +1,5 @@
1
1
  const versions = require('./versions.json');
2
- const { registerPartials, generateRoute, generateEmptyCsv } = 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,11 +14,15 @@ module.exports = async (data, utils) => {
14
14
 
15
15
  registerPartials(utils);
16
16
 
17
- data.routes
18
- .map((route) => ({ ...route, layoutKey: `${route.name}_${Date.now()}` }))
19
- .forEach((route) => {
20
- generateRoute(route, utils);
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
 
23
27
  data.csv
24
28
  .map(entity => ({
@@ -28,5 +32,4 @@ module.exports = async (data, utils) => {
28
32
  .forEach(entity => {
29
33
  generateEmptyCsv(entity, data.appName, utils);
30
34
  });
31
-
32
35
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "2.6.0",
4
+ "version": "2.7.0",
5
5
  "license": "Apache-2.0",
6
6
  "genxSeedConfig": {
7
7
  "exclude": [
@@ -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="${() => ({isSnapshot: {{ config.snapshot }} })}"
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>
@@ -1 +1,9 @@
1
- <foundation-form resourceName="{{config.resourceName}}"></foundation-form>
1
+ <foundation-form
2
+ resourceName="{{config.resourceName}}"
3
+ {{#if config.uischema}}
4
+ :uischema=${() => (
5
+ {{{config.uischema}}}
6
+ )}
7
+ {{/if}}
8
+ >
9
+ </foundation-form>
@@ -4,6 +4,11 @@
4
4
  {{#if config.snapshot}}
5
5
  isSnapshot="{{config.snapshot}}"
6
6
  {{/if}}
7
+ {{#if config.deferredGridOptions}}
8
+ :deferredGridOptions=${() => (
9
+ {{{config.deferredGridOptions}}}
10
+ )}
11
+ {{/if}}
7
12
  >
8
13
  </grid-pro-genesis-datasource>
9
14
  </zero-grid-pro>
package/.genx/utils.js CHANGED
@@ -26,9 +26,39 @@ const generateEmptyCsv = (entity, appName, { writeFileWithData }) => {
26
26
  writeFileWithData(resolve(__dirname, `../server/{{appName}}-app/src/main/genesis/data/${entity.name}.csv`), {entity}, resolve(__dirname, 'templates/csv.hbs'));
27
27
  };
28
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
+
29
58
  module.exports = {
30
59
  makeDirectory,
31
60
  registerPartials,
32
61
  generateRoute,
33
62
  generateEmptyCsv,
63
+ formatRouteData,
34
64
  };
@@ -26,13 +26,18 @@ Add file / directory pointers.
26
26
 
27
27
  📑 &nbsp; **How should this be tested?**
28
28
 
29
+ ### Defaults
29
30
 
30
31
 
31
32
  ```
32
- npx -y @genesislcap/genx@latest init prtest -x --ref YOUR-BRANCH-NAME --no-npm
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
  ✅ &nbsp; **Checklist**
38
43
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## [2.6.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.10...v2.6.0) (2024-04-10)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "2.6.0",
4
+ "version": "2.7.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"