Skip to content

Commit dc28869

Browse files
CUMULUS-4129: Be able to turn off estimateTableRowCount (#1246)
* CUMULUS-4129: Add env var to toggle row count Added cypress test for estimated row count Added env var to webpack Add estimate row count var to readme
1 parent 482a845 commit dc28869

File tree

8 files changed

+59
-4
lines changed

8 files changed

+59
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111
- Added `USE_UTC_TIME_FORMAT` environment variable to allow control over the table's date/time timezone format
1212
- **CUMULUS-3811**
1313
- Refactor data management class components to functional components
14+
- **CUMULUS_4129**
15+
- Added ESTIMATE_TABLE_ROW_COUNT env var to toggle estimated table row count for executions and granules
1416
- **CUMULUS_4182**
1517
- executions and granules list calls updated to search un-archived records
1618
- **CUMULUS-4223**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Setting the following environment variables can override the default values.
3838
| KIBANAROOT | \<optional\> Points to a Kibana endpoint. | |
3939
| INITIAL_DATE_RANGE_IN_DAYS| \<optional\> Number of days to load up before at start | |
4040
| USE_UTC_TIME_FORMAT| The table's timestamp column's time display format. Expected value is UTC. | |
41-
41+
| ESTIMATE_TABLE_ROW_COUNT | \<optional\> Toggles estimated row count for Granule and Execution tables | true |
4242

4343
## Quick start
4444

app/src/js/actions/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,12 @@ export const listGranules = (options) => (dispatch, getState) => {
206206
method: 'GET',
207207
id: null,
208208
url: new URL('granules', root).href,
209-
params: parseArchivedInListParams({ limit: defaultPageLimit, ...options, ...timeFilters })
209+
params: parseArchivedInListParams({
210+
limit: defaultPageLimit,
211+
estimateTableRowCount: _config.estimateTableRowCount,
212+
...options,
213+
...timeFilters
214+
})
210215
}
211216
});
212217
};
@@ -684,7 +689,12 @@ export const listExecutions = (options) => (dispatch, getState) => {
684689
type: types.EXECUTIONS,
685690
method: 'GET',
686691
url: new URL('executions', root).href,
687-
params: parseArchivedInListParams({ limit: defaultPageLimit, ...options, ...timeFilters })
692+
params: parseArchivedInListParams({
693+
limit: defaultPageLimit,
694+
estimateTableRowCount: _config.estimateTableRowCount,
695+
...options,
696+
...timeFilters
697+
})
688698
}
689699
});
690700
};

app/src/js/config/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const config = {
3030
enableRecovery: computeBool(process.env.ENABLE_RECOVERY, false),
3131
servedByCumulusAPI: computeBool(process.env.SERVED_BY_CUMULUS_API, ''),
3232
useUTCTimeFormat: process.env.USE_UTC_TIME_FORMAT || '',
33+
estimateTableRowCount: computeBool(process.env.ESTIMATE_TABLE_ROW_COUNT, true),
3334
};
3435

3536
module.exports = config;

cypress.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = defineConfig({
55
env: {
66
APIROOT: 'http://localhost:5001',
77
authToken: null,
8+
ESTIMATE_TABLE_ROW_COUNT: true,
89
},
910
retries: {
1011
runMode: 2,

cypress/e2e/executions.cy.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,24 @@ describe('Dashboard Executions Page', () => {
467467
cy.get('.table .tbody .tr').should('have.length', 1);
468468
});
469469
});
470+
471+
describe('when ESTIMATE_TABLE_ROW_COUNT is false', () => {
472+
before(() => {
473+
Cypress.env('ESTIMATE_TABLE_ROW_COUNT', false);
474+
cy.login();
475+
cy.visit('/executions');
476+
});
477+
478+
it('should not estimate table row count', () => {
479+
cy.wait(500);
480+
cy.get('.num-title').invoke('text').then((executionCount) => {
481+
cy.get('.tbody .tr').should('have.length', Number(executionCount));
482+
});
483+
cy.get('.checkmark--wrapper').contains('Archived').click();
484+
cy.wait(500);
485+
cy.get('.num-title').invoke('text').then((executionCount) => {
486+
cy.get('.tbody .tr').should('have.length', Number(executionCount));
487+
});
488+
});
489+
});
470490
});

cypress/e2e/granules.cy.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,4 +1005,24 @@ describe('Dashboard Granules Page', () => {
10051005
.and('include', `search=${searchShort}`);
10061006
});
10071007
});
1008+
1009+
describe('when ESTIMATE_TABLE_ROW_COUNT is false', () => {
1010+
before(() => {
1011+
Cypress.env('ESTIMATE_TABLE_ROW_COUNT', false);
1012+
cy.login();
1013+
cy.visit('/granules');
1014+
});
1015+
1016+
it('should not estimate table row count', () => {
1017+
cy.wait(500);
1018+
cy.get('.num-title').invoke('text').then((granuleCount) => {
1019+
cy.get('.tbody .tr').should('have.length', Number(granuleCount));
1020+
});
1021+
cy.get('.checkmark--wrapper').contains('Archived').click();
1022+
cy.wait(500);
1023+
cy.get('.num-title').invoke('text').then((granuleCount) => {
1024+
cy.get('.tbody .tr').should('have.length', Number(granuleCount));
1025+
});
1026+
});
1027+
});
10081028
});

webpack.common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ const CommonConfig = {
167167
BUCKET: config.graphicsPath,
168168
ENABLE_RECOVERY: config.enableRecovery,
169169
SERVED_BY_CUMULUS_API: config.servedByCumulusAPI,
170-
USE_UTC_TIME_FORMAT: config.useUTCTimeFormat
170+
USE_UTC_TIME_FORMAT: config.useUTCTimeFormat,
171+
ESTIMATE_TABLE_ROW_COUNT: config.estimateTableRowCount
171172
}),
172173
],
173174
};

0 commit comments

Comments
 (0)