11import { Service } from "@/pages/ui/services/models/service" ;
22import GenericTable from "../Table" ;
33import { useNavigate } from "react-router-dom" ;
4- import { Copy , Edit , MoreVertical , RefreshCcwIcon , Trash2 } from "lucide-react" ;
4+ import { Edit , MoreVertical , RefreshCcwIcon , Trash2 } from "lucide-react" ;
55import OscarColors from "@/styles" ;
66import useServicesContext from "@/pages/ui/services/context/ServicesContext" ;
77import { Button } from "../ui/button" ;
8- import { Card , CardContent , CardFooter , CardHeader , CardTitle } from "../ui/card" ;
98import { DropdownMenu , DropdownMenuContent , DropdownMenuItem , DropdownMenuLabel , DropdownMenuSeparator , DropdownMenuTrigger } from "../ui/dropdown-menu" ;
109import { useState } from "react" ;
1110import getServicesApi from "@/api/services/getServicesApi" ;
1211import deleteServiceApi from "@/api/services/deleteServiceApi" ;
1312import { alert } from "@/lib/alert" ;
14- import DeleteDialog from "../DeleteDialog" ;
1513import updateServiceApi from "@/api/services/updateServiceApi" ;
16- import { useAuth } from "@/contexts/AuthContext" ;
1714import ServiceRedirectButton from "../ServiceRedirectButton" ;
15+ import IntegratedAppTopbar from "./components/Topbar" ;
16+ import DeleteDialog from "../DeleteDialog" ;
1817
1918interface IntegratedAppProps {
2019 appName : string ;
@@ -28,8 +27,6 @@ function IntegratedApp({ appName, endpoint, filteredServices, additionalExposedP
2827 const { setFormService } = useServicesContext ( ) ;
2928 const [ servicesToDelete , setServicesToDelete ] = useState < Service [ ] > ( [ ] ) ;
3029 const { setServices } = useServicesContext ( ) ;
31- const authContext = useAuth ( ) ;
32-
3330
3431 const navigate = useNavigate ( ) ;
3532
@@ -99,40 +96,23 @@ function IntegratedApp({ appName, endpoint, filteredServices, additionalExposedP
9996 }
10097
10198 return (
102- < div className = "grid grid-cols-1 gap-6 w-[95%] sm:w-[90%] lg:w-[80%] mx-auto mt-[40px] min-w-[300px] max-w-[1600px] content-start" >
103- < div className = "text-center sm:text-left flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-3" >
104- < h1 className = "" style = { { fontSize : "24px" , fontWeight : "500" } } > { appName } </ h1 >
105- < div className = "grid grid-cols-1 xl:grid-cols-[auto_auto] text-md text-decoration-underline-hover"
106- onClick = { ( ) => {
107- navigator . clipboard . writeText ( authContext . authData . endpoint ) ;
108- alert . success ( "Endpoint copied to clipboard" ) ;
109- } }
110- style = { {
111- cursor : "pointer" ,
112- } }
99+ < div className = "" >
100+ < IntegratedAppTopbar appName = { appName } DeployInstancePopover = { DeployInstancePopover } />
101+ < div
102+ style = { {
103+ display : "flex" ,
104+ flexDirection : "column" ,
105+ flexGrow : 1 ,
106+ flexBasis : 0 ,
107+ overflow : "hidden" ,
108+ } }
113109 >
114- < div className = "truncate" >
115- { `${ authContext . authData . user } -\u00A0` }
116- </ div >
117- < div className = "flex flex-row items-center justify-center gap-2 truncate" >
118- { `${ authContext . authData . endpoint } ` }
119- < Copy className = "h-4 w-4" />
120- </ div >
121- </ div >
122- </ div >
123- < Card >
124- < CardHeader >
125- < CardTitle className = "flex flex-row items-center justify-between gap-2" >
126- < div > Deployed { appName } Instances</ div >
127- < DeployInstancePopover />
128- </ CardTitle >
129- </ CardHeader >
130- < CardContent className = "flex flex-col max-h-[65vh]" >
131110 < GenericTable < Service >
132111 data = { filteredServices }
133112 idKey = "name"
134113 columns = { [
135114 { header : "Name" , accessor : "name" , sortBy : "name" } ,
115+ { header : "Image" , accessor : "image" , sortBy : "image" } ,
136116 { header : "CPU" , accessor : "cpu" , sortBy : "cpu" } ,
137117 { header : "Memory" , accessor : "memory" , sortBy : "memory" } ,
138118 ] }
@@ -142,7 +122,7 @@ function IntegratedApp({ appName, endpoint, filteredServices, additionalExposedP
142122 < DropdownMenu >
143123 < DropdownMenuTrigger asChild title = "More actions" >
144124 < Button variant = { "link" } size = "icon" tooltipLabel = "More Actions" >
145- < MoreVertical size = { 20 } />
125+ < MoreVertical />
146126 </ Button >
147127 </ DropdownMenuTrigger >
148128 < DropdownMenuContent align = "end" className = "w-[220px]" >
@@ -175,11 +155,13 @@ function IntegratedApp({ appName, endpoint, filteredServices, additionalExposedP
175155 } ,
176156 {
177157 button : ( service ) => (
178- < ServiceRedirectButton
179- service = { service }
180- endpoint = { endpoint }
181- additionalExposedPathArgs = { additionalExposedPathArgs }
182- />
158+ < div className = "p-2" >
159+ < ServiceRedirectButton
160+ service = { service }
161+ endpoint = { endpoint }
162+ additionalExposedPathArgs = { additionalExposedPathArgs }
163+ />
164+ </ div >
183165 ) ,
184166 } ,
185167 {
@@ -190,7 +172,7 @@ function IntegratedApp({ appName, endpoint, filteredServices, additionalExposedP
190172 onClick = { ( ) => setServicesToDelete ( [ service ] ) }
191173 tooltipLabel = "Delete"
192174 >
193- < Trash2 color = { OscarColors . Red } size = { 20 } />
175+ < Trash2 color = { OscarColors . Red } />
194176 </ Button >
195177 ) ,
196178 } ,
@@ -218,17 +200,13 @@ function IntegratedApp({ appName, endpoint, filteredServices, additionalExposedP
218200 } ,
219201 ] }
220202 />
221- </ CardContent >
222- < CardFooter className = "grid grid-cols-1 hidden" >
223-
224- </ CardFooter >
225- </ Card >
226- < DeleteDialog
227- isOpen = { servicesToDelete . length > 0 }
228- onClose = { ( ) => setServicesToDelete ( [ ] ) }
229- onDelete = { handleDeleteService }
230- itemNames = { servicesToDelete . map ( ( service ) => service . name ) }
231- />
203+ < DeleteDialog
204+ isOpen = { servicesToDelete . length > 0 }
205+ onClose = { ( ) => setServicesToDelete ( [ ] ) }
206+ onDelete = { handleDeleteService }
207+ itemNames = { servicesToDelete . map ( ( service ) => service . name ) }
208+ />
209+ </ div >
232210 </ div >
233211 ) ;
234212}
0 commit comments