1
1
import { A } from "@cocalc/frontend/components/A" ;
2
- import ComputeServer from "./compute-server" ;
2
+ import ComputeServer , { currentlyEditing } from "./compute-server" ;
3
3
import CreateComputeServer from "./create-compute-server" ;
4
4
import { useTypedRedux } from "@cocalc/frontend/app-framework" ;
5
5
import { cmp , plural } from "@cocalc/util/misc" ;
6
6
import { availableClouds } from "./config" ;
7
- import { Input , Card , Checkbox , Radio , Switch , Tooltip } from "antd" ;
7
+ import {
8
+ Alert ,
9
+ Button ,
10
+ Input ,
11
+ Card ,
12
+ Checkbox ,
13
+ Radio ,
14
+ Switch ,
15
+ Tooltip ,
16
+ } from "antd" ;
8
17
import { useEffect , useState } from "react" ;
9
18
const { Search } = Input ;
10
19
import { search_match , search_split } from "@cocalc/util/misc" ;
@@ -166,6 +175,7 @@ function ComputeServerTable({
166
175
> (
167
176
( get_local_storage ( `${ project_id } -compute-server-sort` ) ?? "custom" ) as any ,
168
177
) ;
178
+
169
179
if ( ! computeServers || computeServers . size == 0 ) {
170
180
return (
171
181
< div style = { { textAlign : "center" } } >
@@ -179,7 +189,14 @@ function ComputeServerTable({
179
189
const search_words = search_split ( search . toLowerCase ( ) ) ;
180
190
const ids : number [ ] = [ ] ;
181
191
let numDeleted = 0 ;
192
+ let numSkipped = 0 ;
182
193
for ( const [ id ] of computeServers ) {
194
+ if ( currentlyEditing . id == id ) {
195
+ // always include the one that is currently being edited. We wouldn't want,
196
+ // e.g., changing the title shouldn't make the editing modal vanish!
197
+ ids . push ( id ) ;
198
+ continue ;
199
+ }
183
200
const isDeleted = ! ! computeServers . getIn ( [ id , "deleted" ] ) ;
184
201
if ( isDeleted ) {
185
202
numDeleted += 1 ;
@@ -191,6 +208,7 @@ function ComputeServerTable({
191
208
if (
192
209
! search_match ( computeServerToSearch ( computeServers , id ) , search_words )
193
210
) {
211
+ numSkipped += 1 ;
194
212
continue ;
195
213
}
196
214
}
@@ -258,7 +276,7 @@ function ComputeServerTable({
258
276
style = { { marginBottom : "10px" } }
259
277
key = { `${ id } ` }
260
278
editable = { account_id == server . account_id }
261
- controls = { { setShowDeleted, setSearch } }
279
+ controls = { { setShowDeleted } }
262
280
/>
263
281
</ div >
264
282
) ;
@@ -347,6 +365,25 @@ function ComputeServerTable({
347
365
</ Checkbox >
348
366
) }
349
367
</ div >
368
+ { numSkipped > 0 && (
369
+ < Alert
370
+ showIcon
371
+ style = { { margin : "15px auto" , maxWidth : "600px" } }
372
+ type = "warning"
373
+ message = {
374
+ < div style = { { marginTop : "5px" } } >
375
+ Not showing { numSkipped } compute servers due to current filter.
376
+ < Button
377
+ type = "text"
378
+ style = { { float : "right" , marginTop : "-5px" } }
379
+ onClick = { ( ) => setSearch ( "" ) }
380
+ >
381
+ Clear
382
+ </ Button >
383
+ </ div >
384
+ }
385
+ />
386
+ ) }
350
387
< div
351
388
style = { { /* maxHeight: "60vh", overflow: "auto", */ width : "100%" } }
352
389
>
0 commit comments