mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 23:20:50 +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
|
// Recalculate swimlane state on changes
|
||||||
$scope.$watch("domainObject", swimlanePopulator.populate);
|
$scope.$watch("domainObject", swimlanePopulator.populate);
|
||||||
|
|
||||||
|
@ -43,8 +43,7 @@ define(
|
|||||||
var swimlanes = [],
|
var swimlanes = [],
|
||||||
start = Number.POSITIVE_INFINITY,
|
start = Number.POSITIVE_INFINITY,
|
||||||
end = Number.NEGATIVE_INFINITY,
|
end = Number.NEGATIVE_INFINITY,
|
||||||
colors = (configuration.colors || {}),
|
assigner,
|
||||||
assigner = new TimelineColorAssigner(colors),
|
|
||||||
lastDomainObject;
|
lastDomainObject;
|
||||||
|
|
||||||
// Track extremes of start/end times
|
// Track extremes of start/end times
|
||||||
@ -152,8 +151,15 @@ define(
|
|||||||
recalculateSwimlanes(lastDomainObject);
|
recalculateSwimlanes(lastDomainObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initialize() {
|
||||||
|
var colors = (configuration.colors || {});
|
||||||
|
assigner = new TimelineColorAssigner(colors);
|
||||||
|
configuration.colors = colors;
|
||||||
|
recalculateSwimlanes(lastDomainObject);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure colors are exposed in configuration
|
// Ensure colors are exposed in configuration
|
||||||
configuration.colors = colors;
|
initialize();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
@ -188,6 +194,15 @@ define(
|
|||||||
*/
|
*/
|
||||||
end: function () {
|
end: function () {
|
||||||
return end;
|
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