mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
Merge pull request #2608 from nasa/conditionSet-view-provider
Condition set view provider
This commit is contained in:
commit
37650487f7
@ -43,7 +43,7 @@
|
||||
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
||||
);
|
||||
|
||||
openmct.install(openmct.plugins.Espresso());
|
||||
openmct.install(openmct.plugins.Snow());
|
||||
openmct.install(openmct.plugins.MyItems());
|
||||
openmct.install(openmct.plugins.LocalStorage());
|
||||
openmct.install(openmct.plugins.Generator());
|
||||
|
@ -265,7 +265,6 @@ define([
|
||||
this.install(this.plugins.ImportExport());
|
||||
this.install(this.plugins.WebPage());
|
||||
this.install(this.plugins.Condition());
|
||||
this.install(this.plugins.ConditionSet());
|
||||
}
|
||||
|
||||
MCT.prototype = Object.create(EventEmitter.prototype);
|
||||
|
73
src/plugins/condition/ConditionSetViewProvider.js
Normal file
73
src/plugins/condition/ConditionSetViewProvider.js
Normal file
@ -0,0 +1,73 @@
|
||||
/*****************************************************************************
|
||||
* 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 ConditionSet from './components/ConditionSet.vue';
|
||||
import Vue from 'vue';
|
||||
|
||||
export default class ConditionSetViewProvider {
|
||||
constructor(openmct) {
|
||||
this.openmct = openmct;
|
||||
this.key = 'conditionSet.view';
|
||||
this.cssClass = 'icon-summary-widget'; // TODO: replace with class for new icon
|
||||
}
|
||||
|
||||
canView(domainObject) {
|
||||
return domainObject.type === 'conditionSet';
|
||||
}
|
||||
|
||||
canEdit(domainObject) {
|
||||
return domainObject.type === 'conditionSet';
|
||||
}
|
||||
|
||||
view(domainObject, objectPath) {
|
||||
let component;
|
||||
const openmct = this.openmct;
|
||||
return {
|
||||
show: (container, isEditing) => {
|
||||
component = new Vue({
|
||||
el: container,
|
||||
components: {
|
||||
ConditionSet
|
||||
},
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject,
|
||||
objectPath
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isEditing
|
||||
}
|
||||
},
|
||||
template: '<condition-set :isEditing="isEditing"></condition-set>'
|
||||
});
|
||||
},
|
||||
onEditModeChange: (isEditing) => {
|
||||
component.isEditing = isEditing;
|
||||
},
|
||||
destroy: () => {
|
||||
component.$destroy();
|
||||
component = undefined;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
53
src/plugins/condition/components/Condition.vue
Normal file
53
src/plugins/condition/components/Condition.vue
Normal file
@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div id="conditionArea"
|
||||
class="c-cs-ui__conditions"
|
||||
:class="['widget-condition', { 'widget-condition--current': isCurrent }]"
|
||||
>
|
||||
<div class="title-bar">
|
||||
<span v-if="isDefault"
|
||||
class="condition-name"
|
||||
>Default
|
||||
</span>
|
||||
<span v-else
|
||||
class="condition-name"
|
||||
>[condition name]
|
||||
</span>
|
||||
<span v-if="isDefault"
|
||||
class="condition-output"
|
||||
>Output: false
|
||||
</span>
|
||||
<span v-else
|
||||
class="condition-output"
|
||||
>Output: [condition output]
|
||||
</span>
|
||||
</div>
|
||||
<div class="condition-config">
|
||||
<span v-if="isDefault"
|
||||
class="condition-description"
|
||||
>When all else fails
|
||||
</span>
|
||||
<span v-else
|
||||
class="condition-description"
|
||||
>[condition description]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
props: {
|
||||
isEditing: Boolean,
|
||||
isCurrent: Boolean,
|
||||
isDefault: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
conditionData: {}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
111
src/plugins/condition/components/ConditionCollection.vue
Normal file
111
src/plugins/condition/components/ConditionCollection.vue
Normal file
@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<section id="conditionCollection"
|
||||
class="c-cs__ui_section"
|
||||
>
|
||||
<div class="c-cs__ui__header">
|
||||
<span class="c-cs__ui__header-label">Conditions</span>
|
||||
<span
|
||||
class="is-enabled flex-elem"
|
||||
:class="['c-cs__disclosure-triangle', { 'c-cs__disclosure-triangle--expanded': expanded }]"
|
||||
@click="expanded = !expanded"
|
||||
></span>
|
||||
</div>
|
||||
<div v-if="expanded"
|
||||
class="c-cs__ui_content"
|
||||
>
|
||||
<div v-show="isEditing"
|
||||
class="help"
|
||||
>
|
||||
<span>The first condition to match is the one that wins. Drag conditions to rearrange.</span>
|
||||
</div>
|
||||
<div class="holder add-condition-button-wrapper align-left">
|
||||
<button
|
||||
v-show="isEditing"
|
||||
id="addCondition"
|
||||
class="c-cs-button c-cs-button--major add-condition-button"
|
||||
@click="addCondition"
|
||||
>
|
||||
<span class="c-cs-button__label">Add Condition</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-for="condition in conditions"
|
||||
:key="condition.key"
|
||||
>
|
||||
<div v-if="isEditing">
|
||||
<ConditionEdit :domain-object="condition.domainObject"
|
||||
:is-default="condition.isDefault"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Condition :domain-object="condition.domainObject"
|
||||
:is-default="condition.isDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Condition from '../../condition/components/Condition.vue';
|
||||
import ConditionEdit from '../../condition/components/ConditionEdit.vue';
|
||||
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
components: {
|
||||
Condition,
|
||||
ConditionEdit
|
||||
},
|
||||
props: {
|
||||
isEditing: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
expanded: true,
|
||||
conditions: [
|
||||
{
|
||||
identifier: {
|
||||
key: 'testConditionKey',
|
||||
namespace: ''
|
||||
},
|
||||
type: 'condition',
|
||||
isDefault: true
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
destroyed() {
|
||||
this.composition.off('add', this.addCondition);
|
||||
this.composition.off('remove', this.removeCondition);
|
||||
this.composition.off('reorder', this.reorder);
|
||||
},
|
||||
mounted() {
|
||||
this.composition = this.openmct.composition.get(this.domainObject);
|
||||
this.composition.on('add', this.addCondition);
|
||||
this.composition.on('remove', this.removeCondition);
|
||||
this.composition.on('reorder', this.reorder);
|
||||
this.composition.load();
|
||||
},
|
||||
methods: {
|
||||
addCondition() {
|
||||
let condition = {};
|
||||
condition.domainObject = this.domainObject;
|
||||
condition.key = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||
|
||||
this.conditions.unshift(condition);
|
||||
},
|
||||
removeCondition(identifier) {
|
||||
console.log(`remove condition`);
|
||||
// let index = _.findIndex(this.conditions, (condition) => this.openmct.objects.makeKeyString(identifier) === item.key);
|
||||
|
||||
// this.conditions.splice(index, 1);
|
||||
},
|
||||
reorder(reorderPlan) {
|
||||
let oldConditions = this.conditions.slice();
|
||||
reorderPlan.forEach((reorderEvent) => {
|
||||
this.$set(this.conditions, reorderEvent.newIndex, oldConditions[reorderEvent.oldIndex]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
99
src/plugins/condition/components/ConditionEdit.vue
Normal file
99
src/plugins/condition/components/ConditionEdit.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div id="conditionArea"
|
||||
class="c-cs-editui__conditions"
|
||||
:class="['widget-condition', { 'widget-condition--current': isCurrent }]"
|
||||
>
|
||||
<div class="title-bar">
|
||||
<span
|
||||
class="c-c__menu-hamburger"
|
||||
:class="{ 'is-enabled': !isDefault }"
|
||||
@click="expanded = !expanded"
|
||||
></span>
|
||||
<span
|
||||
class="is-enabled flex-elem"
|
||||
:class="['c-c__disclosure-triangle', { 'c-c__disclosure-triangle--expanded': expanded }]"
|
||||
@click="expanded = !expanded"
|
||||
></span>
|
||||
<div class="condition-summary">
|
||||
<span v-if="isDefault"
|
||||
class="condition-name"
|
||||
>Default
|
||||
</span>
|
||||
<span v-else
|
||||
class="condition-name"
|
||||
>[condition name]
|
||||
</span>
|
||||
<span v-if="isDefault"
|
||||
class="condition-description"
|
||||
>When all else fails
|
||||
</span>
|
||||
<span v-else
|
||||
class="condition-description"
|
||||
>[condition description]
|
||||
</span>
|
||||
</div>
|
||||
<span v-if="!isDefault"
|
||||
class="is-enabled c-c__duplicate"
|
||||
></span>
|
||||
<span v-if="!isDefault"
|
||||
class="is-enabled c-c__trash"
|
||||
@click="removeCondition"
|
||||
></span>
|
||||
</div>
|
||||
<div v-if="expanded"
|
||||
class="condition-config-edit widget-rule-content c-sw-editui__rules-wrapper holder widget-rules-wrapper flex-elem expanded"
|
||||
>
|
||||
<div id="ruleArea"
|
||||
class="c-sw-editui__rules widget-rules"
|
||||
>
|
||||
<div class="c-sw-rule">
|
||||
<div class="c-sw-rule__ui l-compact-form l-widget-rule has-local-controls">
|
||||
<div>
|
||||
<ul>
|
||||
<li>
|
||||
<label>Condition Name</label>
|
||||
<span class="controls">
|
||||
<input class="t-rule-name-input"
|
||||
type="text"
|
||||
>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<label>Output</label>
|
||||
<span class="controls">
|
||||
<select class="">
|
||||
<option value="false">false</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
props: {
|
||||
isEditing: Boolean,
|
||||
isCurrent: Boolean,
|
||||
isDefault: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
conditions: {},
|
||||
expanded: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
removeCondition() {
|
||||
console.log(this);
|
||||
// this.conditions.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
35
src/plugins/condition/components/ConditionSet.vue
Normal file
35
src/plugins/condition/components/ConditionSet.vue
Normal file
@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="c-object-view u-contents">
|
||||
<div class="c-cs-edit w-condition-set">
|
||||
<div class="c-sw-edit__ui holder">
|
||||
<CurrentOutput :current-output="mockCurrentOutput" />
|
||||
<TestData :is-editing="isEditing" />
|
||||
<ConditionCollection :is-editing="isEditing" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CurrentOutput from './CurrentOutput.vue';
|
||||
import TestData from './TestData.vue';
|
||||
import ConditionCollection from './ConditionCollection.vue';
|
||||
|
||||
export default {
|
||||
inject: ["openmct", "objectPath", "domainObject"],
|
||||
components: {
|
||||
CurrentOutput,
|
||||
TestData,
|
||||
ConditionCollection
|
||||
},
|
||||
props: {
|
||||
isEditing: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
mockCurrentOutput: 'Data_Present'
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
40
src/plugins/condition/components/CurrentOutput.vue
Normal file
40
src/plugins/condition/components/CurrentOutput.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<section id="current-output">
|
||||
<div class="c-cs__ui__header">
|
||||
<span class="c-cs__ui__header-label">Current Output</span>
|
||||
<span
|
||||
class="is-enabled flex-elem"
|
||||
:class="['c-cs__disclosure-triangle', { 'c-cs__disclosure-triangle--expanded': expanded }]"
|
||||
@click="expanded = !expanded"
|
||||
></span>
|
||||
</div>
|
||||
<div v-if="expanded"
|
||||
class="c-cs__ui_content"
|
||||
>
|
||||
<div>
|
||||
<span class="current-output">{{ currentOutput }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
props: {
|
||||
currentOutput: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
isEditing: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
expanded: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
68
src/plugins/condition/components/TestData.vue
Normal file
68
src/plugins/condition/components/TestData.vue
Normal file
@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<section v-show="isEditing"
|
||||
id="test-data"
|
||||
class="test-data"
|
||||
>
|
||||
<div class="c-cs__ui__header">
|
||||
<span class="c-cs__ui__header-label">Test Data</span>
|
||||
<span
|
||||
class="is-enabled flex-elem"
|
||||
:class="['c-cs__disclosure-triangle', { 'c-cs__disclosure-triangle--expanded': expanded }]"
|
||||
@click="expanded = !expanded"
|
||||
></span>
|
||||
</div>
|
||||
<div v-if="expanded"
|
||||
class="c-cs__ui_content"
|
||||
>
|
||||
<label class="checkbox custom">
|
||||
<input type="checkbox"
|
||||
class="t-test-data-checkbox"
|
||||
>
|
||||
<span>Apply Test Data</span>
|
||||
</label>
|
||||
<div class="t-test-data-config">
|
||||
<div class="c-cs-editui__conditions widget-condition">
|
||||
<form>
|
||||
<label>
|
||||
<span>Set</span>
|
||||
<select>
|
||||
<option>- Select Input -</option>
|
||||
</select>
|
||||
</label>
|
||||
<span class="is-enabled flex-elem c-cs__duplicate"></span>
|
||||
<span class="is-enabled flex-elem c-cs__trash"></span>
|
||||
</form>
|
||||
</div>
|
||||
<div class="c-cs-editui__conditions widget-condition">
|
||||
<form>
|
||||
<label>
|
||||
<span>Set</span>
|
||||
<select>
|
||||
<option>- Select Input -</option>
|
||||
</select>
|
||||
</label>
|
||||
<span class="is-enabled c-cs__duplicate"></span>
|
||||
<span class="is-enabled c-cs__trash"></span>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
props: {
|
||||
isEditing: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
expanded: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
142
src/plugins/condition/components/condition-set.scss
Normal file
142
src/plugins/condition/components/condition-set.scss
Normal file
@ -0,0 +1,142 @@
|
||||
.c-cs-edit {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
section {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.c-cs__ui__header {
|
||||
background-color: #D0D1D3;
|
||||
padding: 0.4em 0.6em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
color: #7C7D80;
|
||||
display: flex;
|
||||
justify-content: stretch;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.c-cs__ui__header-label {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.c-cs__ui_content {
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
.c-cs__ui_content .help {
|
||||
font-style: italic;
|
||||
padding: 0.4em 0;
|
||||
}
|
||||
|
||||
.current-output {
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
margin: 0.4em 0.6em;
|
||||
}
|
||||
|
||||
.condition-output {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.condition-description {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.checkbox.custom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
.checkbox.custom span {
|
||||
display: inline-block;
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
|
||||
.t-test-data-config {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.widget-condition form {
|
||||
padding: 0.5em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: stretch;
|
||||
}
|
||||
|
||||
.widget-condition form label {
|
||||
flex-grow: 1;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.widget-condition form input {
|
||||
min-height: 24px;
|
||||
}
|
||||
|
||||
.c-cs-button[class*="--major"],
|
||||
.c-cs-button[class*='is-active'],
|
||||
.c-cs-button--menu[class*="--major"],
|
||||
.c-cs-button--menu[class*='is-active'] {
|
||||
border: solid 1.5px #0B427C;
|
||||
background-color: #4778A3;
|
||||
padding: 0.2em 0.6em;
|
||||
margin: 0.4em;
|
||||
font-weight: bold;
|
||||
color: #eee;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.c-cs__disclosure-triangle,
|
||||
.c-cs__menu-hamburger,
|
||||
.c-cs__duplicate,
|
||||
.c-cs__trash {
|
||||
$d: 8px;
|
||||
color: $colorDisclosureCtrl;
|
||||
width: $d;
|
||||
visibility: hidden;
|
||||
|
||||
&.is-enabled {
|
||||
cursor: pointer;
|
||||
visibility: visible;
|
||||
|
||||
&:hover {
|
||||
color: $colorDisclosureCtrlHov;
|
||||
}
|
||||
|
||||
&:before {
|
||||
$s: .5;
|
||||
display: block;
|
||||
font-family: symbolsfont;
|
||||
font-size: 1rem * $s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.c-cs__disclosure-triangle {
|
||||
&:before {
|
||||
content: $glyph-icon-arrow-right;
|
||||
}
|
||||
|
||||
&--expanded {
|
||||
&:before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.c-cs__duplicate {
|
||||
margin-right: 0.3em;
|
||||
&:before {
|
||||
content: $glyph-icon-duplicate;
|
||||
}
|
||||
}
|
||||
|
||||
.c-cs__trash {
|
||||
&:before {
|
||||
content: $glyph-icon-trash;
|
||||
}
|
||||
}
|
||||
|
152
src/plugins/condition/components/condition.scss
Normal file
152
src/plugins/condition/components/condition.scss
Normal file
@ -0,0 +1,152 @@
|
||||
|
||||
|
||||
.widget-condition {
|
||||
background-color: #eee;
|
||||
margin: 0 0 0.6em;
|
||||
border-radius: 3px;
|
||||
|
||||
&--current {
|
||||
background-color: #DEECFA;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: stretch;
|
||||
padding: 0.4em 0;
|
||||
}
|
||||
|
||||
.title-bar span {
|
||||
margin-right: 0.6em;
|
||||
}
|
||||
|
||||
.title-bar span.c-c__duplicate,
|
||||
.title-bar span.c-c__trash{
|
||||
margin-right: 0;
|
||||
margin-left: 0.3em;
|
||||
}
|
||||
|
||||
.widget-condition > div {
|
||||
margin: 0 0.4em;
|
||||
}
|
||||
|
||||
.condition-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.condition-summary .condition-description {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.condition-summary {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.condition-config {
|
||||
padding: 0.3em 0;
|
||||
}
|
||||
|
||||
.widget-condition form label {
|
||||
flex-grow: 1;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.l-widget-rule {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.widget-rule-content.expanded {
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
.widget-rule-content.expanded ul {
|
||||
border-top: solid 1px #ccc;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.l-compact-form ul li {
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
||||
.l-compact-form ul li .controls {
|
||||
line-height: 20px;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
.l-compact-form ul li > label {
|
||||
display: block;
|
||||
width: 90px;
|
||||
text-align: right;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.l-compact-form ul li .controls input[type="text"],
|
||||
.l-compact-form ul li .controls input[type="search"],
|
||||
.l-compact-form ul li .controls input[type="number"],
|
||||
.l-compact-form ul li .controls button,
|
||||
.l-compact-form ul li .controls select {
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
.condition-config-edit {
|
||||
padding: 3px 0;
|
||||
}
|
||||
|
||||
|
||||
.c-c__disclosure-triangle,
|
||||
.c-c__menu-hamburger,
|
||||
.c-c__duplicate,
|
||||
.c-c__trash {
|
||||
$d: 8px;
|
||||
color: $colorDisclosureCtrl;
|
||||
width: $d;
|
||||
visibility: hidden;
|
||||
|
||||
&.is-enabled {
|
||||
cursor: pointer;
|
||||
visibility: visible;
|
||||
|
||||
&:hover {
|
||||
color: $colorDisclosureCtrlHov;
|
||||
}
|
||||
|
||||
&:before {
|
||||
$s: .5;
|
||||
display: block;
|
||||
font-family: symbolsfont;
|
||||
font-size: 1rem * $s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.c-c__disclosure-triangle {
|
||||
&:before {
|
||||
content: $glyph-icon-arrow-right;
|
||||
}
|
||||
|
||||
&--expanded {
|
||||
&:before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.c-c__menu-hamburger {
|
||||
&:before {
|
||||
content: $glyph-icon-menu-hamburger;
|
||||
}
|
||||
}
|
||||
|
||||
.c-c__duplicate {
|
||||
&:before {
|
||||
content: $glyph-icon-duplicate;
|
||||
}
|
||||
}
|
||||
|
||||
.c-c__trash {
|
||||
&:before {
|
||||
content: $glyph-icon-trash;
|
||||
}
|
||||
}
|
@ -19,8 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
import ConditionSetViewProvider from './ConditionSetViewProvider.js';
|
||||
|
||||
export default function ConditionPlugin() {
|
||||
|
||||
return function install(openmct) {
|
||||
openmct.types.addType('condition', {
|
||||
name: 'Condition',
|
||||
@ -31,5 +33,19 @@ export default function ConditionPlugin() {
|
||||
domainObject.composition = [];
|
||||
}
|
||||
});
|
||||
|
||||
openmct.types.addType('conditionSet', {
|
||||
name: 'Condition Set',
|
||||
key: 'conditionSet',
|
||||
description: 'A set of one or more conditions based on user-specified criteria.',
|
||||
creatable: true,
|
||||
cssClass: 'icon-summary-widget', // TODO: replace with class for new icon
|
||||
initialize: function (domainObject) {
|
||||
domainObject.composition = [];
|
||||
}
|
||||
});
|
||||
|
||||
openmct.objectViews.addProvider(new ConditionSetViewProvider(openmct));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,43 +23,77 @@
|
||||
import { createOpenMct } from "testTools";
|
||||
import ConditionPlugin from "./plugin";
|
||||
|
||||
let openmct;
|
||||
let conditionDefinition;
|
||||
let mockDomainObject;
|
||||
let openmct = createOpenMct();
|
||||
openmct.install(new ConditionPlugin());
|
||||
|
||||
let mockConditionObject = {
|
||||
name: 'Condition',
|
||||
key: 'condition',
|
||||
creatable: false
|
||||
};
|
||||
let conditionDefinition;
|
||||
let conditionSetDefinition;
|
||||
let mockDomainObject;
|
||||
let mockDomainObject2;
|
||||
let element;
|
||||
let child;
|
||||
|
||||
describe('the plugin', function () {
|
||||
|
||||
beforeEach(() => {
|
||||
openmct = createOpenMct();
|
||||
openmct.install(new ConditionPlugin());
|
||||
beforeAll((done) => {
|
||||
conditionDefinition = openmct.types.get('condition').definition;
|
||||
mockDomainObject = {
|
||||
identifier: {
|
||||
key: 'testConditionKey',
|
||||
namespace: ''
|
||||
},
|
||||
type: 'condition'
|
||||
};
|
||||
|
||||
conditionDefinition.initialize(mockDomainObject);
|
||||
|
||||
conditionSetDefinition = openmct.types.get('conditionSet').definition;
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
element = document.createElement('div');
|
||||
child = document.createElement('div');
|
||||
element.appendChild(child);
|
||||
|
||||
mockDomainObject2 = {
|
||||
identifier: {
|
||||
key: 'testConditionSetKey',
|
||||
namespace: ''
|
||||
},
|
||||
type: 'conditionSet'
|
||||
};
|
||||
|
||||
conditionSetDefinition.initialize(mockDomainObject2);
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.start(appHolder);
|
||||
});
|
||||
|
||||
it('defines an object type with the correct key', () => {
|
||||
let mockConditionObject = {
|
||||
name: 'Condition',
|
||||
key: 'condition',
|
||||
creatable: false
|
||||
};
|
||||
|
||||
it('defines a condition object type with the correct key', () => {
|
||||
expect(conditionDefinition.key).toEqual(mockConditionObject.key);
|
||||
});
|
||||
|
||||
it('is not creatable', () => {
|
||||
expect(conditionDefinition.creatable).toEqual(mockConditionObject.creatable);
|
||||
let mockConditionSetObject = {
|
||||
name: 'Condition Set',
|
||||
key: 'conditionSet',
|
||||
creatable: true
|
||||
};
|
||||
|
||||
it('defines a conditionSet object type with the correct key', () => {
|
||||
expect(conditionSetDefinition.key).toEqual(mockConditionSetObject.key);
|
||||
});
|
||||
|
||||
describe('the object', () => {
|
||||
beforeEach(() => {
|
||||
mockDomainObject = {
|
||||
identifier: {
|
||||
key: 'testConditionKey',
|
||||
namespace: ''
|
||||
},
|
||||
type: 'condition'
|
||||
};
|
||||
describe('the condition object', () => {
|
||||
|
||||
conditionDefinition.initialize(mockDomainObject);
|
||||
it('is not creatable', () => {
|
||||
expect(conditionDefinition.creatable).toEqual(mockConditionObject.creatable);
|
||||
});
|
||||
|
||||
it('initializes with an empty composition list', () => {
|
||||
@ -67,4 +101,28 @@ describe('the plugin', function () {
|
||||
expect(mockDomainObject.composition.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the conditionSet object', () => {
|
||||
|
||||
it('is creatable', () => {
|
||||
expect(conditionSetDefinition.creatable).toEqual(mockConditionSetObject.creatable);
|
||||
});
|
||||
|
||||
it('initializes with an empty composition list', () => {
|
||||
expect(mockDomainObject2.composition instanceof Array).toBeTrue();
|
||||
expect(mockDomainObject2.composition.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('provides a view', () => {
|
||||
const testViewObject = {
|
||||
id:"test-object",
|
||||
type: "conditionSet"
|
||||
};
|
||||
|
||||
const applicableViews = openmct.objectViews.get(testViewObject);
|
||||
let conditionSetView = applicableViews.find((viewProvider) => viewProvider.key === 'conditionSet.view');
|
||||
expect(conditionSetView).toBeDefined();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* 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 ConditionSetComponent from './components/ConditionSet.vue';
|
||||
import Vue from 'vue';
|
||||
|
||||
export default function ConditionSet(openmct) {
|
||||
return {
|
||||
key: 'conditionSet',
|
||||
name: 'Condition Set',
|
||||
cssClass: 'icon-page',
|
||||
canView: function (domainObject) {
|
||||
return domainObject.type === 'conditionSet';
|
||||
},
|
||||
view: function (domainObject) {
|
||||
let component;
|
||||
|
||||
return {
|
||||
show: function (element) {
|
||||
component = new Vue({
|
||||
el: element,
|
||||
components: {
|
||||
ConditionSetComponent
|
||||
},
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject
|
||||
},
|
||||
template: '<condition-set-component></condition-set-component>'
|
||||
});
|
||||
},
|
||||
destroy: function (element) {
|
||||
component.$destroy();
|
||||
component = undefined;
|
||||
}
|
||||
};
|
||||
},
|
||||
priority: function () {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<template>
|
||||
<div><!-- Condition Set component contents will go here --></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
data: function () {
|
||||
return {
|
||||
currentDomainObject: this.domainObject
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,39 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
export default function plugin() {
|
||||
const conditionSetType = {
|
||||
name: 'Condition Set',
|
||||
key: 'conditionSet',
|
||||
description: 'A set of one or more conditions based on user-specified criteria.',
|
||||
creatable: true,
|
||||
cssClass: 'icon-summary-widget',
|
||||
initialize: function (domainObject) {
|
||||
domainObject.composition = [];
|
||||
// domainObject.telemetry = {};
|
||||
}
|
||||
};
|
||||
|
||||
return function install(openmct) {
|
||||
openmct.types.addType('conditionSet', conditionSetType);
|
||||
};
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* 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 ConditionSetPlugin from './plugin';
|
||||
import { createOpenMct } from 'testTools';
|
||||
|
||||
describe("The plugin", () => {
|
||||
let openmct;
|
||||
let mockDomainObject;
|
||||
|
||||
beforeEach(() => {
|
||||
openmct = createOpenMct();
|
||||
openmct.install(new ConditionSetPlugin());
|
||||
|
||||
mockDomainObject = {
|
||||
identifier: {
|
||||
key: 'testKey',
|
||||
namespace: ''
|
||||
},
|
||||
type: 'conditionSet'
|
||||
};
|
||||
});
|
||||
|
||||
it('defines a conditionSet object type with the correct key', () => {
|
||||
expect(openmct.types.get('conditionSet').definition.key).toEqual('conditionSet');
|
||||
});
|
||||
|
||||
it('defines a conditionSet object type that is creatable', () => {
|
||||
expect(openmct.types.get('conditionSet').definition.creatable).toBeTrue();
|
||||
});
|
||||
|
||||
describe("shows the conditionSet object is initialized with", () => {
|
||||
beforeEach(() => {
|
||||
openmct.types.get('conditionSet').definition.initialize(mockDomainObject);
|
||||
});
|
||||
|
||||
it('a composition array', () => {
|
||||
expect(Array.isArray(mockDomainObject.composition)).toBeTrue();
|
||||
});
|
||||
|
||||
// it('a telemetry object', () => {
|
||||
// expect(typeof mockDomainObject.telemetry === 'object').toBeTrue();
|
||||
// });
|
||||
});
|
||||
});
|
||||
|
@ -47,11 +47,10 @@ define([
|
||||
'./goToOriginalAction/plugin',
|
||||
'./clearData/plugin',
|
||||
'./webPage/plugin',
|
||||
'./conditionSet/plugin',
|
||||
'./condition/plugin',
|
||||
'./themes/espresso',
|
||||
'./themes/maelstrom',
|
||||
'./themes/snow',
|
||||
'./condition/plugin'
|
||||
'./themes/snow'
|
||||
], function (
|
||||
_,
|
||||
UTCTimeSystem,
|
||||
@ -79,11 +78,10 @@ define([
|
||||
GoToOriginalAction,
|
||||
ClearData,
|
||||
WebPagePlugin,
|
||||
ConditionSetPlugin,
|
||||
ConditionPlugin,
|
||||
Espresso,
|
||||
Maelstrom,
|
||||
Snow,
|
||||
ConditionPlugin
|
||||
Snow
|
||||
) {
|
||||
var bundleMap = {
|
||||
LocalStorage: 'platform/persistence/local',
|
||||
@ -186,7 +184,6 @@ define([
|
||||
plugins.GoToOriginalAction = GoToOriginalAction.default;
|
||||
plugins.ClearData = ClearData;
|
||||
plugins.WebPage = WebPagePlugin.default;
|
||||
plugins.ConditionSet = ConditionSetPlugin.default;
|
||||
plugins.Espresso = Espresso.default;
|
||||
plugins.Maelstrom = Maelstrom.default;
|
||||
plugins.Snow = Snow.default;
|
||||
|
@ -1,5 +1,7 @@
|
||||
@import "../api/overlays/components/dialog-component.scss";
|
||||
@import "../api/overlays/components/overlay-component.scss";
|
||||
@import "../plugins/condition/components/condition.scss";
|
||||
@import "../plugins/condition/components/condition-set.scss";
|
||||
@import "../plugins/displayLayout/components/box-view.scss";
|
||||
@import "../plugins/displayLayout/components/display-layout.scss";
|
||||
@import "../plugins/displayLayout/components/edit-marquee.scss";
|
||||
|
Loading…
Reference in New Issue
Block a user