Skip to content

armgit / core

Public Imported from GitHub
0

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

UI updates: Updated to latest model

Rich Turner731a0592400b
diff --git a/ui/component/or-rules-editor/src/index.ts b/ui/component/or-rules-editor/src/index.ts
index 410034ef8..dad373440 100644
--- a/ui/component/or-rules-editor/src/index.ts
+++ b/ui/component/or-rules-editor/src/index.ts
@@ -6,7 +6,7 @@ import {
AssetDescriptor,
AttributeDescriptor,
AttributeValueDescriptor,
- BaseAssetQueryOperator,
+ AssetQueryOperator,
JsonRulesetDefinition,
LogicGroup,
MetaItemDescriptor,
@@ -646,7 +646,7 @@ class OrRulesEditor extends translate(i18next)(LitElement) {
return valuePredicate.predicates !== undefined && valuePredicate.predicates.length > 0 && valuePredicate.predicates.findIndex((p) => !p.match || p.value === undefined) === 0;
case "datetime":
case "number":
- return valuePredicate.operator !== undefined && valuePredicate.value !== undefined && (valuePredicate.operator !== BaseAssetQueryOperator.BETWEEN || valuePredicate.rangeValue !== undefined);
+ return valuePredicate.operator !== undefined && valuePredicate.value !== undefined && (valuePredicate.operator !== AssetQueryOperator.BETWEEN || valuePredicate.rangeValue !== undefined);
case "radial":
return valuePredicate.radius !== undefined && valuePredicate.lat !== undefined && valuePredicate.lng !== undefined;
case "rect":
diff --git a/ui/component/or-rules-editor/src/or-rule-asset-query.ts b/ui/component/or-rules-editor/src/or-rule-asset-query.ts
index b0e4bfeaa..a7feb42d2 100644
--- a/ui/component/or-rules-editor/src/or-rule-asset-query.ts
+++ b/ui/component/or-rules-editor/src/or-rule-asset-query.ts
@@ -3,8 +3,8 @@ import {
AttributeDescriptor,
AttributePredicate,
AttributeValueType,
- BaseAssetQueryMatch,
- BaseAssetQueryOperator,
+ AssetQueryMatch,
+ AssetQueryOperator,
NewAssetQuery,
ValuePredicateUnion,
ValueType,
@@ -87,7 +87,7 @@ class OrRuleAssetQuery extends LitElement {
case "datetime":
return html `<span>NOT IMPLEMENTED</span>`;
case "number":
- if (valuePredicate.operator === BaseAssetQueryOperator.BETWEEN) {
+ if (valuePredicate.operator === AssetQueryOperator.BETWEEN) {
return html`
<or-input required type="${InputType.NUMBER}" @or-input-changed="${(e: OrInputChangedEvent) => this.setValuePredicateProperty(valuePredicate, "value", e.detail.value)}" .assetType="${getAssetTypeFromQuery(this.query)}" .attributeName="${attributeName}" .attributeDescriptor="${descriptor}" .value="${valuePredicate.value ? valuePredicate.value : null}" ?readonly="${this.readonly}"></or-input>
<span style="display: inline-flex; align-items: center;">&</span>
@@ -200,7 +200,7 @@ class OrRuleAssetQuery extends LitElement {
};
}
- attributePredicate!.name.match = BaseAssetQueryMatch.EXACT;
+ attributePredicate!.name.match = AssetQueryMatch.EXACT;
attributePredicate!.name.value = attributeName;
this.dispatchEvent(new OrRuleChangedEvent());
this.requestUpdate();
@@ -277,13 +277,13 @@ class OrRuleAssetQuery extends LitElement {
switch (valuePredicate.predicateType) {
case "string":
switch (valuePredicate.match) {
- case BaseAssetQueryMatch.EXACT:
+ case AssetQueryMatch.EXACT:
return valuePredicate.negate ? AssetQueryOperator.NOT_EQUALS : AssetQueryOperator.EQUALS;
- case BaseAssetQueryMatch.BEGIN:
+ case AssetQueryMatch.BEGIN:
return valuePredicate.negate ? AssetQueryOperator.NOT_STARTS_WITH : AssetQueryOperator.STARTS_WITH;
- case BaseAssetQueryMatch.END:
+ case AssetQueryMatch.END:
return valuePredicate.negate ? AssetQueryOperator.NOT_ENDS_WITH : AssetQueryOperator.ENDS_WITH;
- case BaseAssetQueryMatch.CONTAINS:
+ case AssetQueryMatch.CONTAINS:
return valuePredicate.negate ? AssetQueryOperator.NOT_CONTAINS : AssetQueryOperator.CONTAINS;
}
return;
@@ -294,17 +294,17 @@ class OrRuleAssetQuery extends LitElement {
case "datetime":
case "number":
switch (valuePredicate.operator) {
- case BaseAssetQueryOperator.EQUALS:
+ case AssetQueryOperator.EQUALS:
return valuePredicate.negate ? AssetQueryOperator.NOT_EQUALS : AssetQueryOperator.EQUALS;
- case BaseAssetQueryOperator.GREATER_THAN:
+ case AssetQueryOperator.GREATER_THAN:
return valuePredicate.negate ? AssetQueryOperator.LESS_EQUALS : AssetQueryOperator.GREATER_THAN;
- case BaseAssetQueryOperator.GREATER_EQUALS:
+ case AssetQueryOperator.GREATER_EQUALS:
return valuePredicate.negate ? AssetQueryOperator.LESS_THAN : AssetQueryOperator.GREATER_EQUALS;
- case BaseAssetQueryOperator.LESS_THAN:
+ case AssetQueryOperator.LESS_THAN:
return valuePredicate.negate ? AssetQueryOperator.GREATER_EQUALS : AssetQueryOperator.LESS_THAN;
- case BaseAssetQueryOperator.LESS_EQUALS:
+ case AssetQueryOperator.LESS_EQUALS:
return valuePredicate.negate ? AssetQueryOperator.GREATER_THAN : AssetQueryOperator.LESS_EQUALS;
- case BaseAssetQueryOperator.BETWEEN:
+ case AssetQueryOperator.BETWEEN:
return valuePredicate.negate ? AssetQueryOperator.NOT_BETWEEN : AssetQueryOperator.BETWEEN;
}
return;
@@ -438,7 +438,7 @@ class OrRuleAssetQuery extends LitElement {
predicate = {
predicateType: "string",
negate: value === AssetQueryOperator.NOT_STARTS_WITH,
- match: BaseAssetQueryMatch.BEGIN
+ match: AssetQueryMatch.BEGIN
};
}
break;
@@ -448,7 +448,7 @@ class OrRuleAssetQuery extends LitElement {
predicate = {
predicateType: "string",
negate: value === AssetQueryOperator.NOT_ENDS_WITH,
- match: BaseAssetQueryMatch.END
+ match: AssetQueryMatch.END
};
}
break;
@@ -458,14 +458,14 @@ class OrRuleAssetQuery extends LitElement {
if (valueType === ValueType.NUMBER) {
predicate = {
predicateType: "number",
- operator: BaseAssetQueryOperator.BETWEEN,
+ operator: AssetQueryOperator.BETWEEN,
negate: true
};
} else {
// Assume datetime
predicate = {
predicateType: "datetime",
- operator: BaseAssetQueryOperator.BETWEEN,
+ operator: AssetQueryOperator.BETWEEN,
negate: true
};
}
@@ -480,13 +480,13 @@ class OrRuleAssetQuery extends LitElement {
if (valueType === ValueType.NUMBER) {
predicate = {
predicateType: "number",
- operator: key as BaseAssetQueryOperator
+ operator: key as AssetQueryOperator
};
} else {
// Assume datetime
predicate = {
predicateType: "datetime",
- operator: key as BaseAssetQueryOperator
+ operator: key as AssetQueryOperator
};
}
break;
@@ -498,19 +498,19 @@ class OrRuleAssetQuery extends LitElement {
predicate = {
predicateType: "datetime",
negate: value === AssetQueryOperator.NOT_EQUALS,
- operator: BaseAssetQueryOperator.EQUALS
+ operator: AssetQueryOperator.EQUALS
};
} else if (valueType === ValueType.NUMBER) {
predicate = {
predicateType: "number",
negate: value === AssetQueryOperator.NOT_EQUALS,
- operator: BaseAssetQueryOperator.EQUALS
+ operator: AssetQueryOperator.EQUALS
};
} else if (valueType === ValueType.STRING) {
predicate = {
predicateType: "string",
negate: value === AssetQueryOperator.NOT_EQUALS,
- match: BaseAssetQueryMatch.EXACT
+ match: AssetQueryMatch.EXACT
};
}
break;
@@ -535,7 +535,7 @@ class OrRuleAssetQuery extends LitElement {
predicate = {
predicateType: "string",
negate: value === AssetQueryOperator.NOT_CONTAINS,
- match: BaseAssetQueryMatch.CONTAINS
+ match: AssetQueryMatch.CONTAINS
};
}
}
diff --git a/ui/component/or-rules-editor/src/or-rule-condition.ts b/ui/component/or-rules-editor/src/or-rule-condition.ts
index 60f13b3e8..1e0982422 100644
--- a/ui/component/or-rules-editor/src/or-rule-condition.ts
+++ b/ui/component/or-rules-editor/src/or-rule-condition.ts
@@ -1,6 +1,6 @@
import {customElement, html, LitElement, TemplateResult, property} from "lit-element";
import {
- BaseAssetQueryMatch,
+ AssetQueryMatch,
RuleCondition,
AssetDescriptor,
} from "@openremote/model";
@@ -163,7 +163,7 @@ class OrRuleCondition extends LitElement {
if (!this.ruleCondition!.assets!.types || this.ruleCondition!.assets!.types.length === 0) {
this.ruleCondition!.assets!.types = [{
predicateType: "string",
- match: BaseAssetQueryMatch.EXACT
+ match: AssetQueryMatch.EXACT
}];
}
diff --git a/ui/component/or-smart-notify/src/index.ts b/ui/component/or-smart-notify/src/index.ts
index 5d7f8e195..8eb49aaa5 100644
--- a/ui/component/or-smart-notify/src/index.ts
+++ b/ui/component/or-smart-notify/src/index.ts
@@ -7,7 +7,7 @@ import {faClock} from "@fortawesome/free-regular-svg-icons";
import {faTimes} from "@fortawesome/free-solid-svg-icons";
import REST from "@openremote/rest";
-import {AssetQuery, BaseAssetQueryInclude} from "@openremote/model";
+import {AssetQuery, AssetQueryInclude} from "@openremote/model";
import openremote from "@openremote/core";
@customElement("or-smart-notify")
@@ -51,7 +51,7 @@ class OrSmartNotify extends LitElement {
return new Promise((resolve: any, reject: any) => {
const smartNotifyQuery: AssetQuery = {
name: {predicateType: "string", value: "SMART_NOTIFY_ASSET"},
- select: {include: BaseAssetQueryInclude.ALL_EXCEPT_PATH}
+ select: {include: AssetQueryInclude.ALL_EXCEPT_PATH}
};
REST.api.AssetResource.queryAssets(smartNotifyQuery).then((response: any) => {
console.log("Setting Smart Notify");
diff --git a/ui/demo/demo-core/src/util.ts b/ui/demo/demo-core/src/util.ts
index 427cb4ac9..679bd5700 100644
--- a/ui/demo/demo-core/src/util.ts
+++ b/ui/demo/demo-core/src/util.ts
@@ -1,20 +1,20 @@
-import {Asset, AssetQuery, BaseAssetQueryMatch, BaseAssetQueryInclude} from "@openremote/model";
+import {Asset, AssetQuery, AssetQueryMatch, AssetQueryInclude} from "@openremote/model";
import rest from "@openremote/rest";
export async function getApartment1Asset(): Promise<Asset | undefined> {
const query: AssetQuery = {
name: {
predicateType: "string",
- match: BaseAssetQueryMatch.EXACT,
+ match: AssetQueryMatch.EXACT,
value: "Apartment 1"
},
type: {
predicateType: "string",
- match: BaseAssetQueryMatch.EXACT,
+ match: AssetQueryMatch.EXACT,
value: "urn:openremote:asset:residence"
},
select: {
- include: BaseAssetQueryInclude.ONLY_ID_AND_NAME
+ include: AssetQueryInclude.ONLY_ID_AND_NAME
}
};
diff --git a/ui/demo/demo-or-thermostat/src/index.ts b/ui/demo/demo-or-thermostat/src/index.ts
index 584aa77e6..679e3f5de 100644
--- a/ui/demo/demo-or-thermostat/src/index.ts
+++ b/ui/demo/demo-or-thermostat/src/index.ts
@@ -5,8 +5,8 @@ import "@openremote/or-thermostat";
import {
AssetQuery,
AttributeEvent,
- BaseAssetQueryInclude,
- BaseAssetQueryMatch,
+ AssetQueryInclude,
+ AssetQueryMatch,
EventSubscription,
Asset
} from "@openremote/model";
@@ -17,7 +17,7 @@ async function initApartment1Asset(): Promise<string|undefined> {
let query: AssetQuery = {
name: {
predicateType: "string",
- match: BaseAssetQueryMatch.EXACT,
+ match: AssetQueryMatch.EXACT,
value: "Living Room"
},
parent: {
@@ -25,11 +25,11 @@ async function initApartment1Asset(): Promise<string|undefined> {
},
type: {
predicateType: "string",
- match: BaseAssetQueryMatch.EXACT,
+ match: AssetQueryMatch.EXACT,
value: "urn:openremote:asset:room"
},
select: {
- include: BaseAssetQueryInclude.ONLY_ID_AND_NAME
+ include: AssetQueryInclude.ONLY_ID_AND_NAME
}
};