Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor

robindekkers93f58ae35afd
diff --git a/ui/component/or-rules-editor/src/or-rule-then/index.ts b/ui/component/or-rules-editor/src/or-rule-then/index.ts
index cbcbf74f9..5c7e67b66 100644
--- a/ui/component/or-rules-editor/src/or-rule-then/index.ts
+++ b/ui/component/or-rules-editor/src/or-rule-then/index.ts
@@ -5,7 +5,8 @@ import {Rule, RuleTrigger, RuleActionUnion, NewAssetQuery, BaseAssetQueryMatch}
import '../or-rule-then-condition';
-let defaultThen:RuleActionUnion[] = [];
+
+let hasAddThenCondition:Boolean = false
const defaultAssetType:NewAssetQuery = {
"types": [{
@@ -22,6 +23,15 @@ let defaultThenCondition:RuleActionUnion = {
target: { "useAssetsFromWhen": true}
};
+let secondThenCondition:RuleActionUnion = {
+ action: "write-attribute",
+ attributeName: 'profileColor',
+ value: 'orange',
+ target: { "useAssetsFromWhen": true}
+};
+
+let defaultThen:RuleActionUnion[] = [defaultThenCondition, secondThenCondition];
+
@customElement('or-rule-then')
class OrRuleThen extends LitElement {
@@ -43,7 +53,9 @@ class OrRuleThen extends LitElement {
<span class="rule-additional">&</span>
`
}) : ``}
- <a class="button-add" @click="${this.addThenCondition}">+</a>
+ ${hasAddThenCondition ? html`
+ <a class="button-add" @click="${this.addThenCondition}">+</a>
+ `: ``}
</div>
</div>
`;
@@ -60,6 +72,7 @@ class OrRuleThen extends LitElement {
super.updated(_changedProperties);
if(this.rule && !this.rule.then) {
this.rule.then = defaultThen;
+ this.requestUpdate();
}
}
diff --git a/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts b/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts
index 5069e0bae..5570e8022 100644
--- a/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts
+++ b/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts
@@ -80,7 +80,8 @@ class OrRuleWhenCondition extends LitElement {
if(this.predicate && this.predicate.name) {
this.predicate.name.value = value;
- console.log(this.predicate);
+
+ this.setOperator(e)
this.requestUpdate();
}
}
@@ -89,7 +90,6 @@ class OrRuleWhenCondition extends LitElement {
const value = e.detail.value;
if(this.predicate && this.predicate.value && this.predicate.value.predicateType === 'string') {
this.predicate.value.match = value;
- console.log(this.predicate);
this.requestUpdate();
}
}
@@ -99,7 +99,6 @@ class OrRuleWhenCondition extends LitElement {
if(this.predicate && this.predicate.value && this.predicate.value.predicateType === 'string') {
this.predicate.value.value = value;
- console.log(this.predicate);
this.requestUpdate();
}
}
diff --git a/ui/component/or-rules-editor/src/or-rule-when/index.ts b/ui/component/or-rules-editor/src/or-rule-when/index.ts
index b3b1848e0..b6d642a97 100644
--- a/ui/component/or-rules-editor/src/or-rule-when/index.ts
+++ b/ui/component/or-rules-editor/src/or-rule-when/index.ts
@@ -29,10 +29,12 @@ const defaultWhenCondition:RuleTrigger = {
const defaultPredicate:AttributePredicate = {
name: {
predicateType: "string",
- match: BaseAssetQueryMatch.EXACT
+ match: BaseAssetQueryMatch.EXACT,
+ value: "airlineIata"
},
value: {
- predicateType: "string"
+ predicateType: "string",
+ match: BaseAssetQueryMatch.EXACT
}
};
diff --git a/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts b/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts
index d19dc1b9a..82eeb7828 100644
--- a/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts
+++ b/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts
@@ -53,7 +53,7 @@ class OrSelectAssetAttribute extends LitElement {
super();
// TODO Should come from rules-config based on asset type?
- // TODO what is the attribute name of profile flights?
+
this.attributeDescriptors = [
{ name: 'flightProfile', valueType: AttributeValueType.STRING },
{ name: 'profileName', valueType: AttributeValueType.STRING },