@@ -18,17 +18,13 @@ import { User } from "@gitpod/gitpod-protocol";
1818import { useLocation } from "react-router" ;
1919import { StartWorkspaceModalContext , StartWorkspaceModalKeyBinding } from "./start-workspace-modal-context" ;
2020import SelectIDEModal from "../settings/SelectIDEModal" ;
21- import Arrow from "../components/Arrow" ;
22- import ConfirmationModal from "../components/ConfirmationModal" ;
2321
2422export interface WorkspacesProps { }
2523
2624export interface WorkspacesState {
2725 workspaces : WorkspaceInfo [ ] ;
2826 isTemplateModelOpen : boolean ;
2927 repos : WhitelistedRepository [ ] ;
30- showInactive : boolean ;
31- deleteModalVisible : boolean ;
3228}
3329
3430export default function ( ) {
@@ -39,8 +35,6 @@ export default function () {
3935 const [ activeWorkspaces , setActiveWorkspaces ] = useState < WorkspaceInfo [ ] > ( [ ] ) ;
4036 const [ inactiveWorkspaces , setInactiveWorkspaces ] = useState < WorkspaceInfo [ ] > ( [ ] ) ;
4137 const [ workspaceModel , setWorkspaceModel ] = useState < WorkspaceModel > ( ) ;
42- const [ showInactive , setShowInactive ] = useState < boolean > ( ) ;
43- const [ deleteModalVisible , setDeleteModalVisible ] = useState < boolean > ( ) ;
4438 const { setIsStartWorkspaceModalVisible } = useContext ( StartWorkspaceModalContext ) ;
4539
4640 useEffect ( ( ) => {
@@ -56,18 +50,6 @@ export default function () {
5650 < >
5751 < Header title = "Workspaces" subtitle = "Manage recent and stopped workspaces." />
5852
59- < ConfirmationModal
60- title = "Delete Inactive Workspaces"
61- areYouSureText = "You are about to permanently delete your inactive workspaces."
62- buttonText = "Delete Inactive Workspaces"
63- visible = { ! ! deleteModalVisible }
64- onClose = { ( ) => setDeleteModalVisible ( false ) }
65- onConfirm = { ( ) => {
66- inactiveWorkspaces . forEach ( ( ws ) => workspaceModel ?. deleteWorkspace ( ws . workspace . id ) ) ;
67- setDeleteModalVisible ( false ) ;
68- } }
69- > </ ConfirmationModal >
70-
7153 { isOnboardingUser && < SelectIDEModal location = { "workspace_list" } /> }
7254
7355 { workspaceModel ?. initialized &&
@@ -146,58 +128,27 @@ export default function () {
146128 } ) }
147129 { activeWorkspaces . length > 0 && < div className = "py-6" > </ div > }
148130 { inactiveWorkspaces . length > 0 && (
149- < div className = "pt-14" >
150- < div className = "border-t border-gray-200 dark:border-gray-800" > </ div >
151- < div
152- onClick = { ( ) => setShowInactive ( ! showInactive ) }
153- className = "flex cursor-pointer py-6"
131+ < div className = "p-3 text-gray-400 bg-gray-50 dark:bg-gray-800 rounded-xl text-sm text-center" >
132+ Unpinned workspaces that have been inactive for more than 14 days will be
133+ automatically deleted.{ " " }
134+ < a
135+ className = "gp-link"
136+ href = "https://www.gitpod.io/docs/life-of-workspace/#garbage-collection"
154137 >
155- < div className = "flex flex-col" >
156- < h2 className = "" > Inactive Workspaces</ h2 >
157- </ div >
158- < div >
159- < Arrow
160- up = { ! ! showInactive }
161- customBorderClasses = "text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400"
162- />
163- </ div >
164- </ div >
165- { showInactive ? (
166- < >
167- < div className = "flex flex-row p-3 text-gray-400 bg-gray-50 dark:bg-gray-800 rounded-xl" >
168- < div className = "text-sm flex-auto py-3" >
169- Unpinned workspaces that have been inactive for more than 14 days
170- will be automatically deleted.{ " " }
171- < a
172- className = "gp-link"
173- href = "https://www.gitpod.io/docs/life-of-workspace/#garbage-collection"
174- >
175- Learn more
176- </ a >
177- </ div >
178- < button
179- onClick = { ( ) => setDeleteModalVisible ( true ) }
180- className = "ml-2 danger secondary w-64 p-2"
181- >
182- Delete Inactive Workspaces
183- </ button >
184- </ div >
185- { inactiveWorkspaces . map ( ( e ) => {
186- return (
187- < WorkspaceEntry
188- key = { e . workspace . id }
189- desc = { e }
190- model = { workspaceModel }
191- stopWorkspace = { ( wsId ) =>
192- getGitpodService ( ) . server . stopWorkspace ( wsId )
193- }
194- />
195- ) ;
196- } ) }
197- </ >
198- ) : null }
138+ Learn more
139+ </ a >
199140 </ div >
200141 ) }
142+ { inactiveWorkspaces . map ( ( e ) => {
143+ return (
144+ < WorkspaceEntry
145+ key = { e . workspace . id }
146+ desc = { e }
147+ model = { workspaceModel }
148+ stopWorkspace = { ( wsId ) => getGitpodService ( ) . server . stopWorkspace ( wsId ) }
149+ />
150+ ) ;
151+ } ) }
201152 </ ItemsList >
202153 </ >
203154 ) : (
0 commit comments