Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into becca/default-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Jan 12, 2024
2 parents c968e3c + af3a7aa commit cbd73e3
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 8 deletions.
1 change: 1 addition & 0 deletions ee/desktop/user/menu/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
DefaultIcon menuIcon = "default"
TriangleExclamationIcon menuIcon = "triangle-exclamation"
CircleXIcon menuIcon = "circle-x"
CircleDotIcon menuIcon = "circle-dot"
)

// MenuData encapsulates a menu bar icon and accessible menu items
Expand Down
11 changes: 11 additions & 0 deletions ee/desktop/user/menu/menu_icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ func getIcon(icon menuIcon) []byte {
assets.MenubarCircleXMonochromeIco,
assets.MenubarCircleXMonochromePng,
)
case CircleDotIcon:
return chooseIcon(
assets.MenubarCircleDotDarkmodeIco,
assets.MenubarCircleDotDarkmodePng,
assets.MenubarCircleDotLightmodeIco,
assets.MenubarCircleDotLightmodePng,
assets.MenubarCircleDotLightmodeShadowIco,
assets.MenubarCircleDotLightmodeShadowPng,
assets.MenubarCircleDotMonochromeIco,
assets.MenubarCircleDotMonochromePng,
)
case DefaultIcon:
fallthrough
default:
Expand Down
4 changes: 4 additions & 0 deletions ee/desktop/user/menu/menu_icon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func Test_getIcon(t *testing.T) {
name: "CircleX",
icon: CircleXIcon,
},
{
name: "CircleDot",
icon: CircleDotIcon,
},
}
for _, tt := range tests {
tt := tt
Expand Down
23 changes: 15 additions & 8 deletions ee/tuf/library_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/Masterminds/semver"
"github.com/kolide/kit/fsutil"
"github.com/kolide/launcher/pkg/autoupdate"
"github.com/kolide/launcher/pkg/backoff"
"github.com/kolide/launcher/pkg/traces"
"github.com/theupdateframework/go-tuf/data"
tufutil "github.com/theupdateframework/go-tuf/util"
Expand Down Expand Up @@ -100,7 +101,9 @@ func (ulm *updateLibraryManager) AddToLibrary(binary autoupdatableBinary, curren
return
}
dirToRemove := filepath.Dir(stagedUpdatePath)
if err := os.RemoveAll(dirToRemove); err != nil {
if err := backoff.WaitFor(func() error {
return os.RemoveAll(dirToRemove)
}, 500*time.Millisecond, 100*time.Millisecond); err != nil {
ulm.slogger.Log(context.TODO(), slog.LevelWarn,
"could not remove temp staging directory",
"directory", dirToRemove,
Expand Down Expand Up @@ -187,13 +190,17 @@ func (ulm *updateLibraryManager) moveVerifiedUpdate(binary autoupdatableBinary,
return fmt.Errorf("could not create temporary directory for untarring and validating new update: %w", err)
}
defer func() {
// In case of error, clean up the staged version
if err := os.RemoveAll(stagedVersionedDirectory); err != nil {
ulm.slogger.Log(context.TODO(), slog.LevelWarn,
"could not remove staged update",
"directory", stagedVersionedDirectory,
"err", err,
)
// In case of error, clean up the staged version and its directory
if _, err := os.Stat(stagedVersionedDirectory); err == nil || !os.IsNotExist(err) {
if err := backoff.WaitFor(func() error {
return os.RemoveAll(stagedVersionedDirectory)
}, 500*time.Millisecond, 100*time.Millisecond); err != nil {
ulm.slogger.Log(context.TODO(), slog.LevelWarn,
"could not remove staged update",
"directory", stagedVersionedDirectory,
"err", err,
)
}
}
}()

Expand Down
24 changes: 24 additions & 0 deletions ee/ui/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ var KolideIco []byte
//go:embed kolide.png
var KolidePng []byte

//go:embed menubar-circle-dot-darkmode.ico
var MenubarCircleDotDarkmodeIco []byte

//go:embed menubar-circle-dot-darkmode.png
var MenubarCircleDotDarkmodePng []byte

//go:embed menubar-circle-dot-lightmode.ico
var MenubarCircleDotLightmodeIco []byte

//go:embed menubar-circle-dot-lightmode.png
var MenubarCircleDotLightmodePng []byte

//go:embed menubar-circle-dot-lightmode-shadow.ico
var MenubarCircleDotLightmodeShadowIco []byte

//go:embed menubar-circle-dot-lightmode-shadow.png
var MenubarCircleDotLightmodeShadowPng []byte

//go:embed menubar-circle-dot-monochrome.ico
var MenubarCircleDotMonochromeIco []byte

//go:embed menubar-circle-dot-monochrome.png
var MenubarCircleDotMonochromePng []byte

//go:embed menubar-circle-x-darkmode.ico
var MenubarCircleXDarkmodeIco []byte

Expand Down
Binary file added ee/ui/assets/menubar-circle-dot-darkmode.ico
Binary file not shown.
Binary file added ee/ui/assets/menubar-circle-dot-darkmode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ee/ui/assets/menubar-circle-dot-lightmode.ico
Binary file not shown.
Binary file added ee/ui/assets/menubar-circle-dot-lightmode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ee/ui/assets/menubar-circle-dot-monochrome.ico
Binary file not shown.
Binary file added ee/ui/assets/menubar-circle-dot-monochrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cbd73e3

Please sign in to comment.