discourse-data-explorer/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs

122 lines
4.0 KiB
Handlebars
Raw Normal View History

2015-06-30 22:51:38 -04:00
<h2>Queries</h2>
2015-07-01 00:21:14 -04:00
{{#if not_https}}
<div class="https-warning">
{{fa-icon "warning"}}
{{i18n "explorer.https_warning"}}
</div>
{{/if}}
2015-06-30 13:37:48 -04:00
<div class="query-list">
2015-06-30 19:43:43 -04:00
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" content=content castInteger="true" nameChanges="true"}}
2015-06-30 13:37:48 -04:00
{{d-button action="showCreate" icon="plus" class="no-text"}}
{{d-button action="importQuery" label="explorer.import.label" icon="upload"}}
</div>
2015-06-30 22:51:38 -04:00
2015-06-30 13:37:48 -04:00
{{#if showCreate}}
<div class="query-create">
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}}
2015-06-30 15:52:17 -04:00
{{d-button action="create" label="explorer.create" icon="plus" class="btn-primary"}}
2015-06-30 13:37:48 -04:00
</div>
{{/if}}
2015-06-30 22:51:38 -04:00
2015-06-30 13:37:48 -04:00
<hr>
2015-06-30 22:51:38 -04:00
{{#if selectedItem.fake}}
{{i18n "explorer.no_queries"}} <a {{action "showCreate"}}>{{i18n "explorer.no_queries_hook"}}</a>
{{else}}
<div class="query-edit {{if editName "editing"}}">
{{#if selectedItem}}
<div class="name">
{{#if editing}}
{{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 editing}}
{{textarea value=selectedItem.description}}
{{else}}
{{selectedItem.description}}
{{/if}}
</div>
<div class="query-editor">
<div class="editor-panel">
2015-07-09 16:20:21 -04:00
{{ace-editor content=selectedItem.sql mode="sql" stashSelf=editor}}
</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 class="btn-primary"}}
{{d-button action="download" label="explorer.export" disabled=runDisabled icon="download"}}
</div>
<div class="pull-right">
{{#if selectedItem.destroyed}}
{{d-button action="recover" class="" icon="undo" label="explorer.recover"}}
{{else}}
{{d-button action="discard" class="btn-danger" icon="undo" label="explorer.undo" disabled=saveDisabled}}
{{d-button action="destroy" class="btn-danger" icon="trash" label="explorer.delete"}}
{{/if}}
</div>
<div class="clear"></div>
{{/if}}
</div>
2015-06-30 22:51:38 -04:00
<form class="query-run" {{action "run" on="submit"}}>
{{#if selectedItem.param_names}}
<div class="query-params">
<div class="param-save">
{{d-button action="saveDefaults" label="explorer.save_params" type="button"}}
{{d-button action="resetParams" label="explorer.reset_params" type="button"}}
2015-06-30 22:51:38 -04:00
</div>
{{#each selectedItem.param_names as |pname|}}
<div class="param">
{{param-field params=selectedItem.params pname=pname}}
<span class="param-name">{{pname}}</span>
</div>
{{/each}}
</div>
{{/if}}
<div class="bool-options">
<label>{{input type="checkbox" checked=explain name="explain"}} {{i18n "explorer.explain_label"}}</label>
2015-06-30 18:12:12 -04:00
</div>
2015-07-08 19:46:36 -04:00
{{#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" type="submit"}}
2015-07-08 19:46:36 -04:00
{{/if}}
</form>
2015-07-01 00:21:14 -04:00
<hr>
2015-06-30 18:12:12 -04:00
{{/if}}
{{conditional-loading-spinner condition=loading}}
{{#unless selectedItem.fake}}
{{#if results}}
<div class="query-results">
{{#if showResults}}
{{query-result query=selectedItem content=results}}
{{else}}
{{#each results.errors as |err|}}
<pre class="query-error"><code>{{~err}}</code></pre>
{{/each}}
{{/if}}
</div>
{{/if}}
{{/unless}}