@genesislcap/blank-app-seed 3.13.1 → 3.14.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.13.1",
4
+ "version": "3.14.0",
5
5
  "license": "Apache-2.0",
6
6
  "genxSeedConfig": {
7
7
  "exclude": [
@@ -1,18 +1,26 @@
1
- <rapid-g2plot-chart
2
- type="{{ config.type }}"
3
- :config="${(x) => ({
4
- {{#ifEquals config.type "pie"}}
5
- radius: 0.75,
6
- angleField: 'value',
7
- colorField: 'groupBy',
8
- {{else}}
9
- xField: 'groupBy',
10
- yField: 'value',
11
- {{/ifEquals}}
12
- })}"
13
- >
14
- <chart-datasource
15
- resourceName="{{ config.resourceName }}"
16
- server-fields="{{ config.xField }} {{ config.yField }}"
17
- ></chart-datasource>
18
- </rapid-g2plot-chart>
1
+ ${whenElse(
2
+ (x) => getViewUpdateRightComponent(x.user, '{{config.permissions.viewRight}}'),
3
+ html`
4
+ <rapid-g2plot-chart
5
+ type="{{ config.type }}"
6
+ :config="${(x) => ({
7
+ {{#ifEquals config.type "pie"}}
8
+ radius: 0.75,
9
+ angleField: 'value',
10
+ colorField: 'groupBy',
11
+ {{else}}
12
+ xField: 'groupBy',
13
+ yField: 'value',
14
+ {{/ifEquals}}
15
+ })}"
16
+ >
17
+ <chart-datasource
18
+ resourceName="{{ config.resourceName }}"
19
+ server-fields="{{ config.xField }} {{ config.yField }}"
20
+ ></chart-datasource>
21
+ </rapid-g2plot-chart>
22
+ `,
23
+ html`
24
+ <not-permitted-component></not-permitted-component>
25
+ `,
26
+ )}
@@ -1,51 +1,59 @@
1
- <entity-management
2
- design-system-prefix="rapid"
3
- enable-row-flashing
4
- enable-cell-flashing
5
- {{#if config.title}}
6
- title="{{ config.title }}"
7
- {{/if}}
8
- resourceName="{{ config.resourceName }}"
9
- {{#if config.createEvent}}
10
- createEvent="{{ config.createEvent }}"
11
- {{#if config.createFormUiSchema}}
12
- :createFormUiSchema=${() => (
13
- {{{ config.createFormUiSchema }}}
14
- )}
15
- {{/if}}
16
- {{/if}}
17
- {{#if config.updateEvent}}
18
- updateEvent="{{ config.updateEvent }}"
19
- {{#if config.updateFormUiSchema}}
20
- :updateFormUiSchema=${() => (
21
- {{{ config.updateFormUiSchema }}}
22
- )}
23
- {{/if}}
24
- {{/if}}
25
- {{#if config.deleteEvent}}
26
- deleteEvent="{{ config.deleteEvent }}"
27
- {{/if}}
28
- {{#if config.gridOptions}}
29
- :gridOptions=${() => (
30
- {{{config.gridOptions}}}
31
- )}
32
- {{/if}}
33
- {{#if config.snapshot}}
34
- :datasourceConfig=${() => ({isSnapshot: {{ config.snapshot }} })}
35
- {{/if}}
36
- {{#if config.reqrep}}
37
- :datasourceConfig=${() => ({pollingInterval: 5000 })}
38
- {{/if}}
39
- {{#if config.columns}}
40
- :columns=${() => {{{ config.columns }}} }
41
- {{/if}}
42
- {{#if config.modalPosition}}
43
- modal-position="{{ config.modalPosition }}"
44
- {{/if}}
45
- {{#if config.sizeColumnsToFit}}
46
- size-columns-to-fit
47
- {{/if}}
48
- {{#if config.enableSearchBar}}
49
- enable-search-bar
50
- {{/if}}
51
- ></entity-management>
1
+ ${whenElse(
2
+ (x) => getViewUpdateRightComponent(x.user, '{{config.permissions.viewRight}}'),
3
+ html`
4
+ <entity-management
5
+ design-system-prefix="rapid"
6
+ enable-row-flashing
7
+ enable-cell-flashing
8
+ {{#if config.title}}
9
+ title="{{ config.title }}"
10
+ {{/if}}
11
+ resourceName="{{ config.resourceName }}"
12
+ {{#if config.createEvent}}
13
+ createEvent="${(x) => getViewUpdateRightComponent(x.user, '{{config.permissions.updateRight}}', '{{ config.createEvent }}')}"
14
+ {{#if config.createFormUiSchema}}
15
+ :createFormUiSchema=${() => (
16
+ {{{ config.createFormUiSchema }}}
17
+ )}
18
+ {{/if}}
19
+ {{/if}}
20
+ {{#if config.updateEvent}}
21
+ updateEvent="${(x) => getViewUpdateRightComponent(x.user, '{{config.permissions.updateRight}}', '{{ config.updateEvent }}')}"
22
+ {{#if config.updateFormUiSchema}}
23
+ :updateFormUiSchema=${() => (
24
+ {{{ config.updateFormUiSchema }}}
25
+ )}
26
+ {{/if}}
27
+ {{/if}}
28
+ {{#if config.deleteEvent}}
29
+ deleteEvent="${(x) => getViewUpdateRightComponent(x.user, '{{config.permissions.updateRight}}', '{{ config.deleteEvent }}')}"
30
+ {{/if}}
31
+ {{#if config.gridOptions}}
32
+ :gridOptions=${() => (
33
+ {{{config.gridOptions}}}
34
+ )}
35
+ {{/if}}
36
+ {{#if config.snapshot}}
37
+ :datasourceConfig=${() => ({isSnapshot: {{ config.snapshot }} })}
38
+ {{/if}}
39
+ {{#if config.reqrep}}
40
+ :datasourceConfig=${() => ({pollingInterval: 5000 })}
41
+ {{/if}}
42
+ {{#if config.columns}}
43
+ :columns=${() => {{{ config.columns }}} }
44
+ {{/if}}
45
+ {{#if config.modalPosition}}
46
+ modal-position="{{ config.modalPosition }}"
47
+ {{/if}}
48
+ {{#if config.sizeColumnsToFit}}
49
+ size-columns-to-fit
50
+ {{/if}}
51
+ {{#if config.enableSearchBar}}
52
+ enable-search-bar
53
+ {{/if}}
54
+ ></entity-management>
55
+ `,
56
+ html`
57
+ <not-permitted-component></not-permitted-component>
58
+ `,
59
+ )}
@@ -1,10 +1,18 @@
1
- <foundation-form
2
- design-system-prefix="rapid"
3
- resourceName="{{config.resourceName}}"
4
- {{#if config.uischema}}
5
- :uischema=${() => (
6
- {{{config.uischema}}}
7
- )}
8
- {{/if}}
9
- >
10
- </foundation-form>
1
+ ${whenElse(
2
+ (x) => getViewUpdateRightComponent(x.user, '{{config.permissions.viewRight}}'),
3
+ html`
4
+ <foundation-form
5
+ design-system-prefix="rapid"
6
+ resourceName="{{config.resourceName}}"
7
+ {{#if config.uischema}}
8
+ :uischema=${() => (
9
+ {{{config.uischema}}}
10
+ )}
11
+ {{/if}}
12
+ >
13
+ </foundation-form>
14
+ `,
15
+ html`
16
+ <not-permitted-component></not-permitted-component>
17
+ `,
18
+ )}
@@ -1,20 +1,28 @@
1
- <rapid-grid-pro
2
- enable-row-flashing
3
- enable-cell-flashing
4
- >
5
- <grid-pro-genesis-datasource
6
- resource-name="{{config.resourceName}}"
7
- {{#if config.snapshot}}
8
- isSnapshot="{{config.snapshot}}"
9
- {{/if}}
10
- {{#if config.reqrep}}
11
- :datasourceConfig=${() => ({pollingInterval: 5000 })}
12
- {{/if}}
13
- {{#if config.gridOptions}}
14
- :deferredGridOptions=${() => (
15
- {{{config.gridOptions}}}
16
- )}
17
- {{/if}}
18
- >
19
- </grid-pro-genesis-datasource>
20
- </rapid-grid-pro>
1
+ ${whenElse(
2
+ (x) => getViewUpdateRightComponent(x.user, '{{config.permissions.viewRight}}'),
3
+ html`
4
+ <rapid-grid-pro
5
+ enable-row-flashing
6
+ enable-cell-flashing
7
+ >
8
+ <grid-pro-genesis-datasource
9
+ resource-name="{{config.resourceName}}"
10
+ {{#if config.snapshot}}
11
+ isSnapshot="{{config.snapshot}}"
12
+ {{/if}}
13
+ {{#if config.reqrep}}
14
+ :datasourceConfig=${() => ({pollingInterval: 5000 })}
15
+ {{/if}}
16
+ {{#if config.gridOptions}}
17
+ :deferredGridOptions=${() => (
18
+ {{{config.gridOptions}}}
19
+ )}
20
+ {{/if}}
21
+ >
22
+ </grid-pro-genesis-datasource>
23
+ </rapid-grid-pro>
24
+ `,
25
+ html`
26
+ <not-permitted-component></not-permitted-component>
27
+ `,
28
+ )}
@@ -1,3 +1,4 @@
1
+ import { User } from '@genesislcap/foundation-user';
1
2
  import { customElement, GenesisElement } from '@genesislcap/web-core';
2
3
  import { {{pascalCase route.name}}Styles as styles } from './{{kebabCase route.name}}.styles';
3
4
  import { {{pascalCase route.name}}Template as template } from './{{kebabCase route.name}}.template';
@@ -8,6 +9,8 @@ import { {{pascalCase route.name}}Template as template } from './{{kebabCase rou
8
9
  styles,
9
10
  })
10
11
  export class {{pascalCase route.name}} extends GenesisElement {
12
+ @User user: User;
13
+
11
14
  constructor() {
12
15
  super();
13
16
  }
@@ -1,5 +1,5 @@
1
- import { html } from '@genesislcap/web-core';
2
- import { getDateFormatter, getNumberFormatter{{#if route.FDC3EventHandlersEnabled}}, sendEventOnChannel{{/if}} } from '../../utils';
1
+ import { html, whenElse } from '@genesislcap/web-core';
2
+ import { getDateFormatter, getNumberFormatter, getViewUpdateRightComponent{{#if route.FDC3EventHandlersEnabled}}, sendEventOnChannel{{/if}} } from '../../utils';
3
3
  import type { {{pascalCase route.name}} } from './{{kebabCase route.name}}';
4
4
 
5
5
  export const {{pascalCase route.name}}Template = html<{{pascalCase route.name}}>`
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.14.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.13.1...v3.14.0) (2024-06-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * handle component view/update permissions GENC-470 (#257) 7c3c3b6
9
+
3
10
  ## [3.13.1](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.13.0...v3.13.1) (2024-06-17)
4
11
 
5
12
 
@@ -105,6 +105,7 @@
105
105
  "@genesislcap/foundation-store": "{{versions.UI}}",
106
106
  "@genesislcap/foundation-ui": "{{versions.UI}}",
107
107
  "@genesislcap/foundation-utils": "{{versions.UI}}",
108
+ "@genesislcap/foundation-user": "{{versions.UI}}",
108
109
  "@genesislcap/foundation-zero": "{{versions.UI}}",
109
110
  "@genesislcap/foundation-zero-grid-pro": "{{versions.UI}}",
110
111
  "@genesislcap/g2plot-chart": "{{versions.UI}}",
@@ -129,6 +130,7 @@
129
130
  "@genesislcap/foundation-store": "{{versions.UI}}",
130
131
  "@genesislcap/foundation-ui": "{{versions.UI}}",
131
132
  "@genesislcap/foundation-utils": "{{versions.UI}}",
133
+ "@genesislcap/foundation-user": "{{versions.UI}}",
132
134
  "@genesislcap/foundation-zero": "{{versions.UI}}",
133
135
  "@genesislcap/foundation-zero-grid-pro": "{{versions.UI}}",
134
136
  "@genesislcap/g2plot-chart": "{{versions.UI}}",
@@ -8,6 +8,7 @@ import { zeroGridComponents } from '@genesislcap/foundation-zero-grid-pro';
8
8
  import { g2plotChartsComponents } from '@genesislcap/g2plot-chart';
9
9
  import * as rapidDesignSystem from '@genesislcap/rapid-design-system';
10
10
  import { rapidGridComponents } from '@genesislcap/rapid-grid-pro';
11
+ import { NotPermittedComponent } from './not-permitted-component';
11
12
 
12
13
  /**
13
14
  * Ensure tree shaking doesn't remove these.
@@ -15,6 +16,7 @@ import { rapidGridComponents } from '@genesislcap/rapid-grid-pro';
15
16
  FoundationRouter;
16
17
  EntityManagement;
17
18
  Form;
19
+ NotPermittedComponent;
18
20
 
19
21
  /**
20
22
  * registerComponents.
@@ -0,0 +1 @@
1
+ export * from './not-permitted-component';
@@ -0,0 +1,13 @@
1
+ import { css } from '@genesislcap/web-core';
2
+ import { errorMessageStyles, mixinScreen } from '../../styles';
3
+
4
+ export const notPermittedComponentStyles = css`
5
+ ${errorMessageStyles}
6
+
7
+ :host {
8
+ ${mixinScreen('flex')}
9
+
10
+ align-items: center;
11
+ justify-content: center;
12
+ }
13
+ `;
@@ -0,0 +1,6 @@
1
+ import { html } from '@genesislcap/web-core';
2
+ import type { NotPermittedComponent } from './not-permitted-component';
3
+
4
+ export const notPermittedComponentTemplate = html<NotPermittedComponent>`
5
+ <h3 class="error-message">You do not have access to view this component.</h3>
6
+ `;
@@ -0,0 +1,14 @@
1
+ import { customElement, GenesisElement } from '@genesislcap/web-core';
2
+ import { notPermittedComponentStyles as styles } from './not-permitted-component.styles';
3
+ import { notPermittedComponentTemplate as template } from './not-permitted-component.template';
4
+
5
+ @customElement({
6
+ name: 'not-permitted-component',
7
+ template,
8
+ styles,
9
+ })
10
+ export class NotPermittedComponent extends GenesisElement {
11
+ constructor() {
12
+ super();
13
+ }
14
+ }
@@ -1,15 +1,13 @@
1
1
  import { css } from '@genesislcap/web-core';
2
- import { mixinScreen } from '../../styles';
2
+ import { errorMessageStyles, mixinScreen } from '../../styles';
3
3
 
4
4
  export const NotFoundStyles = css`
5
+ ${errorMessageStyles}
6
+
5
7
  :host {
6
8
  ${mixinScreen('flex')}
7
9
 
8
10
  align-items: center;
9
11
  justify-content: center;
10
12
  }
11
-
12
- h1 {
13
- color: var(--neutral-foreground-rest);
14
- }
15
13
  `;
@@ -2,5 +2,5 @@ import { html } from '@genesislcap/web-core';
2
2
  import type { NotFound } from './not-found';
3
3
 
4
4
  export const NotFoundTemplate = html<NotFound>`
5
- <h1>Not found! 404</h1>
5
+ <h1 class="error-message">Not found! 404</h1>
6
6
  `;
@@ -1,16 +1,13 @@
1
1
  import { css } from '@genesislcap/web-core';
2
- import { mixinScreen } from '../../styles';
2
+ import { errorMessageStyles, mixinScreen } from '../../styles';
3
3
 
4
4
  export const NotPermittedStyles = css`
5
+ ${errorMessageStyles}
6
+
5
7
  :host {
6
8
  ${mixinScreen('flex')}
7
9
 
8
10
  align-items: center;
9
11
  justify-content: center;
10
12
  }
11
-
12
- h1 {
13
- text-align: center;
14
- color: var(--neutral-foreground-rest);
15
- }
16
13
  `;
@@ -2,7 +2,7 @@ import { html } from '@genesislcap/web-core';
2
2
  import type { NotPermitted } from './not-permitted';
3
3
 
4
4
  export const NotPermittedTemplate = html<NotPermitted>`
5
- <h1>
5
+ <h1 class="error-message">
6
6
  You do not have permission to access this part of the application, please contact your
7
7
  administrator.
8
8
  </h1>
@@ -1,4 +1,5 @@
1
- import { css } from '@genesislcap/web-core';
1
+ import { errorColor } from '@genesislcap/rapid-design-system';
2
+ import { css, neutralLayer4 } from '@genesislcap/web-core';
2
3
  import { mixinCardTitle } from './typography';
3
4
 
4
5
  export const stylesCardHeading = css`
@@ -7,6 +8,21 @@ export const stylesCardHeading = css`
7
8
  }
8
9
  `;
9
10
 
11
+ export const errorMessageStyles = css`
12
+ .error-message {
13
+ color: var(--neutral-foreground-rest);
14
+ background-color: ${neutralLayer4};
15
+ border-color: ${errorColor};
16
+ border-radius: 7px;
17
+ border-style: solid;
18
+ border-width: 4px;
19
+ padding: 5px;
20
+ margin: 15px;
21
+ text-align: center;
22
+ width: fit-content;
23
+ }
24
+ `;
25
+
10
26
  export const mixinScreen = (display: string = 'block') => `
11
27
  contain: content;
12
28
  display: ${display};
@@ -1,3 +1,4 @@
1
1
  export * from './fdc3';
2
2
  export * from './formatters';
3
3
  export * from './logger';
4
+ export * from './permissions';
@@ -0,0 +1,7 @@
1
+ import { User } from '@genesislcap/foundation-user';
2
+
3
+ export const getViewUpdateRightComponent = (
4
+ user: User,
5
+ right: string,
6
+ event: string | boolean = true,
7
+ ) => (!right || user.hasPermission(right) ? event : '');
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": "3.13.1",
4
+ "version": "3.14.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"