Include enum values in schema

This commit is contained in:
Kane York
2015-07-09 15:46:19 -07:00
parent 3422415ef6
commit 2bbe69d67e
8 changed files with 104 additions and 7 deletions
@@ -0,0 +1,14 @@
export default Ember.Component.extend({
classNames: ['fa', 'fa-info', 'enum-info'],
tagName: 'i',
enuminfo: function() {
const hash = this.get('col.enum');
let result = [];
for (let key in hash) {
if (!hash.hasOwnProperty(key)) { continue; }
result.push({value: key, name: hash[key]});
}
return result;
}.property('col.enum')
});
@@ -6,8 +6,13 @@ export default Ember.Component.extend({
_bindClicks: function() {
const self = this;
this.$()./*children('.schema-table-name').*/click(function() {
this.$().find('.schema-table-name').click(function(e) {
self.set('open', !self.get('open'));
e.preventDefault();
});
}.on('didInsertElement')
}.on('didInsertElement'),
_cleanup: function() {
this.$().find('.schema-table-name').off('click');
}.on('willDestroyElement')
});
@@ -22,7 +22,13 @@ export default Ember.Component.extend({
}
if (notes) {
col.notes = notes;
col.havetypeinfo = true;
}
if (col.enum) {
col.havetypeinfo = true;
}
});
}
return schema;
@@ -45,14 +45,14 @@
<div class="query-editor">
<div class="editor-panel">
{{ace-editor content=selectedItem.sql mode="sql"}}
</div>
<div class="right-panel">
<div class="schema grippie-target">
{{explorer-schema schema=schema}}
</div>
</div>
<div class="editor-panel">
{{ace-editor content=selectedItem.sql mode="sql"}}
</div>
<div class="grippie"></div>
<div class="clear"></div>
</div>
@@ -0,0 +1,7 @@
<ol>
{{#each enuminfo as |enum|}}
<li value="{{enum.value}}">
{{enum.name}}
</li>
{{/each}}
</ol>
@@ -19,10 +19,13 @@
</dt>
<dd>
{{col.data_type}}
{{#if col.notes}}
{{#if col.havetypeinfo}}
<br>
<span class="schema-typenotes">
{{col.notes}}
{{#if col.enum}}
{{explorer-schema-enuminfo col=col}}
{{/if}}
</span>
{{/if}}
</dd>