You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2019/04/05 05:41:36 UTC

[ignite] branch master updated: IGNITE-8368 Web Console: Refactored queries notebooks list.

This is an automated email from the ASF dual-hosted git repository.

akuznetsov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d93a0b  IGNITE-8368 Web Console: Refactored queries notebooks list.
0d93a0b is described below

commit 0d93a0b84a135e1853cb7972fafbcca65d12fe82
Author: Alexander Kalinin <ve...@yandex.ru>
AuthorDate: Fri Apr 5 12:40:23 2019 +0700

    IGNITE-8368 Web Console: Refactored queries notebooks list.
---
 .../queries-notebooks-list/controller.js           | 43 ++++------------------
 .../queries-notebooks-list/template.tpl.pug        |  9 ++++-
 2 files changed, 16 insertions(+), 36 deletions(-)

diff --git a/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/controller.js b/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/controller.js
index 379f974..a10dd1f 100644
--- a/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/controller.js
+++ b/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/controller.js
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-import headerTemplate from '../../../../../app/primitives/ui-grid-header/index.tpl.pug';
-
 export class NotebooksListCtrl {
     static $inject = ['IgniteNotebook', 'IgniteMessages', 'IgniteLoading', 'IgniteInput', '$scope', '$modal'];
 
@@ -31,45 +29,18 @@ export class NotebooksListCtrl {
         const sqlQueryTemplate = `<div class="ui-grid-cell-contents">{{row.entity.sqlQueriesParagraphsLength}}</div>`;
         const scanQueryTemplate = `<div class="ui-grid-cell-contents">{{row.entity.scanQueriesPsaragraphsLength}}</div>`;
 
-        const categories = [
+        this.categories = [
             { name: 'Name', visible: true, enableHiding: false },
             { name: 'SQL Queries', visible: true, enableHiding: false },
             { name: 'Scan Queries', visible: true, enableHiding: false }
         ];
 
-        const columnDefs = [
-            { name: 'name', displayName: 'Notebook name', categoryDisplayName: 'Name', field: 'name', cellTemplate: notebookNameTemplate, pinnedLeft: true, filter: { placeholder: 'Filter by Name...' } },
+        this.columnDefs = [
+            { name: 'name', displayName: 'Notebook name', categoryDisplayName: 'Name', field: 'name', cellTemplate: notebookNameTemplate, filter: { placeholder: 'Filter by Name...' } },
             { name: 'sqlQueryNum', displayName: 'SQL Queries', categoryDisplayName: 'SQL Queries', field: 'sqlQueriesParagraphsLength', cellTemplate: sqlQueryTemplate, enableSorting: true, type: 'number', minWidth: 150, width: '10%', enableFiltering: false },
             { name: 'scanQueryNum', displayName: 'Scan Queries', categoryDisplayName: 'Scan Queries', field: 'scanQueriesParagraphsLength', cellTemplate: scanQueryTemplate, enableSorting: true, type: 'number', minWidth: 150, width: '10%', enableFiltering: false }
         ];
 
-        this.gridOptions = {
-            data: [],
-
-            categories,
-            columnDefs,
-            headerTemplate,
-
-            rowHeight: 46,
-            selectWithCheckboxOnly: true,
-            suppressRemoveSort: false,
-            enableFiltering: true,
-            enableSelectAll: true,
-            enableRowSelection: true,
-            enableFullRowSelection: true,
-            enableColumnMenus: false,
-            noUnselect: false,
-            fastWatch: true,
-            onRegisterApi: (api) => {
-                this.gridApi = api;
-
-                api.selection.on.rowSelectionChanged($scope, this._onSelectionChanged.bind(this));
-                api.selection.on.rowSelectionChangedBatch($scope, this._onSelectionChanged.bind(this));
-
-                this.$scope.$watch(() => this.gridApi.grid.getVisibleRows().length, (rows) => this._adjustHeight(rows));
-            }
-        };
-
         this.actionOptions = [
             {
                 action: 'Clone',
@@ -96,8 +67,10 @@ export class NotebooksListCtrl {
     async _loadAllNotebooks() {
         try {
             this.IgniteLoading.start('notebooksLoading');
-            this.notebooks = await this.IgniteNotebook.read();
-            this.gridOptions.data = this._preprocessNotebooksList(this.notebooks);
+
+            const data = await this.IgniteNotebook.read();
+
+            this.notebooks = this._preprocessNotebooksList(data);
         }
         catch (err) {
             this.IgniteMessages.showError(err);
@@ -122,7 +95,7 @@ export class NotebooksListCtrl {
         return notebook.paragraphs.filter((paragraph) => paragraph.qryType === queryType).length || 0;
     }
 
-    _onSelectionChanged() {
+    onSelectionChanged() {
         this._checkActionsAllow();
     }
 
diff --git a/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/template.tpl.pug b/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/template.tpl.pug
index bbf6df7..a637556 100644
--- a/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/template.tpl.pug
+++ b/modules/web-console/frontend/app/components/page-queries/components/queries-notebooks-list/template.tpl.pug
@@ -41,7 +41,14 @@ page-queries-slot(slot-name="'queriesButtons'" ng-if="!$root.IgniteDemoMode")
                 })
 
         .panel-collapse(ignite-loading='notebooksLoading' ignite-loading-text='Loading notebooks...')
-            .grid.ui-grid--ignite#queriesNotebooksList(ui-grid='$ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-hovering)
+            ignite-grid-table(
+                items='$ctrl.notebooks'
+                column-defs='$ctrl.columnDefs'
+                grid-api='$ctrl.gridApi'
+                grid-thin='true'
+                on-selection-change='$ctrl.onSelectionChanged()'
+            )
+
             grid-no-data(grid-api='$ctrl.gridApi')
                 | You have no notebooks.
                 a.link-success(ng-click='$ctrl.createNotebook()') Create one?