You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/05/31 06:36:08 UTC
[18/25] git commit: updated refs/heads/master to 2f29185
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/1545b3f3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1545b3f3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1545b3f3
Branch: refs/heads/master
Commit: 1545b3f3ed7ba21a4d5c475418b130f521c7d1f0
Parents: e03e2aa
Author: Pranav Saxena <pr...@citrix.com>
Authored: Tue May 28 20:21:02 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Thu May 30 21:57:15 2013 +0530
----------------------------------------------------------------------
ui/scripts/system.js | 220 +++++++++++++++++++++++++++++++++++++++++----
1 files changed, 201 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1545b3f3/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 3b0cf86..02e13bd 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -9953,14 +9953,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: {
@@ -10709,6 +10735,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) {
@@ -10927,20 +11074,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
+ });
+
}
});
}
@@ -12991,6 +13167,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");