Freshness Indicators (#5002)

* Added animation-delay and animation-duration properties to inline styles

* Accept config options from plugin

* Lint fix

* Lint remove trailing space

* Lint: blank line

* Make default values consistent

* Removal of default css and cleanup

* Updated the default values for image freshness

Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
Michael Rogers 2022-04-06 11:26:00 -05:00 committed by GitHub
parent 6153ad8e1e
commit 476f1b2579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 8 deletions

View File

@ -2,11 +2,16 @@ import ImageryViewComponent from './components/ImageryView.vue';
import Vue from 'vue'; import Vue from 'vue';
const DEFAULT_IMAGE_FRESHNESS_OPTIONS = {
fadeOutDelayTime: '0s',
fadeOutDurationTime: '30s'
};
export default class ImageryView { export default class ImageryView {
constructor(openmct, domainObject, objectPath) { constructor(openmct, domainObject, objectPath, options) {
this.openmct = openmct; this.openmct = openmct;
this.domainObject = domainObject; this.domainObject = domainObject;
this.objectPath = objectPath; this.objectPath = objectPath;
this.options = options;
this.component = undefined; this.component = undefined;
} }
@ -27,6 +32,7 @@ export default class ImageryView {
openmct: this.openmct, openmct: this.openmct,
domainObject: this.domainObject, domainObject: this.domainObject,
objectPath: alternateObjectPath || this.objectPath, objectPath: alternateObjectPath || this.objectPath,
imageFreshnessOptions: this.options?.imageFreshness || DEFAULT_IMAGE_FRESHNESS_OPTIONS,
currentView: this currentView: this
}, },
data() { data() {

View File

@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
import ImageryView from './ImageryView'; import ImageryView from './ImageryView';
export default function ImageryViewProvider(openmct) { export default function ImageryViewProvider(openmct, options) {
const type = 'example.imagery'; const type = 'example.imagery';
function hasImageTelemetry(domainObject) { function hasImageTelemetry(domainObject) {
@ -43,7 +43,7 @@ export default function ImageryViewProvider(openmct) {
return hasImageTelemetry(domainObject) && (!isChildOfTimeStrip || openmct.router.isNavigatedObject(objectPath)); return hasImageTelemetry(domainObject) && (!isChildOfTimeStrip || openmct.router.isNavigatedObject(objectPath));
}, },
view: function (domainObject, objectPath) { view: function (domainObject, objectPath) {
return new ImageryView(openmct, domainObject, objectPath); return new ImageryView(openmct, domainObject, objectPath, options);
} }
}; };
} }

View File

@ -132,6 +132,10 @@
<!-- image fresh --> <!-- image fresh -->
<div <div
v-if="canTrackDuration" v-if="canTrackDuration"
:style="{
'animation-delay': imageFreshnessOptions.fadeOutDelayTime,
'animation-duration': imageFreshnessOptions.fadeOutDurationTime
}"
:class="{'c-imagery--new': isImageNew && !refreshCSS}" :class="{'c-imagery--new': isImageNew && !refreshCSS}"
class="c-imagery__age icon-timer" class="c-imagery__age icon-timer"
>{{ formattedDuration }}</div> >{{ formattedDuration }}</div>
@ -235,7 +239,7 @@ export default {
ImageControls ImageControls
}, },
mixins: [imageryData], mixins: [imageryData],
inject: ['openmct', 'domainObject', 'objectPath', 'currentView'], inject: ['openmct', 'domainObject', 'objectPath', 'currentView', 'imageFreshnessOptions'],
props: { props: {
focusedImageTimestamp: { focusedImageTimestamp: {
type: Number, type: Number,

View File

@ -1,3 +1,13 @@
@keyframes fade-out {
from {
background-color: rgba($colorOk, 0.5);
}
to {
background-color: rgba($colorOk, 0);
color: inherit;
}
}
.c-imagery { .c-imagery {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -123,9 +133,13 @@
// New imagery // New imagery
$bgColor: $colorOk; $bgColor: $colorOk;
color: $colorOkFg; color: $colorOkFg;
background: rgba($bgColor, 0.5); background-color: rgba($bgColor, 0.5);
@include flash($animName: flashImageAge, $iter: 2, $dur: 250ms, $valStart: rgba($colorOk, 0.7), $valEnd: rgba($colorOk, 0)); animation-name: fade-out;
animation-timing-function: ease-in;
animation-iteration-count: 1;
animation-fill-mode: forwards;
} }
&__thumbs-wrapper { &__thumbs-wrapper {
display: flex; // Uses row layout display: flex; // Uses row layout

View File

@ -23,9 +23,9 @@
import ImageryViewProvider from './ImageryViewProvider'; import ImageryViewProvider from './ImageryViewProvider';
import ImageryTimestripViewProvider from './ImageryTimestripViewProvider'; import ImageryTimestripViewProvider from './ImageryTimestripViewProvider';
export default function () { export default function (options) {
return function install(openmct) { return function install(openmct) {
openmct.objectViews.addProvider(new ImageryViewProvider(openmct)); openmct.objectViews.addProvider(new ImageryViewProvider(openmct, options));
openmct.objectViews.addProvider(new ImageryTimestripViewProvider(openmct)); openmct.objectViews.addProvider(new ImageryTimestripViewProvider(openmct));
}; };
} }