Skip to content
Permalink
Browse files

UI updates: or-rules styling and bug fixes

  • Loading branch information
richturner committed Dec 1, 2019
1 parent e036749 commit 13f3cd6a028891d0fced5368b8f51266afd74c60
@@ -130,12 +130,12 @@ export class OrRuleActionAttribute extends translate(i18next)(LitElement) {
}

inputTemplate = getAttributeValueTemplate(assetType, attribute, this.readonly || false, false, (v: any) => this.setActionAttributeValue(v), this.config ? this.config.inputProvider : undefined, undefined,
(attribute.type && (attribute.type.valueType == ValueType.BOOLEAN || attribute.type == AttributeValueType.BOOLEAN.name || attribute.type == AttributeValueType.SWITCH_TOGGLE.name)) ? `` : i18next.t("value"));
(attribute.type && (attribute.type.valueType === ValueType.BOOLEAN || attribute.type === AttributeValueType.BOOLEAN.name || attribute.type === AttributeValueType.SWITCH_TOGGLE.name)) ? "" : i18next.t("value"));
}

return html`
<or-input id="matchSelect" .label="${i18next.t("asset")}" type="${InputType.SELECT}" @or-input-changed="${(e: OrInputChangedEvent) => this._assetId = (e.detail.value)}" ?readonly="${this.readonly}" .options="${idOptions}" .value="${idValue}"></or-input>
<or-input id="attributeSelect" .label="${i18next.t("attribute")}" type="${InputType.SELECT}" @or-input-changed="${(e: OrInputChangedEvent) => this.setActionAttributeName(e.detail.value)}" ?readonly="${this.readonly}" .options="${attributes}" .value="${this.action.attributeName}"></or-input>
<or-input id="matchSelect" .label="${i18next.t("asset")}" .type="${InputType.SELECT}" @or-input-changed="${(e: OrInputChangedEvent) => this._assetId = (e.detail.value)}" ?readonly="${this.readonly}" .options="${idOptions}" .value="${idValue}"></or-input>
<or-input id="attributeSelect" .label="${i18next.t("attribute")}" .type="${InputType.SELECT}" @or-input-changed="${(e: OrInputChangedEvent) => this.setActionAttributeName(e.detail.value)}" ?readonly="${this.readonly}" .options="${attributes}" .value="${this.action.attributeName}"></or-input>
${inputTemplate ? inputTemplate(this.action.value) : ``}
`;
}
@@ -181,7 +181,7 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {
<div class="attribute-editor">
<or-input type="${InputType.SELECT}" @or-input-changed="${(e: OrSelectChangedEvent) => this.setAttributeName(attributePredicate, e.detail.value)}" ?readonly="${this.readonly}" .options="${attributes}" .value="${attributeName}" .label="${i18next.t("attribute")}"></or-input>
${attributeName ? html`<or-input type="${InputType.SELECT}" @or-input-changed="${(e: OrSelectChangedEvent) => this.setOperator(assetDescriptor, attribute, attributeName, attributePredicate, e.detail.value)}" ?readonly="${this.readonly}" .options="${operators}" .value="${i18next.t("operator")}" .label="${i18next.t("Operator")}"></or-input>` : ``}
${attributeName ? html`<or-input type="${InputType.SELECT}" @or-input-changed="${(e: OrSelectChangedEvent) => this.setOperator(assetDescriptor, attribute, attributeName, attributePredicate, e.detail.value)}" ?readonly="${this.readonly}" .options="${operators}" .value="${operator}" .label="${i18next.t("operator")}"></or-input>` : ``}
${attributePredicate ? this.attributePredicateValueEditorTemplate(assetDescriptor, attributePredicate) : ``}
</div>
@@ -101,7 +101,11 @@ export class OrRuleJsonViewer extends translate(i18next)(LitElement) implements

if (!ruleset.rules) {
// New ruleset so start a new rule
this._rule = {};
if (this.config && this.config.json && this.config.json.rule) {
this._rule = JSON.parse(JSON.stringify(this.config.json.rule)) as JsonRule;
} else {
this._rule = {};
}
} else {
try {
const rules = JSON.parse(ruleset.rules) as JsonRulesetDefinition;
@@ -331,7 +331,7 @@ class OrRuleThenOtherwise extends translate(i18next)(LitElement) {
action: "write-attribute"
};
let template: RuleActionUnion | undefined;
let templateConfig = this.config && this.config.json ? this.config.json : undefined;
const templateConfig = this.config && this.config.json ? this.config.json : undefined;

if (!otherwise) {
if (!this.rule.then) {
@@ -44,7 +44,7 @@ export const style = css`
min-height: var(--internal-or-rules-header-height);
height: var(--internal-or-rules-header-height);
z-index: 1;
padding: 0 20px;
padding: 10px 20px 0 20px;
--or-icon-fill: var(--internal-or-rules-panel-color);
}
@@ -105,7 +105,7 @@ export class OrRuleViewer extends translate(i18next)(LitElement) {
@property({attribute: false})
protected _supported = true;

@query("#rule-viewer")
@query("#rule-view")
public view?: RuleView;

protected _focusName = false;

0 comments on commit 13f3cd6

Please sign in to comment.
You can’t perform that action at this time.