Skip to content

Commit 3e23dce

Browse files
shefalijoshiozyx
andauthored
fix(#7892): restore "now" (marcus bains) line to planning views (#7898)
* Initialize alignment offset to 0. (it was undefined). Also handle a small bug with swimlane configuration not getting replaced when the plan used by a gantt chart was changed * lint: fix * test: update visual tests to mock clock and show now line --------- Co-authored-by: Mazzella, Jesse D. (ARC-TI)[KBR Wyle Services, LLC] <[email protected]>
1 parent 7f8b5e0 commit 3e23dce

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed

e2e/helper/planningUtils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl
129129
*/
130130
export function getEarliestStartTime(planJson) {
131131
const activities = Object.values(planJson).flat();
132+
132133
return Math.min(...activities.map((activity) => activity.start));
133134
}
134135

@@ -139,6 +140,7 @@ export function getEarliestStartTime(planJson) {
139140
*/
140141
export function getLatestEndTime(planJson) {
141142
const activities = Object.values(planJson).flat();
143+
142144
return Math.max(...activities.map((activity) => activity.end));
143145
}
144146

@@ -151,6 +153,7 @@ export function getFirstActivity(planJson) {
151153
const groups = Object.keys(planJson);
152154
const firstGroupKey = groups[0];
153155
const firstGroupItems = planJson[firstGroupKey];
156+
154157
return firstGroupItems[0];
155158
}
156159

e2e/tests/visual-a11y/planning-gantt.visual.spec.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,25 @@ import fs from 'fs';
2626
import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../appActions.js';
2727
import { scanForA11yViolations, test } from '../../avpFixtures.js';
2828
import { VISUAL_FIXED_URL } from '../../constants.js';
29-
import { setBoundsToSpanAllActivities, setDraftStatusForPlan } from '../../helper/planningUtils.js';
29+
import {
30+
getFirstActivity,
31+
setBoundsToSpanAllActivities,
32+
setDraftStatusForPlan
33+
} from '../../helper/planningUtils.js';
3034

3135
const examplePlanSmall2 = JSON.parse(
3236
fs.readFileSync(new URL('../../test-data/examplePlans/ExamplePlan_Small2.json', import.meta.url))
3337
);
3438

39+
const FIRST_ACTIVITY_SMALL_2 = getFirstActivity(examplePlanSmall2);
40+
3541
test.describe('Visual - Gantt Chart @a11y', () => {
3642
test.beforeEach(async ({ page }) => {
43+
// Set the clock to the end of the first activity in the plan
44+
// This is so we can see the "now" line in the plan view
45+
await page.clock.install({ time: FIRST_ACTIVITY_SMALL_2.end + 10000 });
46+
await page.clock.resume();
47+
3748
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
3849
});
3950
test('Gantt Chart View', async ({ page, theme }) => {

e2e/tests/visual-a11y/planning-timestrip.visual.spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,21 @@ import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../appAct
2727
import { scanForA11yViolations, test } from '../../avpFixtures.js';
2828
import { waitForAnimations } from '../../baseFixtures.js';
2929
import { VISUAL_FIXED_URL } from '../../constants.js';
30-
import { setBoundsToSpanAllActivities } from '../../helper/planningUtils.js';
30+
import { getFirstActivity, setBoundsToSpanAllActivities } from '../../helper/planningUtils.js';
3131

3232
const examplePlanSmall2 = JSON.parse(
3333
fs.readFileSync(new URL('../../test-data/examplePlans/ExamplePlan_Small2.json', import.meta.url))
3434
);
3535

36+
const FIRST_ACTIVITY_SMALL_2 = getFirstActivity(examplePlanSmall2);
37+
3638
test.describe('Visual - Time Strip @a11y', () => {
3739
test.beforeEach(async ({ page }) => {
40+
// Set the clock to the end of the first activity in the plan
41+
// This is so we can see the "now" line in the plan view
42+
await page.clock.install({ time: FIRST_ACTIVITY_SMALL_2.end + 10000 });
43+
await page.clock.resume();
44+
3845
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
3946
});
4047
test('Time Strip View', async ({ page, theme }) => {

e2e/tests/visual-a11y/planning-view.visual.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const examplePlanSmall2 = JSON.parse(
4242
);
4343

4444
const FIRST_ACTIVITY_SMALL_1 = getFirstActivity(examplePlanSmall1);
45+
const FIRST_ACTIVITY_SMALL_2 = getFirstActivity(examplePlanSmall2);
4546

4647
test.describe('Visual - Timelist progress bar @clock @a11y', () => {
4748
test.beforeEach(async ({ page }) => {
@@ -59,6 +60,11 @@ test.describe('Visual - Timelist progress bar @clock @a11y', () => {
5960

6061
test.describe('Visual - Plan View @a11y', () => {
6162
test.beforeEach(async ({ page }) => {
63+
// Set the clock to the end of the first activity in the plan
64+
// This is so we can see the "now" line in the plan view
65+
await page.clock.install({ time: FIRST_ACTIVITY_SMALL_2.end + 10000 });
66+
await page.clock.resume();
67+
6268
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
6369
});
6470

src/plugins/plan/components/PlanView.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export default {
248248
}
249249
},
250250
handleConfigurationChange(newConfiguration) {
251+
this.configuration = this.planViewConfiguration.getConfiguration();
251252
Object.keys(newConfiguration).forEach((key) => {
252253
this[key] = newConfiguration[key];
253254
});

src/ui/components/TimeSystemAxis.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default {
7979
const svgWidth = ref(0);
8080
const svgHeight = ref(0);
8181
const axisTransform = ref('translate(0,20)');
82+
const alignmentOffset = ref(0);
8283
const nowMarkerStyle = reactive({
8384
height: '0px',
8485
left: '0px'
@@ -100,6 +101,7 @@ export default {
100101
svgWidth,
101102
svgHeight,
102103
axisTransform,
104+
alignmentOffset,
103105
nowMarkerStyle,
104106
openmct
105107
};

0 commit comments

Comments
 (0)