mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 23:20:50 +00:00
Time strip marcus banes line "now line" fix for right y-axis and when now is out of bounds (#7993)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Has been cancelled
* Account for right y-axes when calculating now line position. Don't show the now line if it's out of bounds of the time axis * Add test for now marker in realtime and out of bounds modes
This commit is contained in:
parent
ecd120387c
commit
28b5d7c41c
@ -24,7 +24,9 @@ import {
|
|||||||
createDomainObjectWithDefaults,
|
createDomainObjectWithDefaults,
|
||||||
createPlanFromJSON,
|
createPlanFromJSON,
|
||||||
navigateToObjectWithFixedTimeBounds,
|
navigateToObjectWithFixedTimeBounds,
|
||||||
setFixedIndependentTimeConductorBounds
|
setFixedIndependentTimeConductorBounds,
|
||||||
|
setFixedTimeMode,
|
||||||
|
setTimeConductorBounds
|
||||||
} from '../../../appActions.js';
|
} from '../../../appActions.js';
|
||||||
import { expect, test } from '../../../pluginFixtures.js';
|
import { expect, test } from '../../../pluginFixtures.js';
|
||||||
|
|
||||||
@ -74,21 +76,14 @@ const testPlan = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test.describe('Time Strip', () => {
|
test.describe('Time Strip', () => {
|
||||||
test('Create two Time Strips, add a single Plan to both, and verify they can have separate Independent Time Contexts', async ({
|
let timestrip;
|
||||||
page
|
let plan;
|
||||||
}) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5627'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Constant locators
|
|
||||||
const activityBounds = page.locator('.activity-bounds');
|
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
// Goto baseURL
|
// Goto baseURL
|
||||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
const timestrip = await test.step('Create a Time Strip', async () => {
|
timestrip = await test.step('Create a Time Strip', async () => {
|
||||||
const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
|
const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
|
||||||
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
expect(objectName).toBe(createdTimeStrip.name);
|
expect(objectName).toBe(createdTimeStrip.name);
|
||||||
@ -96,7 +91,7 @@ test.describe('Time Strip', () => {
|
|||||||
return createdTimeStrip;
|
return createdTimeStrip;
|
||||||
});
|
});
|
||||||
|
|
||||||
const plan = await test.step('Create a Plan and add it to the timestrip', async () => {
|
plan = await test.step('Create a Plan and add it to the timestrip', async () => {
|
||||||
const createdPlan = await createPlanFromJSON(page, {
|
const createdPlan = await createPlanFromJSON(page, {
|
||||||
name: 'Test Plan',
|
name: 'Test Plan',
|
||||||
json: testPlan
|
json: testPlan
|
||||||
@ -110,6 +105,22 @@ test.describe('Time Strip', () => {
|
|||||||
.dragTo(page.getByLabel('Object View'));
|
.dragTo(page.getByLabel('Object View'));
|
||||||
await page.getByLabel('Save').click();
|
await page.getByLabel('Save').click();
|
||||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
return createdPlan;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('Create two Time Strips, add a single Plan to both, and verify they can have separate Independent Time Contexts', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5627'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Constant locators
|
||||||
|
const activityBounds = page.locator('.activity-bounds');
|
||||||
|
|
||||||
|
await test.step('Set time strip to fixed timespan mode and verify activities', async () => {
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
||||||
|
|
||||||
@ -119,8 +130,6 @@ test.describe('Time Strip', () => {
|
|||||||
// Verify all events are displayed
|
// Verify all events are displayed
|
||||||
const eventCount = await page.locator('.activity-bounds').count();
|
const eventCount = await page.locator('.activity-bounds').count();
|
||||||
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
||||||
|
|
||||||
return createdPlan;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step('TimeStrip can use the Independent Time Conductor', async () => {
|
await test.step('TimeStrip can use the Independent Time Conductor', async () => {
|
||||||
@ -177,4 +186,48 @@ test.describe('Time Strip', () => {
|
|||||||
expect(await activityBounds.count()).toEqual(1);
|
expect(await activityBounds.count()).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Time strip now line', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/7817'
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Is displayed in realtime mode', async () => {
|
||||||
|
await expect(page.getByLabel('Now Marker')).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Is hidden when out of bounds of the time axis', async () => {
|
||||||
|
// Switch to fixed timespan mode
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
// Get the end bounds
|
||||||
|
const endBounds = await page.getByLabel('End bounds').textContent();
|
||||||
|
|
||||||
|
// Add 2 minutes to end bound datetime and use it as the new end time
|
||||||
|
let endTimeStamp = new Date(endBounds);
|
||||||
|
endTimeStamp.setUTCMinutes(endTimeStamp.getUTCMinutes() + 2);
|
||||||
|
const endDate = endTimeStamp.toISOString().split('T')[0];
|
||||||
|
const milliseconds = endTimeStamp.getMilliseconds();
|
||||||
|
const endTime = endTimeStamp.toISOString().split('T')[1].replace(`.${milliseconds}Z`, '');
|
||||||
|
|
||||||
|
// Subtract 1 minute from the end bound and use it as the new start time
|
||||||
|
let startTimeStamp = new Date(endBounds);
|
||||||
|
startTimeStamp.setUTCMinutes(startTimeStamp.getUTCMinutes() + 1);
|
||||||
|
const startDate = startTimeStamp.toISOString().split('T')[0];
|
||||||
|
const startMilliseconds = startTimeStamp.getMilliseconds();
|
||||||
|
const startTime = startTimeStamp
|
||||||
|
.toISOString()
|
||||||
|
.split('T')[1]
|
||||||
|
.replace(`.${startMilliseconds}Z`, '');
|
||||||
|
// Set fixed timespan mode to the future so that "now" is out of bounds.
|
||||||
|
await setTimeConductorBounds(page, {
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
startTime,
|
||||||
|
endTime
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(page.getByLabel('Now Marker')).toBeHidden();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div ref="axisHolder" class="c-timesystem-axis">
|
<div ref="axisHolder" class="c-timesystem-axis">
|
||||||
<div class="nowMarker" :style="nowMarkerStyle"><span class="icon-arrow-down"></span></div>
|
<div class="nowMarker" :style="nowMarkerStyle" aria-label="Now Marker">
|
||||||
|
<span class="icon-arrow-down"></span>
|
||||||
|
</div>
|
||||||
<svg :width="svgWidth" :height="svgHeight">
|
<svg :width="svgWidth" :height="svgHeight">
|
||||||
<g class="axis" font-size="1.3em" :transform="axisTransform"></g>
|
<g class="axis" font-size="1.3em" :transform="axisTransform"></g>
|
||||||
</svg>
|
</svg>
|
||||||
@ -116,8 +118,10 @@ export default {
|
|||||||
this.axisTransform = `translate(${this.alignmentData.leftWidth + leftOffset}, 20)`;
|
this.axisTransform = `translate(${this.alignmentData.leftWidth + leftOffset}, 20)`;
|
||||||
|
|
||||||
const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0;
|
const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0;
|
||||||
|
|
||||||
|
this.leftAlignmentOffset = this.alignmentData.leftWidth + leftOffset;
|
||||||
this.alignmentOffset =
|
this.alignmentOffset =
|
||||||
this.alignmentData.leftWidth + leftOffset + this.alignmentData.rightWidth + rightOffset;
|
this.leftAlignmentOffset + this.alignmentData.rightWidth + rightOffset;
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
@ -175,8 +179,8 @@ export default {
|
|||||||
this.nowMarkerStyle.height = this.contentHeight + 'px';
|
this.nowMarkerStyle.height = this.contentHeight + 'px';
|
||||||
const nowTimeStamp = this.openmct.time.now();
|
const nowTimeStamp = this.openmct.time.now();
|
||||||
const now = this.xScale(nowTimeStamp);
|
const now = this.xScale(nowTimeStamp);
|
||||||
this.nowMarkerStyle.left = `${now + this.alignmentOffset}px`;
|
this.nowMarkerStyle.left = `${now + this.leftAlignmentOffset}px`;
|
||||||
if (now > this.width) {
|
if (now < 0 || now > this.width) {
|
||||||
nowMarker.classList.add('hidden');
|
nowMarker.classList.add('hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user