Merge pull request #4895 from scop/sort-available-events

Sort list of available events
This commit is contained in:
Bram Kragten 2020-02-17 21:15:08 +01:00 committed by GitHub
commit 52ea3a5ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import { html } from "@polymer/polymer/lib/utils/html-tag"; import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element"; import { PolymerElement } from "@polymer/polymer/polymer-element";
import { compare } from "../../../common/string/compare";
import { EventsMixin } from "../../../mixins/events-mixin"; import { EventsMixin } from "../../../mixins/events-mixin";
import LocalizeMixin from "../../../mixins/localize-mixin"; import LocalizeMixin from "../../../mixins/localize-mixin";
@ -58,7 +59,7 @@ class EventsList extends EventsMixin(LocalizeMixin(PolymerElement)) {
super.connectedCallback(); super.connectedCallback();
this.hass.callApi("GET", "events").then( this.hass.callApi("GET", "events").then(
function(events) { function(events) {
this.events = events; this.events = events.sort((e1, e2) => compare(e1.event, e2.event));
}.bind(this) }.bind(this)
); );
} }