mirror of
https://github.com/nasa/openmct.git
synced 2025-05-31 06:31:04 +00:00
[Timeline] Watch for configuration object
...to address #908 in a manner which does not cause #957
This commit is contained in:
parent
ed69a65f9b
commit
70b593e28a
@ -97,6 +97,8 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$watch("configuration", swimlanePopulator.configure);
|
||||
|
||||
// Recalculate swimlane state on changes
|
||||
$scope.$watch("domainObject", swimlanePopulator.populate);
|
||||
|
||||
|
@ -43,8 +43,7 @@ define(
|
||||
var swimlanes = [],
|
||||
start = Number.POSITIVE_INFINITY,
|
||||
end = Number.NEGATIVE_INFINITY,
|
||||
colors = (configuration.colors || {}),
|
||||
assigner = new TimelineColorAssigner(colors),
|
||||
assigner,
|
||||
lastDomainObject;
|
||||
|
||||
// Track extremes of start/end times
|
||||
@ -152,8 +151,15 @@ define(
|
||||
recalculateSwimlanes(lastDomainObject);
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
var colors = (configuration.colors || {});
|
||||
assigner = new TimelineColorAssigner(colors);
|
||||
configuration.colors = colors;
|
||||
recalculateSwimlanes(lastDomainObject);
|
||||
}
|
||||
|
||||
// Ensure colors are exposed in configuration
|
||||
configuration.colors = colors;
|
||||
initialize();
|
||||
|
||||
return {
|
||||
/**
|
||||
@ -188,6 +194,15 @@ define(
|
||||
*/
|
||||
end: function () {
|
||||
return end;
|
||||
},
|
||||
/**
|
||||
* Pass a new configuration object (to retrieve and store
|
||||
* swimlane configuration)
|
||||
* @param newConfig
|
||||
*/
|
||||
configure: function (newConfig) {
|
||||
configuration = newConfig;
|
||||
initialize();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user