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

View File

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

View File

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

View File

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