Commit 17a9aad0 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-1585 : Search result page should show the entityType for each result

parent c74ba142
......@@ -223,9 +223,12 @@
}
.backgrid-paginator ul > .disabled > span,
.backgrid-paginator ul > .disabled > a,
.backgrid-paginator ul > .disabled > a:hover {
cursor: pointer;
.backgrid-paginator ul > .disabled > a {
&:hover {
cursor: not-allowed;
background-color: #7ed3be !important;
}
}
.popover {
......
......@@ -173,5 +173,6 @@
}
.popoverTerm {
text-align: center;
margin-top: 25px !important;
}
......@@ -16,10 +16,7 @@
* limitations under the License.
*/
define(function(require) {
var Backbone = require('backbone');
var template = require('hbs!tmpl/common/modal');
define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backbone, template) {
var Modal = Backbone.View.extend({
......
......@@ -92,28 +92,34 @@ define(['require',
getToOffset: function() {
var toOffset = 0;
if (this.entityCollection.models.length < this.count) {
toOffset = ((this.currPage - 1) * (this.count - 1) + (this.entityCollection.models.length));
toOffset = (this.getFromOffset() + (this.entityCollection.models.length));
} else {
toOffset = ((this.currPage - 1) * (this.count - 1) + (this.entityCollection.models.length - 1));
toOffset = (this.getFromOffset() + (this.entityCollection.models.length - 1));
}
return toOffset;
},
getFromOffset: function(options) {
var count = (this.currPage - 1) * (this.count - 1);
if (options && (options.nextClick || options.previousClick || this.entityCollection.models.length)) {
return count + 1;
} else {
return count;
}
},
renderOffset: function(options) {
var that = this;
if (options.nextClick) {
options.previous.removeAttr("disabled");
if (that.entityCollection.length != 0) {
that.currPage++;
that.ui.pageRecordText.html("Showing " + ((that.currPage - 1) * (that.count - 1) + 1) + " - " + that.getToOffset());
if (this.entityCollection.length != 0) {
this.currPage++;
}
}
if (options.previousClick) {
} else if (options.previousClick) {
options.next.removeAttr("disabled");
if (that.currPage > 1 && that.entityCollection.models.length) {
that.currPage--;
that.ui.pageRecordText.html("Showing " + ((that.currPage - 1) * (that.count - 1) + 1) + " - " + that.getToOffset());
if (this.currPage > 1 && this.entityCollection.models.length) {
this.currPage--;
}
}
this.ui.pageRecordText.html("Showing " + this.getFromOffset(options) + " - " + this.getToOffset());
},
fetchCollection: function(options) {
var that = this;
......@@ -130,9 +136,6 @@ define(['require',
options.previous.attr('disabled', true);
options.next.attr('disabled', true);
}
if (!options.nextClick && !options.previousClick) {
that.ui.pageRecordText.html("Showing " + ((that.currPage - 1) * (that.count - 1) + 1) + " - " + that.getToOffset());
}
that.$('.fontLoader').hide();
that.$('.auditTable').show();
that.renderOffset(options);
......
......@@ -398,6 +398,24 @@ define(['require',
}
})
};
col['typeName'] = {
label: "Type",
cell: "Html",
editable: false,
sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
if (that.searchCollection.queryType == "DSL") {
var obj = model.toJSON();
} else {
var obj = model.get('entity');
}
if (obj && obj.typeName) {
return '<a title="Search ' + obj.typeName + '" href="#!/search/searchResult?query=' + obj.typeName + ' &searchType=dsl&dslChecked=true">' + obj.typeName + '</a>';
}
}
})
};
col['owner'] = {
label: "Owner",
cell: "String",
......
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