From 451c949cdb1ff42a70ac3a581f5740385826998f Mon Sep 17 00:00:00 2001 From: Ryan Graham Date: Tue, 17 Sep 2019 13:47:36 -0400 Subject: [PATCH 1/3] fixed resource yaml not loading when no histObj exists --- imports/ui/pages/resources/resourcesSingle.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imports/ui/pages/resources/resourcesSingle.jsx b/imports/ui/pages/resources/resourcesSingle.jsx index 8c44983c..938f7a80 100644 --- a/imports/ui/pages/resources/resourcesSingle.jsx +++ b/imports/ui/pages/resources/resourcesSingle.jsx @@ -133,6 +133,9 @@ export class ResourceYamlDisplay extends React.Component{ compareYamls: this.state.compareYamls, }; var newYamlStr = _.get(this.state, 'compareYamls[0].yamlStr', 'null'); + if(!newYamlStr || newYamlStr == 'null'){ + newYamlStr = histAttrs.resource.data; + } var newYamlObj = newYamlStr; _.attempt(()=>{ newYamlObj = JSON.parse(newYamlStr); @@ -173,7 +176,7 @@ export class ResourceYamlDisplay extends React.Component{ } {!newYamlObj && -
+
Error: Failed to load resource yaml object
} From 54cb988c9d9295bf36a88f2cedd18cf420276ed1 Mon Sep 17 00:00:00 2001 From: Ryan Graham Date: Tue, 17 Sep 2019 13:48:37 -0400 Subject: [PATCH 2/3] added comment --- imports/ui/pages/resources/resourcesSingle.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/imports/ui/pages/resources/resourcesSingle.jsx b/imports/ui/pages/resources/resourcesSingle.jsx index 938f7a80..4c7744eb 100644 --- a/imports/ui/pages/resources/resourcesSingle.jsx +++ b/imports/ui/pages/resources/resourcesSingle.jsx @@ -134,6 +134,7 @@ export class ResourceYamlDisplay extends React.Component{ }; var newYamlStr = _.get(this.state, 'compareYamls[0].yamlStr', 'null'); if(!newYamlStr || newYamlStr == 'null'){ + // defaults to the resource.data yaml if not resourceHistObj found newYamlStr = histAttrs.resource.data; } var newYamlObj = newYamlStr; From 8699e45e0ffa1945b4e3095e4499878838a4f9ab Mon Sep 17 00:00:00 2001 From: Ryan Graham Date: Tue, 17 Sep 2019 13:49:09 -0400 Subject: [PATCH 3/3] typo in comment --- imports/ui/pages/resources/resourcesSingle.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/ui/pages/resources/resourcesSingle.jsx b/imports/ui/pages/resources/resourcesSingle.jsx index 4c7744eb..4ecd79e2 100644 --- a/imports/ui/pages/resources/resourcesSingle.jsx +++ b/imports/ui/pages/resources/resourcesSingle.jsx @@ -134,7 +134,7 @@ export class ResourceYamlDisplay extends React.Component{ }; var newYamlStr = _.get(this.state, 'compareYamls[0].yamlStr', 'null'); if(!newYamlStr || newYamlStr == 'null'){ - // defaults to the resource.data yaml if not resourceHistObj found + // defaults to the resource.data yaml if no resourceHistObj found newYamlStr = histAttrs.resource.data; } var newYamlObj = newYamlStr;