Skip to content

Commit c932296

Browse files
author
Fernando Colom
committed
Merge remote-tracking branch 'origin/JMV-3719-add-link-dashboard-charts'
2 parents 579fc40 + 3bcbd48 commit c932296

File tree

5 files changed

+199
-0
lines changed

5 files changed

+199
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [2.152.0] - 2025-03-14
11+
12+
### Added
13+
14+
- Link key in graphs
15+
1016
## [2.151.0] - 2025-03-14
1117

1218
### Added

lib/schemas/common/graphs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const baseSchemaProperties = {
5151
source: { $ref: 'schemaDefinitions#/definitions/endpoint' },
5252
endpointParameters: { $ref: 'schemaDefinitions#/definitions/endpointParameters' },
5353
componentAttributes: { type: 'object' },
54+
link: { type: 'string' },
5455
x: { type: 'number' },
5556
y: { type: 'number' },
5657
width: { type: 'number' },
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
service: serviceName
2+
name: example-dashboard
3+
root: Dashboard
4+
filters:
5+
- name: filterInput
6+
label: someLabel
7+
component: Input
8+
componentAttributes:
9+
icon: iconName
10+
graphs:
11+
- component: Table
12+
name: graphName
13+
title: someTitleForGraph
14+
x: 0
15+
y: 0
16+
width: 6
17+
height: 3
18+
link: /test
19+
20+
- component: BarChart
21+
name: graphName
22+
title: someTitleForGraph
23+
translateTitle: true
24+
subtitle: someSubtitleForGraph
25+
translateSubtitle: true
26+
componentAttributes:
27+
options:
28+
width: 100%
29+
x: 6
30+
y: 0
31+
width: 6
32+
height: 3
33+
link: /test
34+
35+
- component: TextCardKpi
36+
name: TextCard
37+
title: title
38+
value:
39+
field: someField
40+
mapper:
41+
name: suffix
42+
props:
43+
addWhitespace: true
44+
value: 'hs'
45+
percent:
46+
field: someField
47+
mapper:
48+
name: suffix
49+
props:
50+
addWhitespace: true
51+
value: '%'
52+
x: 0
53+
y: 0
54+
width: 12
55+
height: 4
56+
link: /test
57+
- component: TextCardKpi
58+
name: TextCardDelivery
59+
title: title
60+
value:
61+
field: someField
62+
mapper:
63+
name: suffix
64+
props:
65+
addWhitespace: true
66+
value: 'hs'
67+
percent:
68+
field: someField
69+
mapper:
70+
name: suffix
71+
props:
72+
addWhitespace: true
73+
value: '%'
74+
x: 0
75+
y: 0
76+
width: 12
77+
height: 4
78+
79+
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"service": "serviceName",
3+
"name": "example-dashboard",
4+
"root": "Dashboard",
5+
"filters": [
6+
{
7+
"name": "filterInput",
8+
"label": "someLabel",
9+
"component": "Input",
10+
"componentAttributes": {
11+
"icon": "iconName"
12+
}
13+
}
14+
],
15+
"graphs": [
16+
{
17+
"component": "Table",
18+
"filters": [],
19+
"name": "graphName",
20+
"title": "someTitleForGraph",
21+
"x": 0,
22+
"y": 0,
23+
"width": 6,
24+
"height": 3,
25+
"link": "/test"
26+
},
27+
{
28+
"component": "BarChart",
29+
"filters": [],
30+
"name": "graphName",
31+
"title": "someTitleForGraph",
32+
"translateTitle": true,
33+
"subtitle": "someSubtitleForGraph",
34+
"translateSubtitle": true,
35+
"componentAttributes": {
36+
"options": {
37+
"width": "100%"
38+
}
39+
},
40+
"x": 6,
41+
"y": 0,
42+
"width": 6,
43+
"height": 3,
44+
"link": "/test"
45+
},
46+
{
47+
"component": "TextCardKpi",
48+
"filters": [],
49+
"name": "TextCard",
50+
"title": "title",
51+
"value": {
52+
"field": "someField",
53+
"mapper": {
54+
"name": "suffix",
55+
"props": {
56+
"addWhitespace": true,
57+
"value": "hs"
58+
}
59+
}
60+
},
61+
"percent": {
62+
"field": "someField",
63+
"mapper": {
64+
"name": "suffix",
65+
"props": {
66+
"addWhitespace": true,
67+
"value": "%"
68+
}
69+
}
70+
},
71+
"x": 0,
72+
"y": 0,
73+
"width": 12,
74+
"height": 4,
75+
"link": "/test"
76+
},
77+
{
78+
"component": "TextCardKpi",
79+
"filters": [],
80+
"name": "TextCardDelivery",
81+
"title": "title",
82+
"value": {
83+
"field": "someField",
84+
"mapper": {
85+
"name": "suffix",
86+
"props": {
87+
"addWhitespace": true,
88+
"value": "hs"
89+
}
90+
}
91+
},
92+
"percent": {
93+
"field": "someField",
94+
"mapper": {
95+
"name": "suffix",
96+
"props": {
97+
"addWhitespace": true,
98+
"value": "%"
99+
}
100+
}
101+
},
102+
"x": 0,
103+
"y": 0,
104+
"width": 12,
105+
"height": 4
106+
}
107+
]
108+
}

tests/validator-test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const dashboardSchemaYml = fs.readFileSync(process.cwd() + '/tests/mocks/schemas
4141
const dashboardSchemaExpectedJson = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/expected/dashboard.json');
4242
const dashboardWithSourcesSchemaYml = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/dashboard-with-sources.yml');
4343
const dashboardWithSourcesSchemaExpectedJson = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/expected/dashboard-with-sources.json');
44+
const dashboardWithLinksSchemaExpectedJson = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/expected/dashboard-with-links.json');
45+
const dashboardWithLinksSchemaYml = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/dashboard-with-links.yml');
4446
const previewSchemaYml = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/preview.yml');
4547
const previewSchemaExpected = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/expected/preview.json');
4648
const sectionExampleYML = fs.readFileSync(process.cwd() + '/tests/mocks/schemas/section-example.yml');
@@ -131,6 +133,7 @@ describe('Test validation functions', () => {
131133
const newWithRedirectSchema = ymljs.parse(newWithRedirectSchemaYml.toString());
132134
const dashboardSchema = ymljs.parse(dashboardSchemaYml.toString());
133135
const dashboardWithSourcesSchema = ymljs.parse(dashboardWithSourcesSchemaYml.toString());
136+
const dashboardWithLinksSchema = ymljs.parse(dashboardWithLinksSchemaYml.toString());
134137
const previewSchema = ymljs.parse(previewSchemaYml.toString());
135138
const sectionSchema = ymljs.parse(sectionExampleYML.toString());
136139
const settingsSchema = ymljs.parse(settingsYML.toString());
@@ -160,6 +163,7 @@ describe('Test validation functions', () => {
160163
const planningData = Validator.execute(planningSchema, true, '/test/data17.json');
161164
const settingsData = Validator.execute(settingsSchema, true, '/test/data18.json');
162165
const dashboardWithSourcesData = Validator.execute(dashboardWithSourcesSchema, true, '/test/data19.json');
166+
const dashboardWithLinksData = Validator.execute(dashboardWithLinksSchema, true, '/test/data20.json');
163167

164168
sinon.assert.match(browseData, JSON.parse(browseSchemaExpectedJson.toString()));
165169
sinon.assert.match(browseWithCanCreateData, JSON.parse(browseWithCanCreateSchemaExpectedJson.toString()));
@@ -179,6 +183,7 @@ describe('Test validation functions', () => {
179183
sinon.assert.match(newWithRedirectData, JSON.parse(newWithRedirectSchemaExpectedJson.toString()));
180184
sinon.assert.match(dashboardData, JSON.parse(dashboardSchemaExpectedJson.toString()));
181185
sinon.assert.match(dashboardWithSourcesData, JSON.parse(dashboardWithSourcesSchemaExpectedJson.toString()));
186+
sinon.assert.match(dashboardWithLinksData, JSON.parse(dashboardWithLinksSchemaExpectedJson.toString()));
182187
sinon.assert.match(previewData, JSON.parse(previewSchemaExpected.toString()));
183188
sinon.assert.match(sectionData, JSON.parse(sectionExampleExpected.toString()));
184189
sinon.assert.match(settingsData, JSON.parse(settingsExpected.toString()));

0 commit comments

Comments
 (0)