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 3 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
112 changes: 112 additions & 0 deletions src/plugins/timelist/CompactView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<!--
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>
<compact-view-item
v-for="item in sortedItems"
:key="item.key"
:item="item"
:item-properties="itemProperties"
shefalijoshi marked this conversation as resolved.
Show resolved Hide resolved
>
</compact-view-item>
</template>

<script>
import _ from 'lodash';

import CompactViewItem from './CompactViewItem.vue';

export default {
components: { CompactViewItem },
inject: ['domainObject', 'openmct'],
props: {
headerItems: {
type: Array,
required: true
},
items: {
type: Array,
required: true
},
defaultSort: {
type: Object,
default() {
return {
property: '',
defaultDirection: true
};
}
}
},
data() {
let sortBy = this.defaultSort.property;
let ascending = this.defaultSort.defaultDirection;

return {
sortBy,
ascending
};
},
computed: {
sortedItems() {
let sortedItems = _.sortBy(this.items, this.sortBy);
if (!this.ascending) {
sortedItems = sortedItems.reverse();
}

return sortedItems;
},
itemProperties() {
return this.headerItems.map((headerItem) => {
return {
property: headerItem.property,
format: headerItem.format
};
});
}
},
watch: {
defaultSort: {
handler() {
this.setSort();
},
deep: true
}
},
methods: {
setSort() {
this.sortBy = this.defaultSort.property;
this.ascending = this.defaultSort.defaultDirection;
},
sort(data) {
const property = data.property;
const direction = data.direction;

if (this.sortBy === property) {
this.ascending = !this.ascending;
} else {
this.sortBy = property;
this.ascending = direction;
}
}
}
};
</script>
134 changes: 134 additions & 0 deletions src/plugins/timelist/CompactViewItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<!--
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">
<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">{{ formattedItemValue.title }}</div>
<div class="c-tli__bounds">
<span class="c-tli__duration">{{ formattedItemValue.duration }}</span>
<span class="c-tli__start-time">{{ formattedItemValue.start }}</span>
<span class="c-tli__end-time">{{ formattedItemValue.end }}</span>
</div>
</div>
<div class="c-tli__progress-pie">
<svg viewBox="0 0 100 100">
<circle class="c-svg-progress__bg" r="50" cx="50" cy="50"></circle>
<path id="svg-progress-path" class="c-svg-progress__progress"></path>
<circle
class="c-svg-progress__ticks"
r="40"
cx="50"
cy="50"
stroke-dasharray="3 7.472"
></circle>
</svg>
</div>
<div class="c-tli__time-hero">
<div class="c-tli__time-hero-context">{{ formattedItemValue.label }}</div>
<div class="c-tli__time-hero-time --is-countdown">{{ formattedItemValue.countdown }}</div>
</div>
</div>
</template>

<script>
const CURRENT_CSS_SUFFIX = '--is-current';
const PAST_CSS_SUFFIX = '--is-past';
const FUTURE_CSS_SUFFIX = '--is-future';

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

const ITEM_STATES = {
notStarted: 'not-started',
inProgress: 'in-progress',
completed: 'completed',
aborted: 'aborted',
skipped: 'skipped',
incomplete: 'incomplete',
overdue: 'overdue',
runningLong: 'running-long'
};

export default {
inject: ['openmct'],
props: {
item: {
type: Object,
required: true
},
itemProperties: {
type: Array,
required: true
}
},
data() {
return {
itemState: ITEM_STATES.notStarted
};
},
computed: {
shefalijoshi marked this conversation as resolved.
Show resolved Hide resolved
styleClass() {
return { backgroundColor: ITEM_COLORS[this.item.cssClass] };
},
listItemClass() {
const timeRelationClass = this.item.cssClass;
const itemStateClass = `--is-${this.itemState}`;
return `c-tli ${timeRelationClass} ${itemStateClass}`;
},
formattedItemValue() {
let itemValue = {
title: this.item.name
};
this.itemProperties.forEach((itemProperty) => {
let value = this.item[itemProperty.property];
let formattedValue;
if (itemProperty.format) {
formattedValue = itemProperty.format(
value,
this.item,
itemProperty.property,
this.openmct,
{
skipPrefix: true
}
);
}
itemValue[itemProperty.property] = formattedValue;

let label;
if (itemProperty.property === 'countdown') {
label = value > 0 ? 'Starts' : 'Ended';
}
itemValue.label = itemValue.label ?? label;
});

return itemValue;
}
}
};
</script>
58 changes: 45 additions & 13 deletions src/plugins/timelist/TimelistComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@
-->

<template>
<div ref="timelistHolder" class="c-timelist">
<div ref="timelistHolder" :class="listTypeClass">
<compact-view
v-if="isCompact"
:items="planActivities"
:header-items="headerItems"
:default-sort="defaultSort"
></compact-view>
<list-view
v-else
:items="planActivities"
:header-items="headerItems"
:default-sort="defaultSort"
Expand All @@ -39,6 +46,7 @@ import { TIME_CONTEXT_EVENTS } from '../../api/time/constants.js';
import ListView from '../../ui/components/List/ListView.vue';
import { getPreciseDuration } from '../../utils/duration.js';
import { getValidatedData, getValidatedGroups } from '../plan/util.js';
import CompactView from './CompactView.vue';
import { SORT_ORDER_OPTIONS } from './constants.js';

const SCROLL_TIMEOUT = 10000;
Expand Down Expand Up @@ -72,24 +80,37 @@ const headerItems = [
},
{
defaultDirection: false,
property: 'duration',
property: 'countdown',
name: 'Time To/From',
format: function (value) {
format: function (value, object, key, openmct, options = {}) {
let result;
if (value < 0) {
result = `+${getPreciseDuration(Math.abs(value), {
const prefix = options.skipPrefix ? '' : '+';
result = `${prefix}${getPreciseDuration(Math.abs(value), {
excludeMilliSeconds: true,
useDayFormat: true
})}`;
} else if (value > 0) {
result = `-${getPreciseDuration(value, { excludeMilliSeconds: true, useDayFormat: true })}`;
const prefix = options.skipPrefix ? '' : '+';
result = `${prefix}${getPreciseDuration(value, {
excludeMilliSeconds: true,
useDayFormat: true
})}`;
} else {
result = 'Now';
}

return result;
}
},
{
defaultDirection: false,
property: 'duration',
name: 'Duration',
format: function (value, object, key, openmct) {
return `${getPreciseDuration(value, { excludeMilliSeconds: true, useDayFormat: true })}`;
}
},
{
defaultDirection: true,
property: 'name',
Expand All @@ -104,6 +125,7 @@ const defaultSort = {

export default {
components: {
CompactView,
ListView
},
inject: ['openmct', 'domainObject', 'path', 'composition'],
Expand All @@ -114,9 +136,18 @@ export default {
height: 0,
planActivities: [],
headerItems: headerItems,
defaultSort: defaultSort
defaultSort: defaultSort,
isCompact: false
};
},
computed: {
listTypeClass() {
if (this.isCompact) {
return 'c-timelist c-timelist--large';
}
return 'c-timelist';
}
},
mounted() {
this.isEditing = this.openmct.editor.isEditing();
this.updateTimestamp = _.throttle(this.updateTimestamp, 1000);
Expand Down Expand Up @@ -208,15 +239,14 @@ export default {
this.setViewFromConfig(mutatedObject.configuration);
},
setViewFromConfig(configuration) {
this.filterValue = configuration.filter;
if (this.isEditing) {
this.filterValue = configuration.filter;
this.hideAll = false;
this.listActivities();
} else {
this.filterValue = configuration.filter;
this.setSort();
this.listActivities();
this.isCompact = configuration.isCompact;
}
this.listActivities();
},
updateTimestamp(timestamp) {
//The clock never stops ticking
Expand Down Expand Up @@ -379,11 +409,13 @@ export default {
activity.key = uuid();
}

activity.duration = activity.end - activity.start;

if (activity.start < this.timestamp) {
//if the activity start time has passed, display the time to the end of the activity
activity.duration = activity.end - this.timestamp;
activity.countdown = activity.end - this.timestamp;
} else {
activity.duration = activity.start - this.timestamp;
activity.countdown = activity.start - this.timestamp;
}

return activity;
Expand Down Expand Up @@ -426,7 +458,7 @@ export default {
},
setScrollTop() {
//The view isn't ready yet
if (!this.$el.parentElement) {
if (!this.$el.parentElement || this.isCompact) {
return;
}

Expand Down
Loading
Loading