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 d0a52dc
Date Tue, 28 May 2013 14:52:12 GMT
Updated Branches:
  refs/heads/UI-explicitDedication 8e5223390 -> d0a52dc1e


host and cluster action item API integration calls


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

Branch: refs/heads/UI-explicitDedication
Commit: d0a52dc1ec603620fd855b0db3737e41b825862a
Parents: 8e52233
Author: Pranav Saxena <pranav.saxena@citrix.com>
Authored: Tue May 28 20:21:02 2013 +0530
Committer: Pranav Saxena <pranav.saxena@citrix.com>
Committed: Tue May 28 20:21:02 2013 +0530

----------------------------------------------------------------------
 ui/scripts/system.js |  220 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 201 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0a52dc1/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 1f2bac6..5cc177b 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -9418,14 +9418,40 @@
 										success: function(json) {
 											var item = json.listclustersresponse.cluster[0];
 											addExtraPropertiesToClusterObject(item);
-											args.response.success({
-												actionFilter: clusterActionfilter,
-												data: item
-											});
-										}
-									});
-                }
-              },
+								             $.ajax({
+                                                                                url:createURL("listDedicatedClusters&clusterid="
+args.context.clusters[0].id),
+                                                                                dataType:"json",
+                                                                                async:false,
+                                                                                success:function(json){
+                                                                                  if(json.listdedicatedclustersresponse.dedicatedcluster
!= undefined){
+                                                                                  var clusterItem
= json.listdedicatedclustersresponse.dedicatedcluster[0];
+                                                                                  if (clusterItem.domainid
!= null) {
+                                                                                       $.extend(item,
clusterItem , { isdedicated: 'Yes' });
+                                                                                     }
+                                                                                   }
+                                                                                  else
+                                                                                     $.extend(item
,{ isdedicated: 'No' })
+
+                                                                                    },
+                                                                                  error:function(json){
+                                                                                     args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                                                                                      }
+                                                                                   });
+                                                                             args.response.success({
+                                                                                   actionFilter:
clusterActionfilter,
+                                                                                   data:
item
+                                                                                });
+
+                                                                           },
+
+                                                                            error:function(json){
+                                                                               args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+
+                                                                        }
+
+                 });
+              }
+          },
               nexusVswitch: {
                 title:'label.nexusVswitch',
                 listView: {
@@ -10174,6 +10200,127 @@
                 }
               },
 
+
+               dedicate:{
+                   label: 'Dedicate Host',
+                messages: {
+                  confirm: function(args) {
+                    return 'Do you really want to dedicate this host to a domain/account?
';
+                  },
+                  notification: function(args) {
+                    return 'Host Dedicated';
+                  }
+                },
+                createForm:{
+                   title:'Dedicate Host',
+                   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("dedicateHost&hostId=" + args.context.hosts[0].id
+ "&domainId=" +args.data.domainId + array2.join("") ),
+                    dataType: "json",
+                    success: function(json) {
+                       var jid = json.dedicatehostresponse.jobid;
+                            args.response.success({
+                               _custom:
+                           {      jobId: jid
+                             },
+                            notification: {
+                                 poll: pollAsyncJobResult
+                              },
+                            actionFilter:hostActionfilter
+
+
+                          });
+
+                   /*   args.response.success({
+                        actionFilter: podActionfilter,
+                        data:item
+                      });*/
+                    }
+                  });
+                }
+
+              },
+
+              
+               release:{
+                label:'Release Dedicated Host',
+                messages:{
+                   confirm: function(args) {
+                    return 'Do you want to release this dedicated host ?';
+                  },
+                  notification: function(args) {
+                    return 'Host dedication released';
+                  }
+                },
+               action:function(args){
+                  $.ajax({
+                     url:createURL("releaseDedicatedHost&hostid=" + args.context.hosts[0].id),
+                     dataType:"json",
+                     async:true,
+                     success:function(json){
+                       var jid = json.releasededicatedhostresponse.jobid;
+                       args.response.success({
+                             _custom:
+                           {      jobId: jid
+                             },
+                            notification: {
+                                 poll: pollAsyncJobResult
+                              },
+                            actionFilter:hostActionfilter
+
+                       });
+                     },
+                    error:function(args){
+                      args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                    }
+                  });
+
+               }
+              },
+
+
               enableMaintenanceMode: {
                 label: 'label.action.enable.maintenance.mode',
                 action: function(args) {
@@ -10392,20 +10539,49 @@
                     ipaddress: { label: 'label.ip.address' },
                     version: { label: 'label.version' },
                     disconnected: { label: 'label.last.disconnected' }
-                  }
+                  },
+
+                   {
+
+                   isdedicated:{label:'Dedicated'},
+                   domainid:{label:'Domain ID'}
+
+                   }
+
+
                 ],
 
                 dataProvider: function(args) {								  
-									$.ajax({
-										url: createURL("listHosts&id=" + args.context.hosts[0].id),
-										dataType: "json",
-										async: true,
-										success: function(json) {										  
-											var item = json.listhostsresponse.host[0];
-											args.response.success({
-												actionFilter: hostActionfilter,
-												data: item
-											});
+					        $.ajax({
+							url: createURL("listHosts&id=" + args.context.hosts[0].id),
+							dataType: "json",
+							async: true,
+							success: function(json) {										  
+								var item = json.listhostsresponse.host[0];
+                                                                $.ajax({
+                                                                  url:createURL("listDedicatedHosts&hostid="
+args.context.hosts[0].id),
+                                                                  dataType:"json",
+                                                                  async:false,
+                                                                  success:function(json){
+                                                                      if(json.listdedicatedhostsresponse.dedicatedhost
!= undefined){
+                                                                      var hostItem = json.listdedicatedhostsresponse.dedicatedhost[0];
+                                                                      if (hostItem.domainid
!= null) {
+                                                                             $.extend(item,
hostItem , { isdedicated: 'Yes' });
+                                                                            }
+                                                                         }
+                                                                           else
+                                                                             $.extend(item
,{ isdedicated: 'No' })
+
+                                                                          },
+                                                                            error:function(json){
+                                                                                  args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                                                                                 }
+                                                                             });
+                                                                                 args.response.success({
+                                                                                   actionFilter:
hostActionfilter,
+                                                                                   data:
item
+                                                                                 }); 
+
 										}
 									});											
                 }
@@ -12456,6 +12632,12 @@
     var jsonObj = args.context.item;
     var allowedActions = [];
 
+     if(jsonObj.domainid != null)
+      allowedActions.push("release");
+     else
+      allowedActions.push("dedicate");
+
+
     if (jsonObj.resourcestate == "Enabled") {
       allowedActions.push("edit");
       allowedActions.push("enableMaintenanceMode");


Mime
View raw message