Rename the stylesheet

This commit is contained in:
Kane York 2015-06-30 10:37:48 -07:00
parent ee1cc2d96d
commit 78dafcc631
4 changed files with 28 additions and 12 deletions

View File

@ -3,6 +3,7 @@ import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/qu
export default Ember.ArrayController.extend({
selectedQueryId: null,
results: null,
dirty: false,
loading: false,
@ -25,11 +26,13 @@ export default Ember.ArrayController.extend({
create() {
const self = this;
this.set('loading', true);
this.set('showCreate', false);
var newQuery = this.store.createRecord('query', {name: this.get('newQueryName')});
newQuery.save().then(function(result) {
self.pushObject(result.target);
self.set('selectedItem', result.target);
self.set('selectedQueryId', result.target.id);
self.set('selectedItem.dirty', false);
self.set('results', null);
}).finally(function() {
self.set('loading', false);
});
@ -37,6 +40,11 @@ export default Ember.ArrayController.extend({
importQuery() {
showModal('import-query');
this.set('showCreate', false);
},
showCreate() {
this.set('showCreate', true);
},
editName() {
@ -59,11 +67,11 @@ export default Ember.ArrayController.extend({
const self = this;
this.set('loading', true);
this.store.find('query', this.get('selectedItem.id')).then(function(result) {
debugger;
const query = self.get('selectedItem');
query.setProperties(result.getProperties(Query.updatePropertyNames));
query.markNotDirty();
self.set('editName', false);
self.set('results', null);
}).finally(function() {
self.set('loading', false);
});

View File

@ -1,10 +1,16 @@
<h3>Queries</h3>
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}}
{{d-button action="create" label="explorer.create" icon="plus"}}
{{d-button action="importQuery" label="explorer.import.label" icon="upload" class="import-button"}}
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="name" content=content castInteger="true"}}
<div class="query-list">
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="name" content=content castInteger="true"}}
{{d-button action="showCreate" icon="plus" class="no-text"}}
{{d-button action="importQuery" label="explorer.import.label" icon="upload"}}
</div>
{{#if showCreate}}
<div class="query-create">
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}}
{{d-button action="create" label="explorer.create" icon="plus"}}
</div>
{{/if}}
<hr>
<div class="query-edit">
{{partial "admin/plugins-explorer-show" model=selectedItem}}
</div>

View File

@ -1,7 +1,9 @@
.query-list {
overflow-y: scroll;
max-height: 15em;
margin: 10px 0;
}
.query-create {
margin: 10px 0;
}
.query-edit {

View File

@ -5,7 +5,7 @@
# url: https://github.com/discourse/discourse-data-explorer
enabled_site_setting :data_explorer_enabled
register_asset 'stylesheets/tagging.scss'
register_asset 'stylesheets/explorer.scss'
# route: /admin/plugins/explorer
add_admin_route 'explorer.title', 'explorer'
@ -231,7 +231,7 @@ SQL
end
# guardian.ensure_can_see! query
render_serialized query, DataExplorer::QuerySerializer, root: 'queries'
render_serialized query, DataExplorer::QuerySerializer, root: 'query'
end
# Helper endpoint for logic