@@ -389,16 +389,6 @@ func stopAppWithCmd(ctx context.Context, docker command.Cli, app app.ArduinoApp,
389389 ctx , cancel := context .WithCancel (ctx )
390390 defer cancel ()
391391
392- appStatus , err := getAppStatus (ctx , docker , app )
393- if err != nil {
394- yield (StreamMessage {error : err })
395- return
396- }
397- if appStatus .State != StatusStarting && appStatus .State != StatusRunning {
398- yield (StreamMessage {data : fmt .Sprintf ("app %q is not running" , app .Name )})
399- return
400- }
401-
402392 if ! yield (StreamMessage {data : fmt .Sprintf ("Stopping app %q" , app .Name )}) {
403393 return
404394 }
@@ -420,7 +410,7 @@ func stopAppWithCmd(ctx context.Context, docker command.Cli, app app.ArduinoApp,
420410 yield (StreamMessage {error : err })
421411 return
422412 }
423- if appStatus .State != StatusStarting && appStatus .State != StatusRunning {
413+ if appStatus .Status != StatusStarting && appStatus .Status != StatusRunning {
424414 yield (StreamMessage {data : fmt .Sprintf ("app %q is not running" , app .Name )})
425415 return
426416 }
@@ -523,7 +513,7 @@ func StartDefaultApp(
523513 if err != nil {
524514 return fmt .Errorf ("failed to get app details: %w" , err )
525515 }
526- if status .State == "running" {
516+ if status .Status == "running" {
527517 return nil
528518 }
529519
@@ -547,7 +537,7 @@ type AppInfo struct {
547537 Name string `json:"name"`
548538 Description string `json:"description"`
549539 Icon string `json:"icon"`
550- State State `json:"state ,omitempty"`
540+ Status Status `json:"status ,omitempty"`
551541 Example bool `json:"example"`
552542 Default bool `json:"default"`
553543}
@@ -561,7 +551,8 @@ type ListAppRequest struct {
561551 ShowExamples bool
562552 ShowOnlyDefault bool
563553 ShowApps bool
564- StateFilter State
554+ StatusFilter Status
555+
565556 // IncludeNonStandardLocationApps will include apps that are not in the standard apps directory.
566557 // We will search by looking for docker container metadata, and add the app not present in the
567558 // standard apps directory in the result list.
@@ -637,14 +628,14 @@ func ListApps(
637628 continue
638629 }
639630
640- var state State
631+ var status Status
641632 if idx := slices .IndexFunc (apps , func (a AppStatusInfo ) bool {
642633 return a .AppPath .EqualsTo (app .FullPath )
643634 }); idx != - 1 {
644- state = apps [idx ].State
635+ status = apps [idx ].Status
645636 }
646637
647- if req .StateFilter != "" && req .StateFilter != state {
638+ if req .StatusFilter != "" && req .StatusFilter != status {
648639 continue
649640 }
650641
@@ -659,7 +650,7 @@ func ListApps(
659650 Name : app .Name ,
660651 Description : app .Descriptor .Description ,
661652 Icon : app .Descriptor .Icon ,
662- State : state ,
653+ Status : status ,
663654 Example : id .IsExample (),
664655 Default : isDefault ,
665656 },
@@ -675,7 +666,7 @@ type AppDetailedInfo struct {
675666 Path string `json:"path"`
676667 Description string `json:"description"`
677668 Icon string `json:"icon"`
678- State State `json:"state " required:"true"`
669+ Status Status `json:"status " required:"true"`
679670 Example bool `json:"example"`
680671 Default bool `json:"default"`
681672 Bricks []AppDetailedBrick `json:"bricks,omitempty"`
@@ -699,15 +690,15 @@ func AppDetails(
699690 var wg sync.WaitGroup
700691 wg .Add (2 )
701692 var defaultAppPath string
702- var state State
693+ var status Status
703694 go func () {
704695 defer wg .Done ()
705696 app , err := getAppStatus (ctx , docker , userApp )
706697 if err != nil {
707698 slog .Warn ("unable to get app status" , slog .String ("error" , err .Error ()), slog .String ("path" , userApp .FullPath .String ()))
708- state = StatusStopped
699+ status = StatusStopped
709700 } else {
710- state = app .State
701+ status = app .Status
711702 }
712703 }()
713704 go func () {
@@ -736,7 +727,7 @@ func AppDetails(
736727 Path : userApp .FullPath .String (),
737728 Description : userApp .Descriptor .Description ,
738729 Icon : userApp .Descriptor .Icon ,
739- State : state ,
730+ Status : status ,
740731 Example : id .IsExample (),
741732 Default : defaultAppPath == userApp .FullPath .String (),
742733 Bricks : f .Map (userApp .Descriptor .Bricks , func (b app.Brick ) AppDetailedBrick {
0 commit comments