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 2017/04/14 10:54:40 UTC

ignite git commit: IGNITE-4068 Added common primitive for buttons group. Refactored existing button groups.

Repository: ignite
Updated Branches:
  refs/heads/master 68727334c -> e5200c276


IGNITE-4068 Added common primitive for buttons group. Refactored existing button groups.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5200c27
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5200c27
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5200c27

Branch: refs/heads/master
Commit: e5200c27622e89ae904182699bd9d1954a2ebd4c
Parents: 6872733
Author: Dmitriy Shabalin <dm...@gmail.com>
Authored: Fri Apr 14 17:55:38 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 14 17:55:38 2017 +0700

----------------------------------------------------------------------
 .../frontend/app/helpers/jade/mixins.pug        | 12 ++++---
 .../frontend/app/modules/sql/sql.controller.js  |  6 ----
 .../frontend/app/primitives/btn-group/index.pug | 35 ++++++++++++++++++++
 .../views/configuration/domains-import.tpl.pug  |  2 +-
 .../views/configuration/domains.tpl.pug         |  1 -
 .../web-console/frontend/views/sql/sql.tpl.pug  | 12 +++----
 6 files changed, 47 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e5200c27/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 3b6cd19..21468cc 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -16,6 +16,7 @@
 
 include ./form
 include ../../primitives/tooltip/index
+include ../../primitives/btn-group/index
 include ../../primitives/datepicker/index
 include ../../primitives/dropdown/index
 include ../../primitives/ui-grid-settings/index
@@ -53,7 +54,7 @@ mixin main-table(title, rows, focusId, click, rowTemplate, searchField)
 
 //- Mixin with save, remove, clone and undo buttons.
 mixin save-remove-clone-undo-buttons(objectName)
-    -var removeTip = '"Remove current ' + objectName + '"'
+    -var removeTip = 'Remove current ' + objectName
     -var cloneTip = '"Clone current ' + objectName + '"'
     -var undoTip = '"Undo all changes for current ' + objectName + '"'
 
@@ -64,10 +65,11 @@ mixin save-remove-clone-undo-buttons(objectName)
             a.btn.btn-primary(id='save-item' ng-disabled='!ui.inputForm.$dirty' ng-click='ui.inputForm.$dirty && saveItem()' bs-tooltip='' data-title=`{{saveBtnTipText(ui.inputForm.$dirty, '${objectName}')}}` data-placement='bottom' data-trigger='hover') Save
         .panel-tip-container(ng-show='backupItem._id')
             a.btn.btn-primary(id='clone-item' ng-click='cloneItem()' bs-tooltip=cloneTip data-placement='bottom' data-trigger='hover') Clone
-        .btn-group.panel-tip-container(ng-show='backupItem._id')
-            button.btn.btn-primary(id='remove-item' ng-click='removeItem()' bs-tooltip=removeTip data-placement='bottom' data-trigger='hover') Remove
-            button.btn.dropdown-toggle.btn-primary(id='remove-item-dropdown' data-toggle='dropdown' data-container='body' bs-dropdown='[{ text: "Remove All", click: "removeAllItems()" }]' data-placement='bottom-right')
-                span.caret
+
+        -var actions = [{ text: "Remove", click: "removeItem()" }, { text: "Remove All", click: "removeAllItems()" }]
+
+        +btn-group(actions, removeTip)(ng-show='backupItem._id')
+
         .panel-tip-container(ng-show='backupItem')
             i.btn.btn-primary.fa.fa-undo(id='undo-item' ng-disabled='!ui.inputForm.$dirty' ng-click='ui.inputForm.$dirty && resetAll()' bs-tooltip=undoTip data-placement='bottom' data-trigger='hover')
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5200c27/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index 075bd55..b1cd3d0 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -271,12 +271,6 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
             {value: 3600000, label: 'hours', short: 'h'}
         ];
 
-        $scope.exportDropdown = [
-            { text: 'Export all', click: 'exportCsvAll(paragraph)' }
-            // { 'text': 'Export all to CSV', 'click': 'exportCsvAll(paragraph)' },
-            // { 'text': 'Export all to PDF', 'click': 'exportPdfAll(paragraph)' }
-        ];
-
         $scope.metadata = [];
 
         $scope.metaFilter = '';

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5200c27/modules/web-console/frontend/app/primitives/btn-group/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/btn-group/index.pug b/modules/web-console/frontend/app/primitives/btn-group/index.pug
new file mode 100644
index 0000000..c047b25
--- /dev/null
+++ b/modules/web-console/frontend/app/primitives/btn-group/index.pug
@@ -0,0 +1,35 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+mixin btn-group(actions, tip)
+    .btn-group.panel-tip-container&attributes(attributes)
+        button.btn.btn-primary(
+            ng-click=`${actions[0].click}`
+
+            bs-tooltip=''
+            data-title=tip
+
+            data-trigger='hover'
+            data-placement='bottom'
+        ) #{actions[0].text}
+        button.btn.dropdown-toggle.btn-primary(
+            bs-dropdown=`${JSON.stringify(actions)}`
+
+            data-toggle='dropdown'
+            data-container='body'
+            data-placement='bottom-right'
+        )
+            span.caret

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5200c27/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 04de07a..1289bb3 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -24,7 +24,7 @@ mixin td-ellipses-lbl(w, lbl)
         label #{lbl}
 
 .modal.modal-domain-import.center(role='dialog')
-    - var tipOpts = {};
+    -var tipOpts = {};
     - tipOpts.container = '.modal-content'
     - tipOpts.placement = 'top'
     .modal-dialog.domains-import-dialog

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5200c27/modules/web-console/frontend/views/configuration/domains.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains.tpl.pug b/modules/web-console/frontend/views/configuration/domains.tpl.pug
index 33528c7..a8f9b5c 100644
--- a/modules/web-console/frontend/views/configuration/domains.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains.tpl.pug
@@ -55,7 +55,6 @@ include /app/helpers/jade/mixins
                 .panel-tip-container(bs-tooltip='' data-title='Import domain models from database' data-placement='bottom')
                     button.btn.btn-primary(ng-click='showImportDomainModal()') Import from database
                 +save-remove-clone-undo-buttons('domain model')
-                .btn-group.panel-tip-container.pull-right(bs-tooltip='' data-title='Import domain models from demo database' data-placement='bottom')
                 hr
             .bs-affix-fix
             div(bs-collapse='' data-allow-multiple='true' ng-model='ui.activePanels')

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5200c27/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index b28d602..dd2754d 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -133,10 +133,8 @@ mixin table-result-heading-query
                 +result-toolbar
         .col-xs-4
             .pull-right
-                .btn-group(ng-disabled='paragraph.loading')
-                    button.btn.btn-primary(ng-click='exportCsv(paragraph)' bs-tooltip data-title='{{actionTooltip(paragraph, "export", false)}}') Export
-                    button.btn.btn-primary.dropdown-toggle(id='export-item-dropdown' data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
-                        span.caret
+                -var actions = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }]
+                +btn-group(actions, '{{ actionTooltip(paragraph, "export", false) }}')(ng-disabled='paragraph.loading')
 
 mixin table-result-heading-scan
     .total.row
@@ -150,10 +148,8 @@ mixin table-result-heading-scan
                 +result-toolbar
         .col-xs-4
             .pull-right
-                .btn-group(ng-disabled='paragraph.loading')
-                    button.btn.btn-primary(ng-click='exportCsv(paragraph)' bs-tooltip data-title='{{actionTooltip(paragraph, "export", false)}}') Export
-                    button.btn.btn-primary.dropdown-toggle(id='export-item-dropdown' data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
-                        span.caret
+                -var actions = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }]
+                +btn-group(actions, '{{ actionTooltip(paragraph, "export", false) }}')(ng-disabled='paragraph.loading')
 
 mixin table-result-body
     .grid(ui-grid='paragraph.gridOptions' ui-grid-resize-columns ui-grid-exporter)