Restyling of data explorer

This commit is contained in:
Kane York
2015-07-08 16:46:36 -07:00
parent 6ac463290e
commit dad55e085b
9 changed files with 176 additions and 123 deletions
@@ -1,5 +1,6 @@
export default Ember.Component.extend({
classNameBindings: [':schema-table', 'open'],
tagName: 'li',
open: Em.computed.alias('table.open'),
@@ -47,7 +47,7 @@ export default Ember.Component.extend({
tables.push({
name: key,
columns: schema[key],
open: haveFilter
open: false
});
continue;
}
@@ -10,7 +10,7 @@ export default Ember.ArrayController.extend({
showResults: false,
loading: false,
explain: true,
explain: false,
saveDisabled: Ember.computed.not('selectedItem.dirty'),
runDisabled: Ember.computed.alias('selectedItem.dirty'),
@@ -42,6 +42,21 @@ export default Ember.ArrayController.extend({
);
}.property(),
save() {
const self = this;
this.set('loading', true);
return this.get('selectedItem').save().then(function() {
const query = self.get('selectedItem');
query.markNotDirty();
self.set('editName', false);
}).catch(function(x) {
popupAjaxError(x);
throw x;
}).finally(function() {
self.set('loading', false);
});
},
actions: {
dummy() {},
@@ -70,6 +85,14 @@ export default Ember.ArrayController.extend({
this.get('selectedItem').saveDefaults();
},
save() {
this.save();
},
saverun() {
this.save().then(() => this.send('run'));
},
create() {
const self = this;
this.set('loading', true);
@@ -82,18 +105,6 @@ export default Ember.ArrayController.extend({
});
},
save() {
const self = this;
this.set('loading', true);
this.get('selectedItem').save().then(function() {
const query = self.get('selectedItem');
query.markNotDirty();
self.set('editName', false);
}).catch(popupAjaxError).finally(function() {
self.set('loading', false);
});
},
discard() {
const self = this;
this.set('loading', true);
@@ -1,36 +1,39 @@
{{#if selectedItem}}
<div class="pull-right">
<span class="schema-title">
{{i18n "explorer.schema.title"}}<br>
{{{i18n "explorer.schema.type_help"}}}
</span>
<div class="schema">
{{explorer-schema schema=schema}}
</div>
<div class="name">
{{#if editName}}
{{text-field value=selectedItem.name}}
{{else}}
<h2>{{selectedItem.name}}</h2>
{{d-button action="editName" icon="pencil" class="no-text btn-small"}}
{{/if}}
</div>
<div class="pull-left">
<div class="name">
{{#if editName}}
{{text-field value=selectedItem.name}}
{{else}}
<h2>{{selectedItem.name}}</h2>
{{d-button action="editName" icon="pencil" class="no-text btn-small"}}
{{/if}}
</div>
<div class="desc">
{{#if controller.editName}}
{{textarea value=selectedItem.description}}
{{else}}
{{selectedItem.description}}
{{/if}}
</div>
<div class="sql">
{{textarea value=selectedItem.sql}}
</div>
<div class="desc">
{{#if controller.editName}}
{{textarea value=selectedItem.description}}
{{else}}
{{selectedItem.description}}
{{/if}}
</div>
<div class="query-editor">
<div class="editor-panel">
<div class="sql">
{{textarea value=selectedItem.sql class="grippie-target"}}
</div>
</div>
<div class="right-panel">
<div class="schema grippie-target">
{{explorer-schema schema=schema}}
</div>
</div>
<div class="grippie"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="pull-left">
{{d-button action="save" label="explorer.save" disabled=saveDisabled}}
{{d-button action="save" label="explorer.save" disabled=saveDisabled class="btn-primary"}}
{{d-button action="download" label="explorer.export" disabled=runDisabled icon="download"}}
</div>
<div class="pull-right">
@@ -47,7 +47,15 @@
<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}}
{{#if runDisabled}}
{{#if saveDisabled}}
{{d-button label="explorer.run" disabled="true" class="btn-primary"}}
{{else}}
{{d-button action="saverun" label="explorer.saverun"}}
{{/if}}
{{else}}
{{d-button action="run" label="explorer.run" disabled=runDisabled class="btn-primary"}}
{{/if}}
</div>
<hr>
@@ -8,28 +8,26 @@
</div>
<div class="schema-table-cols">
{{#if table.open}}
<dl>
{{#each table.columns as |col|}}
<div class="schema-table-col">
<div>
<dt class="{{if col.sensitive "sensitive"}}" title="{{if col.sensitive (i18n "explorer.schema.sensitive")}}">
{{#if col.sensitive}}
<span class="schema-colname sensitive" title="{{i18n "explorer.schema.sensitive"}}">
<i class="fa fa-warning"></i>
{{col.column_name}}
</span>
{{else}}
<span class="schema-colname" >
{{col.column_name}}
<i class="fa fa-warning"></i>
{{/if}}
{{col.column_name}}
</dt>
<dd>
{{col.data_type}}
{{#if col.notes}}
<br>
<span class="schema-typenotes">
{{col.notes}}
</span>
{{/if}}
<span class="schema-type">
{{col.data_type}}
{{#if col.notes}}
<span class="schema-typenotes">
{{col.notes}}
</span>
{{/if}}
</span>
</dd>
</div>
{{/each}}
</dl>
{{/if}}
</div>
@@ -1,7 +1,12 @@
<span class="schema-title">
{{i18n "explorer.schema.title"}} - {{{i18n "explorer.schema.type_help"}}}
</span>
{{text-field value=filter placeholderKey="explorer.schema.filter"}}
{{conditional-loading-spinner condition=loading}}
<div class="schema-container">
{{#each tables as |table|}}
{{explorer-schema-onetable table=table}}
{{/each}}
<ul>
{{#each tables as |table|}}
{{explorer-schema-onetable table=table}}
{{/each}}
</ul>
</div>