UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

62 lines 5.29 kB
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{Eo as t,Oo as n}from"./control-ui-core-Rwzhj6nO.js";import{J as r,K as i,X as a,q as o}from"./lit-runtime-CV_MH99K.js";import{Gt as s,Rt as c,Wt as l,Yt as u,en as d}from"./control-ui-core-vvcQQV2m.js";import{dn as f,fn as p,mn as m,un as h}from"./control-ui-boot-shared-CXVvK2AW.js";import{g,h as _}from"./control-ui-boot-new-Bj2SAUyl.js";function v(e){if(!e)return``;switch(e.kind){case`gateway`:return`gateway`;case`profile`:return`profile:${e.profileId}`;case`device`:return`device:${e.deviceId}`}throw Error(`Unknown session placement move target`)}function y(e){if(b)return Promise.resolve(null);b=!0;let n=document.createElement(`div`);return document.body.append(n),new Promise(i=>{let s=!0,c=null,u={profiles:[],devices:[]},h=e.mode===`move`?{kind:`gateway`}:null,g=new _,y=e=>{r(o,n),n.remove(),b=!1,i(e)},x=e=>{h=e,C()},S=e=>{if(e.preventDefault(),!h)return;if(h.kind!==`profile`){y(h);return}let t=g.resolve(h.profileId);y({...h,...t?{machineClass:t}:{}})};function C(){let t=v(h),i=e.mode===`restart`;r(a` <openclaw-modal-dialog label=${d(i?`sessionsView.restartSessionTitle`:`sessionsView.moveSessionTitle`)} @modal-cancel=${()=>y(null)} > <form class="exec-approval-card" @submit=${S}> <div class="exec-approval-header"> <div class="exec-approval-title"> ${d(i?`sessionsView.restartSessionTitle`:`sessionsView.moveSessionTitle`)} </div> <div class="muted"> ${d(i?`sessionsView.restartSessionDescription`:`sessionsView.moveSessionDescription`,{session:e.sessionLabel})} </div> </div> ${i?a`<div class="exec-approval-error" role="alert"> ${d(`sessionsView.restartSessionWarning`)} </div>`:e.activeRun?a`<div class="exec-approval-error" role="alert"> ${d(`sessionsView.moveSessionActiveRunWarning`)} </div>`:a`<div class="callout"> ${d(`sessionsView.moveSessionNoReplayWarning`)} </div>`} ${s?a`<div class="muted">${d(`common.loading`)}</div>`:c?a`<div class="exec-approval-error" role="alert">${c}</div>`:a` <div class="new-session-page__picker-root"> ${i?o:m({value:`gateway`,label:d(`newSession.gateway`),icon:l.monitor,checked:t===`gateway`,onSelect:()=>x({kind:`gateway`})},!1)} ${u.devices.length>0?a` <div class="new-session-page__menu-title"> ${d(`newSession.yourDevices`)} </div> ${u.devices.map(n=>{let r=e.deviceDisabledReason??n.disabledReason;return m({value:`device:${n.deviceId}`,label:n.label,sub:n.subtitle,icon:l.monitor,facts:e.deviceDisabledReason?[e.deviceDisabledReason]:n.facts,checked:t===`device:${n.deviceId}`,disabled:!!e.deviceDisabledReason||!n.selectable,title:r,onSelect:()=>x({kind:`device`,deviceId:n.deviceId})},!1)})} `:o} ${u.profiles.length>0?a` <div class="new-session-page__menu-title"> ${d(`newSession.cloud`)} </div> ${u.profiles.map(t=>{let n=h?.kind===`profile`&&h.profileId===t.id,r=t.machines??[],i=g.resolve(t.id)||r.find(e=>e.default===!0)?.id||``;return a` ${p({profiles:[t],selectedId:n?t.id:``,submitting:!1,icon:l.server,profileDisabledReason:e.profileDisabledReason,onSelect:e=>x({kind:`profile`,profileId:e})})} ${n&&r.length>0?a` <div class="new-session-page__menu-title"> ${d(`newSession.machine`)} </div> ${f({machines:r,selectedId:i,submitting:!1,onSelect:e=>g.select(t.id,e,u.profiles,!1,C)})} `:o} `})} `:o} </div> `} <div class="exec-approval-actions"> <button type="submit" class="btn primary" ?disabled=${s||!!c||!h} > ${d(i?`sessionsView.restartSessionAction`:`sessionsView.moveSessionAction`)} </button> <button type="button" class="btn" @click=${()=>y(null)}> ${d(`common.cancel`)} </button> </div> </form> </openclaw-modal-dialog> `,n)}C(),e.loadCatalog().then(e=>{u=e}).catch(e=>{c=t(e,d(`sessionsView.moveSessionCatalogFailed`))}).finally(()=>{s=!1,C()})})}var b;function x(){return(x=e((()=>{i(),u(),n(),h(),g(),s(),c(),b=!1})))()}x();export{y as showSessionPlacementTargetDialog}; //# sourceMappingURL=session-placement-move-dialog-hC-FO17_.js.map