-
Notifications
You must be signed in to change notification settings - Fork 1
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
17 changed files
with
169 additions
and
154 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from blitz.ui.blitz_ui import BlitzUI, get_blitz_ui | ||
|
||
|
||
class BaseComponent: | ||
def __init__(self, blitz_ui: BlitzUI = get_blitz_ui()) -> None: | ||
self.blitz_ui: BlitzUI = blitz_ui | ||
self.current_project = blitz_ui.current_project | ||
self.current_app = blitz_ui.current_app |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from .blitz_file import BlitzFilePage | ||
from .dashboard import DashboardPage | ||
from .diagram import MermaidPage | ||
from .gpt_builder import AskGPTPage | ||
from .log import LogPage | ||
from .swagger import SwaggerPage | ||
|
||
__all__ = ["BlitzFilePage", "DashboardPage", "MermaidPage", "AskGPTPage", "LogPage", "SwaggerPage"] |
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,41 @@ | ||
from typing import Any, Self | ||
from blitz.ui.components.base import BaseComponent | ||
from nicegui import ui | ||
from starlette.requests import Request | ||
|
||
from blitz.ui.components.header import FrameComponent | ||
|
||
|
||
class BasePage(BaseComponent): | ||
PAGE_NAME = "Blitz Dashboard" | ||
FRAME: FrameComponent | ||
|
||
def __init__(self) -> None: | ||
super().__init__() | ||
self.setup() | ||
self.render() | ||
self.frame() | ||
|
||
def __new__(cls, *args: Any, **kwargs: Any) -> Self: | ||
instance = super().__new__(cls, *args, **kwargs) | ||
if not hasattr(instance, "FRAME"): | ||
instance.FRAME = FrameComponent() | ||
return instance | ||
|
||
def frame(self) -> None: | ||
"""The frame method HAVE to render a frame.""" | ||
if self.FRAME is not None: | ||
self.FRAME.render() | ||
|
||
def setup(self) -> None: | ||
"""The setup method is called before the render method.""" | ||
pass | ||
|
||
def render(self) -> None: | ||
ui.label("Base Page") | ||
|
||
@classmethod | ||
def entrypoint(cls, request: Request) -> None: | ||
print(request.url.path) | ||
ui.page_title(cls.PAGE_NAME) | ||
cls() |
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,14 +1,13 @@ | ||
from blitz.ui.blitz_ui import BlitzUI, get_blitz_ui | ||
from blitz.ui.components.json_editor import BlitzFileEditorComponent | ||
|
||
from blitz.ui.pages.base import BasePage | ||
|
||
class BlitzFilePage: | ||
def __init__(self, blitz_ui: BlitzUI = get_blitz_ui(), project: str | None = None) -> None: | ||
self.blitz_ui = blitz_ui | ||
self.blitz_app = blitz_ui.current_app | ||
|
||
def render_page(self) -> None: | ||
if self.blitz_app is None: | ||
class BlitzFilePage(BasePage): | ||
PAGE_NAME = "Blitz File" | ||
|
||
def render(self) -> None: | ||
if self.blitz_ui.current_app is None: | ||
# TODO handle error | ||
raise Exception | ||
BlitzFileEditorComponent(self.blitz_app.file.raw_file).render() | ||
BlitzFileEditorComponent(self.blitz_ui.current_app.file.raw_file).render() |
Oops, something went wrong.