mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +00:00
[Time Conductor] Warn about unknown formats
This commit is contained in:
parent
5a1d774b47
commit
6db7f056dc
@ -7,7 +7,7 @@
|
|||||||
"provides": "formatService",
|
"provides": "formatService",
|
||||||
"type": "provider",
|
"type": "provider",
|
||||||
"implementation": "FormatProvider.js",
|
"implementation": "FormatProvider.js",
|
||||||
"depends": [ "formats[]" ]
|
"depends": [ "formats[]", "$log" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"formats": [
|
"formats": [
|
||||||
|
@ -85,7 +85,7 @@ define([
|
|||||||
* @param {Array.<function(new : Format)>} format constructors,
|
* @param {Array.<function(new : Format)>} format constructors,
|
||||||
* from the `formats` extension category.
|
* from the `formats` extension category.
|
||||||
*/
|
*/
|
||||||
function FormatProvider(formats) {
|
function FormatProvider(formats, $log) {
|
||||||
var formatMap = {};
|
var formatMap = {};
|
||||||
|
|
||||||
function addToMap(Format) {
|
function addToMap(Format) {
|
||||||
@ -97,10 +97,15 @@ define([
|
|||||||
|
|
||||||
formats.forEach(addToMap);
|
formats.forEach(addToMap);
|
||||||
this.formatMap = formatMap;
|
this.formatMap = formatMap;
|
||||||
|
this.$log = $log;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormatProvider.prototype.getFormat = function (key) {
|
FormatProvider.prototype.getFormat = function (key) {
|
||||||
return this.formatMap[key];
|
var format = this.formatMap[key];
|
||||||
|
if (!format) {
|
||||||
|
this.$log.warn("No format found for " + key);
|
||||||
|
}
|
||||||
|
return format;
|
||||||
};
|
};
|
||||||
|
|
||||||
return FormatProvider;
|
return FormatProvider;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user