cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pran...@apache.org
Subject git commit: updated refs/heads/UI-explicitDedication to 5f11709
Date Tue, 28 May 2013 16:16:21 GMT
Updated Branches:
  refs/heads/UI-explicitDedication 9d4e1565c -> 5f11709ea


Explicit Dedication - Zone action item dedication/release API integration


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

Branch: refs/heads/UI-explicitDedication
Commit: 5f11709ea4b931d3c25dd4bb3abc4737951be1f1
Parents: 9d4e156
Author: Pranav Saxena <pranav.saxena@citrix.com>
Authored: Tue May 28 21:44:45 2013 +0530
Committer: Pranav Saxena <pranav.saxena@citrix.com>
Committed: Tue May 28 21:44:45 2013 +0530

----------------------------------------------------------------------
 ui/scripts/system.js |  175 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 162 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f11709e/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 5cc177b..bad6920 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -4903,6 +4903,121 @@
                     }
                   },
 
+                   dedicate:{
+                   label: 'Dedicate Zone',
+                messages: {
+                  confirm: function(args) {
+                    return 'Do you really want to dedicate this zone to a domain/account?
';
+                  },
+                  notification: function(args) {
+                    return 'Zone Dedicated';
+                  }
+                },
+                createForm:{
+                   title:'Dedicate Zone',
+                   fields:{
+                         domainId:{
+                      label:'Domain',
+                      validation:{required:true},
+                      select:function(args){
+                         $.ajax({
+                              url:createURL("listDomains&listAll=true"),
+                              dataType:"json",
+                              async:false,
+                               success: function(json) {
+                                  var domainObjs= json.listdomainsresponse.domain;
+                                  var items=[];
+
+                                  $(domainObjs).each(function() {
+                                  items.push({id:this.id ,description:this.name });
+                                  });
+
+                                  args.response.success({
+                                  data: items
+                                });
+                               }
+
+
+                        });
+                       }
+                   },
+
+                   accountId:{
+                     label:'Account',
+                    // docID:'helpAccountForDedication',
+                     validation:{required:false}
+
+                  }
+
+
+                     }
+                },
+            
+               action: function(args) {
+                     //EXPLICIT DEDICATION
+                      var array2 = [];
+                      if(args.data.accountId != "")
+                        array2.push("&accountId=" +todb(args.data.accountId));
+
+                    $.ajax({
+                    url: createURL("dedicateZone&zoneId=" + args.context.physicalResources[0].id
+ "&domainId=" +args.data.domainId + array2.join("") ),
+                    dataType: "json",
+                    success: function(json) {
+                       var jid = json.dedicatezoneresponse.jobid;
+                            args.response.success({
+                               _custom:
+                           {      jobId: jid
+                             },
+                            notification: {
+                                 poll: pollAsyncJobResult
+                              },
+                            actionFilter:zoneActionfilter
+
+
+                          });
+
+                    }
+                  });
+                }
+
+              },
+
+              release:{
+                label:'Release Dedicated Zone',
+                messages:{
+                   confirm: function(args) {
+                    return 'Do you want to release this dedicated zone ?';
+                  },
+                  notification: function(args) {
+                    return 'Zone dedication released';
+                  }
+                },
+               action:function(args){
+                  $.ajax({
+                     url:createURL("releaseDedicatedZone&zoneid=" + args.context.physicalResources[0].id),
+                     dataType:"json",
+                     async:true,
+                      success:function(json){
+                       var jid = json.releasededicatedzoneresponse.jobid;
+                        args.response.success({
+                             _custom:
+                           {      jobId: jid
+                             },
+                            notification: {
+                                 poll: pollAsyncJobResult
+                              },
+                            actionFilter:zoneActionfilter
+
+                       });
+                     },
+                    error:function(json){
+                      args.response.error(parseXMLHttpResponse(json));
+                    }
+                  });
+
+               }
+              },
+
                   'remove': {
                     label: 'label.action.delete.zone',
                     messages: {
@@ -5000,7 +5115,15 @@
 												  isEditable: true,
 												  converter:cloudStack.converters.toBooleanText
                         }
-                      }
+                      },
+
+                       {
+
+                       isdedicated:{label:'Dedicated'},
+                       domainid:{label:'Domain ID'}
+
+                       }
+
                     ],
                     dataProvider: function(args) {
                       $.ajax({
@@ -5009,12 +5132,32 @@
                           id: args.context.physicalResources[0].id
                         },
                         success: function(json) {
-                          selectedZoneObj = json.listzonesresponse.zone[0];
-                          args.response.success({
-                            data: json.listzonesresponse.zone[0],
-                            actionFilter: zoneActionfilter
-                          });
-                        }
+                           selectedZoneObj = json.listzonesresponse.zone[0];
+                             $.ajax({
+                                                    url:createURL("listDedicatedZones&zoneid="
+args.context.physicalResources[0].id),
+                                                    dataType:"json",
+                                                    async:false,
+                                                    success:function(json){
+                                                        if(json.listdedicatedzonesresponse.dedicatedzone
!= undefined){
+                                                          var zoneItem = json.listdedicatedzonesresponse.dedicatedzone[0];
+                                                            if (zoneItem.domainid != null)
{
+                                                            $.extend(selectedZoneObj, zoneItem
, { isdedicated: 'Yes' });
+                                                          }
+                                                        }
+                                                        else
+                                                            $.extend(selectedZoneObj,{ isdedicated:
'No' })
+
+                                                    },
+                                                  error:function(json){
+                                                       args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                                                  }
+                                              });
+                                             args.response.success({
+                                                actionFilter: zoneActionfilter,
+                                                data: selectedZoneObj
+                                            });
+
+                           }
                       });
                     }
                   },
@@ -8298,8 +8441,8 @@
 
                        });
                      },
-                    error:function(args){
-                      args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                    error:function(json){
+                      args.response.error(parseXMLHttpResponse(json));
                     }
                   });
 
@@ -9286,8 +9429,8 @@
 
                        });
                      },
-                    error:function(args){
-                      args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                    error:function(json){
+                      args.response.error(parseXMLHttpResponse(json));
                     }
                   });
 
@@ -10312,8 +10455,8 @@
 
                        });
                      },
-                    error:function(args){
-                      args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                    error:function(json){
+                      args.response.error(parseXMLHttpResponse(json));
                     }
                   });
 
@@ -12530,6 +12673,12 @@
   var zoneActionfilter = function(args) {
     var jsonObj = args.context.item;
     var allowedActions = ['enableSwift'];
+
+     if(jsonObj.domainid != null)
+      allowedActions.push("release");
+    else
+    allowedActions.push("dedicate");
+
     allowedActions.push("edit");
     if(jsonObj.allocationstate == "Disabled")
       allowedActions.push("enable");


Mime
View raw message