File tree Expand file tree Collapse file tree 2 files changed +48
-16
lines changed
site/src/modules/resources Expand file tree Collapse file tree 2 files changed +48
-16
lines changed Original file line number Diff line number Diff line change @@ -286,10 +286,43 @@ export const GroupApp: Story = {
286286} ;
287287
288288export const Devcontainer : Story = {
289- beforeEach : ( ) => {
290- spyOn ( API , "getAgentContainers" ) . mockResolvedValue ( {
291- devcontainers : [ M . MockWorkspaceAgentDevcontainer ] ,
292- containers : [ M . MockWorkspaceAgentContainer ] ,
293- } ) ;
289+ parameters : {
290+ queries : [
291+ {
292+ key : [ "agents" , M . MockWorkspaceAgent . id , "containers" ] ,
293+ data : {
294+ devcontainers : [ M . MockWorkspaceAgentDevcontainer ] ,
295+ containers : [ M . MockWorkspaceAgentContainer ] ,
296+ } ,
297+ } ,
298+ ] ,
299+ webSocket : [ ] ,
300+ } ,
301+ } ;
302+
303+ export const FoundDevcontainer : Story = {
304+ args : {
305+ agent : {
306+ ...M . MockWorkspaceAgentReady ,
307+ } ,
308+ } ,
309+ parameters : {
310+ queries : [
311+ {
312+ key : [ "agents" , M . MockWorkspaceAgentReady . id , "containers" ] ,
313+ data : {
314+ devcontainers : [
315+ {
316+ ...M . MockWorkspaceAgentDevcontainer ,
317+ status : "stopped" ,
318+ container : undefined ,
319+ agent : undefined ,
320+ } ,
321+ ] ,
322+ containers : [ ] ,
323+ } ,
324+ } ,
325+ ] ,
326+ webSocket : [ ] ,
294327 } ,
295328} ;
Original file line number Diff line number Diff line change @@ -137,17 +137,16 @@ export const AgentRow: FC<AgentRowProps> = ({
137137 // This is used to show the parent apps of the devcontainer.
138138 const [ showParentApps , setShowParentApps ] = useState ( false ) ;
139139
140- let shouldDisplayAppsSection = shouldDisplayAgentApps ;
141- if (
142- devcontainers &&
143- devcontainers . find (
144- // We only want to hide the parent apps by default when there are dev
145- // containers that are either starting or running. If they are all in
146- // the stopped state, it doesn't make sense to hide the parent apps.
140+ const anyRunningOrStartingDevcontainers =
141+ devcontainers ?. find (
147142 ( dc ) => dc . status === "running" || dc . status === "starting" ,
148- ) !== undefined &&
149- ! showParentApps
150- ) {
143+ ) !== undefined ;
144+
145+ // We only want to hide the parent apps by default when there are dev
146+ // containers that are either starting or running. If they are all in
147+ // the stopped state, it doesn't make sense to hide the parent apps.
148+ let shouldDisplayAppsSection = shouldDisplayAgentApps ;
149+ if ( anyRunningOrStartingDevcontainers && ! showParentApps ) {
151150 shouldDisplayAppsSection = false ;
152151 }
153152
@@ -187,7 +186,7 @@ export const AgentRow: FC<AgentRowProps> = ({
187186 </ div >
188187
189188 < div className = "flex items-center gap-2" >
190- { devcontainers && devcontainers . length > 0 && (
189+ { anyRunningOrStartingDevcontainers && (
191190 < Button
192191 variant = "outline"
193192 size = "sm"
You can’t perform that action at this time.
0 commit comments