-
Notifications
You must be signed in to change notification settings - Fork 980
Fleet UI: return app name on success of adding android app #44068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,15 +65,16 @@ type addAppStoreAppRequest struct { | |
| } | ||
|
|
||
| type addAppStoreAppResponse struct { | ||
| TitleID uint `json:"software_title_id,omitempty"` | ||
| Err error `json:"error,omitempty"` | ||
| TitleID uint `json:"software_title_id,omitempty"` | ||
| Name string `json:"name,omitempty"` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a docs update for this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do separate PR into 4.86.0 docs |
||
| Err error `json:"error,omitempty"` | ||
| } | ||
|
|
||
| func (r addAppStoreAppResponse) Error() error { return r.Err } | ||
|
|
||
| func addAppStoreAppEndpoint(ctx context.Context, request interface{}, svc fleet.Service) (fleet.Errorer, error) { | ||
| req := request.(*addAppStoreAppRequest) | ||
| titleID, err := svc.AddAppStoreApp(ctx, req.TeamID, fleet.VPPAppTeam{ | ||
| titleID, name, err := svc.AddAppStoreApp(ctx, req.TeamID, fleet.VPPAppTeam{ | ||
| VPPAppID: fleet.VPPAppID{AdamID: req.AppStoreID, Platform: req.Platform}, | ||
| SelfService: req.SelfService, | ||
| LabelsIncludeAny: req.LabelsIncludeAny, | ||
|
|
@@ -87,15 +88,15 @@ func addAppStoreAppEndpoint(ctx context.Context, request interface{}, svc fleet. | |
| return &addAppStoreAppResponse{Err: err}, nil | ||
| } | ||
|
|
||
| return &addAppStoreAppResponse{TitleID: titleID}, nil | ||
| return &addAppStoreAppResponse{TitleID: titleID, Name: name}, nil | ||
| } | ||
|
|
||
| func (svc *Service) AddAppStoreApp(ctx context.Context, _ *uint, _ fleet.VPPAppTeam) (uint, error) { | ||
| func (svc *Service) AddAppStoreApp(ctx context.Context, _ *uint, _ fleet.VPPAppTeam) (uint, string, error) { | ||
| // skipauth: No authorization check needed due to implementation returning | ||
| // only license error. | ||
| svc.authz.SkipAuthorization(ctx) | ||
|
|
||
| return 0, fleet.ErrMissingLicense | ||
| return 0, "", fleet.ErrMissingLicense | ||
| } | ||
|
|
||
| ////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,7 +126,7 @@ func TestVPPAuth(t *testing.T) { | |
| checkAuthErr(t, tt.shouldFailRead, err) | ||
| } | ||
|
|
||
| _, err = svc.AddAppStoreApp(ctx, tt.teamID, fleet.VPPAppTeam{VPPAppID: fleet.VPPAppID{AdamID: "123", Platform: fleet.IOSPlatform}}) | ||
| _, _, err = svc.AddAppStoreApp(ctx, tt.teamID, fleet.VPPAppTeam{VPPAppID: fleet.VPPAppID{AdamID: "123", Platform: fleet.IOSPlatform}}) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's being tested elsewhere: server/service/integration_android_software_test.go in TestAndroidAppsSelfService, lines ~307 and ~392 |
||
| if tt.teamID == nil { | ||
| require.Error(t, err) | ||
| } else { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fleet's MySQL layer doesn't normalize VPP app names on insert (no triggers, no column transforms). The value you pass in is the value that gets stored. Adding a re-read after write is an extra DB round-trip to guard against something that doesn't happen.