Skip to content

Commit

Permalink
Fix event list
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Oct 23, 2023
1 parent 49340d2 commit 2bb2ba7
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions services/core/IEEE_2030_5/demo/webgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def df(self) -> pd.DataFrame:

class PropertyWrapper:
"""The PropertyWrapper class handles binding on behalf of the parent object.
The class handles the binding from/to and formatting/applying when sending the
object to the parent.
"""
Expand Down Expand Up @@ -169,10 +169,10 @@ def apply_to_parent(self):

def should_be_none(self) -> bool:
"""Answers the question whether the parent property should be None.
Loop over the backing object and if any of the fields are not None then
the answer is False. Otherwise the answer is True.
:return: True if all fields are None, False otherwise.
"""
for fld in fields(self.backing_obj):
Expand All @@ -191,16 +191,29 @@ def update_sessions():
client_session.verify = config.ieee_ca


def get_from_server(context: str, admin_request=False, deserialize=False):
def get_from_server(context: str,
admin_request=False,
deserialize=False,
start=None,
after=None,
limit=None):
if admin_request:
session = admin_session
else:
session = client_session

params = {}
if start is not None:
params["s"] = int(start)
if after is not None:
params["a"] = int(after)
if limit is not None:
params["l"] = int(limit)

if admin_request:
response = session.get(config.ieee_server + f"/admin/{context}")
response = session.get(config.ieee_server + f"/admin/{context}", params=params)
else:
response = session.get(config.ieee_server + f"/{context}")
response = session.get(config.ieee_server + f"/{context}", params=params)

if deserialize:
return xml_to_dataclass(response.text)
Expand Down Expand Up @@ -547,7 +560,8 @@ def do_refresh():
ui.notify("Refreshed")

control_list: m.DERControlList = get_from_server(program.DERControlListLink.href,
deserialize=True)
deserialize=True,
limit=1000)

#active_list: m.DERControlList = get_from_server(program.ActiveDERControlListLink.href, deserialize=True)

Expand Down

0 comments on commit 2bb2ba7

Please sign in to comment.