<div class="blade-static __bottom"
     ng-if="pageSettings.itemsPerPageCount < pageSettings.totalItems"
     ng-include="'pagerTemplate.html'"></div>
<div class="blade-content __xlarge-wide">
  <div class="blade-inner">
    <div class="inner-block">
      <div class="table-wrapper"
           ng-if="blade.currentEntities.length"
           ng-init="setGridOptions({
                    data: 'blade.currentEntities',
                    rowTemplate: 'list.row.html',
                    columnDefs: [
                                { name: 'actions', displayName: '', enableColumnResizing: false, enableSorting: false, width: 30, cellTemplate: 'list-actions.cell.html', pinnedLeft:true },
                                { name: 'name', displayName: 'sql-queries.blades.sql-query-list.labels.name'},
                        ]})">
        <div ui-grid="gridOptions" ui-grid-auto-resize ui-grid-save-state ui-grid-selection ui-grid-resize-columns ui-grid-move-columns ui-grid-pinning ui-grid-height></div>
        <ul class="menu __context" role="menu" id="sql_query">
          <li class="menu-item" ng-click='blade.openReportView(contextMenuEntity)'>
            <i class="menu-ico fa fa-eye"></i> {{'sql-queries.commands.view-report' | translate}}
          </li>
          <li class="menu-item" va-permission="sql-queries:update" ng-click='blade.editSqlQuery(contextMenuEntity)'>
            <i class="menu-ico fa fa-pencil"></i> {{'sql-queries.commands.edit-report' | translate}}
          </li>
          <li class="menu-item" va-permission="sql-queries:delete" ng-click='blade.deleteSqlQuery([contextMenuEntity])'>
            <i class="menu-ico fa fa-trash-o"></i> {{'platform.commands.delete' | translate}}
          </li>
        </ul>
      </div>
      <div class="sql-queries-no-data" ng-if="!blade.currentEntities.length">
        <div class="sql-queries-no-data-inner">
          <i class="fa fa-database sql-queries-no-data-icon"></i>
          <div class="sql-queries-no-data-title">{{ 'sql-queries.blades.sql-query-list.labels.no-data-title' | translate }}</div>
          <div class="sql-queries-no-data-text">{{ 'sql-queries.blades.sql-query-list.labels.no-data-text' | translate }}</div>
        </div>
      </div>
    </div>
  </div>
</div>

<script type="text/ng-template" id="list.row.html">
  <div ng-click="grid.appScope.blade.selectNode(row.entity)" ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid" ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'" class="ui-grid-cell" ng-class="{'ui-grid-row-header-cell': col.isRowHeader, '__hovered': grid.appScope.contextMenuEntity === row.entity, '__selected': row.entity.id===grid.appScope.selectedNodeId }" role="{{col.isRowHeader ? 'rowheader' : 'gridcell' }}" ui-grid-cell context-menu="grid.appScope.contextMenuEntity = row.entity" data-target="sql_query"></div>
</script>
<script type="text/ng-template" id="list-actions.cell.html">
  <div class="ui-grid-actions" left-click-menu="grid.appScope.contextMenuEntity = row.entity" data-target="sql_query">
    <i class="fa fa-ellipsis-v"></i>
  </div>
</script>