1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 22:32:21 +01:00

Dashboard editor live validation (#540)

* Dashboard editor validation

* Improve range detection

* Lint
This commit is contained in:
Otto Winter
2019-05-11 11:41:09 +02:00
committed by GitHub
parent e373620393
commit a1a7448868
7 changed files with 134 additions and 19 deletions

View File

@@ -233,15 +233,19 @@ class Config(OrderedDict):
return err
return None
def get_deepest_value_for_path(self, path):
# type: (ConfigPath) -> ConfigType
def get_deepest_document_range_for_path(self, path):
# type: (ConfigPath) -> Optional[ESPHomeDataBase]
data = self
doc_range = None
for item_index in path:
try:
data = data[item_index]
except (KeyError, IndexError, TypeError):
return data
return data
return doc_range
if isinstance(data, ESPHomeDataBase) and data.esp_range is not None:
doc_range = data.esp_range
return doc_range
def get_nested_item(self, path):
# type: (ConfigPath) -> ConfigType