11import { A } from "@cocalc/frontend/components/A" ;
2- import ComputeServer from "./compute-server" ;
2+ import ComputeServer , { currentlyEditing } from "./compute-server" ;
33import CreateComputeServer from "./create-compute-server" ;
44import { useTypedRedux } from "@cocalc/frontend/app-framework" ;
55import { cmp , plural } from "@cocalc/util/misc" ;
66import { 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" ;
817import { useEffect , useState } from "react" ;
918const { Search } = Input ;
1019import { search_match , search_split } from "@cocalc/util/misc" ;
@@ -166,6 +175,7 @@ function ComputeServerTable({
166175 > (
167176 ( get_local_storage ( `${ project_id } -compute-server-sort` ) ?? "custom" ) as any ,
168177 ) ;
178+
169179 if ( ! computeServers || computeServers . size == 0 ) {
170180 return (
171181 < div style = { { textAlign : "center" } } >
@@ -179,7 +189,14 @@ function ComputeServerTable({
179189 const search_words = search_split ( search . toLowerCase ( ) ) ;
180190 const ids : number [ ] = [ ] ;
181191 let numDeleted = 0 ;
192+ let numSkipped = 0 ;
182193 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+ }
183200 const isDeleted = ! ! computeServers . getIn ( [ id , "deleted" ] ) ;
184201 if ( isDeleted ) {
185202 numDeleted += 1 ;
@@ -191,6 +208,7 @@ function ComputeServerTable({
191208 if (
192209 ! search_match ( computeServerToSearch ( computeServers , id ) , search_words )
193210 ) {
211+ numSkipped += 1 ;
194212 continue ;
195213 }
196214 }
@@ -258,7 +276,7 @@ function ComputeServerTable({
258276 style = { { marginBottom : "10px" } }
259277 key = { `${ id } ` }
260278 editable = { account_id == server . account_id }
261- controls = { { setShowDeleted, setSearch } }
279+ controls = { { setShowDeleted } }
262280 />
263281 </ div >
264282 ) ;
@@ -347,6 +365,25 @@ function ComputeServerTable({
347365 </ Checkbox >
348366 ) }
349367 </ 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+ ) }
350387 < div
351388 style = { { /* maxHeight: "60vh", overflow: "auto", */ width : "100%" } }
352389 >
0 commit comments