mirror of
https://github.com/rancher/types.git
synced 2025-09-01 05:09:10 +00:00
update pipeline types
This commit is contained in:
committed by
Alena Prokharchyk
parent
977d3d15e3
commit
36f2de76ce
@@ -20,6 +20,10 @@ func (n *NamespaceReference) FromInternal(data map[string]interface{}) {
|
||||
if ok {
|
||||
for _, path := range n.fields {
|
||||
convert.Transform(data, path, func(input interface{}) interface{} {
|
||||
parts := strings.SplitN(convert.ToString(input), ":", 2)
|
||||
if len(parts) == 2 {
|
||||
return input
|
||||
}
|
||||
return fmt.Sprintf("%s:%v", namespaceID, input)
|
||||
})
|
||||
}
|
||||
@@ -27,13 +31,17 @@ func (n *NamespaceReference) FromInternal(data map[string]interface{}) {
|
||||
}
|
||||
|
||||
func (n *NamespaceReference) ToInternal(data map[string]interface{}) error {
|
||||
namespaceID, ok := data["namespaceId"]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
for _, path := range n.fields {
|
||||
convert.Transform(data, path, func(input interface{}) interface{} {
|
||||
parts := strings.SplitN(convert.ToString(input), ":", 2)
|
||||
if len(parts) == 2 {
|
||||
if len(parts) == 2 && (parts[0] == namespaceID) {
|
||||
return parts[1]
|
||||
}
|
||||
return parts[0]
|
||||
return input
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user