Skip to content

Commit 29a85e4

Browse files
authored
Merge pull request #239 from nais/tenant-autoconnect
Auto-connect when switching tennant
2 parents 9aabeb4 + 5de15f8 commit 29a85e4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.github/workflows/build.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Test and Build
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-18.04
8+
steps:
9+
- uses: actions/checkout@v3
10+
- run: |
11+
sudo apt update
12+
sudo apt remove --yes libappindicator3-dev
13+
sudo apt install --yes build-essential ruby ruby-dev rubygems libgtk-3-dev libayatana-appindicator3-dev
14+
#sudo gem install --no-document fpm -v 1.13.1
15+
- uses: actions/setup-go@v3
16+
with:
17+
go-version: '^1.19'
18+
- name: Test and Build
19+
run: |
20+
make local

pkg/systray/gui.go

+14
Original file line numberDiff line numberDiff line change
@@ -557,5 +557,19 @@ func (gui *Gui) activateTenant(ctx context.Context, name string) {
557557
_, err := gui.DeviceAgentClient.SetActiveTenant(ctx, req)
558558
if err != nil {
559559
notify.Errorf("Failed to activate tenant, err: %v", err)
560+
return
561+
}
562+
563+
getConfigResponse, err := gui.DeviceAgentClient.GetAgentConfiguration(ctx, &pb.GetAgentConfigurationRequest{})
564+
if err != nil {
565+
log.Errorf("Failed to get agent configuration, err: %v", err)
566+
return
567+
}
568+
569+
if getConfigResponse.Config.AutoConnect {
570+
_, err = gui.DeviceAgentClient.Login(ctx, &pb.LoginRequest{})
571+
if err != nil {
572+
log.Errorf("connect: %v", err)
573+
}
560574
}
561575
}

0 commit comments

Comments
 (0)