Ver código fonte

AMBARI-9350 Ui not able to load host page, should be robust when host_version not yet created. (atkach)

Andrii Tkach 10 anos atrás
pai
commit
02190c4f38
1 arquivos alterados com 5 adições e 5 exclusões
  1. 5 5
      ambari-web/app/views/main/host.js

+ 5 - 5
ambari-web/app/views/main/host.js

@@ -580,21 +580,21 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
 
     /**
      * true if host has only one repoversion
-     * in this case expander in version columnn is hidden
+     * in this case expander in version column is hidden
      * @returns {Boolean}
      */
     hasSingleVersion: function() {
-      return this.get('content.stackVersions.length') == 1;
+      return this.get('content.stackVersions.length') < 2;
     }.property('content.stackVersions.length'),
 
     /**
      * this version is always shown others hidden unless expander is open
+     * host may have no stack versions
      * @returns {String}
      */
     currentVersion: function() {
-      var currentRepoVersion = this.get('content.stackVersions').findProperty('isCurrent');
-      var version = currentRepoVersion ? currentRepoVersion : this.get('content.stackVersions').filterProperty('isCurrent', false)[0];
-      return version.get('repoVersion') + " (" + version.get('displayStatus') + ")";
+      var currentRepoVersion = this.get('content.stackVersions').findProperty('isCurrent') || this.get('content.stackVersions').objectAt(0);
+      return currentRepoVersion ? currentRepoVersion.get('repoVersion') + " (" + currentRepoVersion.get('displayStatus') + ")" : "";
     }.property('content.stackVersions'),
 
     /**