basic skeleton for conditions code

This commit is contained in:
Joel McKinnon 2019-12-06 12:05:36 -08:00
parent 14a0f84c1b
commit 31a7ebd4f1
6 changed files with 129 additions and 3 deletions

2
app.js
View File

@ -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 || '.';

View File

@ -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);

View File

@ -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: '<condition-component></condition-component>'
});
},
destroy: function (element) {
component.$destroy();
component = undefined;
}
};
},
priority: function () {
return 1;
}
};
}

View File

@ -0,0 +1,16 @@
<template>
<div class="l-iframe abs">
<iframe :src="currentDomainObject.url"></iframe>
</div>
</template>
<script>
export default {
inject: ['openmct', 'domainObject'],
data: function () {
return {
currentDomainObject: this.domainObject
}
}
}
</script>

View File

@ -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"
}
]
});
};
}

View File

@ -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;
});