mirror of
https://github.com/esphome/esphome.git
synced 2025-10-23 20:23:50 +01:00
[web_server] v3 entity grouping (#6833)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -44,6 +44,12 @@ struct UrlMatch {
|
||||
|
||||
struct SortingComponents {
|
||||
float weight;
|
||||
uint64_t group_id;
|
||||
};
|
||||
|
||||
struct SortingGroup {
|
||||
std::string name;
|
||||
float weight;
|
||||
};
|
||||
|
||||
enum JsonDetail { DETAIL_ALL, DETAIL_STATE };
|
||||
@@ -337,7 +343,8 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
|
||||
/// This web handle is not trivial.
|
||||
bool isRequestHandlerTrivial() override; // NOLINT(readability-identifier-naming)
|
||||
|
||||
void add_entity_to_sorting_list(EntityBase *entity, float weight);
|
||||
void add_entity_config(EntityBase *entity, float weight, uint64_t group);
|
||||
void add_sorting_group(uint64_t group_id, const std::string &group_name, float weight);
|
||||
|
||||
protected:
|
||||
void schedule_(std::function<void()> &&f);
|
||||
@@ -346,6 +353,8 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
|
||||
AsyncEventSource events_{"/events"};
|
||||
ListEntitiesIterator entities_iterator_;
|
||||
std::map<EntityBase *, SortingComponents> sorting_entitys_;
|
||||
std::map<uint64_t, SortingGroup> sorting_groups_;
|
||||
|
||||
#if USE_WEBSERVER_VERSION == 1
|
||||
const char *css_url_{nullptr};
|
||||
const char *js_url_{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user