mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 06:03:08 +00:00
New Condition Widget, WIP
- Add new Vue components, mod configs;
This commit is contained in:
parent
57a68a24de
commit
32da19a486
@ -43,7 +43,7 @@
|
||||
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
||||
);
|
||||
|
||||
openmct.install(openmct.plugins.Snow());
|
||||
openmct.install(openmct.plugins.Espresso());
|
||||
openmct.install(openmct.plugins.MyItems());
|
||||
openmct.install(openmct.plugins.LocalStorage());
|
||||
openmct.install(openmct.plugins.Generator());
|
||||
|
@ -265,6 +265,7 @@ define([
|
||||
this.install(this.plugins.ImportExport());
|
||||
this.install(this.plugins.WebPage());
|
||||
this.install(this.plugins.Condition());
|
||||
this.install(this.plugins.ConditionWidget());
|
||||
}
|
||||
|
||||
MCT.prototype = Object.create(EventEmitter.prototype);
|
||||
|
65
src/plugins/conditionWidget/ConditionWidgetViewProvider.js
Normal file
65
src/plugins/conditionWidget/ConditionWidgetViewProvider.js
Normal file
@ -0,0 +1,65 @@
|
||||
/*****************************************************************************
|
||||
* 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 ConditionWidgetComponent from './components/ConditionWidget.vue';
|
||||
import Vue from 'vue';
|
||||
|
||||
export default function ConditionWidget(openmct) {
|
||||
return {
|
||||
key: 'conditionWidget',
|
||||
name: 'Condition Widget',
|
||||
cssClass: 'icon-asterisk',
|
||||
objectClass: 'o-condition-widget',
|
||||
canView: function (domainObject) {
|
||||
return domainObject.type === 'conditionWidget';
|
||||
},
|
||||
canEdit: function (domainObject) {
|
||||
return domainObject.type === 'conditionWidget';
|
||||
},
|
||||
view: function (domainObject) {
|
||||
let component;
|
||||
|
||||
return {
|
||||
show: function (element) {
|
||||
component = new Vue({
|
||||
el: element,
|
||||
components: {
|
||||
ConditionWidgetComponent: ConditionWidgetComponent
|
||||
},
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject
|
||||
},
|
||||
template: '<condition-widget-component></condition-widget-component>'
|
||||
});
|
||||
},
|
||||
destroy: function (element) {
|
||||
component.$destroy();
|
||||
component = undefined;
|
||||
}
|
||||
};
|
||||
},
|
||||
priority: function () {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
}
|
16
src/plugins/conditionWidget/components/ConditionWidget.vue
Normal file
16
src/plugins/conditionWidget/components/ConditionWidget.vue
Normal file
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div class="c-condition-widget">
|
||||
{{ currentDomainObject.label }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
data: function () {
|
||||
return {
|
||||
currentDomainObject: this.domainObject
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
52
src/plugins/conditionWidget/plugin.js
Normal file
52
src/plugins/conditionWidget/plugin.js
Normal file
@ -0,0 +1,52 @@
|
||||
/*****************************************************************************
|
||||
* 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 ConditionWidgetViewProvider from './ConditionWidgetViewProvider.js';
|
||||
|
||||
export default function plugin() {
|
||||
return function install(openmct) {
|
||||
openmct.objectViews.addProvider(new ConditionWidgetViewProvider(openmct));
|
||||
|
||||
openmct.types.addType('conditionWidget', {
|
||||
name: "Condition Widget",
|
||||
description: "Condition Widget description TBD",
|
||||
creatable: true,
|
||||
cssClass: 'icon-asterisk',
|
||||
form: [
|
||||
{
|
||||
"key": "label",
|
||||
"name": "Label",
|
||||
"control": "textfield",
|
||||
"required": true,
|
||||
"cssClass": "l-input"
|
||||
},
|
||||
{
|
||||
"key": "url",
|
||||
"name": "URL",
|
||||
"control": "textfield",
|
||||
"required": false,
|
||||
"cssClass": "l-input-lg"
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
}
|
@ -48,6 +48,7 @@ define([
|
||||
'./clearData/plugin',
|
||||
'./webPage/plugin',
|
||||
'./condition/plugin',
|
||||
'./conditionWidget/plugin',
|
||||
'./themes/espresso',
|
||||
'./themes/maelstrom',
|
||||
'./themes/snow'
|
||||
@ -79,6 +80,7 @@ define([
|
||||
ClearData,
|
||||
WebPagePlugin,
|
||||
ConditionPlugin,
|
||||
ConditionWidgetPlugin,
|
||||
Espresso,
|
||||
Maelstrom,
|
||||
Snow
|
||||
@ -188,6 +190,7 @@ define([
|
||||
plugins.Maelstrom = Maelstrom.default;
|
||||
plugins.Snow = Snow.default;
|
||||
plugins.Condition = ConditionPlugin.default;
|
||||
plugins.ConditionWidget = ConditionWidgetPlugin.default;
|
||||
|
||||
return plugins;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user