Updated Branches: refs/heads/trunk aacb46fbd -> d6ad2991c
AMBARI-3214. HDFS > QuickLinks should point to the links for the active NameNode. (xiwang via yusaku) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/d6ad2991 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/d6ad2991 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/d6ad2991 Branch: refs/heads/trunk Commit: d6ad2991ce8b8aaeb98d8d8fbdcbff1ad98ebb71 Parents: aacb46f Author: Yusaku Sako <[email protected]> Authored: Thu Sep 12 15:24:52 2013 -0700 Committer: Yusaku Sako <[email protected]> Committed: Thu Sep 12 15:25:06 2013 -0700 ---------------------------------------------------------------------- ambari-web/app/mappers/service_mapper.js | 10 ++++++---- ambari-web/app/styles/application.less | 12 +++++++++++- .../app/templates/main/dashboard/service/hdfs.hbs | 6 +++++- .../templates/main/dashboard/widgets/hdfs_links.hbs | 4 ++++ .../app/templates/main/service/info/summary.hbs | 6 +++++- ambari-web/app/views/common/quick_view_link_view.js | 15 ++++++++++++++- 6 files changed, 45 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d6ad2991/ambari-web/app/mappers/service_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js index 2cb1c93..7982731 100644 --- a/ambari-web/app/mappers/service_mapper.js +++ b/ambari-web/app/mappers/service_mapper.js @@ -340,7 +340,7 @@ App.servicesMapper = App.QuickDataMapper.create({ if ( component.host_components.length == 2) { var haState1; var haState2; - if (component.host_components[1].metrics && component.host_components[1].metrics.dfs) { + if (component.host_components[1].metrics.dfs) { haState2 = component.host_components[1].metrics.dfs.FSNamesystem.HAState; } if (component.host_components[0].metrics.dfs) { @@ -391,9 +391,11 @@ App.servicesMapper = App.QuickDataMapper.create({ item.nameNodeComponent = component; finalConfig = jQuery.extend(finalConfig, hdfsConfig); // Get the live, dead & decommission nodes from string json - var liveNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.LiveNodes); - var deadNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DeadNodes); - var decommissionNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DecomNodes); + if (component.host_components[0].metrics.dfs && component.host_components[0].metrics.dfs.namenode) { + var liveNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.LiveNodes); + var deadNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DeadNodes); + var decommissionNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DecomNodes); + } item.live_data_nodes = []; item.dead_data_nodes = []; item.decommission_data_nodes = []; http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d6ad2991/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 5e86f59..bd93e95 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -2008,6 +2008,11 @@ width:100%; .service-block { margin-top: 20px; + .disabled-hdfs-quick-link { + pointer-events: none; + color: #808080; + cursor: default; + } } .service-configuration { @@ -2082,7 +2087,6 @@ table.graphs { } /*Dashboard Widgets Start*/ - #dashboard-widgets-container{ h4{ line-height: 30px; @@ -2364,7 +2368,13 @@ table.graphs { .link-button{ padding-top: 7px; padding-left: 70px; + .disabled-hdfs-quick-link { + pointer-events: none; + color: #808080; + cursor: default; } + } + .widget-content{ text-align: center; font-weight: none; http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d6ad2991/ambari-web/app/templates/main/dashboard/service/hdfs.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/service/hdfs.hbs b/ambari-web/app/templates/main/dashboard/service/hdfs.hbs index 895ec8a..2a7928b 100644 --- a/ambari-web/app/templates/main/dashboard/service/hdfs.hbs +++ b/ambari-web/app/templates/main/dashboard/service/hdfs.hbs @@ -155,7 +155,11 @@ </a> <ul class="dropdown-menu"> {{#each view.quickLinks}} - <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> + {{#if disabled}} + <li><a class="disabled-hdfs-quick-link">{{label}}</a></li> + {{else}} + <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> + {{/if}} {{/each}} </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d6ad2991/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs b/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs index 5539a53..bd45a25 100644 --- a/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs +++ b/ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs @@ -86,7 +86,11 @@ </a> <ul class="dropdown-menu"> {{#each view.quickLinks}} + {{#if disabled}} + <li><a class="disabled-hdfs-quick-link">{{label}}</a></li> + {{else}} <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li> + {{/if}} {{/each}} </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d6ad2991/ambari-web/app/templates/main/service/info/summary.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs index 6875793..bff363c 100644 --- a/ambari-web/app/templates/main/service/info/summary.hbs +++ b/ambari-web/app/templates/main/service/info/summary.hbs @@ -25,7 +25,11 @@ <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t common.quickLinks}}<b class="caret"></b></a> <ul class="dropdown-menu"> {{#each view.quickLinks}} - <a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a> + {{#if disabled}} + <a class="disabled-hdfs-quick-link">{{label}}</a> + {{else}} + <a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a> + {{/if}} {{/each}} </ul> </li> http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d6ad2991/ambari-web/app/views/common/quick_view_link_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js index 649a30f..28c0bf2 100644 --- a/ambari-web/app/views/common/quick_view_link_view.js +++ b/ambari-web/app/views/common/quick_view_link_view.js @@ -99,7 +99,16 @@ App.QuickViewLinks = Em.View.extend({ switch (serviceName) { case "HDFS": - host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'NAMENODE').get('host.publicHostName'); + if ( this.get('content.snameNode')) { // not HA + host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'NAMENODE').get('host.publicHostName'); + } else { + // HA + if (this.get('content.activeNameNode')) { + host = this.get('content.activeNameNode.hostName'); + }else { + host = 'noActiveNN'; + } + } break; case "MAPREDUCE": case "OOZIE": @@ -140,6 +149,10 @@ App.QuickViewLinks = Em.View.extend({ ]; } return this.get('content.quickLinks').map(function (item) { + if (host == 'noActiveNN') { + item.set('disabled', true); + return item; + } var protocol = self.setProtocol(item.get('service_id')); if (item.get('template')) { item.set('url', item.get('template').fmt(protocol,host));
