diff --git a/assets/javascripts/discourse/components/hljs-code-view.js.es6 b/assets/javascripts/discourse/components/hljs-code-view.js.es6 index 2cd2e9f..24e1083 100644 --- a/assets/javascripts/discourse/components/hljs-code-view.js.es6 +++ b/assets/javascripts/discourse/components/hljs-code-view.js.es6 @@ -1,18 +1,19 @@ import debounce from 'discourse/lib/debounce'; import highlightSyntax from 'discourse/lib/highlight-syntax'; +import { bufferedRender } from 'discourse-common/lib/buffered-render'; -export default Ember.Component.extend({ - render(buffer) { +export default Ember.Component.extend(bufferedRender({ + buildBuffer(buffer) { buffer.push("
");
     buffer.push(Handlebars.Utils.escapeExpression(this.get('value')));
     buffer.push("
"); }, _refreshHighlight: debounce(function() { - this.rerender(); + this.rerenderBuffer(); }, 50).observes('value'), _applyHighlight: function() { highlightSyntax(this.$()); }.on('didInsertElement') -}); +})); diff --git a/assets/javascripts/discourse/components/param-input.js.es6 b/assets/javascripts/discourse/components/param-input.js.es6 index 56356df..0601419 100644 --- a/assets/javascripts/discourse/components/param-input.js.es6 +++ b/assets/javascripts/discourse/components/param-input.js.es6 @@ -38,19 +38,26 @@ export default Ember.Component.extend({ boolTypes: [ {name: I18n.t('explorer.types.bool.true'), id: 'Y'}, {name: I18n.t('explorer.types.bool.false'), id: 'N'}, {name: I18n.t('explorer.types.bool.null_'), id: '#null'} ], - value: function(key, value, previousValue) { - if (arguments.length > 1) { + value: Ember.computed('params', 'info.identifier', { + get() { + return this.get('params')[this.get('info.identifier')]; + }, + set(key, value) { this.get('params')[this.get('info.identifier')] = value.toString(); + return value; } - return this.get('params')[this.get('info.identifier')]; - }.property('params', 'info.identifier'), + }), - valueBool: function(key, value, previousValue) { - if (arguments.length > 1) { - this.get('params')[this.get('info.identifier')] = (!!value).toString(); + valueBool: Ember.computed('params', 'info.identifier', { + get() { + return this.get('params')[this.get('info.identifier')] !== 'false'; + }, + set(key, value) { + value = !!value; + this.get('params')[this.get('info.identifier')] = value.toString(); + return value; } - return this.get('params')[this.get('info.identifier')] !== 'false'; - }.property('params', 'info.identifier'), + }), valid: function() { const type = this.get('info.type'), diff --git a/assets/javascripts/discourse/components/query-result.js.es6 b/assets/javascripts/discourse/components/query-result.js.es6 index 85b9d6a..6005611 100644 --- a/assets/javascripts/discourse/components/query-result.js.es6 +++ b/assets/javascripts/discourse/components/query-result.js.es6 @@ -1,5 +1,6 @@ import { ajax } from 'discourse/lib/ajax'; import Badge from 'discourse/models/badge'; +import { getOwner } from 'discourse-common/lib/get-owner'; function randomIdShort() { return 'xxxxxxxx'.replace(/[xy]/g, function() { @@ -66,7 +67,7 @@ const QueryResultComponent = Ember.Component.extend({ }.property('content', 'columns.@each'), fallbackTemplate: function() { - return this.container.lookup('template:explorer/text.raw'); + return getOwner(this).lookup('template:explorer/text.raw'); }.property(), columnTemplates: function() { @@ -79,7 +80,8 @@ const QueryResultComponent = Ember.Component.extend({ if (self.get('content.colrender')[idx]) { viewName = self.get('content.colrender')[idx]; } - return {name: viewName, template: self.container.lookup('template:explorer/' + viewName + '.raw')}; + const template = getOwner(self).lookup('template:explorer/' + viewName + '.raw'); + return {name: viewName, template }; }); }.property('content', 'columns.@each'), diff --git a/assets/javascripts/discourse/components/query-row-content.js.es6 b/assets/javascripts/discourse/components/query-row-content.js.es6 index b720a75..420cde1 100644 --- a/assets/javascripts/discourse/components/query-row-content.js.es6 +++ b/assets/javascripts/discourse/components/query-row-content.js.es6 @@ -1,7 +1,6 @@ - - import { categoryLinkHTML } from 'discourse/helpers/category-link'; import { autoUpdatingRelativeAge } from 'discourse/lib/formatter'; +import { bufferedRender } from 'discourse-common/lib/buffered-render'; function icon_or_image_replacement(str, ctx) { str = Ember.get(ctx.contexts[0], str); @@ -28,10 +27,10 @@ function bound_date_replacement(str, ctx) { const esc = Handlebars.Utils.escapeExpression; -const QueryRowContentComponent = Ember.Component.extend({ +const QueryRowContentComponent = Ember.Component.extend(bufferedRender({ tagName: "tr", - render: function(buffer) { + buildBuffer(buffer) { const self = this; const row = this.get('row'); const parent = self.get('parent'); @@ -76,6 +75,6 @@ const QueryRowContentComponent = Ember.Component.extend({ buffer.push("" + parts.join("") + ""); } -}); +})); export default QueryRowContentComponent; diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 index 56b2a29..b6d213b 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 @@ -5,7 +5,7 @@ import { ajax } from 'discourse/lib/ajax'; const NoQuery = Query.create({name: "No queries", fake: true}); -export default Ember.ArrayController.extend({ +export default Ember.Controller.extend({ queryParams: { selectedQueryId: "id" }, selectedQueryId: null, showResults: false, @@ -44,7 +44,7 @@ export default Ember.ArrayController.extend({ }.observes('editing'), addCreatedRecord(record) { - this.pushObject(record); + this.get('model').pushObject(record); this.set('selectedQueryId', Ember.get(record, 'id')); this.get('selectedItem').set('dirty', false); this.set('showResults', false); diff --git a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 index 34b1a63..662905e 100644 --- a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 @@ -2,7 +2,6 @@ import { ajax } from 'discourse/lib/ajax'; export default Discourse.Route.extend({ controllerName: 'admin-plugins-explorer', - queryParams: { id: { replace: true } }, model() { const p1 = this.store.findAll('query'); diff --git a/assets/javascripts/discourse/templates/explorer-query-result.hbs b/assets/javascripts/discourse/templates/explorer-query-result.hbs index b3701d4..d5cdf9f 100644 --- a/assets/javascripts/discourse/templates/explorer-query-result.hbs +++ b/assets/javascripts/discourse/templates/explorer-query-result.hbs @@ -22,7 +22,7 @@ - {{~#each row in rows}} + {{~#each rows as |row|}} {{~query-row-content row=row columnTemplates=columnTemplates parent=controller}} {{~/each}}