Skip to content

Commit

Permalink
Fix for rule editor. Has fallback AttributeValueType for attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Miggets7 committed Dec 18, 2019
1 parent c10ce3f commit 1399d09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ui/component/or-attribute-input/src/index.ts
Expand Up @@ -35,7 +35,7 @@ export function getAttributeValueTemplate(
let valueDescriptor: AttributeValueDescriptor | undefined; let valueDescriptor: AttributeValueDescriptor | undefined;


attributeDescriptor = AssetModelUtil.getAttributeDescriptorFromAsset(attribute.name!, assetType); attributeDescriptor = AssetModelUtil.getAttributeDescriptorFromAsset(attribute.name!, assetType);
valueDescriptor = AssetModelUtil.getAttributeValueDescriptorFromAsset(attributeDescriptor && attributeDescriptor.valueDescriptor ? attributeDescriptor.valueDescriptor.name : attribute ? attribute.type as string : undefined, assetType, attribute.name); valueDescriptor = AssetModelUtil.getAttributeValueDescriptorFromAsset(attributeDescriptor && attributeDescriptor.valueDescriptor ? attributeDescriptor.valueDescriptor.name : attribute && attribute.type ? attribute.type.name : undefined, assetType, attribute.name);


if (customProvider) { if (customProvider) {
template = customProvider(assetType, attribute, attributeDescriptor, valueDescriptor, (newValue: any) => valueChangedCallback(newValue), readonly, disabled); template = customProvider(assetType, attribute, attributeDescriptor, valueDescriptor, (newValue: any) => valueChangedCallback(newValue), readonly, disabled);
Expand Down
10 changes: 5 additions & 5 deletions ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts
Expand Up @@ -189,22 +189,22 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {


switch (valuePredicate.predicateType) { switch (valuePredicate.predicateType) {
case "string": case "string":
return getAttributeValueTemplate(assetType, { name: attributeName! }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("string"))(value); return getAttributeValueTemplate(assetType, { name: attributeName!, type: AttributeValueType.STRING }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("string"))(value);
case "boolean": case "boolean":
return html ``; // Handled by the operator IS_TRUE or IS_FALSE return html ``; // Handled by the operator IS_TRUE or IS_FALSE
case "datetime": case "datetime":
return html `<span>NOT IMPLEMENTED</span>`; return html `<span>NOT IMPLEMENTED</span>`;
case "number": case "number":
if (valuePredicate.operator === AQO.BETWEEN) { if (valuePredicate.operator === AQO.BETWEEN) {
const inputTemplate1 = getAttributeValueTemplate(assetType, { name: attributeName! }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("between")); const inputTemplate1 = getAttributeValueTemplate(assetType, { name: attributeName!, type: AttributeValueType.NUMBER }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("between"));
const inputTemplate2 = getAttributeValueTemplate(assetType, { name: attributeName! }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "rangeValue", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("and")); const inputTemplate2 = getAttributeValueTemplate(assetType, { name: attributeName!, type: AttributeValueType.NUMBER }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "rangeValue", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("and"));
return html` return html`
${inputTemplate1(value)} ${inputTemplate1(value)}
<span style="display: inline-flex; align-items: center;">&</span> <span style="display: inline-flex; align-items: center;">&</span>
${inputTemplate2(valuePredicate.rangeValue)} ${inputTemplate2(valuePredicate.rangeValue)}
`; `;
} }
return getAttributeValueTemplate(assetType, { name: attributeName! }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("number"))(value); return getAttributeValueTemplate(assetType, { name: attributeName!, type: AttributeValueType.NUMBER }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("number"))(value);
case "string-array": case "string-array":
return html `<span>NOT IMPLEMENTED</span>`; return html `<span>NOT IMPLEMENTED</span>`;
case "radial": case "radial":
Expand All @@ -220,7 +220,7 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {
case "array": case "array":
// TODO: Update once we can determine inner type of array // TODO: Update once we can determine inner type of array
// Assume string array // Assume string array
return getAttributeValueTemplate(assetType, {name: attributeName!}, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, InputType.TEXT, undefined)(value); return getAttributeValueTemplate(assetType, {name: attributeName!, type: AttributeValueType.ARRAY }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, InputType.TEXT, undefined)(value);
default: default:
return html `<span>NOT IMPLEMENTED</span>`; return html `<span>NOT IMPLEMENTED</span>`;
} }
Expand Down

0 comments on commit 1399d09

Please sign in to comment.