You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2020/05/07 13:22:14 UTC

[atlas] branch branch-2.0 updated: ATLAS-3366:UI: Quick Search dropdown entry icon does not match the fallback icon for that entry

This is an automated email from the ASF dual-hosted git repository.

kbhatt pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 10f4f97  ATLAS-3366:UI: Quick Search dropdown entry icon does not match the fallback icon for that entry
10f4f97 is described below

commit 10f4f977380366fbb5167f6ccedb7a92f8dd2083
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Thu May 7 18:29:50 2020 +0530

    ATLAS-3366:UI: Quick Search dropdown entry icon does not match the fallback icon for that entry
    
    (cherry picked from commit f20f8bae023360f0f577342f8aea5ff0026b87e8)
---
 dashboardv2/public/js/utils/Globals.js             |  1 +
 .../js/views/detail_page/DetailPageLayoutView.js   |  9 ++++++++-
 .../js/views/search/SearchResultLayoutView.js      | 11 +++++++++++
 dashboardv2/public/js/views/site/Header.js         | 23 ++++++++++++++--------
 dashboardv3/public/js/utils/Globals.js             |  1 +
 .../js/views/detail_page/DetailPageLayoutView.js   |  9 ++++++++-
 .../js/views/search/GlobalSearchLayoutView.js      | 14 ++++++++++++-
 .../js/views/search/SearchResultLayoutView.js      | 11 +++++++++++
 8 files changed, 68 insertions(+), 11 deletions(-)

diff --git a/dashboardv2/public/js/utils/Globals.js b/dashboardv2/public/js/utils/Globals.js
index bb515f0..6ed423d 100644
--- a/dashboardv2/public/js/utils/Globals.js
+++ b/dashboardv2/public/js/utils/Globals.js
@@ -37,6 +37,7 @@ define(["require"], function(require) {
         status: false,
         response: {}
     };
+    Globals.serviceTypeMap = {};
     Globals.entityImgPath = "/img/entity-icon/";
     Globals.DEFAULT_UI = "v2";
     return Globals;
diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
index 82e834b..1bc0a42 100644
--- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
+++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
@@ -189,7 +189,14 @@ define(['require',
                                     titleName += '<button title="Deleted" class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i> Deleted</button>';
                                 }
                                 this.ui.title.html(titleName);
-                                var entityData = _.extend({ "serviceType": this.activeEntityDef && this.activeEntityDef.get('serviceType'), "isProcess": isProcess }, collectionJSON);
+                                if (collectionJSON.attributes.serviceType === undefined) {
+                                    if (Globals.serviceTypeMap[collectionJSON.typeName] === undefined && this.activeEntityDef) {
+                                        Globals.serviceTypeMap[collectionJSON.typeName] = this.activeEntityDef.get('serviceType');
+                                    }
+                                } else if (Globals.serviceTypeMap[collectionJSON.typeName] === undefined) {
+                                    Globals.serviceTypeMap[collectionJSON.typeName] = collectionJSON.attributes.serviceType;
+                                }
+                                var entityData = _.extend({ "serviceType": Globals.serviceTypeMap[collectionJSON.typeName], "isProcess": isProcess }, collectionJSON);
                                 if (this.readOnly) {
                                     this.ui.entityIcon.addClass('disabled');
                                 } else {
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 2b41f92..88b4474 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -667,6 +667,17 @@ define(['require',
                             var obj = model.toJSON(),
                                 nameHtml = "",
                                 name = Utils.getName(obj);
+                            if (obj.attributes.serviceType === undefined) {
+                                if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) {
+                                    var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName });
+                                    if (defObj) {
+                                        Globals.serviceTypeMap[obj.typeName] = defObj.get('serviceType');
+                                    }
+                                }
+                            } else if (Globals.serviceTypeMap[obj.typeName] === undefined) {
+                                Globals.serviceTypeMap[obj.typeName] = obj.attributes.serviceType;
+                            }
+                            obj.serviceType = Globals.serviceTypeMap[obj.typeName];
                             if (obj.guid) {
                                 if (obj.guid == "-1") {
                                     nameHtml = '<span title="' + name + '">' + name + '</span>';
diff --git a/dashboardv2/public/js/views/site/Header.js b/dashboardv2/public/js/views/site/Header.js
index ff8f847..ee8a01c 100644
--- a/dashboardv2/public/js/views/site/Header.js
+++ b/dashboardv2/public/js/views/site/Header.js
@@ -133,12 +133,14 @@ define(['require',
             var that = this,
                 request = options.request,
                 response = options.response,
+                inputEl = options.inputEl,
                 term = request.term,
                 data = {},
                 sendResponse = function() {
                     var query = data.query,
                         suggestions = data.suggestions;
                     if (query !== undefined && suggestions !== undefined) {
+                        inputEl.siblings('span.fa-refresh').removeClass("fa-refresh fa-spin-custom").addClass("fa-search");
                         response(data);
                     }
                 };
@@ -195,12 +197,6 @@ define(['require',
                 search: function() {
                     $(this).siblings('span.fa-search').removeClass("fa-search").addClass("fa-refresh fa-spin-custom");
                 },
-                focus: function(event, ui) {
-                    return false;
-                },
-                open: function() {
-                    $(this).siblings('span.fa-refresh').removeClass("fa-refresh fa-spin-custom").addClass("fa-search");
-                },
                 select: function(event, ui) {
                     var item = ui && ui.item;
                     event.preventDefault();
@@ -223,7 +219,8 @@ define(['require',
                 source: function(request, response) {
                     that.fetchSearchData({
                         request: request,
-                        response: response
+                        response: response,
+                        inputEl: this.element
                     });
                 }
             }).focus(function() {
@@ -242,7 +239,6 @@ define(['require',
                     }
                 }
             }).atlasAutoComplete("instance")._renderItem = function(ul, searchItem) {
-
                 if (searchItem) {
                     var data = searchItem.data,
                         searchTerm = this.term,
@@ -268,6 +264,17 @@ define(['require',
                                     item.itemText = Utils.getName(item) + " (" + item.typeName + ")";
                                     var options = {},
                                         table = '';
+                                    if (item.serviceType === undefined) {
+                                        if (Globals.serviceTypeMap[item.typeName] === undefined && that.entityDefCollection) {
+                                            var defObj = that.entityDefCollection.fullCollection.find({ name: item.typeName });
+                                            if (defObj) {
+                                                Globals.serviceTypeMap[item.typeName] = defObj.get("serviceType");
+                                            }
+                                        }
+                                    } else if (Globals.serviceTypeMap[item.typeName] === undefined) {
+                                        Globals.serviceTypeMap[item.typeName] = item.serviceType;
+                                    }
+                                    item.serviceType = Globals.serviceTypeMap[item.typeName];
                                     options.entityData = item;
                                     var imgEl = $('<img src="' + Utils.getEntityIconPath(options) + '">').on("error", function(error, s) {
                                         this.src = Utils.getEntityIconPath(_.extend(options, { errorUrl: this.src }));
diff --git a/dashboardv3/public/js/utils/Globals.js b/dashboardv3/public/js/utils/Globals.js
index bb515f0..6ed423d 100644
--- a/dashboardv3/public/js/utils/Globals.js
+++ b/dashboardv3/public/js/utils/Globals.js
@@ -37,6 +37,7 @@ define(["require"], function(require) {
         status: false,
         response: {}
     };
+    Globals.serviceTypeMap = {};
     Globals.entityImgPath = "/img/entity-icon/";
     Globals.DEFAULT_UI = "v2";
     return Globals;
diff --git a/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
index bb57a19..35ee6bf 100644
--- a/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
+++ b/dashboardv3/public/js/views/detail_page/DetailPageLayoutView.js
@@ -193,7 +193,14 @@ define(['require',
                                     titleName += '<button title="Deleted" class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i> Deleted</button>';
                                 }
                                 this.ui.title.html(titleName);
-                                var entityData = _.extend({ "serviceType": this.activeEntityDef && this.activeEntityDef.get('serviceType'), "isProcess": isProcess }, collectionJSON);
+                                if (collectionJSON.attributes.serviceType === undefined) {
+                                    if (Globals.serviceTypeMap[collectionJSON.typeName] === undefined && this.activeEntityDef) {
+                                        Globals.serviceTypeMap[collectionJSON.typeName] = this.activeEntityDef.get('serviceType');
+                                    }
+                                } else if (Globals.serviceTypeMap[collectionJSON.typeName] === undefined) {
+                                    Globals.serviceTypeMap[collectionJSON.typeName] = collectionJSON.attributes.serviceType;
+                                }
+                                var entityData = _.extend({ "serviceType": Globals.serviceTypeMap[collectionJSON.typeName], "isProcess": isProcess }, collectionJSON);
                                 if (this.readOnly) {
                                     this.ui.entityIcon.addClass('disabled');
                                 } else {
diff --git a/dashboardv3/public/js/views/search/GlobalSearchLayoutView.js b/dashboardv3/public/js/views/search/GlobalSearchLayoutView.js
index 2096e02..afae712 100644
--- a/dashboardv3/public/js/views/search/GlobalSearchLayoutView.js
+++ b/dashboardv3/public/js/views/search/GlobalSearchLayoutView.js
@@ -21,8 +21,9 @@ define(["require",
     "hbs!tmpl/search/GlobalSearchLayoutView_tmpl",
     "utils/Utils",
     "utils/UrlLinks",
+    'utils/Globals',
     "jquery-ui"
-], function(require, Backbone, GlobalSearchLayoutViewTmpl, Utils, UrlLinks) {
+], function(require, Backbone, GlobalSearchLayoutViewTmpl, Utils, UrlLinks, Globals) {
     "use strict";
 
     var GlobalSearchLayoutView = Backbone.Marionette.LayoutView.extend(
@@ -292,6 +293,17 @@ define(["require",
                                             item.itemText = Utils.getName(item) + " (" + item.typeName + ")";
                                             var options = {},
                                                 table = "";
+                                            if (item.serviceType === undefined) {
+                                                if (Globals.serviceTypeMap[item.typeName] === undefined && that.entityDefCollection) {
+                                                    var defObj = that.entityDefCollection.fullCollection.find({ name: item.typeName });
+                                                    if (defObj) {
+                                                        Globals.serviceTypeMap[item.typeName] = defObj.get("serviceType");
+                                                    }
+                                                }
+                                            } else if (Globals.serviceTypeMap[item.typeName] === undefined) {
+                                                Globals.serviceTypeMap[item.typeName] = item.serviceType;
+                                            }
+                                            item.serviceType = Globals.serviceTypeMap[item.typeName];
                                             options.entityData = item;
                                             var imgEl = $('<img src="' + Utils.getEntityIconPath(options) + '">').on("error", function(error, s) {
                                                 this.src = Utils.getEntityIconPath(_.extend(options, { errorUrl: this.src }));
diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
index d2eadfb..2528174 100644
--- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
@@ -680,6 +680,17 @@ define(['require',
                             var obj = model.toJSON(),
                                 nameHtml = "",
                                 name = Utils.getName(obj);
+                            if (obj.attributes.serviceType === undefined) {
+                                if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) {
+                                    var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName });
+                                    if (defObj) {
+                                        Globals.serviceTypeMap[obj.typeName] = defObj.get('serviceType');
+                                    }
+                                }
+                            } else if (Globals.serviceTypeMap[obj.typeName] === undefined) {
+                                Globals.serviceTypeMap[obj.typeName] = obj.attributes.serviceType;
+                            }
+                            obj.serviceType = Globals.serviceTypeMap[obj.typeName];
                             if (obj.guid) {
                                 if (obj.guid == "-1") {
                                     nameHtml = '<span title="' + name + '">' + name + '</span>';