mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 03:06:54 +00:00
[Core] Allow actions to have multiple categories
Allow actions to have multiple categories; this will allow the properties action to be applicable as both a menu option and a button in the view-control category, WTD-1062.
This commit is contained in:
parent
00551779fb
commit
087cea1445
@ -84,11 +84,21 @@ define(
|
|||||||
|
|
||||||
// Build up look-up tables
|
// Build up look-up tables
|
||||||
actions.forEach(function (Action) {
|
actions.forEach(function (Action) {
|
||||||
if (Action.category) {
|
// Get an action's category or categories
|
||||||
actionsByCategory[Action.category] =
|
var categories = Action.category || [];
|
||||||
actionsByCategory[Action.category] || [];
|
|
||||||
actionsByCategory[Action.category].push(Action);
|
// Convert to an array if necessary
|
||||||
}
|
categories = Array.isArray(categories) ?
|
||||||
|
categories : [categories];
|
||||||
|
|
||||||
|
// Store action under all relevant categories
|
||||||
|
categories.forEach(function (category) {
|
||||||
|
actionsByCategory[category] =
|
||||||
|
actionsByCategory[category] || [];
|
||||||
|
actionsByCategory[category].push(Action);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Store action by ekey as well
|
||||||
if (Action.key) {
|
if (Action.key) {
|
||||||
actionsByKey[Action.key] =
|
actionsByKey[Action.key] =
|
||||||
actionsByKey[Action.key] || [];
|
actionsByKey[Action.key] || [];
|
||||||
|
Loading…
Reference in New Issue
Block a user