openmct/platform/import-export/bundle.js
2018-05-14 15:46:17 -07:00

77 lines
3.2 KiB
JavaScript

/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/actions/ExportAsJSONAction",
"./src/actions/ImportAsJSONAction"
], function (
ExportAsJSONAction,
ImportAsJSONAction
) {
return function ImportExportPlugin() {
return function (openmct) {
ExportAsJSONAction.appliesTo = function (context) {
return openmct.$injector.get('policyService')
.allow("creation", context.domainObject.getCapability("type")
);
};
openmct.legacyRegistry.register("platform/import-export", {
"name": "Import-export plugin",
"description": "Allows importing / exporting of domain objects as JSON.",
"extensions": {
"actions": [
{
"key": "export.JSON",
"name": "Export as JSON",
"implementation": ExportAsJSONAction,
"category": "contextual",
"cssClass": "icon-export",
"depends": [
"exportService",
"policyService",
"identifierService"
]
},
{
"key": "import.JSON",
"name": "Import from JSON",
"implementation": ImportAsJSONAction,
"category": "contextual",
"cssClass": "icon-import",
"depends": [
"exportService",
"identifierService",
"dialogService",
"openmct"
]
}
]
}
});
openmct.legacyRegistry.enable('platform/import-export');
};
};
});