in ambari-web/app/views/common/quick_view_link_view.js [81:159]
setQuickLinks: function () {
this.loadTags();
var serviceName = this.get('content.serviceName');
var components = this.get('content.hostComponents');
var host;
var self = this;
var version = App.get('currentStackVersionNumber');
var quickLinks = [];
switch (serviceName) {
case "HDFS":
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.publicHostName');
}else {
host = 'noActiveNN';
}
}
break;
case "MAPREDUCE":
case "OOZIE":
case "GANGLIA":
case "NAGIOS":
case "HUE":
host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('isMaster', true).get("host").get("publicHostName");
break;
case "HBASE":
var component;
if (App.supports.multipleHBaseMasters) {
component = components.filterProperty('componentName', 'HBASE_MASTER').findProperty('haStatus', 'true');
} else {
component = components.findProperty('componentName', 'HBASE_MASTER');
}
if (component) {
if (App.singleNodeInstall) {
host = App.singleNodeAlias;
} else {
host = component.get('host.publicHostName');
}
}
break;
case "YARN":
host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'RESOURCEMANAGER').get('host.publicHostName');
break;
case "MAPREDUCE2":
host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'HISTORYSERVER').get('host.publicHostName');
break;
}
if (!host) {
quickLinks = [
{
label: this.t('quick.links.error.label'),
url: 'javascript:alert("' + this.t('contact.administrator') + '");return false;'
}
];
} else {
quickLinks = this.get('content.quickLinks').map(function (item) {
if (host == 'noActiveNN') {
item.set('disabled', true);
} else {
item.set('disabled', false);
var protocol = self.setProtocol(item.get('service_id'));
if (item.get('template')) {
if(item.get('service_id') === 'YARN'){
var port = self.setPort(item.get('service_id'),protocol, version);
item.set('url', item.get('template').fmt(protocol,host,port));
} else {
item.set('url', item.get('template').fmt(protocol,host));
}
}
}
return item;
});
}
this.set('quickLinks',quickLinks);
}.observes('content.quickLinks.@each.label'),