8bitkick commited on
Commit
f81875f
·
1 Parent(s): 089d52a

Update install button text and modify install request status messages

Browse files
Files changed (1) hide show
  1. index.html +11 -30
index.html CHANGED
@@ -194,7 +194,7 @@
194
  <div id="install-panel">
195
  <h3>Install to Reachy Mini</h3>
196
  <input type="url" id="dashboardUrl" placeholder="http://reachy-dashboard:8000" value="http://localhost:8000" />
197
- <button id="installBtn" class="install-btn"><span>📥</span><span>Install On Robot</span></button>
198
  <div id="installStatus" class="install-status"></div>
199
  </div>
200
  </div>
@@ -229,37 +229,18 @@
229
  statusEl.textContent=msg;
230
  statusEl.style.display='block';
231
  }
232
- function spaceBaseURL(){
233
- const clean = window.location.href.split('?')[0].replace(/#.*$/,'').replace(/\/$/, '');
234
- return clean;
235
- }
236
- function buildPayload(){
237
- // Extract owner/space from HF Space URL if present
238
- const url = spaceBaseURL();
239
- // Expected format: https://huggingface.co/spaces/owner/space
240
- let name = '8bitkick/reachy_mini_3d_web_viz';
241
- const m = url.match(/huggingface\.co\/spaces\/([^\/]+)\/([^\/]+)$/);
242
- if(m){
243
- name = m[1] + '/' + m[2];
244
- }
245
- return {
246
- name: name,
247
- source_kind: 'hf_space',
248
- description: '',
249
- url: url,
250
- extra: { }
251
- };
252
- }
253
  async function install(){
254
  const dashURL = dashInput.value.trim();
255
  if(!dashURL){ showStatus('error','Enter dashboard URL'); return; }
256
- btn.disabled=true; btn.innerHTML='⏳ Installing...'; showStatus('info','Checking dashboard...');
257
  try {
258
- const ping = await fetch(dashURL+'/api/status',{method:'GET'});
259
- if(!ping.ok) throw new Error('Dashboard unreachable');
260
- showStatus('info','Preparing install payload...');
261
- const payload = buildPayload();
262
- showStatus('info','Sending install request...');
 
 
263
  const resp = await fetch(dashURL+'/api/apps/install',{
264
  method:'POST',
265
  headers:{'Content-Type':'application/json','accept':'application/json'},
@@ -268,11 +249,11 @@
268
  const result = await resp.json().catch(()=>({}));
269
  if(!resp.ok) throw new Error(result.detail||'Install failed');
270
  showStatus('success','Install started for '+payload.name+'!');
271
- setTimeout(()=>{showStatus('info','Check dashboard for progress.');},2500);
272
  } catch(err){
273
  showStatus('error','Failed: '+err.message);
274
  } finally {
275
- btn.disabled=false; btn.innerHTML='<span>📥</span><span>Install On Robot</span>';
276
  }
277
  }
278
  btn.addEventListener('click', install);
 
194
  <div id="install-panel">
195
  <h3>Install to Reachy Mini</h3>
196
  <input type="url" id="dashboardUrl" placeholder="http://reachy-dashboard:8000" value="http://localhost:8000" />
197
+ <button id="installBtn" class="install-btn"><span>📥</span><span>Install On R</span></button>
198
  <div id="installStatus" class="install-status"></div>
199
  </div>
200
  </div>
 
229
  statusEl.textContent=msg;
230
  statusEl.style.display='block';
231
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  async function install(){
233
  const dashURL = dashInput.value.trim();
234
  if(!dashURL){ showStatus('error','Enter dashboard URL'); return; }
235
+ btn.disabled=true; btn.innerHTML='⏳ Installing...'; showStatus('info','Sending install request...');
236
  try {
237
+ const payload = {
238
+ name: '8bitkick/reachy_mini_3d_web_viz',
239
+ source_kind: 'hf_space',
240
+ description: '',
241
+ url: 'https://huggingface.co/spaces/8bitkick/reachy_mini_3d_web_viz',
242
+ extra: { additionalProp1: {} }
243
+ };
244
  const resp = await fetch(dashURL+'/api/apps/install',{
245
  method:'POST',
246
  headers:{'Content-Type':'application/json','accept':'application/json'},
 
249
  const result = await resp.json().catch(()=>({}));
250
  if(!resp.ok) throw new Error(result.detail||'Install failed');
251
  showStatus('success','Install started for '+payload.name+'!');
252
+ setTimeout(()=>{showStatus('info','Check reachy output for progress.');},2500);
253
  } catch(err){
254
  showStatus('error','Failed: '+err.message);
255
  } finally {
256
+ btn.disabled=false; btn.innerHTML='<span>📥</span><span>Install On R</span>';
257
  }
258
  }
259
  btn.addEventListener('click', install);