File size: 1,391 Bytes
cce8120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"use client";

import {useEffect,useState} from "react";

export default function DeploymentWorkspace(){

const [deployments,setDeployments]=useState([]);
const [status,setStatus]=useState("Loading...");

async function load(){

try{

const r=await fetch("/api/workspace/deploy/status");

if(r.ok){

const data=await r.json();

setDeployments(data.deployments||[]);
setStatus(data.status||"Ready");

}else{

setStatus("Unavailable");

}

}catch{

setStatus("Backend offline");

}

}

useEffect(()=>{
load();
},[]);

return(

<div className="h-full flex flex-col bg-neutral-950 text-white">

<div className="border-b border-neutral-800 p-3 text-lg font-bold">
Deployment Center
</div>

<div className="p-4">

<div className="mb-4">
Status: <span className="font-semibold">{status}</span>
</div>

<table className="w-full text-sm">

<thead>

<tr className="border-b border-neutral-800">

<th className="text-left p-2">Target</th>
<th className="text-left p-2">Status</th>
<th className="text-left p-2">Time</th>

</tr>

</thead>

<tbody>

{deployments.length===0?

<tr>
<td colSpan="3" className="p-4">
No deployments.
</td>
</tr>

:

deployments.map((d,i)=>(

<tr key={i} className="border-b border-neutral-900">

<td className="p-2">{d.target||"-"}</td>
<td className="p-2">{d.status||"-"}</td>
<td className="p-2">{d.time||"-"}</td>

</tr>

))

}

</tbody>

</table>

</div>

</div>

);

}