Deprecations fixes
This commit is contained in:
parent
7d50fbbdae
commit
86a3d16ad4
|
@ -1,19 +1,11 @@
|
|||
var ColumnHandlers = [];
|
||||
var AssistedHandlers = {};
|
||||
const Escape = Handlebars.Utils.escapeExpression;
|
||||
|
||||
import avatarTemplate from 'discourse/lib/avatar-template';
|
||||
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
||||
import Badge from 'discourse/models/badge';
|
||||
|
||||
var defaultFallback = function(buffer, content, defaultRender) { defaultRender(buffer, content); };
|
||||
|
||||
function isoYMD(date) {
|
||||
return date.getUTCFullYear() + "-" + date.getUTCMonth() + "-" + date.getUTCDate();
|
||||
}
|
||||
function randomIdShort() {
|
||||
return 'xxxxxxxx'.replace(/[xy]/g, function() {
|
||||
/*eslint-disable*/
|
||||
return (Math.random() * 16 | 0).toString(16);
|
||||
/*eslint-enable*/
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -58,12 +50,10 @@ const QueryResultComponent = Ember.Component.extend({
|
|||
}.property('params.@each'),
|
||||
|
||||
columnDispNames: function() {
|
||||
const templates = this.get('columnTemplates');
|
||||
const self = this;
|
||||
if (!this.get('columns')) {
|
||||
return [];
|
||||
}
|
||||
return this.get('columns').map(function(colName, idx) {
|
||||
return this.get('columns').map(function(colName) {
|
||||
if (colName.endsWith("_id")) {
|
||||
return colName.slice(0, -3);
|
||||
}
|
||||
|
@ -125,7 +115,7 @@ const QueryResultComponent = Ember.Component.extend({
|
|||
let windowName = randomIdShort();
|
||||
const newWindowContents = "<style>body{font-size:36px;display:flex;justify-content:center;align-items:center;}</style><body>Click anywhere to close this window once the download finishes.<script>window.onclick=function(){window.close()};</script>";
|
||||
|
||||
const _ = window.open('data:text/html;base64,' + btoa(newWindowContents), windowName);
|
||||
window.open('data:text/html;base64,' + btoa(newWindowContents), windowName);
|
||||
|
||||
let form = document.createElement("form");
|
||||
form.setAttribute('id', 'query-download-result');
|
||||
|
@ -134,7 +124,7 @@ const QueryResultComponent = Ember.Component.extend({
|
|||
form.setAttribute('target', windowName);
|
||||
form.setAttribute('style', 'display:none;');
|
||||
|
||||
function addInput(form, name, value) {
|
||||
function addInput(name, value) {
|
||||
let field;
|
||||
field = document.createElement('input');
|
||||
field.setAttribute('name', name);
|
||||
|
@ -142,12 +132,12 @@ const QueryResultComponent = Ember.Component.extend({
|
|||
form.appendChild(field);
|
||||
}
|
||||
|
||||
addInput(form, 'params', JSON.stringify(this.get('params')));
|
||||
addInput(form, 'explain', this.get('hasExplain'));
|
||||
addInput(form, 'limit', '1000000');
|
||||
addInput('params', JSON.stringify(this.get('params')));
|
||||
addInput('explain', this.get('hasExplain'));
|
||||
addInput('limit', '1000000');
|
||||
|
||||
Discourse.ajax('/session/csrf.json').then(function(csrf) {
|
||||
addInput(form, 'authenticity_token', csrf.csrf);
|
||||
addInput('authenticity_token', csrf.csrf);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import binarySearch from 'discourse/plugins/discourse-data-explorer/discourse/lib/binary-search';
|
||||
import avatarTemplate from 'discourse/lib/avatar-template';
|
||||
|
||||
function icon_or_image_replacement(str, ctx) {
|
||||
str = Ember.get(ctx.contexts[0], str);
|
||||
|
@ -12,14 +10,11 @@ function icon_or_image_replacement(str, ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
function shorthandTinyAvatar(username, uploadId, ctx) {
|
||||
username = Ember.get(ctx.contexts[0], username);
|
||||
uploadId = Ember.get(ctx.contexts[0], uploadId);
|
||||
function shorthandTinyAvatar(avatar_template, ctx) {
|
||||
return new Handlebars.SafeString(Discourse.Utilities.avatarImg({
|
||||
size: "tiny",
|
||||
extraClasses: '',
|
||||
title: username,
|
||||
avatarTemplate: avatarTemplate(username, uploadId)
|
||||
avatarTemplate: avatar_template
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -28,14 +23,9 @@ const esc = Handlebars.Utils.escapeExpression;
|
|||
const QueryRowContentComponent = Ember.Component.extend({
|
||||
tagName: "tr",
|
||||
|
||||
transformedUserTable: function() {
|
||||
return transformedRelTable(this.get('extra.relations.user'));
|
||||
}.property('extra.relations.user'),
|
||||
|
||||
render: function(buffer) {
|
||||
const self = this;
|
||||
const row = this.get('row');
|
||||
const relations = this.get('extra.relations');
|
||||
const parent = self.get('parent');
|
||||
|
||||
const parts = this.get('columnTemplates').map(function(t, idx) {
|
||||
|
|
|
@ -45,12 +45,12 @@ after_initialize do
|
|||
|
||||
class SmallPostWithExcerptSerializer < ApplicationSerializer
|
||||
attributes :id, :topic_id, :post_number, :excerpt
|
||||
attributes :username, :uploaded_avatar_id
|
||||
attributes :username, :avatar_template
|
||||
def excerpt
|
||||
Post.excerpt(object.cooked, 70)
|
||||
end
|
||||
def username; object.user.username; end
|
||||
def uploaded_avatar_id; object.user.uploaded_avatar_id; end
|
||||
def uploaded_avatar_id; object.user.avatar_template; end
|
||||
end
|
||||
|
||||
# Run a data explorer query on the currently connected database.
|
||||
|
|
Loading…
Reference in New Issue