Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
feat(analytics): improved UI of filtered aggregated column (#270)
Browse files Browse the repository at this point in the history
* feat(analytics): improved UI of filtered aggregated column

* ci(ci-cd): add tests

* test(analytics-table): update tests on conditions

Co-authored-by: Aurelien Arino <aurelien.arino@gmail.com>
  • Loading branch information
KZavorotna and Arinono authored Aug 1, 2022
1 parent 29ab4a0 commit e1f9b15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- name: Lint code
run: npm run lint
timeout-minutes: 5
- name: Test code
run: npm run test
timeout-minutes: 1
- name: Create a release
if: github.event_name == 'push'
run: npm run release
Expand Down
7 changes: 3 additions & 4 deletions src/models/analytics/analytics-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ function getColumnPlaceholder(
userLocale: keyof Translations,
): string {
const tl = t[userLocale];
const conditionMarker = 'condition' in column ? '*' : '';

const parseField = (field: string): {
tableName: TableKeys,
Expand Down Expand Up @@ -902,18 +901,18 @@ function getColumnPlaceholder(
onTimeGroupColumn: (timeGroupColumn) => {
const aggregateText = getTranslationString(tl.granularities[timeGroupColumn.granularity]);
const placeholder = placeholderFromField(timeGroupColumn.field);
return `${aggregateText}${conditionMarker}(${placeholder})`;
return `${aggregateText}(${placeholder})`;
},
onAggregatedColumnWithField: (aggregatedColumn, field) => {
const aggregateText = getTranslationString(tl.aggregations[aggregatedColumn.type]);
const placeholder = typeof field === 'string'
? placeholderFromField(field)
: field.expression;
return `${aggregateText}${conditionMarker}(${placeholder})`;
return `${aggregateText}(${placeholder})`;
},
onAggregatedColumnWithoutField: (aggregatedColumn) => {
const aggregateText = getTranslationString(tl.aggregations[aggregatedColumn.type]);
return `${aggregateText}${conditionMarker}`;
return `${aggregateText}`;
},
});
}
Expand Down
4 changes: 2 additions & 2 deletions test/analytics/analytics-tables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ describe('analytics-tables placeholders', () => {
},
},
expected: {
nl: 'Min*(Meting:waarde)',
en: 'Min*(Measurement:value)',
nl: 'Min(Meting:waarde)',
en: 'Min(Measurement:value)',
},
},
])('then it returns me the placeholder ($name)', ({
Expand Down

0 comments on commit e1f9b15

Please sign in to comment.