Skip to content

Commit

Permalink
refresh windows after open view containers (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzakhany authored Oct 27, 2024
1 parent 4333d8f commit ab84e5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/app/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func New(w *app.Window, serviceVersion string) (*UI, error) {
u.header.LoadWorkspaces(u.workspacesState.GetWorkspaces())

//
u.environmentsView = environments.NewView(u.Theme)
u.environmentsView = environments.NewView(w, u.Theme)
u.environmentsController = environments.NewController(u.environmentsView, repo, u.environmentsState, explorerController)
u.environmentsState.AddEnvironmentChangeListener(func(environment *domain.Environment, source state.Source, action state.Action) {
u.header.LoadEnvs(u.environmentsState.GetEnvironments())
Expand Down
8 changes: 7 additions & 1 deletion ui/pages/environments/view.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package environments

import (
"gioui.org/app"
"gioui.org/layout"
"gioui.org/unit"
"gioui.org/widget"
Expand All @@ -22,6 +23,8 @@ const (
)

type View struct {
window *app.Window

newEnvButton widget.Clickable
importButton widget.Clickable

Expand Down Expand Up @@ -53,7 +56,7 @@ type View struct {
tipsView *tips.Tips
}

func NewView(theme *chapartheme.Theme) *View {
func NewView(window *app.Window, theme *chapartheme.Theme) *View {
search := widgets.NewTextField("", "Search...")
search.SetIcon(widgets.SearchIcon, widgets.IconPositionEnd)
search.SetBorderColor(theme.BorderColor)
Expand All @@ -63,6 +66,7 @@ func NewView(theme *chapartheme.Theme) *View {
itemsSearchBox.SetBorderColor(theme.BorderColor)

v := &View{
window: window,
treeViewSearchBox: search,
tabHeader: widgets.NewTabs([]*widgets.Tab{}, nil),
treeView: widgets.NewTreeView([]*widgets.TreeNode{}),
Expand Down Expand Up @@ -272,6 +276,8 @@ func (v *View) OpenContainer(env *domain.Environment) {
})

v.containers.Set(env.MetaData.ID, ct)

v.window.Invalidate()
}

func (v *View) ReloadContainerData(env *domain.Environment) {
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/requests/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,14 @@ func (v *View) OpenRequestContainer(req *domain.Request) {
if req.MetaData.Type == domain.RequestTypeHTTP {
ct := v.createRestfulContainer(req)
v.containers.Set(req.MetaData.ID, ct)
return
}

if req.MetaData.Type == domain.RequestTypeGRPC {
ct := v.createGrpcContainer(req)
v.containers.Set(req.MetaData.ID, ct)
return
}

v.window.Invalidate()
}

func (v *View) createGrpcContainer(req *domain.Request) Container {
Expand Down

0 comments on commit ab84e5f

Please sign in to comment.