Skip to content

Commit

Permalink
Make saml and app return same kind for the UI (#30812)
Browse files Browse the repository at this point in the history
* Make saml and app return same kind for the UI

* Fix tests
  • Loading branch information
avatus authored Aug 21, 2023
1 parent 71ee4d8 commit 4282588
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions lib/web/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3638,7 +3638,7 @@ func TestCheckAccessToRegisteredResource(t *testing.T) {
insertResource: func() {
resource := &types.AppServerV3{
Metadata: types.Metadata{Name: "test-app"},
Kind: types.KindAppServer,
Kind: types.KindApp,
Version: types.V2,
Spec: types.AppServerSpecV3{
HostID: "hostid",
Expand Down Expand Up @@ -4211,7 +4211,7 @@ func TestClusterAppsGet(t *testing.T) {

resource := &types.AppServerV3{
Metadata: types.Metadata{Name: "test-app"},
Kind: types.KindAppServer,
Kind: types.KindApp,
Version: types.V2,
Spec: types.AppServerSpecV3{
HostID: "hostid",
Expand Down Expand Up @@ -4273,7 +4273,7 @@ func TestClusterAppsGet(t *testing.T) {
require.Len(t, resp.Items, 3)
require.Equal(t, 3, resp.TotalCount)
require.ElementsMatch(t, resp.Items, []ui.App{{
Kind: types.KindAppServer,
Kind: types.KindApp,
Name: "app1",
Description: resource.Spec.App.GetDescription(),
URI: resource.Spec.App.GetURI(),
Expand All @@ -4284,7 +4284,7 @@ func TestClusterAppsGet(t *testing.T) {
AWSConsole: true,
UserGroups: []ui.UserGroupAndDescription{{Name: "ug1", Description: "ug1-description"}},
}, {
Kind: types.KindAppServer,
Kind: types.KindApp,
Name: "app2",
URI: "uri",
Labels: []ui.Label{},
Expand All @@ -4293,7 +4293,7 @@ func TestClusterAppsGet(t *testing.T) {
PublicAddr: "publicaddrs",
AWSConsole: false,
}, {
Kind: types.KindSAMLIdPServiceProvider,
Kind: types.KindApp,
Name: "test-saml-app",
Description: "SAML Application",
URI: "",
Expand Down
10 changes: 5 additions & 5 deletions lib/web/ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func MakeApp(app types.Application, c MakeAppsConfig) App {
}

resultApp := App{
Kind: app.GetKind(),
Kind: types.KindApp,
Name: app.GetName(),
Description: app.GetDescription(),
URI: app.GetURI(),
Expand All @@ -135,9 +135,9 @@ func MakeApp(app types.Application, c MakeAppsConfig) App {
func MakeSAMLApp(app types.SAMLIdPServiceProvider, c MakeAppsConfig) App {
labels := makeLabels(app.GetAllLabels())
resultApp := App{
Kind: app.GetKind(),
Kind: types.KindApp,
Name: app.GetName(),
Description: app.GetMetadata().Description,
Description: "SAML Application",
PublicAddr: "",
Labels: labels,
ClusterID: c.AppClusterName,
Expand Down Expand Up @@ -168,7 +168,7 @@ func MakeApps(c MakeAppsConfig) []App {
}

resultApp := App{
Kind: appOrSP.GetKind(),
Kind: types.KindApp,
Name: appOrSP.GetName(),
Description: appOrSP.GetDescription(),
URI: app.GetURI(),
Expand All @@ -191,7 +191,7 @@ func MakeApps(c MakeAppsConfig) []App {
} else {
labels := makeLabels(appOrSP.GetSAMLIdPServiceProvider().GetAllLabels())
resultApp := App{
Kind: appOrSP.GetKind(),
Kind: types.KindApp,
Name: appOrSP.GetName(),
Description: appOrSP.GetDescription(),
PublicAddr: appOrSP.GetPublicAddr(),
Expand Down
10 changes: 5 additions & 5 deletions lib/web/ui/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestMakeApps(t *testing.T) {
}))},
expected: []App{
{
Kind: types.KindAppServer,
Kind: types.KindApp,
Name: "1",
URI: "1.com",
PublicAddr: "1.com",
Expand All @@ -103,7 +103,7 @@ func TestMakeApps(t *testing.T) {
UserGroups: []UserGroupAndDescription{},
},
{
Kind: types.KindAppServer,
Kind: types.KindApp,
Name: "2",
Description: "group 2 friendly name",
URI: "2.com",
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestMakeApps(t *testing.T) {
},
expected: []App{
{
Kind: types.KindAppServer,
Kind: types.KindApp,
Name: "1",
URI: "1.com",
PublicAddr: "1.com",
Expand All @@ -153,7 +153,7 @@ func TestMakeApps(t *testing.T) {
},
},
{
Kind: types.KindAppServer,
Kind: types.KindApp,
Name: "2",
Description: "group 2 friendly name",
URI: "2.com",
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestMakeApps(t *testing.T) {
})},
expected: []App{
{
Kind: types.KindSAMLIdPServiceProvider,
Kind: types.KindApp,
Name: "grafana_saml",
Description: "SAML Application",
PublicAddr: "",
Expand Down

0 comments on commit 4282588

Please sign in to comment.