discourse-data-explorer/assets/javascripts/discourse/components/query-row-content.js.es6

34 lines
953 B
Plaintext
Raw Normal View History

2015-08-25 23:48:19 -04:00
import binarySearch from 'discourse/plugins/discourse-data-explorer/discourse/lib/binary-search';
2015-06-30 18:12:12 -04:00
const QueryRowContentComponent = Ember.Component.extend({
tagName: "tr",
2015-08-25 23:48:19 -04:00
transformedUserTable: function() {
return transformedRelTable(this.get('extra.relations.user'));
}.property('extra.relations.user'),
render: function(buffer) {
const self = this;
2015-06-30 18:12:12 -04:00
const row = this.get('row');
2015-08-25 23:48:19 -04:00
const relations = this.get('extra.relations');
const parts = this.get('columnTemplates').map(function(t, idx) {
const params = {};
if (t.name === "text") {
return row[idx];
} else if (t.name === "user") {
params.user = self.get('parent').lookupUser(parseInt(row[idx]));
} else {
params.value = row[idx];
}
return new Handlebars.SafeString(t.template(params));
2015-06-30 18:12:12 -04:00
});
2015-08-25 23:48:19 -04:00
buffer.push("<td>" + parts.join("</td><td>") + "</td>");
2015-06-30 18:12:12 -04:00
}
});
export default QueryRowContentComponent;