(e=None)
| 108 | # ---------- Dashboard ---------- |
| 109 | |
| 110 | def show_dashboard(e=None): |
| 111 | nonlocal current_system |
| 112 | current_system = None |
| 113 | |
| 114 | page.appbar = None |
| 115 | page.clean() |
| 116 | |
| 117 | title = ft.Row( |
| 118 | [ft.Text(APP_NAME, size=32, weight=ft.FontWeight.BOLD)], |
| 119 | alignment=ft.MainAxisAlignment.CENTER, |
| 120 | ) |
| 121 | |
| 122 | systems_list: list[ft.Control] = [] |
| 123 | |
| 124 | def open_system(system_name: str): |
| 125 | show_system(system_name) |
| 126 | |
| 127 | def open_system_actions(system_name: str): |
| 128 | def do_open(e): |
| 129 | close_current_dialog() |
| 130 | show_system(system_name) |
| 131 | |
| 132 | async def do_clone(e): |
| 133 | close_current_dialog() |
| 134 | clone_system(system_name) |
| 135 | await asyncio.sleep(0) |
| 136 | show_dashboard() |
| 137 | |
| 138 | dlg = ft.AlertDialog( |
| 139 | modal=True, |
| 140 | title=ft.Text(system_name), |
| 141 | actions=[ |
| 142 | # ft.TextButton("Open", on_click=do_open), |
| 143 | ft.TextButton( |
| 144 | "Clone", |
| 145 | icon=ft.Icons.CONTENT_COPY, |
| 146 | on_click=do_clone, |
| 147 | ), |
| 148 | ft.TextButton( |
| 149 | "Delete", |
| 150 | icon=ft.Icons.DELETE_OUTLINE, |
| 151 | icon_color=ft.Colors.RED, |
| 152 | disabled=len(data) == 1, |
| 153 | on_click=lambda e: confirm_delete_system(system_name), |
| 154 | ), |
| 155 | ft.TextButton("Cancel", on_click=lambda e: close_current_dialog()), |
| 156 | ], |
| 157 | actions_alignment=ft.MainAxisAlignment.END, |
| 158 | ) |
| 159 | open_dialog(dlg) |
| 160 | |
| 161 | for system_name in data: |
| 162 | gesture = ft.GestureDetector( |
| 163 | content=ft.Container( |
| 164 | ft.Row( |
| 165 | [ft.Text(system_name, size=18, weight=ft.FontWeight.W_600)], |
| 166 | ), |
| 167 | padding=10, |
no test coverage detected