Skip to content

Commit

Permalink
Merge branch 'release/2.0.8' of https://github.com/nasa/openmct into …
Browse files Browse the repository at this point in the history
…release/2.0.8
  • Loading branch information
shefalijoshi committed Aug 24, 2022
2 parents 5a4dd11 + 78df5fc commit 7bccb73
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,24 @@ test.describe('Time conductor input fields real-time mode', () => {
expect(page.url()).toContain(`startDelta=${startDelta}`);
expect(page.url()).toContain(`endDelta=${endDelta}`);
});

test.fixme('time conductor history in fixed time mode will track changing start and end times', async ({ page }) => {
// change start time, verify it's tracked in history
// change end time, verify it's tracked in history
});

test.fixme('time conductor history in realtime mode will track changing start and end times', async ({ page }) => {
// change start offset, verify it's tracked in history
// change end offset, verify it's tracked in history
});

test.fixme('time conductor history allows you to set a historical timeframe', async ({ page }) => {
// make sure there are historical history options
// select an option and make sure the time conductor start and end bounds are updated correctly
});

test.fixme('time conductor history allows you to set a realtime offsets', async ({ page }) => {
// make sure there are realtime history options
// select an option and verify the offsets are updated correctly
});
});
13 changes: 9 additions & 4 deletions e2e/tests/functional/search.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/

const { test, expect } = require('../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../appActions');
const { v4: uuid } = require('uuid');

test.describe('Grand Search', () => {
test('Can search for objects, and subsequent search dropdown behaves properly', async ({ page, openmctConfig }) => {
Expand Down Expand Up @@ -112,13 +114,16 @@ test.describe("Search Tests @unstable", () => {
await expect(page.locator('text=No matching results.')).toBeVisible();
});

test('Validate single object in search result', async ({ page }) => {
test('Validate single object in search result @couchdb', async ({ page }) => {
//Go to baseURL
await page.goto("./", { waitUntil: "networkidle" });

// Create a folder object
const folderName = 'testFolder';
await createFolderObject(page, folderName);
const folderName = uuid();
await createDomainObjectWithDefaults(page, {
type: 'folder',
name: folderName
});

// Full search for object
await page.type("input[type=search]", folderName);
Expand All @@ -127,7 +132,7 @@ test.describe("Search Tests @unstable", () => {
await waitForSearchCompletion(page);

// Get the search results
const searchResults = await page.locator(searchResultSelector);
const searchResults = page.locator(searchResultSelector);

// Verify that one result is found
expect(await searchResults.count()).toBe(1);
Expand Down
6 changes: 5 additions & 1 deletion src/api/objects/InMemorySearchProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ class InMemorySearchProvider {
// using structuredClone. Thus we're using JSON.parse/JSON.stringify to discard
// those functions.
const nonMutableDomainObject = JSON.parse(JSON.stringify(newDomainObjectToIndex));
provider.index(nonMutableDomainObject);

const objectProvider = this.openmct.objects.getProvider(nonMutableDomainObject.identifier);
if (objectProvider === undefined || objectProvider.search === undefined) {
provider.index(nonMutableDomainObject);
}
}

onCompositionRemoved(domainObjectToRemoveIdentifier) {
Expand Down
9 changes: 7 additions & 2 deletions src/plugins/charts/scatter/ScatterPlotView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ export default {
},
followTimeContext() {
this.timeContext.on('bounds', this.reloadTelemetry);
this.timeContext.on('bounds', this.reloadTelemetryOnBoundsChange);
},
stopFollowingTimeContext() {
if (this.timeContext) {
this.timeContext.off('bounds', this.reloadTelemetry);
this.timeContext.off('bounds', this.reloadTelemetryOnBoundsChange);
}
},
addToComposition(telemetryObject) {
Expand Down Expand Up @@ -181,6 +181,11 @@ export default {
this.composition.on('remove', this.removeTelemetryObject);
this.composition.load();
},
reloadTelemetryOnBoundsChange(bounds, isTick) {
if (!isTick) {
this.reloadTelemetry();
}
},
reloadTelemetry() {
this.valuesByTimestamp = {};
Expand Down
32 changes: 19 additions & 13 deletions src/plugins/timeConductor/ConductorHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
const DEFAULT_DURATION_FORMATTER = 'duration';
const LOCAL_STORAGE_HISTORY_KEY_FIXED = 'tcHistory';
const LOCAL_STORAGE_HISTORY_KEY_REALTIME = 'tcHistoryRealtime';
const DEFAULT_RECORDS = 10;
const DEFAULT_RECORDS_LENGTH = 10;
import { millisecondsToDHMS } from "utils/duration";
import UTCTimeFormat from "../utcTimeSystem/UTCTimeFormat.js";
Expand Down Expand Up @@ -79,24 +79,22 @@ export default {
* @timespans {start, end} number representing timestamp
*/
fixedHistory: {},
presets: []
presets: [],
isFixed: this.openmct.time.clock() === undefined
};
},
computed: {
currentHistory() {
return this.mode + 'History';
},
isFixed() {
return this.openmct.time.clock() === undefined;
},
historyForCurrentTimeSystem() {
const history = this[this.currentHistory][this.timeSystem.key];
return history;
},
storageKey() {
let key = LOCAL_STORAGE_HISTORY_KEY_FIXED;
if (this.mode !== 'fixed') {
if (!this.isFixed) {
key = LOCAL_STORAGE_HISTORY_KEY_REALTIME;
}
Expand All @@ -108,35 +106,43 @@ export default {
handler() {
// only for fixed time since we track offsets for realtime
if (this.isFixed) {
this.updateMode();
this.addTimespan();
}
},
deep: true
},
offsets: {
handler() {
this.updateMode();
this.addTimespan();
},
deep: true
},
timeSystem: {
handler(ts) {
this.updateMode();
this.loadConfiguration();
this.addTimespan();
},
deep: true
},
mode: function () {
this.getHistoryFromLocalStorage();
this.initializeHistoryIfNoHistory();
this.updateMode();
this.loadConfiguration();
}
},
mounted() {
this.updateMode();
this.getHistoryFromLocalStorage();
this.initializeHistoryIfNoHistory();
},
methods: {
updateMode() {
this.isFixed = this.openmct.time.clock() === undefined;
this.getHistoryFromLocalStorage();
this.initializeHistoryIfNoHistory();
},
getHistoryMenuItems() {
const history = this.historyForCurrentTimeSystem.map(timespan => {
let name;
Expand Down Expand Up @@ -203,8 +209,8 @@ export default {
currentHistory = currentHistory.filter(ts => !(ts.start === timespan.start && ts.end === timespan.end));
currentHistory.unshift(timespan); // add to front
if (currentHistory.length > this.records) {
currentHistory.length = this.records;
if (currentHistory.length > this.MAX_RECORDS_LENGTH) {
currentHistory.length = this.MAX_RECORDS_LENGTH;
}
this.$set(this[this.currentHistory], key, currentHistory);
Expand All @@ -231,7 +237,7 @@ export default {
.filter(option => option.timeSystem === this.timeSystem.key);
this.presets = this.loadPresets(configurations);
this.records = this.loadRecords(configurations);
this.MAX_RECORDS_LENGTH = this.loadRecords(configurations);
},
loadPresets(configurations) {
const configuration = configurations.find(option => {
Expand All @@ -243,9 +249,9 @@ export default {
},
loadRecords(configurations) {
const configuration = configurations.find(option => option.records);
const records = configuration ? configuration.records : DEFAULT_RECORDS;
const maxRecordsLength = configuration ? configuration.records : DEFAULT_RECORDS_LENGTH;
return records;
return maxRecordsLength;
},
formatTime(time) {
let format = this.timeSystem.timeFormat;
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/timeConductor/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ describe('time conductor', () => {
describe('duration functions', () => {
it('should transform milliseconds to DHMS', () => {
const functionResults = [millisecondsToDHMS(0), millisecondsToDHMS(86400000),
millisecondsToDHMS(129600000), millisecondsToDHMS(661824000)];
const validResults = [' ', '+ 1d', '+ 1d 12h', '+ 7d 15h 50m 24s'];
millisecondsToDHMS(129600000), millisecondsToDHMS(661824000), millisecondsToDHMS(213927028)];
const validResults = [' ', '+ 1d', '+ 1d 12h', '+ 7d 15h 50m 24s', '+ 2d 11h 25m 27s 28ms'];
expect(validResults).toEqual(functionResults);
});

it('should get precise duration', () => {
const functionResults = [getPreciseDuration(0), getPreciseDuration(643680000),
getPreciseDuration(1605312000)];
const validResults = ['00:00:00:00', '07:10:48:00', '18:13:55:12'];
getPreciseDuration(1605312000), getPreciseDuration(213927028)];
const validResults = ['00:00:00:00:000', '07:10:48:00:000', '18:13:55:12:000', '02:11:25:27:028'];
expect(validResults).toEqual(functionResults);
});
});

0 comments on commit 7bccb73

Please sign in to comment.