-
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.
- Loading branch information
Showing
14 changed files
with
317 additions
and
94 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
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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
'users', | ||
'voice', | ||
'vscode', | ||
'web_ui', | ||
'wifi', | ||
] | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# ruff: noqa: D100, D101, D102, D103, D104, D107 | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from redux import BaseAction, ReducerResult | ||
|
||
|
||
def reducer( | ||
state: None, | ||
action: BaseAction, | ||
) -> ReducerResult[None, None, None]: | ||
_ = action | ||
return state |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Implementation of the web-ui service.""" | ||
|
||
import asyncio | ||
from pathlib import Path | ||
|
||
from quart import Quart | ||
from redux import FinishEvent | ||
|
||
from ubo_app.constants import WEB_UI_DEBUG_MODE, WEB_UI_LISTEN_HOST, WEB_UI_LISTEN_PORT | ||
from ubo_app.store.main import store | ||
|
||
|
||
async def init_service() -> None: | ||
"""Initialize the web-ui service.""" | ||
app = Quart('ubo-app') | ||
app.debug = False | ||
shutdown_event: asyncio.Event = asyncio.Event() | ||
|
||
@app.get('/') | ||
async def hello_world() -> str: | ||
return (Path(__file__).parent / 'static' / 'index.html').read_text() | ||
|
||
store.subscribe_event(FinishEvent, shutdown_event.set) | ||
|
||
async def wait_for_shutdown() -> None: | ||
await shutdown_event.wait() | ||
|
||
await app.run_task( | ||
host=WEB_UI_LISTEN_HOST, | ||
port=WEB_UI_LISTEN_PORT, | ||
debug=WEB_UI_DEBUG_MODE, | ||
shutdown_trigger=wait_for_shutdown, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<title>ubo - web-ui</title> | ||
|
||
<body> | ||
<p>Hello World!</p> | ||
</body> | ||
|
||
</html> |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# ruff: noqa: D100, D101, D102, D103, D104, D107, N999 | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from ubo_handle import Service, register | ||
|
||
|
||
async def setup(service: Service) -> None: | ||
from reducer import reducer | ||
from setup import init_service | ||
|
||
service.register_reducer(reducer) | ||
await init_service() | ||
|
||
|
||
register( | ||
service_id='web_ui', | ||
label='Web UI', | ||
setup=setup, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ruff: noqa: D100, D101, D102, D103, D104, D107, N999 | ||
from __future__ import annotations | ||
|
||
from immutable import Immutable | ||
|
||
|
||
class WebUIState(Immutable): ... |
Oops, something went wrong.