From a4da50bf6dd2e3916179e17ace8577dadba69343 Mon Sep 17 00:00:00 2001 From: kunw Date: Thu, 14 Jul 2016 20:43:58 +0800 Subject: [PATCH] add resizable height in replication page. --- static/resources/css/replication.css | 3 +- .../list-replication.directive.html | 8 ++-- .../replication/list-replication.directive.js | 40 +++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/static/resources/css/replication.css b/static/resources/css/replication.css index f79862d34..1f41d5c18 100644 --- a/static/resources/css/replication.css +++ b/static/resources/css/replication.css @@ -40,8 +40,7 @@ } .pane-split { - overflow-x: hidden; - overflow-y: auto; + overflow: hidden; width: 100%; } diff --git a/static/resources/js/components/replication/list-replication.directive.html b/static/resources/js/components/replication/list-replication.directive.html index dfef80342..e5762a57f 100644 --- a/static/resources/js/components/replication/list-replication.directive.html +++ b/static/resources/js/components/replication/list-replication.directive.html @@ -24,7 +24,7 @@ -
+
@@ -74,7 +74,7 @@
//vm.replicationPolicies ? vm.replicationPolicies.length : 0// // 'items' | tr //
- +

// 'replication_jobs' | tr //


@@ -112,7 +112,7 @@
-
+
@@ -126,7 +126,7 @@
-
+
diff --git a/static/resources/js/components/replication/list-replication.directive.js b/static/resources/js/components/replication/list-replication.directive.js index 0d2f8db53..0208c5ff1 100644 --- a/static/resources/js/components/replication/list-replication.directive.js +++ b/static/resources/js/components/replication/list-replication.directive.js @@ -252,6 +252,46 @@ function link(scope, element, attrs, ctrl) { + + var uponPaneHeight = element.find('#upon-pane').height(); + var downPaneHeight = element.find('#down-pane').height(); + + var uponTableHeight = element.find('#upon-pane .table-body-container').height(); + var downTableHeight = element.find('#down-pane .table-body-container').height(); + + var handleHeight = element.find('.split-handle').height() + element.find('.split-handle').offset().top + element.find('.well').height() - 24; + + var maxDownPaneHeight = 760; + + element.find('.split-handle').on('mousedown', mousedownHandler); + + function mousedownHandler(e) { + e.preventDefault(); + $(document).on('mousemove', mousemoveHandler); + $(document).on('mouseup', mouseupHandler); + } + + function mousemoveHandler(e) { + + var incrementHeight = $('.container-fluid').scrollTop() + e.pageY; + + if(element.find('#down-pane').height() <= maxDownPaneHeight) { + element.find('#upon-pane').css({'height' : (uponPaneHeight - (handleHeight - incrementHeight)) + 'px'}); + element.find('#down-pane').css({'height' : (downPaneHeight + (handleHeight - incrementHeight)) + 'px'}); + element.find('#upon-pane .table-body-container').css({'height': (uponTableHeight - (handleHeight - incrementHeight)) + 'px'}); + element.find('#down-pane .table-body-container').css({'height': (downTableHeight + (handleHeight - incrementHeight)) + 'px'}); + }else{ + element.find('#down-pane').css({'height' : (maxDownPaneHeight) + 'px'}); + $(document).off('mousemove'); + } + } + + function mouseupHandler(e) { + $(document).off('mousedown'); + $(document).off('mousemove'); + } + + ctrl.lastPolicyId = -1; scope.$watch('vm.replicationPolicies', function(current) {