Skip to content

armgit / core

Public Imported from GitHub
0

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

Add sorting to map card attributes and json rules assettype menu

Don1ffd4fa4e662
diff --git a/ui/component/or-map/src/or-map-asset-card.ts b/ui/component/or-map/src/or-map-asset-card.ts
index d53e5c145..e0ceca57a 100644
--- a/ui/component/or-map/src/or-map-asset-card.ts
+++ b/ui/component/or-map/src/or-map-asset-card.ts
@@ -132,7 +132,8 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {
const excludedAttributes = cardConfig && cardConfig.exclude ? cardConfig.exclude : [];
const attrs = attributes.filter((attr) =>
(!includedAttributes || includedAttributes.indexOf(attr.name!) >= 0)
- && (!excludedAttributes || excludedAttributes.indexOf(attr.name!) < 0));
+ && (!excludedAttributes || excludedAttributes.indexOf(attr.name!) < 0))
+ .sort(Util.sortByString((listItem) => listItem.name!));
return html`
<div id="card-container" style="${styleStr}">
diff --git a/ui/component/or-rules/src/json-viewer/or-rule-condition.ts b/ui/component/or-rules/src/json-viewer/or-rule-condition.ts
index 87a64d5f3..d338a0faa 100644
--- a/ui/component/or-rules/src/json-viewer/or-rule-condition.ts
+++ b/ui/component/or-rules/src/json-viewer/or-rule-condition.ts
@@ -40,7 +40,8 @@ export function getWhenTypesMenu(config?: RulesConfig, assetInfos?: AssetTypeInf
icon: icon ? icon : AssetModelUtil.getAssetDescriptorIcon(WellknownAssets.THINGASSET),
styleMap: styleMap
} as MenuItem;
- }));
+ })
+ .sort(Util.sortByString((listItem) => listItem.value!)));
}
if (addTimer) {