mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 17:38:54 +00:00
Change source editor and schema browser
This commit is contained in:
parent
063066dfae
commit
a7ca236903
@ -43,6 +43,10 @@ page-header, .page-header--new {
|
||||
border-color: #b1c1ce; // TODO: variable
|
||||
}
|
||||
|
||||
.rg-bottom span {
|
||||
margin: 1.5px 0 0 -10px;
|
||||
}
|
||||
|
||||
.popover {
|
||||
box-shadow: fade(@redash-gray, 25%) 0px 0px 15px 0px;
|
||||
}
|
||||
|
@ -65,12 +65,18 @@
|
||||
|
||||
</div>
|
||||
<div class="col-sm-3 text-right p-r-0">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row text-center" style="margin-bottom: 10px;">
|
||||
<span ng-show="query.id && canViewSource">
|
||||
<a ng-show="!sourceMode"
|
||||
ng-href="{{query.getUrl(true, selectedTab)}}" class="btn btn-default">Show Source
|
||||
ng-href="{{query.getUrl(true, selectedTab)}}" class="btn btn-default">Show Source <i class="zmdi zmdi-chevron-down"></i>
|
||||
</a>
|
||||
<a ng-show="sourceMode"
|
||||
ng-href="{{query.getUrl(false, selectedTab)}}" class="btn btn-default">Hide Source
|
||||
ng-href="{{query.getUrl(false, selectedTab)}}" class="btn btn-default">Hide Source <i class="zmdi zmdi-chevron-up"></i>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
@ -79,58 +85,59 @@
|
||||
<!-- editor -->
|
||||
<div class="container">
|
||||
<div class="row bg-white tiled p-15 m-b-10" ng-if="sourceMode" resizable r-directions="['bottom']" r-height="300" style="min-height:100px;">
|
||||
|
||||
|
||||
<div ng-class="editorSize" style="height:100%;">
|
||||
<div class="editor__control">
|
||||
<button type="button" class="btn btn-primary btn-s" ng-disabled="queryExecuting || !canExecuteQuery()"
|
||||
ng-click="executeQuery()">
|
||||
<span class="zmdi zmdi-play"></span> Execute
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-default btn-s" ng-click="formatQuery()">
|
||||
<span class="zmdi zmdi-format-indent-increase"></span> Format Query
|
||||
</button>
|
||||
|
||||
<i class="fa fa-database"></i>
|
||||
<span class="text-muted">Data Source</span>
|
||||
<select ng-disabled="!isQueryOwner" ng-model="query.data_source_id" ng-change="updateDataSource()"
|
||||
ng-options="ds.id as ds.name for ds in dataSources"></select>
|
||||
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-s btn-default" ng-click="togglePublished()" ng-if="query.is_draft && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))">
|
||||
<span class="fa fa-paper-plane"></span> Publish
|
||||
</button>
|
||||
<button class="btn btn-s btn-default" ng-click="duplicateQuery()" ng-disabled="query.id === undefined || !canForkQuery()">
|
||||
<span class="zmdi zmdi-arrow-split"></span> Fork
|
||||
</button>
|
||||
<button class="btn btn-default" ng-show="canEdit" ng-click="saveQuery()">
|
||||
<span class="fa fa-floppy-o"> </span> Save<span
|
||||
ng-show="isDirty">*</span>
|
||||
</button>
|
||||
<div ng-if="query.id != undefined" class="btn-group" role="group" uib-dropdown>
|
||||
<button class="btn btn-default btn-sm dropdown-toggle" uib-dropdown-toggle>
|
||||
<span class="zmdi zmdi-more"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" uib-dropdown-menu>
|
||||
<li ng-if="!query.is_archived && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))"><a ng-click="archiveQuery()">Archive Query</a></li>
|
||||
<li ng-if="!query.is_archived && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin')) && showPermissionsControl"><a ng-click="showManagePermissionsModal()">Manage Permissions</a></li>
|
||||
<li ng-if="!query.is_draft && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))"><a ng-click="togglePublished()">Unpublish Query</a></li>
|
||||
<li ng-if="query.id != undefined"><a ng-click="showApiKey()">Show API Key</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="height:calc(100% - 40px); margin-bottom: 0px;">
|
||||
<query-editor query="query"
|
||||
schema="schema"
|
||||
syntax="dataSource.syntax"></query-editor>
|
||||
</p>
|
||||
</div>
|
||||
<schema-browser class="col-md-3 p-0 hidden-sm hidden-xs schema-container"
|
||||
schema="schema"
|
||||
on-refresh="refreshSchema()"
|
||||
ng-show="hasSchema">
|
||||
</schema-browser>
|
||||
|
||||
<div ng-class="editorSize" style="height:100%;">
|
||||
<div class="editor__control">
|
||||
<button type="button" class="btn btn-primary btn-s" ng-disabled="queryExecuting || !canExecuteQuery()"
|
||||
ng-click="executeQuery()">
|
||||
<span class="zmdi zmdi-play"></span> Execute
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-default btn-s" ng-click="formatQuery()">
|
||||
<span class="zmdi zmdi-format-indent-increase"></span> Format Query
|
||||
</button>
|
||||
|
||||
<i class="fa fa-database"></i>
|
||||
<span class="text-muted">Data Source</span>
|
||||
<select ng-disabled="!isQueryOwner" ng-model="query.data_source_id" ng-change="updateDataSource()"
|
||||
ng-options="ds.id as ds.name for ds in dataSources"></select>
|
||||
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-s btn-default" ng-click="togglePublished()" ng-if="query.is_draft && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))">
|
||||
<span class="fa fa-paper-plane"></span> Publish
|
||||
</button>
|
||||
<button class="btn btn-s btn-default" ng-click="duplicateQuery()" ng-disabled="query.id === undefined || !canForkQuery()">
|
||||
<span class="zmdi zmdi-arrow-split"></span> Fork
|
||||
</button>
|
||||
<button class="btn btn-default" ng-show="canEdit" ng-click="saveQuery()">
|
||||
<span class="fa fa-floppy-o"> </span> Save<span
|
||||
ng-show="isDirty">*</span>
|
||||
</button>
|
||||
<div ng-if="query.id != undefined" class="btn-group" role="group" uib-dropdown>
|
||||
<button class="btn btn-default btn-sm dropdown-toggle" uib-dropdown-toggle>
|
||||
<span class="zmdi zmdi-more"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" uib-dropdown-menu>
|
||||
<li ng-if="!query.is_archived && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))"><a ng-click="archiveQuery()">Archive Query</a></li>
|
||||
<li ng-if="!query.is_archived && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin')) && showPermissionsControl"><a ng-click="showManagePermissionsModal()">Manage Permissions</a></li>
|
||||
<li ng-if="!query.is_draft && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))"><a ng-click="togglePublished()">Unpublish Query</a></li>
|
||||
<li ng-if="query.id != undefined"><a ng-click="showApiKey()">Show API Key</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="height:calc(100% - 40px); margin-bottom: 0px;">
|
||||
<query-editor query="query"
|
||||
schema="schema"
|
||||
syntax="dataSource.syntax"></query-editor>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of editor -->
|
||||
|
@ -46,7 +46,7 @@ function QueryViewCtrl(
|
||||
|
||||
function toggleSchemaBrowser(hasSchema) {
|
||||
$scope.hasSchema = hasSchema;
|
||||
$scope.editorSize = hasSchema ? 'col-md-9 p-r-0' : 'col-md-12';
|
||||
$scope.editorSize = hasSchema ? 'col-md-9 p-l-0' : 'col-md-12';
|
||||
}
|
||||
|
||||
function getSchema(refresh = undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user