@@ -9,6 +9,7 @@ import { GitpodHostUrl } from '@gitpod/gitpod-protocol/lib/util/gitpod-host-url'
9
9
import moment from 'moment' ;
10
10
import React , { useState } from 'react' ;
11
11
import ConfirmationModal from '../components/ConfirmationModal' ;
12
+ import Modal from '../components/Modal' ;
12
13
import { ContextMenuEntry } from '../components/ContextMenu' ;
13
14
import { Item , ItemField , ItemFieldContextMenu , ItemFieldIcon } from '../components/ItemsList' ;
14
15
import PendingChangesDropdown from '../components/PendingChangesDropdown' ;
@@ -30,7 +31,8 @@ interface Props {
30
31
}
31
32
32
33
export function WorkspaceEntry ( { desc, model, isAdmin, stopWorkspace } : Props ) {
33
- const [ isModalVisible , setModalVisible ] = useState ( false ) ;
34
+ const [ isDeleteModalVisible , setDeleteModalVisible ] = useState ( false ) ;
35
+ const [ isRenameModalVisible , setRenameModalVisible ] = useState ( false ) ;
34
36
const state : WorkspaceInstancePhase = desc . latestInstance ?. status ?. phase || 'stopped' ;
35
37
const currentBranch = desc . latestInstance ?. status . repo ?. branch || Workspace . getBranchName ( desc . workspace ) || '<unknown>' ;
36
38
const ws = desc . workspace ;
@@ -45,7 +47,16 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) {
45
47
{
46
48
title : 'Open' ,
47
49
href : startUrl . toString ( )
48
- } ] ;
50
+ } ,
51
+ {
52
+ title : 'Rename ' ,
53
+ href : "" ,
54
+ onClick : ( ) => {
55
+ setRenameModalVisible ( true ) ;
56
+ }
57
+ } ,
58
+
59
+ ] ;
49
60
if ( state === 'running' ) {
50
61
menuEntries . push ( {
51
62
title : 'Stop' ,
@@ -78,7 +89,7 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) {
78
89
title : 'Delete' ,
79
90
customFontStyle : 'text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300' ,
80
91
onClick : ( ) => {
81
- setModalVisible ( true ) ;
92
+ setDeleteModalVisible ( true ) ;
82
93
}
83
94
}
84
95
) ;
@@ -111,18 +122,25 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) {
111
122
</ Tooltip >
112
123
</ ItemField >
113
124
< ItemFieldContextMenu menuEntries = { menuEntries } />
114
- { isModalVisible && < ConfirmationModal
125
+ { isDeleteModalVisible && < ConfirmationModal
115
126
title = "Delete Workspace"
116
127
areYouSureText = "Are you sure you want to delete this workspace?"
117
128
children = { {
118
129
name : ws . id ,
119
130
description : ws . description ,
120
131
} }
121
132
buttonText = "Delete Workspace"
122
- visible = { isModalVisible }
123
- onClose = { ( ) => setModalVisible ( false ) }
133
+ visible = { isDeleteModalVisible }
134
+ onClose = { ( ) => setDeleteModalVisible ( false ) }
124
135
onConfirm = { ( ) => model . deleteWorkspace ( ws . id ) }
125
136
/> }
137
+ { isRenameModalVisible &&
138
+ < Modal
139
+ visible = { true }
140
+ onClose = { ( ) => setRenameModalVisible ( false ) } >
141
+ < h3 > Rename Workspace</ h3 >
142
+ </ Modal >
143
+ }
126
144
</ Item > ;
127
145
}
128
146
0 commit comments