2016-12-01 13:54:21 -05:00
|
|
|
{{#explorer-container hideSchema=hideSchema everEditing=everEditing}}
|
2015-06-30 22:51:38 -04:00
|
|
|
|
2016-12-01 13:54:21 -05:00
|
|
|
{{#if disallow}}
|
2018-09-04 14:53:12 -04:00
|
|
|
<h1>{{i18n "explorer.admins_only"}}</h1>
|
2016-12-01 13:54:21 -05:00
|
|
|
{{else}}
|
2018-08-19 06:58:24 -04:00
|
|
|
{{#unless selectedQueryId}}
|
|
|
|
<div class="query-list">
|
2018-11-02 08:41:20 -04:00
|
|
|
{{text-field value=search placeholderKey="explorer.search_placeholder"}}
|
2018-09-07 06:28:52 -04:00
|
|
|
{{d-button action="showCreate" icon="plus" class="no-text btn-right"}}
|
2018-11-08 11:37:23 -05:00
|
|
|
{{d-button action="importQuery" label="explorer.import.label" icon="upload"}}
|
2016-12-01 13:54:21 -05:00
|
|
|
</div>
|
2015-06-30 22:51:38 -04:00
|
|
|
|
2018-08-19 06:58:24 -04:00
|
|
|
{{#if showCreate}}
|
|
|
|
<div class="query-create">
|
|
|
|
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}}
|
|
|
|
{{d-button action="create" disabled=createDisabled label="explorer.create" icon="plus" class="btn-primary"}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if othersDirty}}
|
|
|
|
<div class="warning">
|
2018-11-15 11:12:32 -05:00
|
|
|
{{d-icon "warning"}}
|
2018-08-19 06:58:24 -04:00
|
|
|
{{i18n "explorer.others_dirty"}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
{{/unless}}
|
2015-07-09 13:50:00 -04:00
|
|
|
|
2018-05-09 16:06:20 -04:00
|
|
|
{{#if content.length}}
|
2018-09-07 06:28:52 -04:00
|
|
|
{{#unless selectedItem.fake}}
|
2018-05-09 16:06:20 -04:00
|
|
|
<div class="query-edit {{if editName "editing"}}">
|
|
|
|
{{#if selectedItem}}
|
|
|
|
{{#if editing}}
|
|
|
|
<div class="name">
|
2018-09-04 14:53:12 -04:00
|
|
|
{{d-button action="goHome" icon="chevron-left" class="previous"}}
|
2018-08-29 03:51:02 -04:00
|
|
|
<div class="name-text-field">
|
|
|
|
{{text-field value=selectedItem.name}}
|
|
|
|
</div>
|
2018-05-09 16:06:20 -04:00
|
|
|
</div>
|
|
|
|
<div class="desc">
|
2018-08-19 00:54:53 -04:00
|
|
|
{{textarea value=selectedItem.description placeholder=(i18n "explorer.description_placeholder")}}
|
2018-05-09 16:06:20 -04:00
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<div class="name">
|
2018-09-04 14:53:12 -04:00
|
|
|
{{d-button action="goHome" icon="chevron-left" class="previous"}}
|
|
|
|
<h1>{{selectedItem.name}}
|
2018-10-10 07:29:13 -04:00
|
|
|
{{#unless editDisabled}}
|
|
|
|
<a {{action "editName" class="edit-query-name"}}>{{d-icon "pencil"}}</a>
|
|
|
|
{{/unless}}
|
2018-09-04 14:53:12 -04:00
|
|
|
</h1>
|
2018-05-09 16:06:20 -04:00
|
|
|
</div>
|
|
|
|
<div class="desc">
|
|
|
|
{{selectedItem.description}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{! the SQL editor will show the first time you }}
|
|
|
|
{{#if everEditing}}
|
|
|
|
<div class="query-editor {{if hideSchema "no-schema"}}">
|
|
|
|
<div class="right-panel">
|
|
|
|
<div class="schema grippie-target">
|
|
|
|
{{explorer-schema schema=schema hideSchema=hideSchema}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="editor-panel">
|
|
|
|
{{ace-editor content=selectedItem.sql mode="sql"}}
|
2016-12-01 13:54:21 -05:00
|
|
|
</div>
|
2018-05-09 16:06:20 -04:00
|
|
|
<div class="grippie"></div>
|
|
|
|
<div class="clear"></div>
|
2016-12-01 13:54:21 -05:00
|
|
|
</div>
|
2018-05-09 16:06:20 -04:00
|
|
|
{{else}}
|
|
|
|
<div class="sql">
|
|
|
|
{{hljs-code-view value=selectedItem.sql codeClass="sql"}}
|
2015-09-21 14:19:31 -04:00
|
|
|
</div>
|
2018-05-09 16:06:20 -04:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<div class="clear"></div>
|
|
|
|
|
|
|
|
<div class="pull-left">
|
|
|
|
{{#if everEditing}}
|
|
|
|
{{d-button action="save" label="explorer.save" disabled=saveDisabled class="btn-primary"}}
|
|
|
|
{{else}}
|
2018-10-10 07:29:13 -04:00
|
|
|
{{#unless editDisabled}}
|
|
|
|
{{d-button action="editName" label="explorer.edit" icon="pencil" class="btn-primary"}}
|
|
|
|
{{/unless}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{/if}}
|
|
|
|
{{d-button action="download" label="explorer.export" disabled=runDisabled icon="download"}}
|
2015-09-21 14:19:31 -04:00
|
|
|
</div>
|
2018-05-09 16:06:20 -04:00
|
|
|
<div class="pull-right">
|
|
|
|
{{#if selectedItem.destroyed}}
|
|
|
|
{{d-button action="recover" class="" icon="undo" label="explorer.recover"}}
|
|
|
|
{{else}}
|
|
|
|
{{#if everEditing}}
|
|
|
|
{{d-button action="discard" class="btn-danger" icon="undo" label="explorer.undo" disabled=saveDisabled}}
|
|
|
|
{{/if}}
|
2018-10-10 07:29:13 -04:00
|
|
|
{{#unless editDisabled}}
|
|
|
|
{{d-button action="destroy" class="btn-danger" icon="trash" label="explorer.delete"}}
|
|
|
|
{{/unless}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{/if}}
|
2015-09-21 14:19:31 -04:00
|
|
|
</div>
|
2018-05-09 16:06:20 -04:00
|
|
|
<div class="clear"></div>
|
2016-12-01 13:54:21 -05:00
|
|
|
{{/if}}
|
2018-05-09 16:06:20 -04:00
|
|
|
</div>
|
2016-12-01 13:54:21 -05:00
|
|
|
|
2018-05-09 16:06:20 -04:00
|
|
|
<form class="query-run" {{action "run" on="submit"}}>
|
|
|
|
{{#if selectedItem.hasParams}}
|
|
|
|
<div class="query-params">
|
|
|
|
{{#each selectedItem.param_info as |pinfo|}}
|
|
|
|
{{param-input params=selectedItem.params info=pinfo}}
|
|
|
|
{{! <div class="param">
|
|
|
|
{{param-field params=selectedItem.params pname=pinfo.identifier type=pinfo.type}
|
|
|
|
<span class="param-name">{{pinfo.identifier}</span>
|
|
|
|
</div> }}
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
{{#if runDisabled}}
|
|
|
|
{{#if saveDisabled}}
|
|
|
|
{{d-button label="explorer.run" disabled="true" class="btn-primary"}}
|
2016-12-01 13:54:21 -05:00
|
|
|
{{else}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{d-button action="saverun" label="explorer.saverun"}}
|
2016-12-01 13:54:21 -05:00
|
|
|
{{/if}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{else}}
|
|
|
|
{{d-button action="run" label="explorer.run" disabled=runDisabled class="btn-primary" type="submit"}}
|
|
|
|
{{/if}}
|
|
|
|
<label class="query-plan">{{input type="checkbox" checked=explain name="explain"}} {{i18n "explorer.explain_label"}}</label>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<hr>
|
2018-09-07 06:28:52 -04:00
|
|
|
{{/unless}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{conditional-loading-spinner condition=loading}}
|
|
|
|
{{#unless selectedItem.fake}}
|
|
|
|
{{#if results}}
|
|
|
|
<div class="query-results">
|
|
|
|
{{#if showResults}}
|
|
|
|
{{query-result query=selectedItem content=results}}
|
2016-12-01 13:54:21 -05:00
|
|
|
{{else}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{#each results.errors as |err|}}
|
|
|
|
<pre class="query-error"><code>{{~err}}</code></pre>
|
|
|
|
{{/each}}
|
2016-12-01 13:54:21 -05:00
|
|
|
{{/if}}
|
2015-09-21 14:19:31 -04:00
|
|
|
</div>
|
2015-07-14 19:01:38 -04:00
|
|
|
{{/if}}
|
2018-05-09 16:06:20 -04:00
|
|
|
{{/unless}}
|
2015-09-21 14:19:31 -04:00
|
|
|
|
2018-08-12 12:08:25 -04:00
|
|
|
{{#if showRecentQueries}}
|
2018-09-12 05:23:29 -04:00
|
|
|
<div class="container">
|
|
|
|
<table class="recent-queries">
|
|
|
|
<thead class="heading-container">
|
|
|
|
<th class="col heading name">
|
|
|
|
<div class="heading-toggle" {{action "sortByProperty" "name"}}>
|
|
|
|
{{directory-toggle field="name" labelKey="explorer.query_name" order=order asc=asc}}
|
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
<th class="col heading created-by">
|
|
|
|
<div class="heading-toggle" {{action "sortByProperty" "username"}}>
|
|
|
|
{{directory-toggle field="username" labelKey="explorer.query_user" order=order asc=asc}}
|
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
<th class="col heading created-at">
|
|
|
|
<div class="heading-toggle" {{action "sortByProperty" "last_run_at"}}>
|
|
|
|
{{directory-toggle field="last_run_at" labelKey="explorer.query_time" order=order asc=asc}}
|
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
</thead>
|
|
|
|
<tr></tr>
|
|
|
|
<tbody>
|
2018-11-02 08:41:20 -04:00
|
|
|
{{#each filteredContent as |query|}}
|
2018-09-12 05:23:29 -04:00
|
|
|
<tr class="query-row">
|
|
|
|
<td>
|
|
|
|
<a {{action "scrollTop"}} href="/admin/plugins/explorer/?id={{query.id}}">
|
|
|
|
<b class="query-name">{{query.name}}</b>
|
|
|
|
<medium class="query-desc">{{query.description}}</medium>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td class="query-created-by">
|
|
|
|
{{#if query.username}}
|
|
|
|
<a href="/users/{{query.username}}/activity">
|
|
|
|
<medium>{{query.username}}</medium>
|
2018-08-31 14:11:33 -04:00
|
|
|
</a>
|
2018-09-12 05:23:29 -04:00
|
|
|
{{/if}}
|
|
|
|
</td>
|
|
|
|
<td class="query-created-at">
|
2018-11-08 11:37:23 -05:00
|
|
|
{{#if query.last_run_at}}
|
2018-09-12 05:23:29 -04:00
|
|
|
<medium>
|
|
|
|
{{bound-date query.last_run_at}}
|
|
|
|
</medium>
|
|
|
|
{{else}}
|
|
|
|
<medium>
|
|
|
|
{{bound-date query.created_at}}
|
|
|
|
</medium>
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
2018-11-02 08:41:20 -04:00
|
|
|
{{else}}
|
|
|
|
<br>
|
|
|
|
<em class="no-search-results"> {{i18n "explorer.no_search_results"}}</em>
|
2018-09-12 05:23:29 -04:00
|
|
|
{{/each}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2018-08-12 12:08:25 -04:00
|
|
|
{{/if}}
|
|
|
|
|
2018-05-09 16:06:20 -04:00
|
|
|
<div class="explorer-pad-bottom"></div>
|
2016-12-01 13:54:21 -05:00
|
|
|
|
|
|
|
{{/if}}
|
2015-07-02 12:15:55 -04:00
|
|
|
{{/if}}
|
2016-12-01 13:54:21 -05:00
|
|
|
{{/explorer-container}}
|