From b9a459c24d9fb561e1d64abec606656e899d6482 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 26 Feb 2013 15:53:34 -0800 Subject: [PATCH] Regions UI: Move to separate source file, add real data, update style -Move region UI code to ui-custom/regions.js, to separate from core UI rendering -Pull real data and endpoint URL on region select list, from data provider in scripts/regions.js -Make region selector have same appearance as notifications box --- ui/css/cloudstack3.css | 60 +++++++++------------- ui/index.jsp | 1 + ui/scripts/regions.js | 14 +++++ ui/scripts/ui-custom/regions.js | 90 +++++++++++++++++++++++++++++++++ ui/scripts/ui/core.js | 75 ++------------------------- 5 files changed, 134 insertions(+), 106 deletions(-) create mode 100644 ui/scripts/ui-custom/regions.js diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index d1166dc0467..fb45d2cad55 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -11102,29 +11102,28 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; - width: 281px; - background: #E4E4E4; - height: 327px; - /*+placement:shift 72px 49px;*/ + width: 318px; + background: url(../images/bg-notifications.png) center; + height: 372px; + /*+placement:shift 321px 49px;*/ position: relative; - left: 72px; + left: 321px; top: 49px; position: absolute; z-index: 1000; - /*+box-shadow:0px 3px 11px #171717;*/ - -moz-box-shadow: 0px 3px 11px #171717; - -webkit-box-shadow: 0px 3px 11px #171717; - -o-box-shadow: 0px 3px 11px #171717; - box-shadow: 0px 3px 11px #171717; } .region-selector h2 { - color: #283139; - text-shadow: 0px 1px 3px #FFFFFF; - margin: 5px 0 12px; + color: #FFFFFF; text-align: center; + font-size: 21px; letter-spacing: 1px; - font-size: 18px; + /*+text-shadow:0px 1px 2px #000000;*/ + -moz-text-shadow: 0px 1px 2px #000000; + -webkit-text-shadow: 0px 1px 2px #000000; + -o-text-shadow: 0px 1px 2px #000000; + text-shadow: 0px 1px 2px #000000; + margin: 31px 0 14px; } .region-selector .buttons { @@ -11134,16 +11133,16 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it } .region-selector .buttons .button.close { + background: url(../images/gradients.png) 0px -317px; float: right; - cursor: pointer; - background: url(../images/bg-gradients.png) 0px -270px; + margin-right: 10px; + border-bottom: 1px solid #232323; /*+border-radius:4px;*/ -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; - border: 1px solid #B1B1B1; - padding: 8px 17px 8px 18px; + padding: 8px; } .region-selector .buttons .button.close:hover { @@ -11155,16 +11154,17 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it } .region-selector .buttons .button.close span { - color: #636363; - /*+text-shadow:none;*/ - -moz-text-shadow: none; - -webkit-text-shadow: none; - -o-text-shadow: none; - text-shadow: none; + color: #FFFFFF; + font-weight: bold; + letter-spacing: 1px; + /*+text-shadow:0px 1px 2px #000000;*/ + -moz-text-shadow: 0px 1px 2px #000000; + -webkit-text-shadow: 0px 1px 2px #000000; + -o-text-shadow: 0px 1px 2px #000000; + text-shadow: 0px 1px 2px #000000; } .region-selector .buttons .button.close:hover span { - color: #000000; } .region-selector ul { @@ -11212,16 +11212,6 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it text-shadow: 0px 1px #FFFFFF; } -.region-selector .top-arrow { - width: 76px; - height: 12px; - background: url(../images/sprites.png) -107px -1312px; - /*+placement:shift 78px -12px;*/ - position: relative; - left: 78px; - top: -12px; -} - .region-switcher .icon { display: block; width: 100%; diff --git a/ui/index.jsp b/ui/index.jsp index 1e0df9f1c24..d1e6bfa923b 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1657,6 +1657,7 @@ under the License. + diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 46f73dabb31..ee77ac1e2eb 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -18,6 +18,20 @@ cloudStack.sections.regions = { title: 'label.menu.regions', id: 'regions', + regionSelector: { + dataProvider: function(args) { + $.ajax({ + url: createURL('listRegions&listAll=true'), + success: function(json) { + var regions = json.listregionsresponse.region + + args.response.success({ + data: regions ? regions : [] + }); + } + }); + } + }, listView: { section: 'regions', fields: { diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js new file mode 100644 index 00000000000..73b14a78a26 --- /dev/null +++ b/ui/scripts/ui-custom/regions.js @@ -0,0 +1,90 @@ +(function($, cloudStack) { + $(window).bind('cloudStack.ready', function() { + // Region switcher + var $regionList = $('