Update URL. Regression - select2 not updating
This commit is contained in:
parent
6852f69cd7
commit
a81f8495b0
|
@ -3,12 +3,13 @@ import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/qu
|
||||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||||
|
|
||||||
export default Ember.ArrayController.extend({
|
export default Ember.ArrayController.extend({
|
||||||
|
queryParams: { selectedQueryId: "id" },
|
||||||
selectedQueryId: null,
|
selectedQueryId: null,
|
||||||
results: null,
|
results: null,
|
||||||
showResults: false,
|
showResults: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
explain: false,
|
explain: true,
|
||||||
|
|
||||||
saveDisabled: Ember.computed.not('selectedItem.dirty'),
|
saveDisabled: Ember.computed.not('selectedItem.dirty'),
|
||||||
runDisabled: Ember.computed.alias('selectedItem.dirty'),
|
runDisabled: Ember.computed.alias('selectedItem.dirty'),
|
||||||
|
@ -133,7 +134,7 @@ export default Ember.ArrayController.extend({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: {
|
data: {
|
||||||
params: JSON.stringify(this.get('selectedItem.params')),
|
params: JSON.stringify(this.get('selectedItem.params')),
|
||||||
explain: true
|
explain: this.get('explain')
|
||||||
}
|
}
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
|
@ -3,6 +3,5 @@ export default {
|
||||||
path: '/plugins',
|
path: '/plugins',
|
||||||
map() {
|
map() {
|
||||||
this.route('explorer');
|
this.route('explorer');
|
||||||
this.route('explorer-show', {path: 'explorer/:id'});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
|
||||||
model(params) {
|
|
||||||
return this.store.find('query', params.get('id'));
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
controllerName: 'admin-plugins-explorer',
|
controllerName: 'admin-plugins-explorer',
|
||||||
|
queryParams: { id: { replace: true } },
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll('query');
|
return this.store.findAll('query');
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
<div class="bool-options">
|
||||||
|
<label>{{input type="checkbox" checked=explain name="explain"}} {{i18n "explorer.explain_label"}}</label>
|
||||||
|
</div>
|
||||||
{{d-button action="run" label="explorer.run" disabled=runDisabled}}
|
{{d-button action="run" label="explorer.run" disabled=runDisabled}}
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
|
@ -7,9 +7,13 @@
|
||||||
{{duration}}
|
{{duration}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if hasExplain}}
|
|
||||||
<pre><code>{{content.explain}}</code></pre>
|
{{~#if hasExplain}}
|
||||||
{{/if}}
|
<pre><code>
|
||||||
|
{{~content.explain}}
|
||||||
|
</code></pre>
|
||||||
|
{{~/if}}
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="headers">
|
<tr class="headers">
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
.clear { clear: both; }
|
.clear { clear: both; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.query-list, .query-edit, .query-results {
|
.query-params {
|
||||||
|
border: 1px solid dark-light-diff($primary, $secondary, 60%, -20%);
|
||||||
|
input {
|
||||||
|
margin: 9px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-list, .query-edit, .query-results, .query-params {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,3 +37,4 @@ en:
|
||||||
download_json: "Save Query Results"
|
download_json: "Save Query Results"
|
||||||
run_time: "Query completed in {{value}} ms."
|
run_time: "Query completed in {{value}} ms."
|
||||||
column: "Column {{number}}"
|
column: "Column {{number}}"
|
||||||
|
explain_label: "Include query plan?"
|
||||||
|
|
|
@ -276,7 +276,7 @@ SQL
|
||||||
end
|
end
|
||||||
query.save
|
query.save
|
||||||
|
|
||||||
render_serialized query, DataExplorer::QuerySerializer, root: true
|
render_serialized query, DataExplorer::QuerySerializer, root: 'query'
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -290,7 +290,7 @@ SQL
|
||||||
query = DataExplorer::Query.find(params[:id].to_i)
|
query = DataExplorer::Query.find(params[:id].to_i)
|
||||||
query_params = MultiJson.load(params[:params])
|
query_params = MultiJson.load(params[:params])
|
||||||
opts = {current_user: current_user.username}
|
opts = {current_user: current_user.username}
|
||||||
opts[:explain] = true if params[:explain]
|
opts[:explain] = true if params[:explain] == "true"
|
||||||
result = DataExplorer.run_query(query, query_params, opts)
|
result = DataExplorer.run_query(query, query_params, opts)
|
||||||
|
|
||||||
if result[:error]
|
if result[:error]
|
||||||
|
@ -340,6 +340,7 @@ SQL
|
||||||
|
|
||||||
DataExplorer::Engine.routes.draw do
|
DataExplorer::Engine.routes.draw do
|
||||||
root to: "query#index"
|
root to: "query#index"
|
||||||
|
|
||||||
get 'queries' => "query#index"
|
get 'queries' => "query#index"
|
||||||
post 'queries' => "query#create"
|
post 'queries' => "query#create"
|
||||||
get 'queries/:id' => "query#show"
|
get 'queries/:id' => "query#show"
|
||||||
|
|
Loading…
Reference in New Issue