Skip to content

Commit

Permalink
Backwards-compatible client-side kind detection (#4812)
Browse files Browse the repository at this point in the history
* Backwards-compatible `kind` detection

* Add comment
  • Loading branch information
ericpgreen2 authored May 2, 2024
1 parent 489d52f commit 202343d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web-common/src/features/entity-management/file-content-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ function tryParseYaml(

try {
const yaml = parse(fileContents);
if (yaml.type) {

// Get `type` (or `kind`, for backwards-compatibility) from yaml file
// We try `kind` first to avoid picking up old Sources' `type` field
if (yaml?.kind) {
kind = ResourceShortNameToKind[yaml.kind as string];
} else if (yaml?.type) {
kind = ResourceShortNameToKind[yaml.type as string];
}
if (yaml.name) {

// Get `name` from yaml file
if (yaml?.name) {
name = yaml.name as string;
}
} catch (err) {
Expand Down

0 comments on commit 202343d

Please sign in to comment.