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