CLOUDSTACK-1910: cloudstack UI - Regions menu - GSLB - load balancer rules - implement "Assign load balancer rule to GSLB" action.

This commit is contained in:
Jessica Wang 2013-04-16 16:26:20 -07:00
parent 32ccb8a5c9
commit 4b636a10aa

View File

@ -452,15 +452,14 @@
} }
}, },
//???
lbUnderGSLB: { lbUnderGSLB: {
id: 'lbUnderGSLB', id: 'lbUnderGSLB',
type: 'select', type: 'select',
title: 'load balancer rules assigned to this GSLB', title: 'assigned load balancer rules',
listView: { listView: {
section: 'lbUnderGSLB', section: 'lbUnderGSLB',
id: 'lbUnderGSLB', id: 'lbUnderGSLB',
label: 'load balancer rules assigned to this GSLB', label: 'assigned load balancer rules',
fields: { fields: {
name: { label: 'label.name' }, name: { label: 'label.name' },
publicport: { label: 'label.public.port' }, publicport: { label: 'label.public.port' },
@ -483,6 +482,70 @@
} }
}); });
}, },
actions: {
add: {
label: 'assign load balancer rule to GSLB',
messages: {
confirm: function(args) {
return 'Please confirm you want to assign load balancer rule to GSLB';
},
notification: function(args) {
return 'assign load balancer rule to GSLB';
}
},
createForm: {
title: 'assign load balancer rule to GSLB',
fields: {
loadbalancerrule: {
label: 'load balancer rule',
select: function(args) {
var data = {
globalloadbalancerruleid: args.context.GSLB[0].id,
listAll: true
};
$.ajax({
url: createURL('listLoadBalancerRules'),
data: data,
success: function(json) {
var items = json.listloadbalancerrulesresponse.loadbalancerrule;
args.response.success({
data: items,
descriptionField: 'name'
});
}
});
}
}
}
},
action: function(args) {
var data = {
id: args.context.GSLB[0].id,
loadbalancerrulelist: args.data.loadbalancerrule
};
$.ajax({
url: createURL('assignToGlobalLoadBalancerRule'),
data: data,
success: function(json) {
var jid = json.assigntogloballoadbalancerruleresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
}
}
}
);
}
});
},
notification: {
poll: pollAsyncJobResult
}
}
},
detailView: { detailView: {
name: 'load balancer rule details', name: 'load balancer rule details',
actions: { actions: {
@ -529,11 +592,11 @@
privateport: { label: 'label.private.port' }, privateport: { label: 'label.private.port' },
algorithm: { label: 'label.algorithm' }, algorithm: { label: 'label.algorithm' },
publicip: { label: 'label.public.ip' }, publicip: { label: 'label.public.ip' },
state: { label: 'label.state' },
id: { label: 'label.id' }, id: { label: 'label.id' },
cidrlist: { label: 'label.cidr' }, cidrlist: { label: 'label.cidr' },
domain: { label: 'label.domain' }, domain: { label: 'label.domain' },
account: { label: 'label.account' }, account: { label: 'label.account' }
state: { label: 'label.state' }
} }
], ],
dataProvider: function(args) { dataProvider: function(args) {
@ -555,7 +618,6 @@
} }
} }
} }
//???
} }
}; };