mirror of
https://github.com/discourse/discourse-data-explorer.git
synced 2025-06-28 10:32:11 +00:00
mostly styling change
This commit is contained in:
parent
c52ac59eee
commit
a12c906c9a
@ -1,7 +1,7 @@
|
|||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/query';
|
import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/query';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.ArrayController.extend({
|
||||||
selectedItem: null,
|
selectedItem: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
@ -12,9 +12,13 @@ export default Ember.Controller.extend({
|
|||||||
dummy() {},
|
dummy() {},
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
var newQuery = Query.create({name: this.get('newQueryName')});
|
const self = this;
|
||||||
//var newQuery = this.store.createRecord('query', {name: this.get('newQueryName')});
|
var newQuery = this.store.createRecord('query', {name: this.get('newQueryName')});
|
||||||
newQuery.save();
|
newQuery.save().then(function(result) {
|
||||||
|
self.pushObject(result.target);
|
||||||
|
self.set('selectedItem', result.target);
|
||||||
|
debugger;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
importQuery() {
|
importQuery() {
|
||||||
|
@ -14,7 +14,4 @@ const Query = RestModel.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('query model loaded');
|
|
||||||
|
|
||||||
Discourse.Query = Query;
|
|
||||||
export default Query;
|
export default Query;
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
{{#if model}}
|
{{#if model}}
|
||||||
<h2>{{model.name}}</h2>
|
<div class="name">
|
||||||
<div>{{model.description}}</div>
|
{{#if editName}}
|
||||||
{{textarea value=model.sql}}
|
{{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"}}
|
{{d-button action="run" label="explorer.run"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
<h3>Queries</h3>
|
||||||
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}}
|
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}}
|
||||||
{{d-button action="create" label="explorer.create" icon="plus"}}
|
{{d-button action="create" label="explorer.create" icon="plus"}}
|
||||||
{{d-button action="importQuery" label="explorer.import.label" icon="upload" class="import-button"}}
|
{{d-button action="importQuery" label="explorer.import.label" icon="upload" class="import-button"}}
|
||||||
|
<div class="query-list">
|
||||||
<h3>Queries</h3>
|
<table>
|
||||||
<table class="query-list">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="q-name">Name</th>
|
<th class="q-name">Name</th>
|
||||||
@ -19,7 +19,12 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
{{render "admin/plugins-explorer-show" selectedItem}}
|
<hr>
|
||||||
|
<div class="query-edit">
|
||||||
{{! results }}
|
{{render "admin/plugins-explorer-show" selectedItem}}
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="query-results">
|
||||||
|
{{results}}
|
||||||
|
</div>
|
||||||
|
@ -1,68 +1,20 @@
|
|||||||
|
|
||||||
.topic-title-outlet.choose-tags {
|
.query-list {
|
||||||
margin-left: 25px;
|
overflow-y: scroll;
|
||||||
margin-top: 3px;
|
max-height: 15em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-cloud {
|
.query-edit .sql textarea {
|
||||||
.discourse-tag {
|
width: 800px;
|
||||||
display: inline-block;
|
height: 100px;
|
||||||
color: #333 !important;
|
font-family: monospace;
|
||||||
}
|
border-color: $tertiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extra-info-wrapper {
|
.query-edit .desc textarea {
|
||||||
.discourse-tag {
|
width: 200px;
|
||||||
-webkit-animation: fadein .7s;
|
|
||||||
animation: fadein .7s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.query-list, .query-edit, .query-results {
|
||||||
.add-tags .select2 {
|
margin: 10px 0;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ SQL
|
|||||||
def create
|
def create
|
||||||
# guardian.ensure_can_create_explorer_query!
|
# 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
|
# Set the ID _only_ if undeleting
|
||||||
if params[:recover]
|
if params[:recover]
|
||||||
query.id = params[:id].to_i
|
query.id = params[:id].to_i
|
||||||
@ -252,8 +252,9 @@ SQL
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
query = DataExplorer::Query.find(params[:id].to_i)
|
query = DataExplorer::Query.find(params[:id].to_i)
|
||||||
|
hash = params.require(:query)
|
||||||
[:name, :sql, :defaults, :description].each do |sym|
|
[:name, :sql, :defaults, :description].each do |sym|
|
||||||
query.send("#{sym}=", params[sym]) if params[sym]
|
query.send("#{sym}=", params[sym]) if hash[sym]
|
||||||
end
|
end
|
||||||
query.save
|
query.save
|
||||||
|
|
||||||
@ -321,7 +322,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 /query -> explorer#create
|
post 'queries' => "query#create"
|
||||||
# GET /query/:id -> explorer#show
|
# GET /query/:id -> explorer#show
|
||||||
# PUT /query/:id -> explorer#update
|
# PUT /query/:id -> explorer#update
|
||||||
# DELETE /query/:id -> explorer#destroy
|
# DELETE /query/:id -> explorer#destroy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user