incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke4...@apache.org
Subject [31/50] [abbrv] git commit: CS-13091: Enable/disable physical network UI actions
Date Sun, 27 May 2012 22:35:41 GMT
CS-13091: Enable/disable physical network UI actions

Conflicts:

	ui/index.jsp


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

Branch: refs/heads/3.0.x
Commit: ff3c23677614d41aa9088dcf0b6fecb6f2c0dc28
Parents: 036c7a0
Author: Brian Federle <brian.federle@citrix.com>
Authored: Thu May 24 12:15:58 2012 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Thu May 24 12:16:51 2012 -0700

----------------------------------------------------------------------
 .../WEB-INF/classes/resources/messages.properties  |    4 +
 ui/index.jsp                                       |    4 +
 ui/scripts/system.js                               |   93 ++++++++++++++-
 ui/scripts/ui-custom/zoneChart.js                  |    3 +-
 4 files changed, 99 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff3c2367/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 f51a5f2..94bb005 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1,4 +1,8 @@
 #new labels (begin) **********************************************************************************************
+label.action.enable.physical.network=Enable physical network
+label.action.disable.physical.network=Disable physical network
+message.action.enable.physical.network=Please confirm that you want to enable this physical
network.
+message.action.disable.physical.network=Please confirm that you want to disable this physical
network.
 label.ipaddress=IP Address
 label.vcdcname=vCenter DC name
 label.vcipaddress=vCenter IP Address

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff3c2367/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index ab1ce02..43281bb 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -1659,6 +1659,10 @@ dictionary = {
 'message.edit.traffic.type': '<fmt:message key="message.edit.traffic.type"/>',
 'label.label': '<fmt:message key="label.label"/>',
 'message.configure.all.traffic.types': '<fmt:message key="message.configure.all.traffic.types"/>',
+'label.action.enable.physical.network': '<fmt:message key="label.action.enable.physical.network"/>',
+'label.action.disable.physical.network': '<fmt:message key="label.action.disable.physical.network"/>',
+'message.action.enable.physical.network': '<fmt:message key="message.action.enable.physical.network"/>',
+'message.action.disable.physical.network': '<fmt:message key="message.action.disable.physical.network"/>',
 'label.ipaddress': '<fmt:message key="label.ipaddress"/>',
 'label.vcdcname': '<fmt:message key="label.vcdcname"/>',
 'label.vcipaddress': '<fmt:message key="label.vcipaddress"/>',

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff3c2367/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 7303419..a60cb29 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -1827,7 +1827,81 @@
 							notification: {
 								poll: pollAsyncJobResult
 							}
-						}
+						},
+            enable: {
+              label: 'label.action.enable.physical.network',
+              messages: {
+                confirm: function(args) {
+                  return 'message.action.enable.physical.network';
+                },
+                notification: function(args) {
+                  return 'label.action.enable.physical.network';
+                }
+              },
+              action: function(args) {
+                $.ajax({
+                  url: createURL('updatePhysicalNetwork'),
+                  data: {
+                    id: args.context.physicalNetworks[0].id,
+                    state: 'Enabled'
+                  },
+                  success: function(json) {
+                    args.response.success({
+                      _custom: {
+                        jobId: json.updatephysicalnetworkresponse.jobid,
+                        getUpdatedItem: function(json) {
+                          return {
+                            state: 'Enabled'
+                          };
+                        },
+                        getActionFilter: function() {
+                          return cloudStack.actionFilter.physicalNetwork;
+                        }
+                      }
+                    });
+                  },
+                  error: function(json) { args.response.error(parseXMLHttpResponse(json));
}
+                });
+              },
+              notification: { poll: pollAsyncJobResult }
+            },
+            disable: {
+              label: 'label.action.disable.physical.network',
+              messages: {
+                confirm: function(args) {
+                  return 'message.action.disable.physical.network';
+                },
+                notification: function(args) {
+                  return 'label.action.disable.physical.network';
+                }
+              },
+              action: function(args) {
+                $.ajax({
+                  url: createURL('updatePhysicalNetwork'),
+                  data: {
+                    id: args.context.physicalNetworks[0].id,
+                    state: 'Disabled'
+                  },
+                  success: function(json) {
+                    args.response.success({
+                      _custom: {
+                        jobId: json.updatephysicalnetworkresponse.jobid,
+                        getUpdatedItem: function(json) {
+                          return {
+                            state: 'Disabled'
+                          };
+                        },
+                        getActionFilter: function() {
+                          return cloudStack.actionFilter.physicalNetwork;
+                        }                                          
+                      }
+                    });
+                  },
+                  error: function(json) { args.response.error(parseXMLHttpResponse(json));
}
+                });
+              },
+              notification: { poll: pollAsyncJobResult }
+            }
 					}
         },
         dataProvider: function(args) {
@@ -1839,6 +1913,7 @@
             success: function(json) {
 						  physicalNetworkObjs = json.listphysicalnetworksresponse.physicalnetwork;
               args.response.success({
+                actionFilter: cloudStack.actionFilter.physicalNetwork,
                 data: json.listphysicalnetworksresponse.physicalnetwork
               });
             }
@@ -9235,7 +9310,17 @@
 				}
 			);
 		}
-	}
-	
-	
+	};
+
+	cloudStack.actionFilter.physicalNetwork = function(args) {
+    var state = args.context.item.state;
+
+    if (state == 'Enabled') {
+      return ['disable', 'remove'];
+    } else if (state == 'Disabled') {
+      return ['enable', 'remove'];
+    }
+
+    return [];
+  };
 })($, cloudStack);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff3c2367/ui/scripts/ui-custom/zoneChart.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/zoneChart.js b/ui/scripts/ui-custom/zoneChart.js
index 7c4951a..dfe26e9 100644
--- a/ui/scripts/ui-custom/zoneChart.js
+++ b/ui/scripts/ui-custom/zoneChart.js
@@ -295,11 +295,12 @@
           response: {
             success: function(args) {
               var data = args.data;
+              var actionFilter = args.actionFilter;
 
               $chart.listView({
                 listView: $.extend(true, {}, cloudStack.sections.system.naas.networks.listView,
{
                   dataProvider: function(args) {
-                    args.response.success({ data: data });
+                    args.response.success({ actionFilter: actionFilter, data: data });
                   },
                   detailView: {
                     tabs: {


Mime
View raw message