mirror of
https://github.com/nasa/openmct.git
synced 2025-01-21 12:05:12 +00:00
small fixes
This commit is contained in:
parent
e1e1e0fb2f
commit
ea6f8c9a50
@ -1,34 +1,19 @@
|
||||
<template>
|
||||
<div id="conditionArea"
|
||||
class="c-cs-ui__conditions"
|
||||
:class="['widget-condition', { 'widget-condition--current': isCurrent }]"
|
||||
:class="['widget-condition', { 'widget-condition--current': condition.isCurrent }]"
|
||||
>
|
||||
<div class="title-bar">
|
||||
<span v-if="isDefault"
|
||||
class="condition-name"
|
||||
>Default
|
||||
<span class="condition-name">
|
||||
{{condition.name}}
|
||||
</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 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 class="condition-description">
|
||||
{{ condition.description}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -38,9 +23,7 @@
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
props: {
|
||||
isEditing: Boolean,
|
||||
isCurrent: Boolean,
|
||||
isDefault: Boolean
|
||||
condition: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -34,13 +34,12 @@
|
||||
class="conditionArea"
|
||||
>
|
||||
<div v-if="isEditing">
|
||||
<ConditionEdit :is-default="condition.isDefault"
|
||||
:condition="condition"
|
||||
<ConditionEdit :condition="condition"
|
||||
@persist="persist"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Condition :is-default="condition.isDefault" />
|
||||
<Condition :condition="condition" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,9 +65,7 @@ export default {
|
||||
return {
|
||||
expanded: true,
|
||||
parentKeyString: this.openmct.objects.makeKeyString(this.domainObject.identifier),
|
||||
conditionCollection: [{
|
||||
isDefault: true
|
||||
}]
|
||||
conditionCollection: []
|
||||
};
|
||||
},
|
||||
destroyed() {
|
||||
@ -77,6 +74,9 @@ export default {
|
||||
mounted() {
|
||||
this.instantiate = this.openmct.$injector.get('instantiate');
|
||||
this.conditionCollection = this.domainObject.configuration.conditionCollection || this.conditionCollection;
|
||||
this.addDefaultCondition();
|
||||
console.log(this.conditionCollection);
|
||||
|
||||
},
|
||||
methods: {
|
||||
added(conditionDO) {
|
||||
@ -85,15 +85,17 @@ export default {
|
||||
addCondition() {
|
||||
let conditionObjId = uuid();
|
||||
let conditionObj = {
|
||||
"composition": [],
|
||||
"name": "Unnamed Condition",
|
||||
"type": "condition",
|
||||
"id": conditionObjId,
|
||||
"location": this.parentKeyString,
|
||||
"identifier": {
|
||||
"namespace": "",
|
||||
"key": conditionObjId
|
||||
}
|
||||
isDefault: false,
|
||||
composition: [],
|
||||
name: "Unnamed Condition",
|
||||
type: "condition",
|
||||
id: conditionObjId,
|
||||
location: this.parentKeyString,
|
||||
identifier: {
|
||||
namespace: "",
|
||||
key: conditionObjId
|
||||
},
|
||||
output: 'test'
|
||||
};
|
||||
|
||||
let conditionDOKeyString = this.openmct.objects.makeKeyString(conditionObj.identifier);
|
||||
@ -103,12 +105,31 @@ export default {
|
||||
|
||||
this.conditionCollection.unshift(conditionDO);
|
||||
|
||||
this.$set(this.domainObject.configuration.conditionCollection, 0, conditionDO);
|
||||
|
||||
console.log(conditionDO.name)
|
||||
this.$set(this.conditionCollection, 0, conditionDO);
|
||||
|
||||
console.log(this.conditionCollection);
|
||||
|
||||
this.persist();
|
||||
},
|
||||
addDefaultCondition() {
|
||||
this.conditionCollection = [];
|
||||
|
||||
let conditionObjId = uuid();
|
||||
this.conditionCollection.push({
|
||||
description: 'when all fails',
|
||||
isDefault: true,
|
||||
composition: [],
|
||||
name: "Default",
|
||||
type: "condition",
|
||||
id: conditionObjId,
|
||||
location: this.parentKeyString,
|
||||
identifier: {
|
||||
namespace: "",
|
||||
key: conditionObjId
|
||||
},
|
||||
output: 'Default test'
|
||||
});
|
||||
},
|
||||
removeCondition(identifier) {
|
||||
let index = _.findIndex(this.conditionCollection, (condition) => this.openmct.objects.makeKeyString(identifier) === condition.identifier.key);
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
<template>
|
||||
<div class="c-cs-editui__conditions"
|
||||
:class="['widget-condition', { 'widget-condition--current': isCurrent }]"
|
||||
:class="['widget-condition', { 'widget-condition--current': condition.isCurrent }]"
|
||||
>
|
||||
<div class="title-bar">
|
||||
<span
|
||||
class="c-c__menu-hamburger"
|
||||
:class="{ 'is-enabled': !isDefault }"
|
||||
@click="expanded = !expanded"
|
||||
:class="{ 'is-enabled': !condition.isDefault }"
|
||||
@click="expanded = !condition.expanded"
|
||||
></span>
|
||||
<span
|
||||
class="is-enabled flex-elem"
|
||||
:class="['c-c__disclosure-triangle', { 'c-c__disclosure-triangle--expanded': expanded }]"
|
||||
@click="expanded = !expanded"
|
||||
@click="expanded = !condition.expanded"
|
||||
></span>
|
||||
<div class="condition-summary">
|
||||
<span class="condition-name">{{ name }}</span>
|
||||
<span class="condition-description">{{ description }}</span>
|
||||
<span class="condition-name">{{ condition.name }}</span>
|
||||
<span class="condition-description">{{ condition.description }}</span>
|
||||
</div>
|
||||
<span v-if="!isDefault"
|
||||
<span v-if="!condition.isDefault"
|
||||
class="is-enabled c-c__duplicate"
|
||||
></span>
|
||||
<span v-if="!isDefault"
|
||||
<span v-if="!condition.isDefault"
|
||||
class="is-enabled c-c__trash"
|
||||
@click="removeCondition"
|
||||
></span>
|
||||
@ -38,7 +38,7 @@
|
||||
<li>
|
||||
<label>Condition Name</label>
|
||||
<span class="controls">
|
||||
<input v-model="name"
|
||||
<input v-model="condition.name"
|
||||
class="t-rule-name-input"
|
||||
type="text"
|
||||
>
|
||||
@ -65,16 +65,10 @@
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
props: {
|
||||
isEditing: Boolean,
|
||||
isCurrent: Boolean,
|
||||
isDefault: Boolean,
|
||||
condition: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
condition: Object
|
||||
},
|
||||
data() {
|
||||
console.log(`this.condition.name: ${this.condition.name}`);
|
||||
|
||||
return {
|
||||
expanded: true,
|
||||
name: this.condition.name,
|
||||
@ -82,6 +76,7 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
console.log(`this.condition.name: ${this.condition.name}`);
|
||||
// console.log(`currentObjectPath: ${this.currentObjectPath.name}`);
|
||||
// console.log(this.domainObject);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user