You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/02/27 22:57:41 UTC

[3/23] git commit: refs/heads/master - Implement region list view

Implement region list view


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/142a5a8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/142a5a8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/142a5a8f

Branch: refs/heads/master
Commit: 142a5a8fba0859b39ecae1e1610d875816f5a37f
Parents: 47816a4
Author: Brian Federle <br...@citrix.com>
Authored: Tue Feb 26 13:09:32 2013 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Feb 26 13:09:32 2013 -0800

----------------------------------------------------------------------
 .../WEB-INF/classes/resources/messages.properties  |    3 +
 ui/dictionary.jsp                                  |    3 +
 ui/index.jsp                                       |    1 +
 ui/scripts/cloudStack.js                           |    5 +-
 ui/scripts/regions.js                              |   71 +++++++++++++++
 5 files changed, 81 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/142a5a8f/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index a0ed7c9..7374bd8 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -17,6 +17,9 @@
 
 
 #new labels (begin) **********************************************************************************************
+label.menu.regions=Regions
+label.region=Region
+label.endpoint=Endpoint
 label.plugins=Plugins
 label.plugin.details=Plugin details
 label.author.name=Author name

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/142a5a8f/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 3a10258..98f6bf8 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -25,6 +25,9 @@ under the License.
 <% long now = System.currentTimeMillis(); %>
 <script language="javascript">
 dictionary = {
+'label.region': '<fmt:message key="label.region"/>',
+'label.endpoint': '<fmt:message key="label.endpoint"/>',
+'label.menu.regions': '<fmt:message key="label.menu.regions"/>',
 'label.plugins': '<fmt:message key="label.plugins"/>',
 'label.plugin.details': '<fmt:message key="label.plugin.details"/>',
 'label.author.name': '<fmt:message key="label.author.name"/>',

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/142a5a8f/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index 462ddaf..1e0df9f 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -1656,6 +1656,7 @@ under the License.
     <script type="text/javascript" src="scripts/instanceWizard.js?t=<%=now%>"></script>
     <script type="text/javascript" src="scripts/instances.js?t=<%=now%>"></script>
     <script type="text/javascript" src="scripts/events.js?t=<%=now%>"></script>
+    <script type="text/javascript" src="scripts/regions.js?t=<%=now%>"></script>
     <script type="text/javascript" src="scripts/ui-custom/ipRules.js?t=<%=now%>"></script>
     <script type="text/javascript" src="scripts/ui-custom/enableStaticNAT.js?t=<%=now%>"></script>
     <script type="text/javascript" src="scripts/ui-custom/securityRules.js?t=<%=now%>"></script>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/142a5a8f/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index 3c5dfe1..f9b5a58 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -22,7 +22,7 @@
       var sections = [];
 
       if(isAdmin()) {
-        sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects"];
+        sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions"];
       }
       else if(isDomainAdmin()) {
         sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
@@ -54,7 +54,8 @@
       accounts: {},
 			
       domains: {}, //domain-admin and root-admin only
-			
+
+      regions: {}, //root-admin only
       system: {},  //root-admin only     
       'global-settings': {}, //root-admin only     
       configuration: {}, //root-admin only

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/142a5a8f/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
new file mode 100644
index 0000000..f29dc6d
--- /dev/null
+++ b/ui/scripts/regions.js
@@ -0,0 +1,71 @@
+// 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.
+(function(cloudStack) {
+  cloudStack.sections.regions = {
+    title: 'label.menu.regions',
+    id: 'regions',
+    listView: {
+      section: 'regions',
+      fields: {
+        name: { label: 'label.name' },
+        endpoint: { label: 'label.endpoint' }
+      },
+      dataProvider: function(args) {
+        $.ajax({
+          url: createURL('listRegions&listAll=true'),
+          success: function(json) {
+            var regions = json.listregionsresponse.region
+
+            args.response.success({
+              data: regions ? regions : []
+            });
+          }
+        });
+      },
+      detailView: {
+        name: 'Region details',
+        tabs: {
+          details: {
+            title: 'label.details',
+            fields: [
+              {
+                name: { label: 'label.name' },
+              },
+              {
+                endpoint: { label: 'label.endpoint' },
+                id: { label: 'label.id' }
+              }
+            ],
+            dataProvider: function(args) {								  
+              $.ajax({
+                url: createURL('listRegions&listAll=true'),
+                data: { id: args.context.regions[0].id },
+                success: function(json) {
+                  var region = json.listregionsresponse.region
+
+                  args.response.success({
+                    data: region ? region[0] : {}
+                  });
+                }
+              });  
+            }
+          }
+        }
+      }
+    }
+  };
+})(cloudStack);