-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-ui): process input demands dispatched on the bus
- Loading branch information
Showing
28 changed files
with
367 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/flows/results/test_wireless/wireless_flow/window-rpi-001.hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// window-rpi-001 | ||
37ce32a12a80915276ecbf3176fdf9162f152f74a9f67e34e1df640f48e3f741 | ||
80d7df0e74ea16d07c0fb984760f5e350ce2ecc0781f18978019ea833206e795 |
2 changes: 1 addition & 1 deletion
2
tests/flows/results/test_wireless/wireless_flow/window-rpi-002.hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// window-rpi-002 | ||
37ce32a12a80915276ecbf3176fdf9162f152f74a9f67e34e1df640f48e3f741 | ||
80d7df0e74ea16d07c0fb984760f5e350ce2ecc0781f18978019ea833206e795 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,45 @@ | ||
# ruff: noqa: D100, D101, D102, D103, D104, D107 | ||
from __future__ import annotations | ||
|
||
from dataclasses import replace | ||
from typing import TYPE_CHECKING | ||
|
||
from redux import InitAction, InitializationActionError | ||
|
||
from ubo_app.store.operations import ( | ||
InputAction, | ||
InputDemandAction, | ||
InputProvideAction, | ||
) | ||
from ubo_app.store.services.web_ui import WebUIState | ||
|
||
if TYPE_CHECKING: | ||
from redux import BaseAction, ReducerResult | ||
from redux import ReducerResult | ||
|
||
|
||
def reducer( | ||
state: None, | ||
action: BaseAction, | ||
) -> ReducerResult[None, None, None]: | ||
_ = action | ||
state: WebUIState | None, | ||
action: InputAction, | ||
) -> WebUIState | ReducerResult[WebUIState, None, None]: | ||
if state is None: | ||
if isinstance(action, InitAction): | ||
return WebUIState(active_inputs=[]) | ||
raise InitializationActionError(action) | ||
|
||
if isinstance(action, InputDemandAction): | ||
return replace( | ||
state, | ||
active_inputs=[*state.active_inputs, action.description], | ||
) | ||
|
||
if isinstance(action, InputProvideAction): | ||
return replace( | ||
state, | ||
active_inputs=[ | ||
description | ||
for description in state.active_inputs | ||
if description.id != action.id | ||
], | ||
) | ||
|
||
return state |
Oops, something went wrong.