diff --git a/app.js b/app.js index 479cc7039c..476f2bd2c5 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,7 @@ const fs = require('fs'); const request = require('request'); // Defaults -options.port = options.port || options.p || 8080; +options.port = options.port || options.p || 8070; options.host = options.host || options.h || 'localhost'; options.directory = options.directory || options.D || '.'; diff --git a/src/MCT.js b/src/MCT.js index 404153ab5a..4c9fdfe7dd 100644 --- a/src/MCT.js +++ b/src/MCT.js @@ -265,6 +265,7 @@ define([ this.install(this.plugins.GoToOriginalAction()); this.install(this.plugins.ImportExport()); this.install(this.plugins.WebPage()); + this.install(this.plugins.Condition()); } MCT.prototype = Object.create(EventEmitter.prototype); diff --git a/src/plugins/condition/ConditionViewProvider.js b/src/plugins/condition/ConditionViewProvider.js new file mode 100644 index 0000000000..629e6b0c69 --- /dev/null +++ b/src/plugins/condition/ConditionViewProvider.js @@ -0,0 +1,61 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2019, 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. + *****************************************************************************/ + +import ConditionComponent from './components/Condition.vue'; +import Vue from 'vue'; + +export default function Condition(openmct) { + return { + key: 'condition', + name: 'Condition', + cssClass: 'icon-page', + canView: function (domainObject) { + return domainObject.type === 'condition'; + }, + view: function (domainObject) { + let component; + + return { + show: function (element) { + component = new Vue({ + el: element, + components: { + ConditionComponent: ConditionComponent + }, + provide: { + openmct, + domainObject + }, + template: '' + }); + }, + destroy: function (element) { + component.$destroy(); + component = undefined; + } + }; + }, + priority: function () { + return 1; + } + }; +} diff --git a/src/plugins/condition/components/Condition.vue b/src/plugins/condition/components/Condition.vue new file mode 100644 index 0000000000..19ec4a146b --- /dev/null +++ b/src/plugins/condition/components/Condition.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/plugins/condition/plugin.js b/src/plugins/condition/plugin.js new file mode 100644 index 0000000000..ed55678ae2 --- /dev/null +++ b/src/plugins/condition/plugin.js @@ -0,0 +1,45 @@ +/***************************************************************************** + * 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. + *****************************************************************************/ + +import ConditionViewProvider from './ConditionViewProvider.js'; + +export default function plugin() { + return function install(openmct) { + openmct.objectViews.addProvider(new ConditionViewProvider(openmct)); + + openmct.types.addType('condition', { + name: "Condition", + creatable: true, + description: "A conditional rule based on user-specified criteria.", + cssClass: 'icon-page', + form: [ + { + "key": "url", + "name": "URL", + "control": "textfield", + "required": true, + "cssClass": "l-input-lg" + } + ] + }); + }; +} diff --git a/src/plugins/plugins.js b/src/plugins/plugins.js index cb64e4005b..dcfe24dbd9 100644 --- a/src/plugins/plugins.js +++ b/src/plugins/plugins.js @@ -45,7 +45,8 @@ define([ './objectMigration/plugin', './goToOriginalAction/plugin', './clearData/plugin', - './webPage/plugin' + './webPage/plugin', + './condition/plugin' ], function ( _, UTCTimeSystem, @@ -71,7 +72,8 @@ define([ ObjectMigration, GoToOriginalAction, ClearData, - WebPagePlugin + WebPagePlugin, + ConditionPlugin ) { var bundleMap = { LocalStorage: 'platform/persistence/local', @@ -173,6 +175,7 @@ define([ plugins.GoToOriginalAction = GoToOriginalAction.default; plugins.ClearData = ClearData; plugins.WebPage = WebPagePlugin.default; + plugins.Condition = ConditionPlugin.default; return plugins; });