fix resource owner display on backup list (#1580)
## Type of change - [x] 🐛 Bugfix ## Issue(s) * #1506 ## Test Plan - [x] ⚡ Unit test
This commit is contained in:
parent
f3980f6bc9
commit
5f82edb783
@ -296,8 +296,8 @@ func resourcesShortFormat(m map[string][]string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transforms the slice to a single map.
|
// Transforms the slice to a single map.
|
||||||
// Keys are each map's scopeKeyResource value.
|
// Keys are each service's rootCat value.
|
||||||
// Values are the set of all scopeKeyDataTypes for a given resource.
|
// Values are the set of all scopeKeyDataTypes for the resource.
|
||||||
func toResourceTypeMap[T scopeT](s []scope) map[string][]string {
|
func toResourceTypeMap[T scopeT](s []scope) map[string][]string {
|
||||||
if len(s) == 0 {
|
if len(s) == 0 {
|
||||||
return nil
|
return nil
|
||||||
@ -314,7 +314,9 @@ func toResourceTypeMap[T scopeT](s []scope) map[string][]string {
|
|||||||
k = All
|
k = All
|
||||||
}
|
}
|
||||||
|
|
||||||
r[k] = addToSet(r[k], split(sc[scopeKeyDataType].Target))
|
for _, sk := range split(k) {
|
||||||
|
r[sk] = addToSet(r[sk], split(sc[scopeKeyDataType].Target))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|||||||
@ -106,6 +106,21 @@ func (suite *SelectorSuite) TestToResourceTypeMap() {
|
|||||||
"smarf": {unknownCatStub.String()},
|
"smarf": {unknownCatStub.String()},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "multiple resources",
|
||||||
|
input: []scope{
|
||||||
|
scope(stubScope("")),
|
||||||
|
{
|
||||||
|
rootCatStub.String(): filterize(scopeConfig{}, join("smarf", "fnords")),
|
||||||
|
scopeKeyDataType: filterize(scopeConfig{}, unknownCatStub.String()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expect: map[string][]string{
|
||||||
|
"All": {rootCatStub.String()},
|
||||||
|
"smarf": {unknownCatStub.String()},
|
||||||
|
"fnords": {unknownCatStub.String()},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "disjoint types",
|
name: "disjoint types",
|
||||||
input: []scope{
|
input: []scope{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user