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 @@ ...@@ -223,9 +223,12 @@
} }
.backgrid-paginator ul > .disabled > span, .backgrid-paginator ul > .disabled > span,
.backgrid-paginator ul > .disabled > a, .backgrid-paginator ul > .disabled > a {
.backgrid-paginator ul > .disabled > a:hover { &:hover {
cursor: pointer; cursor: not-allowed;
background-color: #7ed3be !important;
}
} }
.popover { .popover {
......
...@@ -173,5 +173,6 @@ ...@@ -173,5 +173,6 @@
} }
.popoverTerm { .popoverTerm {
text-align: center;
margin-top: 25px !important; margin-top: 25px !important;
} }
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
define(function(require) { define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backbone, template) {
var Backbone = require('backbone');
var template = require('hbs!tmpl/common/modal');
var Modal = Backbone.View.extend({ var Modal = Backbone.View.extend({
......
...@@ -92,28 +92,34 @@ define(['require', ...@@ -92,28 +92,34 @@ define(['require',
getToOffset: function() { getToOffset: function() {
var toOffset = 0; var toOffset = 0;
if (this.entityCollection.models.length < this.count) { 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 { } else {
toOffset = ((this.currPage - 1) * (this.count - 1) + (this.entityCollection.models.length - 1)); toOffset = (this.getFromOffset() + (this.entityCollection.models.length - 1));
} }
return toOffset; 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) { renderOffset: function(options) {
var that = this;
if (options.nextClick) { if (options.nextClick) {
options.previous.removeAttr("disabled"); options.previous.removeAttr("disabled");
if (that.entityCollection.length != 0) { if (this.entityCollection.length != 0) {
that.currPage++; this.currPage++;
that.ui.pageRecordText.html("Showing " + ((that.currPage - 1) * (that.count - 1) + 1) + " - " + that.getToOffset());
} }
} } else if (options.previousClick) {
if (options.previousClick) {
options.next.removeAttr("disabled"); options.next.removeAttr("disabled");
if (that.currPage > 1 && that.entityCollection.models.length) { if (this.currPage > 1 && this.entityCollection.models.length) {
that.currPage--; this.currPage--;
that.ui.pageRecordText.html("Showing " + ((that.currPage - 1) * (that.count - 1) + 1) + " - " + that.getToOffset());
} }
} }
this.ui.pageRecordText.html("Showing " + this.getFromOffset(options) + " - " + this.getToOffset());
}, },
fetchCollection: function(options) { fetchCollection: function(options) {
var that = this; var that = this;
...@@ -130,9 +136,6 @@ define(['require', ...@@ -130,9 +136,6 @@ define(['require',
options.previous.attr('disabled', true); options.previous.attr('disabled', true);
options.next.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.$('.fontLoader').hide();
that.$('.auditTable').show(); that.$('.auditTable').show();
that.renderOffset(options); that.renderOffset(options);
......
...@@ -398,6 +398,24 @@ define(['require', ...@@ -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'] = { col['owner'] = {
label: "Owner", label: "Owner",
cell: "String", 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