This is an automated email from the ASF dual-hosted git repository.
akovalenko pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new 7df08ed [AMBARI-25249] Ambari UI quicklinks
7df08ed is described below
commit 7df08ed4c8689adda76cedad5105aa9b3cfd95e9
Author: Aleksandr Kovalenko <[email protected]>
AuthorDate: Mon Apr 15 19:41:42 2019 +0300
[AMBARI-25249] Ambari UI quicklinks
---
.../app/views/common/quick_view_link_view.js | 33 +++++++++++++++-------
1 file changed, 23 insertions(+), 10 deletions(-)
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 4a64c20..1281554 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -418,14 +418,17 @@ App.QuickLinksView = Em.View.extend({
var links = Em.get(quickLinksConfig, 'links');
links.forEach(function (link) {
- var publicHostName = this.publicHostName(link, hosts, protocol);
- if (publicHostName) {
- if (link.protocol) {
- protocol = this.setProtocol(configProperties, link.protocol);
- }
- var newItem = this.getHostLink(link, publicHostName, protocol,
configProperties, response); //quicklink generated for the hbs template
- if (!Em.isNone(newItem)) {
- quickLinks.push(newItem);
+ var isRelatedComponentInstalled =
this.isRelatedComponentInstalled(link);
+ if (isRelatedComponentInstalled) {
+ var publicHostName = this.publicHostName(link, hosts, protocol);
+ if (publicHostName) {
+ if (link.protocol) {
+ protocol = this.setProtocol(configProperties, link.protocol);
+ }
+ var newItem = this.getHostLink(link, publicHostName, protocol,
configProperties, response); //quicklink generated for the hbs template
+ if (!Em.isNone(newItem)) {
+ quickLinks.push(newItem);
+ }
}
}
}, this);
@@ -480,7 +483,8 @@ App.QuickLinksView = Em.View.extend({
links.forEach(function (link) {
var linkRemoved = Em.get(link, 'removed');
var url = Em.get(link, 'url');
- if (url && !linkRemoved) {
+ var isRelatedComponentInstalled =
this.isRelatedComponentInstalled(link);
+ if (url && !linkRemoved && isRelatedComponentInstalled) {
var hostNameRegExp = new RegExp('([\\w\\W]*):\\d+');
if (serviceName === 'HDFS') {
var config;
@@ -874,5 +878,14 @@ App.QuickLinksView = Em.View.extend({
App.tooltip($(`[rel="${this.get('tooltipAttribute')}"]`));
}
});
- }.observes('showQuickLinks', 'isLoaded', 'quickLinksArray.length')
+ }.observes('showQuickLinks', 'isLoaded', 'quickLinksArray.length'),
+
+ /**
+ * Check if host component related to quickLink is installed
+ * @param quickLink
+ * @returns {Boolean}
+ */
+ isRelatedComponentInstalled: function (quickLink) {
+ return App.HostComponent.find().someProperty('componentName',
quickLink.component_name);
+ }
});