Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table performance paging #7399

Merged
merged 26 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ba476d6
dereactifying the row before passing it to the commponent
jvigliotta Dec 14, 2023
c408530
debouncin
jvigliotta Dec 14, 2023
fbe1a68
i mean... throttle
jvigliotta Dec 14, 2023
c5761c1
initial
jvigliotta Jan 4, 2024
6c53b77
UI functionality, switching between modes, prevention of export in pe…
jvigliotta Jan 16, 2024
46f897f
added limit maintenance in table row collectins, autoscroll respectin…
jvigliotta Jan 17, 2024
cdc3f6b
updating the logic to work correctly :)
jvigliotta Jan 19, 2024
fdd3cb4
added handling for overflow rows, this way if an object is removed, w…
jvigliotta Jan 23, 2024
395a735
removing debug row numbers
jvigliotta Jan 23, 2024
46d72ad
Merge branch 'master' into table-performance-paging
jvigliotta Jan 23, 2024
08c3b14
Merge branch 'master' into table-performance-paging
jvigliotta Jan 23, 2024
d9629db
Closes #7268
charlesh88 Jan 24, 2024
6fbdf7f
Closes #7268
charlesh88 Jan 24, 2024
10b559d
moved row limiting out of table row collections and into telemetry co…
jvigliotta Jan 25, 2024
2639ab2
have swgs return enough data to fill the requested bounds
jvigliotta Jan 25, 2024
7693c70
support minmax in swgs
jvigliotta Jan 25, 2024
00fa2d5
using undefined for more clarity
jvigliotta Jan 25, 2024
2efadaf
clearing up boolean typo
jvigliotta Jan 25, 2024
6fc0022
Merge branch 'master' into table-performance-paging
jvigliotta Jan 26, 2024
088f948
Merge branch 'master' of https://github.com/nasa/openmct into table-p…
unlikelyzero Jan 26, 2024
e185270
Address lint fixes
unlikelyzero Jan 26, 2024
a922578
removing autoscroll for descending, it is not necessary
jvigliotta Jan 26, 2024
adc8ba8
Merge branch 'table-performance-paging' of https://github.com/nasa/op…
jvigliotta Jan 26, 2024
c623d01
update snapshots
unlikelyzero Jan 26, 2024
fdd390d
Merge branch 'table-performance-paging' of https://github.com/nasa/op…
unlikelyzero Jan 26, 2024
ff0d393
lint
unlikelyzero Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@
"gcov",
"WCAG",
"stackedplot",
"Andale"
"Andale",
"checksnapshots"
],
"dictionaries": ["npm", "softwareTerms", "node", "html", "css", "bash", "en_US"],
"ignorePaths": [
Expand Down
8 changes: 7 additions & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For those interested in the mechanics of snapshot testing with Playwright, you c
// from our package.json or circleCI configuration file
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
npm install
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot
npm run test:e2e:checksnapshots
```

### Updating Snapshots
Expand All @@ -134,6 +134,12 @@ npm install
npm run test:e2e:updatesnapshots
```

Once that's done, you'll need to run the following to verify that the changes do not cause more problems:

```sh
npm run test:e2e:checksnapshots
```

## Automated Accessibility (a11y) Testing

Open MCT incorporates accessibility testing through two primary methods to ensure its compliance with accessibility standards:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions example/generator/GeneratorProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ GeneratorProvider.prototype.request = function (domainObject, request) {
var workerRequest = this.makeWorkerRequest(domainObject, request);
workerRequest.start = request.start;
workerRequest.end = request.end;
workerRequest.size = request.size;
workerRequest.strategy = request.strategy;

return this.workerInterface.request(workerRequest);
};
Expand Down
86 changes: 52 additions & 34 deletions example/generator/generatorWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,48 +130,37 @@
var now = Date.now();
var start = request.start;
var end = request.end > now ? now : request.end;
var amplitude = request.amplitude;
var period = request.period;
var offset = request.offset;
var dataRateInHz = request.dataRateInHz;
var phase = request.phase;
var randomness = request.randomness;
var loadDelay = Math.max(request.loadDelay, 0);
var infinityValues = request.infinityValues;
var exceedFloat32 = request.exceedFloat32;

var size = request.size;
var duration = end - start;
var step = 1000 / dataRateInHz;
var maxPoints = Math.floor(duration / step);
var nextStep = start - (start % step) + step;

var data = [];

for (; nextStep < end && data.length < 5000; nextStep += step) {
data.push({
utc: nextStep,
yesterday: nextStep - 60 * 60 * 24 * 1000,
sin: sin(
nextStep,
period,
amplitude,
offset,
phase,
randomness,
infinityValues,
exceedFloat32
),
wavelengths: wavelengths(),
intensities: intensities(),
cos: cos(
nextStep,
period,
amplitude,
offset,
phase,
randomness,
infinityValues,
exceedFloat32
)
});
if (request.strategy === 'minmax' && size) {
// Calculate the number of cycles to include based on size (2 points per cycle)
var totalCycles = Math.min(Math.floor(size / 2), Math.floor(duration / period));

for (let cycle = 0; cycle < totalCycles; cycle++) {
// Distribute cycles evenly across the time range
let cycleStart = start + (duration / totalCycles) * cycle;
let minPointTime = cycleStart; // Assuming min at the start of the cycle
let maxPointTime = cycleStart + period / 2; // Assuming max at the halfway of the cycle

data.push(createDataPoint(minPointTime, request), createDataPoint(maxPointTime, request));
}
} else {
for (let i = 0; i < maxPoints && nextStep < end; i++, nextStep += step) {
data.push(createDataPoint(nextStep, request));
}
}

if (request.strategy !== 'minmax' && size) {
data = data.slice(-size);
}

if (loadDelay === 0) {
Expand All @@ -181,6 +170,35 @@
}
}

function createDataPoint(time, request) {
return {
utc: time,
yesterday: time - 60 * 60 * 24 * 1000,
sin: sin(
time,
request.period,
request.amplitude,
request.offset,
request.phase,
request.randomness,
request.infinityValues,
request.exceedFloat32
),
wavelengths: wavelengths(),
intensities: intensities(),
cos: cos(
time,
request.period,
request.amplitude,
request.offset,
request.phase,
request.randomness,
request.infinityValues,
request.exceedFloat32
)
};
}

function postOnRequest(message, request, data) {
self.postMessage({
id: message.id,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"test:e2e:unstable": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @unstable",
"test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome",
"test:e2e:generatedata": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @generatedata",
"test:e2e:checksnapshots": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot --retries=0",
"test:e2e:updatesnapshots": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot --update-snapshots",
"test:e2e:visual:ci": "percy exec --config ./e2e/.percy.ci.yml --partial -- npx playwright test --config=e2e/playwright-visual-a11y.config.js --project=chrome --grep-invert @unstable",
"test:e2e:visual:full": "percy exec --config ./e2e/.percy.nightly.yml -- npx playwright test --config=e2e/playwright-visual-a11y.config.js --grep-invert @unstable",
Expand Down
9 changes: 9 additions & 0 deletions src/api/telemetry/TelemetryCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ export default class TelemetryCollection extends EventEmitter {
let added = [];
let addedIndices = [];
let hasDataBeforeStartBound = false;
let size = this.options.size;
let enforceSize = size !== undefined && this.options.enforceSize;

// loop through, sort and dedupe
for (let datum of data) {
Expand Down Expand Up @@ -271,6 +273,13 @@ export default class TelemetryCollection extends EventEmitter {
}
} else {
this.emit('add', added, addedIndices);

if (enforceSize && this.boundedTelemetry.length > size) {
const removeCount = this.boundedTelemetry.length - size;
const removed = this.boundedTelemetry.splice(0, removeCount);

this.emit('remove', removed);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a simple way of enforcing size with a small change

}
}
}
}
Expand Down
34 changes: 31 additions & 3 deletions src/plugins/telemetryTable/TelemetryTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ export default class TelemetryTable extends EventEmitter {

this.domainObject = domainObject;
this.openmct = openmct;
this.rowCount = 100;
this.tableComposition = undefined;
this.datumCache = [];
this.configuration = new TelemetryTableConfiguration(domainObject, openmct);
this.telemetryMode = this.configuration.getTelemetryMode();
this.rowLimit = this.configuration.getRowLimit();
this.paused = false;
this.keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);

Expand Down Expand Up @@ -101,18 +102,40 @@ export default class TelemetryTable extends EventEmitter {
}
}

updateTelemetryMode(mode) {
if (this.telemetryMode === mode) {
return;
}

this.telemetryMode = mode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing is a little weird here. Did prettier demand it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea on autosave

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats how i would have wrote it... hehe


this.updateRowLimit();

this.clearAndResubscribe();
}

updateRowLimit() {
if (this.telemetryMode === 'performance') {
this.tableRows.setLimit(this.rowLimit);
} else {
this.tableRows.removeLimit();
}
}

createTableRowCollections() {
this.tableRows = new TableRowCollection();

//Fetch any persisted default sort
let sortOptions = this.configuration.getConfiguration().sortOptions;

//If no persisted sort order, default to sorting by time system, ascending.
//If no persisted sort order, default to sorting by time system, descending.
sortOptions = sortOptions || {
key: this.openmct.time.timeSystem().key,
direction: 'asc'
direction: 'desc'
};

this.updateRowLimit();

this.tableRows.sortBy(sortOptions);
this.tableRows.on('resetRowsFromAllData', this.resetRowsFromAllData);
}
Expand Down Expand Up @@ -144,6 +167,11 @@ export default class TelemetryTable extends EventEmitter {

this.removeTelemetryCollection(keyString);

if (this.telemetryMode === 'performance') {
requestOptions.size = this.rowLimit;
requestOptions.enforceSize = true;
}

this.telemetryCollections[keyString] = this.openmct.telemetry.requestCollection(
telemetryObject,
requestOptions
Expand Down
40 changes: 40 additions & 0 deletions src/plugins/telemetryTable/TelemetryTableConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default class TelemetryTableConfiguration extends EventEmitter {
configuration.columnOrder = configuration.columnOrder || [];
configuration.cellFormat = configuration.cellFormat || {};
configuration.autosize = configuration.autosize === undefined ? true : configuration.autosize;
// anything that doesn't have a telemetryMode existed before the change and should stay as it was for consistency
configuration.telemetryMode = configuration.telemetryMode ?? 'unlimited';
configuration.persistModeChange = configuration.persistModeChange ?? true;
configuration.rowLimit = configuration.rowLimit ?? 50;

return configuration;
}
Expand Down Expand Up @@ -137,6 +141,42 @@ export default class TelemetryTableConfiguration extends EventEmitter {
}, {});
}

getTelemetryMode() {
let configuration = this.getConfiguration();

return configuration.telemetryMode;
}

setTelemetryMode(mode) {
let configuration = this.getConfiguration();
configuration.telemetryMode = mode;
this.updateConfiguration(configuration);
}

getRowLimit() {
let configuration = this.getConfiguration();

return configuration.rowLimit;
}

setRowLimit(limit) {
let configuration = this.getConfiguration();
configuration.rowLimit = limit;
this.updateConfiguration(configuration);
}

getPersistModeChange() {
let configuration = this.getConfiguration();

return configuration.persistModeChange;
}

setPersistModeChange(value) {
let configuration = this.getConfiguration();
configuration.persistModeChange = value;
this.updateConfiguration(configuration);
}

getColumnWidths() {
let configuration = this.getConfiguration();

Expand Down
68 changes: 54 additions & 14 deletions src/plugins/telemetryTable/TelemetryTableType.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,57 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/

export default {
name: 'Telemetry Table',
description:
'Display values for one or more telemetry end points in a scrolling table. Each row is a time-stamped value.',
creatable: true,
cssClass: 'icon-tabular-scrolling',
initialize(domainObject) {
domainObject.composition = [];
domainObject.configuration = {
columnWidths: {},
hiddenColumns: {}
};
}
};
export default function getTelemetryTableType(options = {}) {
const { telemetryMode = 'performance', persistModeChanges = true, rowLimit = 50 } = options;

return {
name: 'Telemetry Table',
description:
'Display values for one or more telemetry end points in a scrolling table. Each row is a time-stamped value.',
creatable: true,
cssClass: 'icon-tabular-scrolling',
form: [
{
key: 'telemetryMode',
name: 'Telemetry Mode',
control: 'select',
options: [
{
value: 'performance',
name: 'Performance Mode'
},
{
value: 'unlimited',
name: 'Unlimited Mode'
}
],
cssClass: 'l-inline',
property: ['configuration', 'telemetryMode']
},
{
name: 'Persist Telemetry Mode Changes',
control: 'toggleSwitch',
cssClass: 'l-input',
key: 'persistModeChanges',
property: ['configuration', 'persistModeChanges']
},
{
name: 'Performance Mode Row Limit',
control: 'toggleSwitch',
cssClass: 'l-input',
key: 'rowLimit',
property: ['configuration', 'rowLimit']
}
],
initialize(domainObject) {
domainObject.composition = [];
domainObject.configuration = {
columnWidths: {},
hiddenColumns: {},
telemetryMode,
persistModeChanges,
rowLimit
};
}
};
}
2 changes: 1 addition & 1 deletion src/plugins/telemetryTable/TelemetryTableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import TableComponent from './components/TableComponent.vue';
import TelemetryTable from './TelemetryTable.js';

export default class TelemetryTableView {
constructor(openmct, domainObject, objectPath) {
constructor(openmct, domainObject, objectPath, options) {
this.openmct = openmct;
this.domainObject = domainObject;
this.objectPath = objectPath;
Expand Down
Loading
Loading