mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 11:09:22 +00:00
Compare commits
4 Commits
fix-missin
...
vue-hack
Author | SHA1 | Date | |
---|---|---|---|
62ff404bb3 | |||
8243cf5d7b | |||
c4c1fea17f | |||
5e920e90ce |
@ -288,6 +288,8 @@ define([
|
||||
this.install(this.plugins.ObjectInterceptors());
|
||||
this.install(this.plugins.NonEditableFolder());
|
||||
this.install(this.plugins.DeviceClassifier());
|
||||
|
||||
this._isVue = true;
|
||||
}
|
||||
|
||||
MCT.prototype = Object.create(EventEmitter.prototype);
|
||||
|
@ -81,14 +81,8 @@ define([
|
||||
return models;
|
||||
}
|
||||
|
||||
return this.apiFetch(missingIds)
|
||||
.then(function (apiResults) {
|
||||
Object.keys(apiResults).forEach(function (k) {
|
||||
models[k] = apiResults[k];
|
||||
});
|
||||
|
||||
return models;
|
||||
});
|
||||
//Temporary fix for missing models - don't retry using this.apiFetch
|
||||
return models;
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
@ -110,7 +110,7 @@ class ActionsAPI extends EventEmitter {
|
||||
return actionsObject;
|
||||
}
|
||||
|
||||
_groupAndSortActions(actionsArray) {
|
||||
_groupAndSortActions(actionsArray = []) {
|
||||
if (!Array.isArray(actionsArray) && typeof actionsArray === 'object') {
|
||||
actionsArray = Object.keys(actionsArray).map(key => actionsArray[key]);
|
||||
}
|
||||
|
@ -190,6 +190,14 @@ ObjectAPI.prototype.get = function (identifier, abortSignal) {
|
||||
|
||||
result = this.applyGetInterceptors(identifier, result);
|
||||
|
||||
return result;
|
||||
}).catch((result) => {
|
||||
console.warn(`Failed to retrieve ${keystring}:`, result);
|
||||
|
||||
delete this.cache[keystring];
|
||||
|
||||
result = this.applyGetInterceptors(identifier);
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
|
@ -483,6 +483,10 @@ define([
|
||||
* @returns {Object<String, {TelemetryValueFormatter}>}
|
||||
*/
|
||||
TelemetryAPI.prototype.getFormatMap = function (metadata) {
|
||||
if (!metadata) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!this.formatMapCache.has(metadata)) {
|
||||
const formatMap = metadata.values().reduce(function (map, valueMetadata) {
|
||||
map[valueMetadata.key] = this.getValueFormatter(valueMetadata);
|
||||
|
@ -96,11 +96,11 @@ export default {
|
||||
|
||||
this.timestampKey = this.openmct.time.timeSystem().key;
|
||||
|
||||
this.valueMetadata = this
|
||||
this.valueMetadata = this.metadata ? this
|
||||
.metadata
|
||||
.valuesForHints(['range'])[0];
|
||||
.valuesForHints(['range'])[0] : undefined;
|
||||
|
||||
this.valueKey = this.valueMetadata.key;
|
||||
this.valueKey = this.valueMetadata ? this.valueMetadata.key : undefined;
|
||||
|
||||
this.unsubscribe = this.openmct
|
||||
.telemetry
|
||||
@ -151,7 +151,10 @@ export default {
|
||||
size: 1,
|
||||
strategy: 'latest'
|
||||
})
|
||||
.then((array) => this.updateValues(array[array.length - 1]));
|
||||
.then((array) => this.updateValues(array[array.length - 1]))
|
||||
.catch((error) => {
|
||||
console.warn('Error fetching data', error);
|
||||
});
|
||||
},
|
||||
updateBounds(bounds, isTick) {
|
||||
this.bounds = bounds;
|
||||
|
@ -73,8 +73,9 @@ export default {
|
||||
hasUnits() {
|
||||
let itemsWithUnits = this.items.filter((item) => {
|
||||
let metadata = this.openmct.telemetry.getMetadata(item.domainObject);
|
||||
const valueMetadatas = metadata ? metadata.valueMetadatas : [];
|
||||
|
||||
return this.metadataHasUnits(metadata.valueMetadatas);
|
||||
return this.metadataHasUnits(valueMetadatas);
|
||||
|
||||
});
|
||||
|
||||
|
@ -101,7 +101,7 @@ export default {
|
||||
addChildren(domainObject) {
|
||||
let keyString = this.openmct.objects.makeKeyString(domainObject.identifier);
|
||||
let metadata = this.openmct.telemetry.getMetadata(domainObject);
|
||||
let metadataWithFilters = metadata.valueMetadatas.filter(value => value.filters);
|
||||
let metadataWithFilters = metadata ? metadata.valueMetadatas.filter(value => value.filters) : [];
|
||||
let hasFiltersWithKeyString = this.persistedFilters[keyString] !== undefined;
|
||||
let mutateFilters = false;
|
||||
let childObject = {
|
||||
|
@ -180,9 +180,13 @@ export default {
|
||||
this.openmct.notifications.alert(message);
|
||||
}
|
||||
|
||||
const relativeHash = hash.slice(hash.indexOf('#'));
|
||||
const url = new URL(relativeHash, `${location.protocol}//${location.host}${location.pathname}`);
|
||||
this.openmct.router.navigate(url.hash);
|
||||
if (this.openmct.editor.isEditing()) {
|
||||
this.previewEmbed();
|
||||
} else {
|
||||
const relativeHash = hash.slice(hash.indexOf('#'));
|
||||
const url = new URL(relativeHash, `${location.protocol}//${location.host}${location.pathname}`);
|
||||
this.openmct.router.navigate(url.hash);
|
||||
}
|
||||
},
|
||||
formatTime(unixTime, timeFormat) {
|
||||
return Moment.utc(unixTime).format(timeFormat);
|
||||
|
@ -21,67 +21,57 @@
|
||||
-->
|
||||
<template>
|
||||
<div class="u-contents">
|
||||
<ul v-if="canEdit"
|
||||
class="l-inspector-part"
|
||||
<div v-if="canEdit"
|
||||
class="grid-row"
|
||||
>
|
||||
<h2 v-if="heading"
|
||||
:title="heading"
|
||||
>{{ heading }}</h2>
|
||||
<li class="grid-row">
|
||||
<div class="grid-cell label"
|
||||
:title="editTitle"
|
||||
>{{ shortLabel }}</div>
|
||||
<div class="grid-cell value">
|
||||
<div class="c-click-swatch c-click-swatch--menu"
|
||||
@click="toggleSwatch()"
|
||||
<div class="grid-cell label"
|
||||
:title="editTitle"
|
||||
>{{ shortLabel }}</div>
|
||||
<div class="grid-cell value">
|
||||
<div class="c-click-swatch c-click-swatch--menu"
|
||||
@click="toggleSwatch()"
|
||||
>
|
||||
<span class="c-color-swatch"
|
||||
:style="{ background: currentColor }"
|
||||
>
|
||||
<span class="c-color-swatch"
|
||||
:style="{ background: currentColor }"
|
||||
</span>
|
||||
</div>
|
||||
<div class="c-palette c-palette--color">
|
||||
<div v-show="swatchActive"
|
||||
class="c-palette__items"
|
||||
>
|
||||
<div v-for="group in colorPaletteGroups"
|
||||
:key="group.id"
|
||||
class="u-contents"
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
<div class="c-palette c-palette--color">
|
||||
<div v-show="swatchActive"
|
||||
class="c-palette__items"
|
||||
>
|
||||
<div v-for="group in colorPaletteGroups"
|
||||
:key="group.id"
|
||||
class="u-contents"
|
||||
<div v-for="color in group"
|
||||
:key="color.id"
|
||||
class="c-palette__item"
|
||||
:class="{ 'selected': currentColor === color.hexString }"
|
||||
:style="{ background: color.hexString }"
|
||||
@click="setColor(color)"
|
||||
>
|
||||
<div v-for="color in group"
|
||||
:key="color.id"
|
||||
class="c-palette__item"
|
||||
:class="{ 'selected': currentColor === color.hexString }"
|
||||
:style="{ background: color.hexString }"
|
||||
@click="setColor(color)"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul v-else
|
||||
class="l-inspector-part"
|
||||
</div>
|
||||
</div>
|
||||
<div v-else
|
||||
class="grid-row"
|
||||
>
|
||||
<h2 v-if="heading"
|
||||
:title="heading"
|
||||
>{{ heading }}</h2>
|
||||
<li class="grid-row">
|
||||
<div class="grid-cell label"
|
||||
:title="viewTitle"
|
||||
>{{ shortLabel }}</div>
|
||||
<div class="grid-cell value">
|
||||
<span class="c-color-swatch"
|
||||
:style="{
|
||||
'background': currentColor
|
||||
}"
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="grid-cell label"
|
||||
:title="viewTitle"
|
||||
>{{ shortLabel }}</div>
|
||||
<div class="grid-cell value">
|
||||
<span class="c-color-swatch"
|
||||
:style="{
|
||||
'background': currentColor
|
||||
}"
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -114,12 +104,6 @@ export default {
|
||||
default() {
|
||||
return 'Color';
|
||||
}
|
||||
},
|
||||
heading: {
|
||||
type: String,
|
||||
default() {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -107,7 +107,7 @@ export default {
|
||||
};
|
||||
this.openmct.objects.mutate(
|
||||
this.domainObject,
|
||||
`configuration.barStyles[${this.key}]`,
|
||||
`configuration.barStyles[${key}]`,
|
||||
this.domainObject.configuration.barStyles[key]
|
||||
);
|
||||
} else {
|
||||
@ -150,6 +150,10 @@ export default {
|
||||
},
|
||||
getAxisMetadata(telemetryObject) {
|
||||
const metadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||
if (!metadata) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const yAxisMetadata = metadata.valuesForHints(['range'])[0];
|
||||
//Exclude 'name' and 'time' based metadata specifically, from the x-Axis values by using range hints only
|
||||
const xAxisMetadata = metadata.valuesForHints(['range']);
|
||||
@ -255,6 +259,9 @@ export default {
|
||||
data.forEach((datum) => {
|
||||
this.processData(telemetryObject, datum, axisMetadata);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(`Error fetching data`, error);
|
||||
});
|
||||
},
|
||||
subscribeToObject(telemetryObject) {
|
||||
|
@ -33,9 +33,9 @@
|
||||
</li>
|
||||
<ColorSwatch v-if="expanded"
|
||||
:current-color="currentColor"
|
||||
title="Manually set the color for this bar graph."
|
||||
edit-title="Manually set the color for this bar graph"
|
||||
view-title="The color for this bar graph."
|
||||
title="Manually set the color for this bar graph series."
|
||||
edit-title="Manually set the color for this bar graph series"
|
||||
view-title="The color for this bar graph series."
|
||||
short-label="Color"
|
||||
class="grid-properties"
|
||||
@colorSet="setColor"
|
||||
|
@ -20,15 +20,13 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<ul class="c-tree">
|
||||
<li v-for="series in domainObject.composition"
|
||||
:key="series.key"
|
||||
>
|
||||
<bar-graph-options :item="series" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="c-tree">
|
||||
<h2 title="Display properties for this object">Bar Graph Series</h2>
|
||||
<bar-graph-options v-for="series in domainObject.composition"
|
||||
:key="series.key"
|
||||
:item="series"
|
||||
/>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -82,12 +82,17 @@ export default class PlotSeries extends Model {
|
||||
.openmct
|
||||
.telemetry
|
||||
.getMetadata(options.domainObject);
|
||||
|
||||
this.formats = options
|
||||
.openmct
|
||||
.telemetry
|
||||
.getFormatMap(this.metadata);
|
||||
|
||||
const range = this.metadata.valuesForHints(['range'])[0];
|
||||
//if the object is missing or doesn't have metadata for some reason
|
||||
let range = {};
|
||||
if (this.metadata) {
|
||||
range = this.metadata.valuesForHints(['range'])[0];
|
||||
}
|
||||
|
||||
return {
|
||||
name: options.domainObject.name,
|
||||
@ -191,7 +196,10 @@ export default class PlotSeries extends Model {
|
||||
.uniq(true, point => [this.getXVal(point), this.getYVal(point)].join())
|
||||
.value();
|
||||
this.reset(newPoints);
|
||||
}.bind(this));
|
||||
}.bind(this))
|
||||
.catch((error) => {
|
||||
console.warn('Error fetching data', error);
|
||||
});
|
||||
/* eslint-enable you-dont-need-lodash-underscore/concat */
|
||||
}
|
||||
/**
|
||||
@ -199,7 +207,9 @@ export default class PlotSeries extends Model {
|
||||
*/
|
||||
onXKeyChange(xKey) {
|
||||
const format = this.formats[xKey];
|
||||
this.getXVal = format.parse.bind(format);
|
||||
if (format) {
|
||||
this.getXVal = format.parse.bind(format);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Update y formatter on change, default to stepAfter interpolation if
|
||||
|
@ -184,7 +184,7 @@ export default class YAxisModel extends Model {
|
||||
this.set('values', yMetadata.values);
|
||||
if (!label) {
|
||||
const labelName = series.map(function (s) {
|
||||
return s.metadata.value(s.get('yKey')).name;
|
||||
return s.metadata ? s.metadata.value(s.get('yKey')).name : '';
|
||||
}).reduce(function (a, b) {
|
||||
if (a === undefined) {
|
||||
return b;
|
||||
@ -204,7 +204,7 @@ export default class YAxisModel extends Model {
|
||||
}
|
||||
|
||||
const labelUnits = series.map(function (s) {
|
||||
return s.metadata.value(s.get('yKey')).units;
|
||||
return s.metadata ? s.metadata.value(s.get('yKey')).units : '';
|
||||
}).reduce(function (a, b) {
|
||||
if (a === undefined) {
|
||||
return b;
|
||||
|
@ -131,7 +131,8 @@ export default {
|
||||
objects.forEach(object => this.addColumnsForObject(object, false));
|
||||
},
|
||||
addColumnsForObject(telemetryObject) {
|
||||
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
||||
const metadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||
let metadataValues = metadata ? metadata.values() : [];
|
||||
metadataValues.forEach(metadatum => {
|
||||
let column = new TelemetryTableColumn(this.openmct, metadatum);
|
||||
this.tableConfiguration.addSingleColumnForObject(telemetryObject, column);
|
||||
|
@ -105,7 +105,8 @@ export default {
|
||||
composition.load().then((domainObjects) => {
|
||||
domainObjects.forEach(telemetryObject => {
|
||||
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
||||
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
||||
const metadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||
let metadataValues = metadata ? metadata.values() : [];
|
||||
let filters = this.filteredTelemetry[keyString];
|
||||
|
||||
if (filters !== undefined) {
|
||||
|
@ -160,7 +160,9 @@ export default {
|
||||
this.status = this.openmct.status.get(this.domainObject.identifier);
|
||||
this.removeStatusListener = this.openmct.status.observe(this.domainObject.identifier, this.setStatus);
|
||||
const provider = this.openmct.objectViews.get(this.domainObject, this.objectPath)[0];
|
||||
this.$refs.objectView.show(this.domainObject, provider.key, false, this.objectPath);
|
||||
if (provider) {
|
||||
this.$refs.objectView.show(this.domainObject, provider.key, false, this.objectPath);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.removeStatusListener();
|
||||
@ -193,8 +195,10 @@ export default {
|
||||
},
|
||||
showMenuItems(event) {
|
||||
const sortedActions = this.openmct.actions._groupAndSortActions(this.menuActionItems);
|
||||
const menuItems = this.openmct.menus.actionsToMenuItems(sortedActions, this.actionCollection.objectPath, this.actionCollection.view);
|
||||
this.openmct.menus.showMenu(event.x, event.y, menuItems);
|
||||
if (sortedActions.length) {
|
||||
const menuItems = this.openmct.menus.actionsToMenuItems(sortedActions, this.actionCollection.objectPath, this.actionCollection.view);
|
||||
this.openmct.menus.showMenu(event.x, event.y, menuItems);
|
||||
}
|
||||
},
|
||||
setStatus(status) {
|
||||
this.status = status;
|
||||
|
Reference in New Issue
Block a user