mostly styling change
This commit is contained in:
parent
c52ac59eee
commit
a12c906c9a
|
@ -1,7 +1,7 @@
|
|||
import showModal from 'discourse/lib/show-modal';
|
||||
import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/query';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
selectedItem: null,
|
||||
|
||||
actions: {
|
||||
|
@ -12,9 +12,13 @@ export default Ember.Controller.extend({
|
|||
dummy() {},
|
||||
|
||||
create() {
|
||||
var newQuery = Query.create({name: this.get('newQueryName')});
|
||||
//var newQuery = this.store.createRecord('query', {name: this.get('newQueryName')});
|
||||
newQuery.save();
|
||||
const self = this;
|
||||
var newQuery = this.store.createRecord('query', {name: this.get('newQueryName')});
|
||||
newQuery.save().then(function(result) {
|
||||
self.pushObject(result.target);
|
||||
self.set('selectedItem', result.target);
|
||||
debugger;
|
||||
});
|
||||
},
|
||||
|
||||
importQuery() {
|
||||
|
|
|
@ -14,7 +14,4 @@ const Query = RestModel.extend({
|
|||
}
|
||||
});
|
||||
|
||||
console.log('query model loaded');
|
||||
|
||||
Discourse.Query = Query;
|
||||
export default Query;
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
{{#if model}}
|
||||
<h2>{{model.name}}</h2>
|
||||
<div>{{model.description}}</div>
|
||||
{{textarea value=model.sql}}
|
||||
<div class="name">
|
||||
{{#if editName}}
|
||||
{{text-field value=model.name}}
|
||||
{{else}}
|
||||
<h2>{{model.name}}</h2>
|
||||
{{d-button action="editName" icon="pencil" class="no-text"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{#if editName}}
|
||||
{{textarea value=model.description}}
|
||||
{{else}}
|
||||
{{model.description}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="sql">
|
||||
{{textarea value=model.sql}}
|
||||
</div>
|
||||
{{d-button action="run" label="explorer.run"}}
|
||||
{{/if}}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<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"}}
|
||||
|
||||
<h3>Queries</h3>
|
||||
<table class="query-list">
|
||||
<div class="query-list">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="q-name">Name</th>
|
||||
|
@ -19,7 +19,12 @@
|
|||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{render "admin/plugins-explorer-show" selectedItem}}
|
||||
|
||||
{{! results }}
|
||||
</div>
|
||||
<hr>
|
||||
<div class="query-edit">
|
||||
{{render "admin/plugins-explorer-show" selectedItem}}
|
||||
</div>
|
||||
<hr>
|
||||
<div class="query-results">
|
||||
{{results}}
|
||||
</div>
|
||||
|
|
|
@ -1,68 +1,20 @@
|
|||
|
||||
.topic-title-outlet.choose-tags {
|
||||
margin-left: 25px;
|
||||
margin-top: 3px;
|
||||
.query-list {
|
||||
overflow-y: scroll;
|
||||
max-height: 15em;
|
||||
}
|
||||
|
||||
.tag-cloud {
|
||||
.discourse-tag {
|
||||
display: inline-block;
|
||||
color: #333 !important;
|
||||
}
|
||||
.query-edit .sql textarea {
|
||||
width: 800px;
|
||||
height: 100px;
|
||||
font-family: monospace;
|
||||
border-color: $tertiary;
|
||||
}
|
||||
|
||||
.extra-info-wrapper {
|
||||
.discourse-tag {
|
||||
-webkit-animation: fadein .7s;
|
||||
animation: fadein .7s;
|
||||
}
|
||||
.query-edit .desc textarea {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
|
||||
.add-tags .select2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.discourse-tag-count {
|
||||
font-size: 0.8em;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.select2-result-label .discourse-tag {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.discourse-tag {
|
||||
padding: 0;
|
||||
margin: 0 5px 0 0;
|
||||
font-size: 0.857em;
|
||||
|
||||
/* !important is needed in the select2 widget to overwrite default styles */
|
||||
color: #999 !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
background-color: transparent !important;
|
||||
font-weight: bold !important;
|
||||
line-height: 1.4em !important;
|
||||
}
|
||||
|
||||
.list-tags {
|
||||
display: inline;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.tag-chooser {
|
||||
width: 500px;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.tag-notification-menu {
|
||||
float: right;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tag-notification-menu .dropdown-menu {
|
||||
right: 0;
|
||||
top: 30px;
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
.query-list, .query-edit, .query-results {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ SQL
|
|||
def create
|
||||
# guardian.ensure_can_create_explorer_query!
|
||||
|
||||
query = DataExplorer::Query.from_hash params.permit(:name, :sql, :defaults, :description)
|
||||
query = DataExplorer::Query.from_hash params.require(:query)
|
||||
# Set the ID _only_ if undeleting
|
||||
if params[:recover]
|
||||
query.id = params[:id].to_i
|
||||
|
@ -252,8 +252,9 @@ SQL
|
|||
|
||||
def update
|
||||
query = DataExplorer::Query.find(params[:id].to_i)
|
||||
hash = params.require(:query)
|
||||
[:name, :sql, :defaults, :description].each do |sym|
|
||||
query.send("#{sym}=", params[sym]) if params[sym]
|
||||
query.send("#{sym}=", params[sym]) if hash[sym]
|
||||
end
|
||||
query.save
|
||||
|
||||
|
@ -321,7 +322,7 @@ SQL
|
|||
DataExplorer::Engine.routes.draw do
|
||||
root to: "query#index"
|
||||
get 'queries' => "query#index"
|
||||
# POST /query -> explorer#create
|
||||
post 'queries' => "query#create"
|
||||
# GET /query/:id -> explorer#show
|
||||
# PUT /query/:id -> explorer#update
|
||||
# DELETE /query/:id -> explorer#destroy
|
||||
|
|
Loading…
Reference in New Issue