Commit 6148b22a by Suma Shivaprasad

ATLAS-843 Atlas UI: Feature to search terms in left navigation. (Kalyanikashikar via sumasai)

parent a05f752d
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<div class="form-group">
<select type="text" class="form-control" data-id="searchTermInput" placeholder="Search term"></select>
</div>
<div class="row"> <div class="row">
<button class="btn btn-taxanomyBack btn-atlas" data-id="backTaxanomy"><i class="fa fa-chevron-left"></i> Back</button> <button class="btn btn-taxanomyBack btn-atlas" data-id="backTaxanomy"><i class="fa fa-chevron-left"></i> Back</button>
</div> </div>
...@@ -21,8 +24,8 @@ ...@@ -21,8 +24,8 @@
<ul class="taxonomyTree"> <ul class="taxonomyTree">
<div class="contentLoading"></div> <div class="contentLoading"></div>
<li class="children parent" data-id="Parent"></li> <li class="children parent" data-id="Parent"></li>
<li class="chileds parentChiled"> <li class="childs parentChild">
<ul data-id="chiledList"> <ul data-id="childList">
</ul> </ul>
</li> </li>
</ul> </ul>
......
...@@ -75,11 +75,18 @@ define(['require', 'utils/Globals'], function(require, Globals) { ...@@ -75,11 +75,18 @@ define(['require', 'utils/Globals'], function(require, Globals) {
}); });
}; };
Utils.defaultErrorHandler = function(model, error) { Utils.defaultErrorHandler = function(model, error) {
/*require(['views/common/ErrorView', 'App'], function(vError, App) {*/
if (error.status == 401) { if (error.status == 401) {
window.location = 'login.jsp' window.location = 'login.jsp'
} else if (error.status == 419) { } else if (error.status == 419) {
window.location = 'login.jsp' window.location = 'login.jsp'
} else if (error.status == 403) {
var message = "You are not authorized";
if (error.statusText) {
message = JSON.parse(error.statusText).AuthorizationError;
}
Utils.notifyError({
content: message
});
} else if (error.status == "0") { } else if (error.status == "0") {
var diffTime = (new Date().getTime() - prevNetworkErrorTime); var diffTime = (new Date().getTime() - prevNetworkErrorTime);
if (diffTime > 3000) { if (diffTime > 3000) {
...@@ -90,8 +97,6 @@ define(['require', 'utils/Globals'], function(require, Globals) { ...@@ -90,8 +97,6 @@ define(['require', 'utils/Globals'], function(require, Globals) {
}); });
} }
} }
/*});*/
}; };
Utils.localStorage = { Utils.localStorage = {
......
...@@ -37,10 +37,11 @@ define(['require', ...@@ -37,10 +37,11 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
Parent: '[data-id="Parent"]', Parent: '[data-id="Parent"]',
chiledList: '[data-id="chiledList"]', childList: '[data-id="childList"]',
liClick: 'li a[data-href]', liClick: 'li a[data-href]',
backTaxanomy: '[data-id="backTaxanomy"]', backTaxanomy: '[data-id="backTaxanomy"]',
expandArrow: '[data-id="expandArrow"]' expandArrow: '[data-id="expandArrow"]',
searchTermInput: '[data-id="searchTermInput"]'
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -56,6 +57,11 @@ define(['require', ...@@ -56,6 +57,11 @@ define(['require',
}; };
events['click ' + this.ui.backTaxanomy] = 'backButtonTaxanomy'; events['click ' + this.ui.backTaxanomy] = 'backButtonTaxanomy';
events['click ' + this.ui.expandArrow] = 'changeArrowState'; events['click ' + this.ui.expandArrow] = 'changeArrowState';
events["change " + this.ui.searchTermInput] = function() {
this.singleClick = false;
var termUrl = this.termCollection.url.split("/", 5).join("/") + "/" + this.ui.searchTermInput.val().split(".").join("/terms/");
this.forwardClick(undefined, true, termUrl);
};
return events; return events;
}, },
/** /**
...@@ -65,7 +71,9 @@ define(['require', ...@@ -65,7 +71,9 @@ define(['require',
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url')); _.extend(this, _.pick(options, 'globalVent', 'url'));
this.parentCollection = new VCatalogList(); this.parentCollection = new VCatalogList();
this.chiledCollection = new VCatalogList(); this.childCollection = new VCatalogList();
this.taxanomy = new VCatalogList();
this.termCollection = new VCatalogList();
this.dblClick = false; this.dblClick = false;
this.singleClick = false; this.singleClick = false;
}, },
...@@ -75,11 +83,17 @@ define(['require', ...@@ -75,11 +83,17 @@ define(['require',
this.dblClick = false; this.dblClick = false;
this.generateTree(true); this.generateTree(true);
}, this); }, this);
this.listenTo(this.chiledCollection, 'reset', function() { this.listenTo(this.childCollection, 'reset', function() {
this.dblClick = false; this.dblClick = false;
this.generateTree(); this.generateTree();
}, this); }, this);
this.listenTo(this.chiledCollection, 'error', function(model, response) { this.listenTo(this.taxanomy, 'reset', function() {
this.searchResult();
}, this);
this.listenTo(this.termCollection, 'reset', function() {
this.termSearchData();
}, this);
this.listenTo(this.childCollection, 'error', function(model, response) {
if (response && response.responseJSON && response.responseJSON.message) { if (response && response.responseJSON && response.responseJSON.message) {
Utils.notifyError({ Utils.notifyError({
content: response.responseJSON.message content: response.responseJSON.message
...@@ -102,7 +116,9 @@ define(['require', ...@@ -102,7 +116,9 @@ define(['require',
var that = this; var that = this;
this.bindEvents(); this.bindEvents();
that.ui.backTaxanomy.hide(); that.ui.backTaxanomy.hide();
this.fetchCollection(this.url, true); this.fetchCollection(this.url, true);
$('body').on("click", '.termPopoverList li', function(e) { $('body').on("click", '.termPopoverList li', function(e) {
that[$(this).find("a").data('fn')](e); that[$(this).find("a").data('fn')](e);
}); });
...@@ -114,6 +130,7 @@ define(['require', ...@@ -114,6 +130,7 @@ define(['require',
that.$('.termPopover').popover('hide'); that.$('.termPopover').popover('hide');
} }
}); });
this.fetchTaxanomyCollections();
}, },
manualRender: function(url, isParent, back) { manualRender: function(url, isParent, back) {
if (back) { if (back) {
...@@ -143,16 +160,16 @@ define(['require', ...@@ -143,16 +160,16 @@ define(['require',
scope.removeClass('fa-chevron-down'); scope.removeClass('fa-chevron-down');
scope.addClass('fa-chevron-right'); scope.addClass('fa-chevron-right');
this.addActiveClass(scope[0]); this.addActiveClass(scope[0]);
this.ui.chiledList.hide(); this.ui.childList.hide();
} else { } else {
if (e && $(e.currentTarget).parents('li.parentChiled').length) { if (e && $(e.currentTarget).parents('li.parentChild').length) {
scope.parent('li').find('.tools .taxanomyloader').show(); scope.parent('li').find('.tools .taxanomyloader').show();
this.forwardClick(e, true); this.forwardClick(e, true);
} else { } else {
scope.addClass('fa-chevron-down'); scope.addClass('fa-chevron-down');
scope.removeClass('fa-chevron-right'); scope.removeClass('fa-chevron-right');
this.singleClick = false; this.singleClick = false;
this.ui.chiledList.show(); this.ui.childList.show();
} }
} }
...@@ -177,9 +194,9 @@ define(['require', ...@@ -177,9 +194,9 @@ define(['require',
this.parentCollection.fullCollection.reset(undefined, { silent: true }); this.parentCollection.fullCollection.reset(undefined, { silent: true });
this.parentCollection.fetch({ reset: true }); this.parentCollection.fetch({ reset: true });
} else { } else {
this.chiledCollection.url = this.url + "?hierarchy/path:."; this.childCollection.url = this.url + "?hierarchy/path:.";
this.chiledCollection.fullCollection.reset(undefined, { silent: true }); this.childCollection.fullCollection.reset(undefined, { silent: true });
this.chiledCollection.fetch({ reset: true }); this.childCollection.fetch({ reset: true });
} }
}, },
forwardClick: function(e, forward, url) { forwardClick: function(e, forward, url) {
...@@ -190,22 +207,29 @@ define(['require', ...@@ -190,22 +207,29 @@ define(['require',
if (url) { if (url) {
hrefUrl = url; hrefUrl = url;
} }
if (!e && !url) {
var dataHref = this.ui.Parent.find('a').data('href');
if (dataHref) {
hrefUrl = dataHref;
}
}
if (forward) { if (forward) {
this.dblClick = true; this.dblClick = true;
this.ui.chiledList.show(); this.ui.childList.show();
this.fetchCollection(hrefUrl, true); this.fetchCollection(hrefUrl, true);
} else { } else {
this.singleClick = true; this.singleClick = true;
} }
Utils.setUrl({ if (hrefUrl.length > 1) {
url: '#!/taxonomy/detailCatalog' + hrefUrl, Utils.setUrl({
mergeBrowserUrl: false, url: '#!/taxonomy/detailCatalog' + hrefUrl,
updateTabState: function() { mergeBrowserUrl: false,
return { taxonomyUrl: this.url, stateChanged: false }; updateTabState: function() {
}, return { taxonomyUrl: this.url, stateChanged: false };
trigger: true },
}); trigger: true
});
}
if (e) { if (e) {
this.addActiveClass(e); this.addActiveClass(e);
} }
...@@ -216,7 +240,7 @@ define(['require', ...@@ -216,7 +240,7 @@ define(['require',
}, },
generateTree: function(isParent) { generateTree: function(isParent) {
var parentLi = "", var parentLi = "",
chiledLi = "", childLi = "",
that = this; that = this;
function createTaxonomy(url) { function createTaxonomy(url) {
...@@ -246,18 +270,18 @@ define(['require', ...@@ -246,18 +270,18 @@ define(['require',
var hrefUrl = "/api" + href.split("/api")[1]; var hrefUrl = "/api" + href.split("/api")[1];
that.fetchCollection(hrefUrl); that.fetchCollection(hrefUrl);
} }
that.ui.chiledList.html(''); that.ui.childList.html('');
that.ui.Parent.addClass('active'); that.ui.Parent.addClass('active');
that.ui.Parent.html(parentLi); that.ui.Parent.html(parentLi);
} }
function createTerm() { function createTerm() {
_.each(that.chiledCollection.fullCollection.models, function(model, key) { _.each(that.childCollection.fullCollection.models, function(model, key) {
var name = Utils.checkTagOrTerm(model.get('name')); var name = Utils.checkTagOrTerm(model.get('name'));
var hrefUrl = "/api" + model.get('href').split("/api")[1] var hrefUrl = "/api" + model.get('href').split("/api")[1]
chiledLi += '<li class="children"><div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover" ></i></div><i class="fa fa-chevron-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a></li>'; childLi += '<li class="children"><div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover" ></i></div><i class="fa fa-chevron-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a></li>';
}); });
that.ui.chiledList.html(chiledLi); that.ui.childList.html(childLi);
} }
if (isParent) { if (isParent) {
...@@ -422,6 +446,32 @@ define(['require', ...@@ -422,6 +446,32 @@ define(['require',
} }
}); });
} }
},
fetchTaxanomyCollections: function() {
this.taxanomy.fetch({ reset: true });
},
searchResult: function() {
var that = this;
_.each(this.taxanomy.models, function(model, key) {
var name = model.get('name');
that.termCollection.url = "/api/atlas/v1/taxonomies/" + name + "/terms";
});
this.termCollection.fetch({ reset: true });
},
termSearchData: function() {
var that = this;
var str = '<option></option>';
for (var j = 0; j < this.termCollection.models.length; j++) {
var terms = this.termCollection.models[j].attributes.name;
str += '<option>' + terms + '</option>';
this.ui.searchTermInput.html(str);
}
// this.ui.searchTermInput.setAttribute('data-href' : that.termCollection.url);
this.ui.searchTermInput.select2({
placeholder: "Search Term",
allowClear: true
});
} }
}); });
return BusinessCatalogLayoutView; return BusinessCatalogLayoutView;
......
...@@ -22,6 +22,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset ...@@ -22,6 +22,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags) ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES: ALL CHANGES:
ATLAS-843 Atlas UI: Feature to search terms in left navigation. (Kalyanikashikar via sumasai)
ATLAS-731 Remove dashboard module in Atlas, replaced by dashboardv2 (kevalbhatt18 via sumasai) ATLAS-731 Remove dashboard module in Atlas, replaced by dashboardv2 (kevalbhatt18 via sumasai)
ATLAS-664 UI: Add Support for Versioning / History (Kalyanikashikar via yhemanth) ATLAS-664 UI: Add Support for Versioning / History (Kalyanikashikar via yhemanth)
ATLAS-833 Make default build profile for External HBase and Solr (tbeerbower via yhemanth) ATLAS-833 Make default build profile for External HBase and Solr (tbeerbower via yhemanth)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment