mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 21:27:52 +00:00
[API] Override dialogService in actions
An ugly hack to allow dialogs to be shown for Save As and Edit Properties, without requiring form generation. This will permit views to be shown instead in certain cases, https://github.com/nasa/openmct/pull/999#issuecomment-236045158
This commit is contained in:
parent
bfdbc71e40
commit
1d31fe8d02
20
src/adapter/actions/ActionDialogDecorator.js
Normal file
20
src/adapter/actions/ActionDialogDecorator.js
Normal file
@ -0,0 +1,20 @@
|
||||
define([], function () {
|
||||
function ActionDialogDecorator(actionService) {
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
ActionDialogDecorator.prototype.getActions = function (context) {
|
||||
return this.actionService.getActions(context).map(function (action) {
|
||||
if (action.dialogService) {
|
||||
action.dialogService = Object.create(action.dialogService);
|
||||
action.dialogService.getUserInput = function (form, value) {
|
||||
window.alert("Get user input!");
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
}
|
||||
return action;
|
||||
});
|
||||
};
|
||||
|
||||
return ActionDialogDecorator;
|
||||
});
|
@ -1,10 +1,12 @@
|
||||
define([
|
||||
'legacyRegistry',
|
||||
'./actions/ActionDialogDecorator',
|
||||
'./directives/MCTView',
|
||||
'./services/Instantiate',
|
||||
'./capabilities/APICapabilityDecorator'
|
||||
], function (
|
||||
legacyRegistry,
|
||||
ActionDialogDecorator,
|
||||
MCTView,
|
||||
Instantiate,
|
||||
APICapabilityDecorator
|
||||
@ -41,6 +43,11 @@ define([
|
||||
depends: [
|
||||
"$injector"
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "decorator",
|
||||
provides: "actionService",
|
||||
implementation: ActionDialogDecorator
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user