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

Add Expanded view for Time List #7378

Merged
merged 79 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
7003f00
Add activity states domain object and interceptor to auto create one
shefalijoshi Jan 10, 2024
92a30a3
Add activity state inspector option
shefalijoshi Jan 10, 2024
4d4f83e
Only save status if we have a unique ids for activities
shefalijoshi Jan 10, 2024
02edb99
Include the id in the activity properties
shefalijoshi Jan 10, 2024
e47bfed
Don't show activity state section in the inspector if multiple activi…
shefalijoshi Jan 10, 2024
3c14025
Display activity properties when an activity row is selected in the t…
shefalijoshi Jan 10, 2024
2e41753
Add compact view for timelist
shefalijoshi Jan 17, 2024
c6a6a18
Add inspector configuration for compact view
shefalijoshi Jan 18, 2024
a0ccc4e
Set colors based on time relation of activity
shefalijoshi Jan 18, 2024
65a7e7e
Use activity id as key if it is available
shefalijoshi Jan 18, 2024
176d344
Ensure the correct option is selected for activity states
shefalijoshi Jan 18, 2024
9ff31d5
Closes #7377
charlesh88 Jan 19, 2024
ad07174
Closes #7377
charlesh88 Jan 19, 2024
02c796a
Add status label
shefalijoshi Jan 19, 2024
44f4ac2
Rename to Expanded view and isExpanded as properties. Add display sty…
shefalijoshi Jan 19, 2024
b0a21d4
Refactor activity selection. Display activity properties
shefalijoshi Jan 19, 2024
3655ba9
Closes #7377
charlesh88 Jan 19, 2024
3365039
Merge remote-tracking branch 'origin/timelist-compact-view' into time…
charlesh88 Jan 19, 2024
5cbd0fd
Closes #7377
charlesh88 Jan 19, 2024
dc1def5
Remove activity states plugin. Move the activity states interceptor t…
shefalijoshi Jan 19, 2024
b413a9b
Change activity states interceptor parameters to options
shefalijoshi Jan 19, 2024
bbf5454
Rename constants
shefalijoshi Jan 19, 2024
6def4c2
Fix activity states test
shefalijoshi Jan 19, 2024
9b85252
Merge branch 'master' of https://github.com/nasa/openmct into activit…
shefalijoshi Jan 19, 2024
51e20ea
Addresses review comments making code more readable.
shefalijoshi Jan 19, 2024
95d7488
Closes #7377
charlesh88 Jan 22, 2024
585b60d
Closes #7377
charlesh88 Jan 22, 2024
15acbc9
Remove ExpandedView component and pull the ExpandedViewItem up to the…
shefalijoshi Jan 23, 2024
dcad88c
Merge branch 'master' into timelist-compact-view
shefalijoshi Jan 23, 2024
e209b00
Fix sorting for compact view.
shefalijoshi Jan 23, 2024
3bd09fc
Merge branch 'timelist-compact-view' of https://github.com/nasa/openm…
shefalijoshi Jan 23, 2024
5908f96
Merge branch 'master' into activity-state-display
shefalijoshi Jan 23, 2024
34c1f20
Closes #7377
charlesh88 Jan 23, 2024
e6fb968
Merge remote-tracking branch 'origin/timelist-compact-view' into time…
charlesh88 Jan 23, 2024
6682d00
Closes #7377
charlesh88 Jan 23, 2024
78f2852
Add e2e test for activity states feature.
shefalijoshi Jan 23, 2024
5c6a733
Address review comments. Rename variables, documentation.
shefalijoshi Jan 23, 2024
42ed592
No shallow copy
shefalijoshi Jan 23, 2024
7931d4b
Merge branch 'master' of https://github.com/nasa/openmct into timelis…
shefalijoshi Jan 24, 2024
b5a73d3
Merge branch 'activity-state-display' of https://github.com/nasa/open…
shefalijoshi Jan 24, 2024
6ac08b0
Merge updates to activity-state
shefalijoshi Jan 25, 2024
8798aa1
Merge branch 'master' of https://github.com/nasa/openmct into timelis…
shefalijoshi Jan 25, 2024
6ae216d
Sync with activity states PR
shefalijoshi Jan 25, 2024
c51f828
Draft of progress-pie
shefalijoshi Jan 25, 2024
3e0342a
- Add `s-selected` styling for Expanded Time List elements.
charlesh88 Jan 25, 2024
21f6279
Add 2 new date formats
shefalijoshi Jan 26, 2024
6116662
Look and feel enhancements for pie, zero duration events and start an…
shefalijoshi Jan 26, 2024
e74be9b
Fix pie show/hide condition
shefalijoshi Jan 26, 2024
9ceb8a6
Merge branch 'timelist-compact-view' of github.com:nasa/openmct into …
charlesh88 Jan 26, 2024
9f7d931
Final touches to the pie and labels
shefalijoshi Jan 26, 2024
eb80bcb
Merge branch 'timelist-compact-view' of github.com:nasa/openmct into …
charlesh88 Jan 26, 2024
a0aa1c9
Refactor label logic
shefalijoshi Jan 26, 2024
d9a50b4
Merge branch 'timelist-compact-view' of github.com:nasa/openmct into …
charlesh88 Jan 26, 2024
884373e
Closes #7377
charlesh88 Jan 26, 2024
9e00836
Merge branch 'master' of https://github.com/nasa/openmct into timelis…
shefalijoshi Jan 29, 2024
a56931e
Remove use of ListView - no point passing arrays around since we are …
shefalijoshi Jan 29, 2024
bb74f21
We addded a new column for duration and changed the previous duration…
shefalijoshi Jan 29, 2024
905801c
Fix expanded view for timelist tests
shefalijoshi Jan 29, 2024
088b4b0
Closes #7377
charlesh88 Jan 29, 2024
91a2c62
Merge remote-tracking branch 'origin/timelist-compact-view' into time…
charlesh88 Jan 29, 2024
3ad4acf
Merge branch 'master' into timelist-compact-view
charlesh88 Jan 29, 2024
af161f9
Closes #7377
charlesh88 Jan 29, 2024
a9feb37
Optimize rendering of timelist activities
shefalijoshi Jan 30, 2024
32781e2
Remove focused test
shefalijoshi Jan 30, 2024
e248c78
Merge branch 'timelist-compact-view' of https://github.com/nasa/openm…
shefalijoshi Jan 30, 2024
a09522d
Merge branch 'master' of https://github.com/nasa/openmct into timelis…
shefalijoshi Jan 30, 2024
333b683
Address review comments
shefalijoshi Jan 30, 2024
1bf5a15
Remove reactive selection for plan activities
shefalijoshi Jan 30, 2024
004957d
destructure props into individual item properties for render performa…
shefalijoshi Jan 30, 2024
ac80da4
Merge remote-tracking branch 'origin' into timelist-compact-view
charlesh88 Jan 30, 2024
6026876
Merge branch 'timelist-compact-view' of https://github.com/nasa/openm…
shefalijoshi Jan 30, 2024
73c2e7e
Use local variables and remove JSON utility methods
shefalijoshi Jan 30, 2024
c03d7bb
Change cancelled to skipped
shefalijoshi Jan 30, 2024
c45c6a2
Focus the activity tab when shown
shefalijoshi Jan 30, 2024
f068090
Fix label updates
shefalijoshi Jan 30, 2024
14ede06
Merge branch 'master' into timelist-compact-view
shefalijoshi Jan 30, 2024
fbd271a
Add countup to cspell
shefalijoshi Jan 30, 2024
fb38cdb
Remove progress pie due to licensing unknowns
shefalijoshi Jan 31, 2024
5cfa222
Merge branch 'timelist-compact-view' of https://github.com/nasa/openm…
shefalijoshi Jan 31, 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
66 changes: 65 additions & 1 deletion e2e/tests/functional/planning/timelist.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const TIME_TO_FROM_COLUMN = 2;
// eslint-disable-next-line no-unused-vars
const ACTIVITY_COLUMN = 3;
const HEADER_ROW = 0;
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 5;

test.describe('Time List', () => {
test("Create a Time List, add a single Plan to it, verify all the activities are displayed with no milliseconds and selecting an activity shows it's properties", async ({
Expand Down Expand Up @@ -109,6 +109,70 @@ test.describe('Time List', () => {
});
});

test("View a timelist in expanded view, verify all the activities are displayed and selecting an activity shows it's properties", async ({
page
}) => {
// Goto baseURL
await page.goto('./', { waitUntil: 'domcontentloaded' });

const timelist = await test.step('Create a Time List', async () => {
const createdTimeList = await createDomainObjectWithDefaults(page, { type: 'Time List' });
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
expect(objectName).toBe(createdTimeList.name);

return createdTimeList;
});

await test.step('Create a Plan and add it to the timelist', async () => {
await createPlanFromJSON(page, {
name: 'Test Plan',
json: examplePlanSmall1,
parent: timelist.uuid
});

// Ensure that all activities are shown in the expanded view
const groups = Object.keys(examplePlanSmall1);
const firstGroupKey = groups[0];
const firstGroupItems = examplePlanSmall1[firstGroupKey];
const firstActivity = firstGroupItems[0];
const lastActivity = firstGroupItems[firstGroupItems.length - 1];
const startBound = firstActivity.start;
const endBound = lastActivity.end;

// Switch to fixed time mode with all plan events within the bounds
await page.goto(
Copy link
Contributor

Choose a reason for hiding this comment

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

whoa

`${timelist.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=timelist.view`
);

// Change the object to edit mode
await page.getByRole('button', { name: 'Edit Object' }).click();

// Find the display properties section in the inspector
await page.getByRole('tab', { name: 'View Properties' }).click();
// Switch to expanded view and save the setting
await page.getByLabel('Display Style').selectOption({ label: 'Expanded' });

// Click on the "Save" button
await page.getByRole('button', { name: 'Save' }).click();
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();

// Verify all events are displayed
const eventCount = await page.getByRole('row').count();
await expect(eventCount).toEqual(firstGroupItems.length);
});

await test.step('Shows activity properties when a row is selected', async () => {
await page.getByRole('row').nth(2).click();

// Find the activity state section in the inspector
await page.getByRole('tab', { name: 'Activity' }).click();
// Check that activity state label is displayed in the inspector.
await expect(page.getByLabel('Activity Status').locator("[aria-selected='true']")).toHaveText(
'Not started'
);
});
});

/**
* The regular expression used to parse the countdown string.
* Some examples of valid Countdown strings:
Expand Down
278 changes: 278 additions & 0 deletions src/plugins/timelist/ExpandedViewItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
<!--
Open MCT, Copyright (c) 2014-2024, United States Government
as represented by the Administrator of the National Aeronautics and Space
Administration. All rights reserved.

Open MCT is licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Open MCT includes source code licensed under additional open source
licenses. See the Open Source Licenses file (LICENSES.md) included with
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<template>
<div :class="listItemClass" role="row">
<div class="c-tli__activity-color">
<div class="c-tli__activity-color-swatch" :style="styleClass"></div>
</div>
<div class="c-tli__title-and-bounds">
<div class="c-tli__title">{{ formattedItem.title }}</div>
<div class="c-tli__bounds" :class="{ '--has-duration': eventHasDuration }">
<div v-if="eventHasDuration" class="c-tli__duration">{{ formattedItem.duration }}</div>
<div v-else class="c-tli__start-time">Event</div>
<div class="c-tli__start-time">
{{ formattedItem.start }}
</div>
<div v-if="eventHasDuration" class="c-tli__end-time">{{ formattedItem.end }}</div>
</div>
</div>
<div class="c-tli__graphic">
<svg viewBox="0 0 100 100">
<g aria-label="Activity in progress" class="c-tli__graphic__pie">
<circle class="c-svg-progress__bg" r="50" cx="50" cy="50"></circle>
<path ref="progressElement" class="c-svg-progress__progress"></path>
<circle
class="c-svg-progress__ticks"
r="40"
cx="50"
cy="50"

Check warning on line 47 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L47

Added line #L47 was not covered by tests
stroke-dasharray="3 7.472"
></circle>
<rect class="c-svg-progress__sweep-hand" x="48" y="18" width="4" height="27"></rect>
</g>
<path

Check warning on line 52 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L52

Added line #L52 was not covered by tests
aria-label="Activity complete"
class="c-tli__graphic__check"
d="M80 20L42.5 57.5L20 35V57.5L42.5 80L80 42.5V20Z"
/>
<path
aria-label="Activity alert"

Check warning on line 58 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L58

Added line #L58 was not covered by tests
class="c-tli__graphic__alert-triangle"
d="M79.4533 70.3034L54.004 25.7641C51.8962 22.0786 48.4636 22.0786 46.3559 25.7641L20.8946 70.3034C18.7868 73.989 20.5332 77 24.7728 77H75.563C79.8146 77 81.561 73.989 79.4533 70.3034ZM54.028 73.1459H46.3198V65.4376H54.028V73.1459ZM55.3409 50.0211L53.0645 61.5835H47.2833L45.007 50.0211V34.6045H55.3529V50.0211H55.3409Z"

Check warning on line 60 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L60

Added line #L60 was not covered by tests
/>
<g aria-label="Activity aborted" class="c-tli__graphic__circle-slash">

Check warning on line 62 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L62

Added line #L62 was not covered by tests
<path
fill-rule="evenodd"

Check warning on line 64 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L64

Added line #L64 was not covered by tests
clip-rule="evenodd"
d="M50 82C67.6731 82 82 67.6731 82 50C82 32.3269 67.6731 18 50 18C32.3269 18 18 32.3269 18 50C18 67.6731 32.3269 82 50 82ZM50 72C62.1503 72 72 62.1503 72 50C72 37.8497 62.1503 28 50 28C37.8497 28 28 37.8497 28 50C28 62.1503 37.8497 72 50 72Z"
/>

Check warning on line 67 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L67

Added line #L67 was not covered by tests
<path
d="M63.7886 29.6404L70.8596 36.7114L36.2114 71.3596L29.1404 64.2886L63.7886 29.6404Z"
/>

Check warning on line 70 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L70

Added line #L70 was not covered by tests
</g>
<path
aria-label="Activity skipped"

Check warning on line 73 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L73

Added line #L73 was not covered by tests
class="c-tli__graphic__skipped"
d="M31 48C31 42.4772 35.5152 38 41 38H59C64.4848 38 69 42.4772 69 48V55H58L74 72L90 55H79V48C79 36.9543 69.9695 28 59 28H41C30.0305 28 21 36.9543 21 48V53.0294C21 56.8792 17.8232 60 14 60V70C23.308 70 31 62.402 31 53.0294V48Z"
/>
</svg>
</div>

Check warning on line 78 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L76-L78

Added lines #L76 - L78 were not covered by tests
<div class="c-tli__time-hero">
<div class="c-tli__time-hero-context-and-time">
<div class="c-tli__time-hero-context">{{ formattedItemLabel }}</div>
<div v-if="showTimeHero" :class="countdownClass">
{{ formattedItem.countdown }}
</div>

Check warning on line 84 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L82-L84

Added lines #L82 - L84 were not covered by tests
</div>
</div>
</div>

Check warning on line 87 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L87

Added line #L87 was not covered by tests
</template>

<script>
import _ from 'lodash';

import { TIME_CONTEXT_EVENTS } from '../../api/time/constants.js';
import { CURRENT_CSS_SUFFIX, FUTURE_CSS_SUFFIX, PAST_CSS_SUFFIX } from './constants.js';

Check warning on line 94 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L94

Added line #L94 was not covered by tests
import { updateProgress } from './inspector/svg-progress.js';

const ITEM_COLORS = {
[CURRENT_CSS_SUFFIX]: '#ffcc00',
[PAST_CSS_SUFFIX]: '#0088ff',
[FUTURE_CSS_SUFFIX]: '#7300ff'

Check warning on line 100 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L100

Added line #L100 was not covered by tests
};

const EXECUTION_STATES = {

Check warning on line 103 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L103

Added line #L103 was not covered by tests
notStarted: 'Not started',
'in-progress': 'In progress',
completed: 'Completed',
aborted: 'Aborted',
skipped: 'Skipped'
};

Check warning on line 110 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L110

Added line #L110 was not covered by tests
const INFERRED_EXECUTION_STATES = {
incomplete: 'Incomplete',
overdue: 'Overdue',

Check warning on line 113 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L113

Added line #L113 was not covered by tests
runningLong: 'Running Long',
starts: 'Starts',
occurs: 'Occurs',

Check warning on line 116 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L116

Added line #L116 was not covered by tests
occurred: 'Occurred',
ends: 'Ends',
ended: 'Ended'
};

export default {
inject: ['openmct', 'domainObject', 'path'],
props: {

Check warning on line 124 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L124

Added line #L124 was not covered by tests
item: {
type: Object,
required: true

Check warning on line 127 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L127

Added line #L127 was not covered by tests
},
shefalijoshi marked this conversation as resolved.
Show resolved Hide resolved
itemProperties: {
type: Array,
required: true
},
executionState: {
type: String,

Check warning on line 134 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L134

Added line #L134 was not covered by tests
default() {
return '';
}
}

Check warning on line 138 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L137-L138

Added lines #L137 - L138 were not covered by tests
},
data() {
return {
timestamp: this.openmct.time.now()
shefalijoshi marked this conversation as resolved.
Show resolved Hide resolved
};

Check warning on line 143 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L141-L143

Added lines #L141 - L143 were not covered by tests
},
computed: {
countdownClass() {
let cssClass = '';
if (this.item.countdown < 0) {

Check warning on line 148 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L148

Added line #L148 was not covered by tests
cssClass = '--is-countup';
} else if (this.item.countdown > 0) {
cssClass = '--is-countdown';

Check warning on line 151 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L151

Added line #L151 was not covered by tests
}
return `c-tli__time-hero-time ${cssClass}`;
},

Check warning on line 154 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L154

Added line #L154 was not covered by tests
styleClass() {
return { backgroundColor: ITEM_COLORS[this.item.cssClass] };
},
isInProgress() {
return this.executionState === 'in-progress';
},
eventHasDuration() {
return this.item.start !== this.item.end;
},
listItemClass() {

Check warning on line 164 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L162-L164

Added lines #L162 - L164 were not covered by tests
const timeRelationClass = this.item.cssClass;
const executionStateClass = `--is-${this.executionState}`;
return `c-tli ${timeRelationClass} ${executionStateClass}`;
},
formattedItemLabel() {
let executionStateLabel;

Check warning on line 170 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L168-L170

Added lines #L168 - L170 were not covered by tests
const executionStateKeys = Object.keys(EXECUTION_STATES);
const executionStateIndex = executionStateKeys.findIndex(
(key) => key === this.executionState

Check warning on line 173 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L173

Added line #L173 was not covered by tests
);
if (executionStateIndex > -1) {
executionStateLabel = EXECUTION_STATES[executionStateIndex];
}

Check warning on line 177 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L177

Added line #L177 was not covered by tests
let label;
// Start time is in the past
if (this.item.start < this.timestamp) {
if (this.item.start === this.item.end) {
// - 'Occurred' : for Events with start < now datetime and 0 duration

Check warning on line 182 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L181-L182

Added lines #L181 - L182 were not covered by tests
label = INFERRED_EXECUTION_STATES.occurred;
}

Check warning on line 184 in src/plugins/timelist/ExpandedViewItem.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/timelist/ExpandedViewItem.vue#L184

Added line #L184 was not covered by tests
// end time has not yet passed
else if (this.item.cssClass === CURRENT_CSS_SUFFIX) {
if (executionStateIndex === 0) {
// - 'Overdue' : executionState.notStarted && start < now datetime
label = INFERRED_EXECUTION_STATES.overdue;
} else if (executionStateIndex === 1) {
// - 'Ends' : executionState.inProgress && now > start datetime && now < end datetime
label = INFERRED_EXECUTION_STATES.ends;
}
}
// end time is also in the past
else if (this.item.cssClass === PAST_CSS_SUFFIX) {
if (executionStateIndex === 0) {
// - 'Incomplete' : executionState.notStarted && now > end datetime
label = INFERRED_EXECUTION_STATES.incomplete;
} else if (executionStateIndex === 1) {
// - 'Running Long' : executionState.inProgress && now > end datetime
label = INFERRED_EXECUTION_STATES.runningLong;
} else if (executionStateIndex === -1) {
// - 'Ended' :now > start datetime && now > end datetime
label = INFERRED_EXECUTION_STATES.ended;
}
}
}
// Start time is in the future
else {
if (this.item.start === this.item.end) {
// - 'Occurs' : for Events with start > now datetime and 0 duration
label = INFERRED_EXECUTION_STATES.occurs;
} else {
// - 'Starts' : for Activities with now > start datetime
label = INFERRED_EXECUTION_STATES.starts;
}
}

return label || executionStateLabel;
},
formattedItem() {
let itemValue = {
title: this.item.name
};
this.itemProperties.forEach((itemProperty) => {
let value = this.item[itemProperty.key];
let formattedValue;
if (itemProperty.format) {
const itemStartDate = new Date(value).toDateString();
const timestampDate = new Date(this.timestamp).toDateString();
formattedValue = itemProperty.format(value, this.item, itemProperty.key, this.openmct, {
skipPrefix: true,
skipDateForToday: itemStartDate === timestampDate
});
}
itemValue[itemProperty.key] = formattedValue;
});

return itemValue;
},
showTimeHero() {
return !(
this.executionState === EXECUTION_STATES.completed ||
this.executionState === EXECUTION_STATES.aborted ||
this.executionState === EXECUTION_STATES.skipped
);
}
},
mounted() {
this.updateTimestamp = _.throttle(this.updateTimestamp, 1000);
this.setTimeContext();
this.timestamp = this.timeContext.now();
shefalijoshi marked this conversation as resolved.
Show resolved Hide resolved
},
methods: {
setTimeContext() {
this.stopFollowingTimeContext();
this.timeContext = this.openmct.time.getContextForView(this.path);
this.followTimeContext();
},
followTimeContext() {
this.timeContext.on(TIME_CONTEXT_EVENTS.tick, this.updateTimestamp);
},
stopFollowingTimeContext() {
if (this.timeContext) {
this.timeContext.off(TIME_CONTEXT_EVENTS.tick, this.updateTimestamp);
}
},
Comment on lines +208 to +220
Copy link
Contributor

Choose a reason for hiding this comment

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

TimeContext stuff is gonna be a great candidate for a Open MCT specific Composable :D

updateTimestamp(time) {
this.timestamp = time;
const progressElement = this.$refs.progressElement;
if (this.isInProgress && progressElement) {
updateProgress(this.item.start, this.item.end, this.timestamp, progressElement);
}
}
}
};
</script>
Loading
Loading