Skip to content

Commit

Permalink
Merge pull request #12721 from lokanandaprabhu/feature/OCPBUGS-9909
Browse files Browse the repository at this point in the history
OCPBUGS-9909: Could not import multiple resources via JSON (while YAML supports this)
  • Loading branch information
openshift-merge-robot committed May 30, 2023
2 parents 5a8491c + 3ccb7d3 commit b454f29
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions frontend/public/components/edit-yaml.jsx
Expand Up @@ -509,8 +509,21 @@ export const EditYAML_ = connect(stateToProps)(
return;
}
if (objs.length === 1) {
this.save();
return;
if (
objs[0]?.apiVersion === 'v1' &&
objs[0]?.kind?.includes('List') &&
objs[0]?.items
) {
if (objs[0]?.items?.length > 0) {
objs = objs[0].items;
} else {
this.handleError(t('public~"items" list is empty'));
return;
}
} else {
this.save();
return;
}
} else if (objs.length === 0) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions frontend/public/locales/en/public.json
Expand Up @@ -471,6 +471,7 @@
"Cannot change resource namespace (original: \"{{namespace}}\", updated: \"{{newNamespace}}\").": "Cannot change resource namespace (original: \"{{namespace}}\", updated: \"{{newNamespace}}\").",
"Cannot change resource kind (original: \"{{original}}\", updated: \"{{updated}}\").": "Cannot change resource kind (original: \"{{original}}\", updated: \"{{updated}}\").",
"Cannot change API group (original: \"{{apiGroup}}\", updated: \"{{newAPIGroup}}\").": "Cannot change API group (original: \"{{apiGroup}}\", updated: \"{{newAPIGroup}}\").",
"\"items\" list is empty": "\"items\" list is empty",
"Resources in the same namespace and API group must have unique names": "Resources in the same namespace and API group must have unique names",
"Failed to parse YAML sample": "Failed to parse YAML sample",
"An error occurred.": "An error occurred.",
Expand Down

0 comments on commit b454f29

Please sign in to comment.