add manager update all control
Test, build, and deploy ComfyUI Jobs / test-build (push) Successful in 3m56s
Test, build, and deploy ComfyUI Jobs / deploy (push) Successful in 14s

This commit is contained in:
2026-10-03 09:54:20 +00:00
parent 4377c5d96e
commit 6b015d29b1
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<section class="jobs">
<div class="heading"><div><div class="eyebrow">REMOTE JOBS</div><h1>Job monitor</h1><p>Read-only view of the remote ComfyUI queue and history.</p></div><button class="refresh" type="button" (click)="reload()">Refresh</button></div>
<section class="server-card"><div class="server-heading"><div><div class="eyebrow">SERVER</div><h2>ComfyUI status</h2></div><span class="connection" [class.offline]="!server">{{server?'Connected':'Unavailable'}}</span></div><div class="server-error" *ngIf="serverError">{{serverError}}</div><div class="queue-panel" *ngIf="server"><div><strong>{{server.queue.total}}</strong><span>jobs queued</span></div><div><strong>{{server.queue.running}}</strong><span>running</span></div><div><strong>{{server.queue.pending}}</strong><span>waiting</span></div></div><div class="server-info" *ngIf="server"><div><span>Version</span><strong>{{server.version || 'Unknown'}}</strong></div><div><span>Operating system</span><strong>{{server.os || 'Unknown'}}</strong></div><div><span>Python</span><strong>{{server.pythonVersion || 'Unknown'}}</strong></div></div><div class="devices" *ngIf="server?.devices?.length"><div class="device" *ngFor="let device of server?.devices || []"><strong>{{device.name}}</strong><span>{{device.type}} · {{formatBytes(device.vramFree)}} free of {{formatBytes(device.vramTotal)}}</span></div></div>
<div class="manager-controls" *ngIf="user?.role==='admin'"><div class="manager-heading"><div><span>ComfyUI Manager {{manager?.managerVersion || '—'}}</span><strong>Runtime controls</strong></div><span *ngIf="manager">Current {{manager.currentVersion}}</span></div><div class="control-actions"><button type="button" (click)="runControl('restart')" [disabled]="!!controlBusy">{{controlBusy==='restart'?'Restarting…':'Restart ComfyUI'}}</button><button type="button" (click)="runControl('update')" [disabled]="!!controlBusy">{{controlBusy==='update'?'Updating…':'Update to latest'}}</button><select [value]="selectedVersion" (change)="selectedVersion=$any($event.target).value" [disabled]="!!controlBusy||!manager"><option value="" disabled>Choose version</option><option *ngFor="let version of manager?.versions || []" [value]="version">Switch to {{version}}</option></select><button type="button" (click)="runControl('switch')" [disabled]="!!controlBusy||!selectedVersion">{{controlBusy==='switch'?'Switching…':'Switch version'}}</button></div><div class="control-message" *ngIf="controlMessage">{{controlMessage}}</div></div>
<div class="manager-controls" *ngIf="user?.role==='admin'"><div class="manager-heading"><div><span>ComfyUI Manager {{manager?.managerVersion || '—'}}</span><strong>Runtime controls</strong></div><span *ngIf="manager">Current {{manager.currentVersion}}</span></div><div class="control-actions"><button type="button" (click)="runControl('restart')" [disabled]="!!controlBusy">{{controlBusy==='restart'?'Restarting…':'Restart ComfyUI'}}</button><button type="button" (click)="runControl('update-all')" [disabled]="!!controlBusy">{{controlBusy==='update-all'?'Updating everything…':'Update all'}}</button><button type="button" (click)="runControl('update')" [disabled]="!!controlBusy">{{controlBusy==='update'?'Updating…':'Update to latest'}}</button><select [value]="selectedVersion" (change)="selectedVersion=$any($event.target).value" [disabled]="!!controlBusy||!manager"><option value="" disabled>Choose version</option><option *ngFor="let version of manager?.versions || []" [value]="version">Switch to {{version}}</option></select><button type="button" (click)="runControl('switch')" [disabled]="!!controlBusy||!selectedVersion">{{controlBusy==='switch'?'Switching…':'Switch version'}}</button></div><div class="control-message" *ngIf="controlMessage">{{controlMessage}}</div></div>
</section>
<section class="running-card" *ngIf="runningJob"><div class="running-heading"><div><div class="eyebrow">CURRENTLY RUNNING</div><h2>{{runningJob.title}}</h2></div><span class="status running">running</span></div><div class="progress-track" [class.indeterminate]="!runningJob.progress"><div class="progress-value" [style.width.%]="runningJob.progress?.percent || 8"></div></div><div class="progress-label">{{runningJob.progress ? (runningJob.progress.percent + '% complete') : 'Working…'}}</div><div class="meta"><span>ID {{runningJob.promptId}}</span><span>Duration {{formatDuration(runningJob.durationMs)}}</span></div><div class="models" *ngIf="runningJob.models.length"><strong>Models</strong><span *ngFor="let model of runningJob.models" [title]="model.type">{{model.name}}</span></div></section>
<div class="notice" *ngIf="error">{{error}}</div><div class="loading" *ngIf="loading">Loading remote jobs…</div><div class="empty" *ngIf="!loading&&!error&&!jobs.length">No remote jobs were returned.</div>
+1 -1
View File
@@ -1,2 +1,2 @@
import { CommonModule } from '@angular/common'; import { Component,OnDestroy,inject } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { AuthService,AuthUser } from '../auth.service'; interface Asset{filename:string;url:string;type:string;width?:number|null;height?:number|null;sizeBytes?:number|null;} interface Model{nodeId:string;type:string;name:string;} interface Progress{value:number;max:number;percent:number;} interface Job{promptId:string;title:string;status:string;queuedAt:number|null;durationMs:number|null;outputCount:number;assets:Asset[];models:Model[];progress:Progress|null;} interface Device{name:string;type:string;vramTotal:number;vramFree:number;} interface ServerStatus{reachable:boolean;version:string;os:string;pythonVersion:string;devices:Device[];queue:{running:number;pending:number;total:number};} interface ManagerInfo{managerVersion:string;currentVersion:string;versions:string[];}
@Component({standalone:true,imports:[CommonModule],templateUrl:'./jobs.page.html',styleUrls:['./jobs.page.scss']}) export class JobsPage implements OnDestroy { jobs:Job[]=[];runningJob:Job|null=null;server:ServerStatus|null=null;manager:ManagerInfo|null=null;user:AuthUser|null=null;selectedVersion='';controlBusy='';controlMessage='';loading=true;error='';serverError='';private http=inject(HttpClient);private auth=inject(AuthService);private refreshTimer:ReturnType<typeof setInterval>;constructor(){this.auth.user$.subscribe(user=>this.user=user);this.refreshTimer=setInterval(()=>this.reload(false),5000);this.reload(true);}ngOnDestroy():void{clearInterval(this.refreshTimer);}reload(showLoading=true):void{if(showLoading)this.loading=true;this.error='';this.loadServerStatus();this.loadManager();this.http.get<{jobs:Job[];running:Job|null}>('/api/jobs').subscribe({next:x=>{this.jobs=x.jobs;this.runningJob=x.running;this.loadAssetMetadata(this.jobs);this.loading=false;},error:e=>{this.error=e.status===502?'ComfyUI is unavailable right now.':'Unable to load jobs.';this.loading=false;}});}loadAssetMetadata(jobs:Job[]):void{for(const job of jobs)for(const asset of job.assets)this.http.get<{width:number|null;height:number|null;sizeBytes:number|null}>(asset.url.replace('/api/assets?', '/api/assets/meta?')).subscribe({next:meta=>Object.assign(asset,meta)});}loadServerStatus():void{this.serverError='';this.http.get<{status:ServerStatus}>('/api/server-status').subscribe({next:x=>this.server=x.status,error:()=>{this.server=null;this.serverError='Unable to read server status';}});}loadManager():void{this.http.get<ManagerInfo>('/api/comfy/manager').subscribe({next:x=>{this.manager=x;if(!this.selectedVersion||!x.versions.includes(this.selectedVersion))this.selectedVersion=x.versions[0]||'';},error:()=>this.manager=null});}runControl(action:'restart'|'update'|'switch'):void{if(this.controlBusy||this.user?.role!=='admin')return;const labels={restart:'restart ComfyUI',update:'update ComfyUI',switch:`switch ComfyUI to ${this.selectedVersion}`};if(action==='switch'&&!this.selectedVersion)return;if(!window.confirm(`Are you sure you want to ${labels[action]}?`))return;this.controlBusy=action;this.controlMessage='';const request=action==='restart'?this.http.post('/api/comfy/restart',{}):action==='update'?this.http.post('/api/comfy/update',{}):this.http.post('/api/comfy/switch-version',{version:this.selectedVersion});request.subscribe({next:(x:any)=>{this.controlMessage=x?.message||'Request accepted.';this.controlBusy='';this.loadManager();},error:(e:any)=>{this.controlMessage=e?.error?.error||'Request failed.';this.controlBusy='';}});}formatDuration(value:number|null):string{if(value===null)return '—';const totalSeconds=Math.max(0,Math.round(value/1000));return `${Math.floor(totalSeconds/60)}m ${totalSeconds%60}s`;}formatBytes(value:number):string{if(!value)return '—';return `${(value/1073741824).toFixed(1)} GB`;}formatFileSize(value:number|null|undefined):string{if(!value)return '—';if(value<1024*1024)return `${(value/1024).toFixed(0)} KB`;return `${(value/1048576).toFixed(1)} MB`;}isVideo(asset:Asset):boolean{return asset.type==='video';}}
@Component({standalone:true,imports:[CommonModule],templateUrl:'./jobs.page.html',styleUrls:['./jobs.page.scss']}) export class JobsPage implements OnDestroy { jobs:Job[]=[];runningJob:Job|null=null;server:ServerStatus|null=null;manager:ManagerInfo|null=null;user:AuthUser|null=null;selectedVersion='';controlBusy='';controlMessage='';loading=true;error='';serverError='';private http=inject(HttpClient);private auth=inject(AuthService);private refreshTimer:ReturnType<typeof setInterval>;constructor(){this.auth.user$.subscribe(user=>this.user=user);this.refreshTimer=setInterval(()=>this.reload(false),5000);this.reload(true);}ngOnDestroy():void{clearInterval(this.refreshTimer);}reload(showLoading=true):void{if(showLoading)this.loading=true;this.error='';this.loadServerStatus();this.loadManager();this.http.get<{jobs:Job[];running:Job|null}>('/api/jobs').subscribe({next:x=>{this.jobs=x.jobs;this.runningJob=x.running;this.loadAssetMetadata(this.jobs);this.loading=false;},error:e=>{this.error=e.status===502?'ComfyUI is unavailable right now.':'Unable to load jobs.';this.loading=false;}});}loadAssetMetadata(jobs:Job[]):void{for(const job of jobs)for(const asset of job.assets)this.http.get<{width:number|null;height:number|null;sizeBytes:number|null}>(asset.url.replace('/api/assets?', '/api/assets/meta?')).subscribe({next:meta=>Object.assign(asset,meta)});}loadServerStatus():void{this.serverError='';this.http.get<{status:ServerStatus}>('/api/server-status').subscribe({next:x=>this.server=x.status,error:()=>{this.server=null;this.serverError='Unable to read server status';}});}loadManager():void{this.http.get<ManagerInfo>('/api/comfy/manager').subscribe({next:x=>{this.manager=x;if(!this.selectedVersion||!x.versions.includes(this.selectedVersion))this.selectedVersion=x.versions[0]||'';},error:()=>this.manager=null});}runControl(action:'restart'|'update'|'update-all'|'switch'):void{if(this.controlBusy||this.user?.role!=='admin')return;const labels={restart:'restart ComfyUI',update:'update ComfyUI', 'update-all':'update ComfyUI and all custom nodes',switch:`switch ComfyUI to ${this.selectedVersion}`};if(action==='switch'&&!this.selectedVersion)return;if(!window.confirm(`Are you sure you want to ${labels[action]}?`))return;this.controlBusy=action;this.controlMessage='';const request=action==='restart'?this.http.post('/api/comfy/restart',{}):action==='update'?this.http.post('/api/comfy/update',{}):action==='update-all'?this.http.post('/api/comfy/update-all',{}):this.http.post('/api/comfy/switch-version',{version:this.selectedVersion});request.subscribe({next:(x:any)=>{this.controlMessage=x?.message||'Request accepted.';this.controlBusy='';this.loadManager();},error:(e:any)=>{this.controlMessage=e?.error?.error||'Request failed.';this.controlBusy='';}});}formatDuration(value:number|null):string{if(value===null)return '—';const totalSeconds=Math.max(0,Math.round(value/1000));return `${Math.floor(totalSeconds/60)}m ${totalSeconds%60}s`;}formatBytes(value:number):string{if(!value)return '—';return `${(value/1073741824).toFixed(1)} GB`;}formatFileSize(value:number|null|undefined):string{if(!value)return '—';if(value<1024*1024)return `${(value/1024).toFixed(0)} KB`;return `${(value/1048576).toFixed(1)} MB`;}isVideo(asset:Asset):boolean{return asset.type==='video';}}