-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Desktop] Startup maintenance screen #2253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you attach some example screenshots and the UX flow of this feature?
100% - was the first thing I started doing after drafting. 😄 |
c787006
to
4ee9360
Compare
1fc2978
to
230a602
Compare
Add maint screen to router Add desktop screen to router
Fix terminal opts nit
…-Org/ComfyUI_frontend into desktop-maintenance-screen
} | ||
|
||
/** State of a maintenance task, managed by the maintenance task store. */ | ||
export interface MaintenanceTaskState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify states to following structure and make these boolean fields computed getter.
export enum TaskState {
Idle = 'idle',
Loading = 'loading',
Executing = 'executing',
Error = 'error',
Warning = 'warning',
OK = 'OK',
Skipped = 'skipped',
Resolved = 'resolved'
}
/** State of a maintenance task, managed by the maintenance task store. */
export interface MaintenanceTaskState {
/** The current state of the task. */
taskState: TaskState
/** `true` if the task has been resolved (was `error`, now `OK`). */
resolved: boolean
/** Whether the task state is currently being refreshed. */
loading: boolean
/** Whether the task is currently running. */
executing: boolean
/** The error message that occurred when the task failed. */
error?: string
}
export class MaintenanceTaskStateImpl implements MaintenanceTaskState {
taskState: TaskState = TaskState.Idle
error?: string
constructor(public readonly task: MaintenanceTask) {}
get resolved(): boolean {
return this.taskState === TaskState.Resolved
}
get loading(): boolean {
return this.taskState === TaskState.Loading
}
get executing(): boolean {
return this.taskState === TaskState.Executing
}
get hasError(): boolean {
return this.taskState === TaskState.Error
}
async execute() {
try {
this.taskState = TaskState.Executing
const success = await this.task.execute()
if (!success) return false
this.error = undefined
this.taskState = TaskState.OK
return true
} catch (error) {
this.error = (error as Error)?.message
this.taskState = TaskState.Error
throw error
}
}
}
/**
* Updates the task list with the latest validation state.
* @param update Update details passed in by electron
*/
const processUpdate = (update: InstallValidation) => {
// Update each task state
for (const task of DESKTOP_MAINTENANCE_TASKS) {
const state = getState(task)
if (update[task.id] === undefined) {
state.taskState = TaskState.Loading
continue
}
if (state.taskState === TaskState.Error && update[task.id] === 'OK') {
state.taskState = TaskState.Resolved
} else {
state.taskState = update[task.id] as TaskState
}
}
// Final update
if (!update.inProgress) {
for (const task of DESKTOP_MAINTENANCE_TASKS) {
const state = getState(task)
state.taskState = update[task.id] as TaskState ?? TaskState.Skipped
}
}
}
Desktop startup validation
Detects problems with the installation when loading, allowing users to easily resolve several issues without needing to load a terminal and type out lengthy commands.
Fix typo in base_path, and missing pyyaml
base-path-venv.mp4
Edit: Pending updates.
┆Issue is synchronized with this Notion page by Unito