Skip to content

Commit

Permalink
Merge pull request #2204 from evidence-dev/release-06-11-24
Browse files Browse the repository at this point in the history
Release 06 11 24
  • Loading branch information
mcrascal authored Jul 12, 2024
2 parents 2ec6844 + 6a44d08 commit b674f98
Show file tree
Hide file tree
Showing 35 changed files with 2,354 additions and 2,607 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-ravens-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Enable strict mode
5 changes: 5 additions & 0 deletions .changeset/fifty-flowers-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/plugin-connector': patch
---

Updated sub-source-vars logic to handle multiple env vars in the same string
5 changes: 5 additions & 0 deletions .changeset/khaki-spies-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

added bubblechart stories
5 changes: 5 additions & 0 deletions .changeset/sixty-keys-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Dont use a date in Dropdown story to enable UI testing
5 changes: 5 additions & 0 deletions .changeset/smart-rice-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Updated Dimension grid take in queries with spaces
6 changes: 6 additions & 0 deletions .changeset/tricky-avocados-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/core-components': patch
'evidence-test-environment': patch
---

Fix Dropdown query-based default value performance and race conditions
4 changes: 2 additions & 2 deletions packages/lib/component-utilities/src/formatTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function formatTitle(column, columnFormat) {
}
});
}
// Remove all underscores before passing to title case function:
result = toTitleCase(result.replace(/_/g, ' '));
// Remove all underscores & double quotes before passing to title case function:
result = toTitleCase(column.replace(/"/g, '').replace(/_/g, ' '));
return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const subSourceVariables = (queryString) => {
const regex = RegExp(/(?<!\$)\$\{(.+?)\}/, 'g');

let match;
while ((match = regex.exec(queryString)) !== null) {
while ((match = regex.exec(output)) !== null) {
const fullMatch = match[0]; // e.g. ${variable}
const varName = match[1]; // e.g. variable
const start = match.index;
Expand All @@ -41,6 +41,8 @@ export const subSourceVariables = (queryString) => {
const before = output.substring(0, start);
const after = output.substring(end);
output = `${before}${value}${after}`;
// Update the lastIndex of the regular expression to continue the search from the end of the replacement
regex.lastIndex = start + value.length;
} else
console.warn(
`Missed substition for ${fullMatch}, do you need to set EVIDENCE_VAR__${varName}?`
Expand Down
4 changes: 3 additions & 1 deletion packages/lib/sdk/src/plugins/datasources/sub-source-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const subSourceVariables = (queryString) => {
const regex = RegExp(/(?<!\$)\$\{(.+?)\}/, 'g');

let match;
while ((match = regex.exec(queryString)) !== null) {
while ((match = regex.exec(output)) !== null) {
const fullMatch = match[0]; // e.g. ${variable}
const varName = match[1]; // e.g. variable
const start = match.index;
Expand All @@ -41,6 +41,8 @@ export const subSourceVariables = (queryString) => {
const before = output.substring(0, start);
const after = output.substring(end);
output = `${before}${value}${after}`;
// Update the lastIndex of the regular expression to continue the search from the end of the replacement
regex.lastIndex = start + value.length;
} else
console.warn(
`Missed substition for ${fullMatch}, do you need to set EVIDENCE_VAR__${varName}?`
Expand Down
23 changes: 22 additions & 1 deletion packages/lib/sdk/src/plugins/datasources/sub-source-vars.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('subSourceVars', () => {
vi.stubEnv('EVIDENCE_VAR__test', 'var-val');
expect(subSourceVariables('${test}')).toEqual('var-val');
});
it('should replace multiple variables that are found in the environment', () => {
it('should replace the same variables that are found in multiple places', () => {
vi.stubEnv('EVIDENCE_VAR__test', 'var-val');

expect(subSourceVariables('${test}\n${test}')).toEqual('var-val\nvar-val');
Expand All @@ -22,4 +22,25 @@ describe('subSourceVars', () => {
vi.stubEnv('EVIDENCE_VAR__test', 'var-val');
expect(subSourceVariables('$${test}\n${test}')).toEqual('${test}\nvar-val');
});
it('should replace different variables that are found in multiple places', () => {
vi.stubEnv('EVIDENCE_VAR__var_a', 'abc');
vi.stubEnv('EVIDENCE_VAR__var_b', 'def');
expect(subSourceVariables('|${var_a}|${var_b}|')).toEqual('|abc|def|');
});
it('should convert 3 different variables', () => {
vi.stubEnv('EVIDENCE_VAR__test', 'var-val');
vi.stubEnv('EVIDENCE_VAR__test2', 'var-val2');
vi.stubEnv('EVIDENCE_VAR__test3', 'var-val3');
expect(subSourceVariables('|${test}|${test2}|${test3}|')).toEqual(
'|var-val|var-val2|var-val3|'
);
});
it('should convert 2 different variables and fail 1', () => {
vi.stubEnv('EVIDENCE_VAR__test', 'var-val');
vi.stubEnv('EVIDENCE_VAR__test2', 'var-val2');
vi.stubEnv('EVIDENCE_VAR__test3', 'var-val3');
expect(subSourceVariables('${test}\n${testZ}\n${test3}')).toEqual(
'var-val\n${testZ}\nvar-val3'
);
});
});
3 changes: 2 additions & 1 deletion packages/ui/core-components/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"moduleResolution": "NodeNext"
"moduleResolution": "NodeNext",
"strict": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
name: series_demo_source
type: faker
options:
seed: evidence-series-demo
seed: evidence-series-demo
26 changes: 13 additions & 13 deletions packages/ui/core-components/sources/faker-demo-source/flights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ schema:
type: id
plane:
category: airline
item: airplane
item: airplane
targetField: name
airline:
category: airline
item: airline
item: airline
targetField: name
fare:
fare:
category: number
item: float
item: float
options:
- max: 10000
min: 75
fractionDigits: 21
departure_airport:
departure_airport:
category: airline
item: airport
targetField: name
arrival_airport:
item: airport
targetField: name
arrival_airport:
category: airline
item: airport
targetField: name
item: airport
targetField: name
seat:
category: airline
item: seat
Expand All @@ -33,6 +33,6 @@ schema:
item: recent
options:
- days: 365
regulator:
category: location
item: country
regulator:
category: location
item: country
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ schema:
- category: helpers
item: fake
options:
- "#{{company.buzzAdjective}}"
- '#{{company.buzzAdjective}}'
- category: helpers
item: fake
options:
- "#{{company.buzzNoun}}"
- '#{{company.buzzNoun}}'
- category: helpers
item: fake
options:
- "#{{company.catchPhraseAdjective}}"
- '#{{company.catchPhraseAdjective}}'
- category: helpers
item: fake
options:
- "#{{company.catchPhraseNoun}}"
- '#{{company.catchPhraseNoun}}'
- category: helpers
item: fake
options:
- "#{{person.jobDescriptor}}{{company.catchPhraseNoun}}"
- '#{{person.jobDescriptor}}{{company.catchPhraseNoun}}'
- category: helpers
item: fake
options:
- "#{{hacker.ingverb}}{{hacker.noun}}"
- '#{{hacker.ingverb}}{{hacker.noun}}'
filters:
- type: unique
fields:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ schema:
item: longitude
options:
- min: -118.9448
max: -117.6464
max: -117.6464
sales:
category: number
item: int
options:
- min: 1000
max: 234593
max: 234593
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ schema:
item: int
options:
- min: 1000
max: 234593
max: 234593
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ schema:
item: longitude
options:
- min: -90.4175
max: -82.1221
max: -82.1221
sales:
category: number
item: int
options:
- min: 1000
max: 234593
max: 234593
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ schema:
item: int
options:
- min: 1000
max: 234593
max: 234593
Loading

0 comments on commit b674f98

Please sign in to comment.