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/04/05 23:03:21 UTC
[26/50] [abbrv] git commit: updated refs/heads/affinity_groups to
ca1a794
GSLB UI: Fix section select for regions->GSLB, to fix broken 'view all' button
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/21f953ff
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/21f953ff
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/21f953ff
Branch: refs/heads/affinity_groups
Commit: 21f953ffa4139f6f522c2b8f00572c5251046aa6
Parents: 8d21b4f
Author: Brian Federle <br...@citrix.com>
Authored: Wed Apr 3 11:34:32 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Apr 3 11:34:32 2013 -0700
----------------------------------------------------------------------
ui/scripts/regions.js | 397 ++++++++++++++++++++++----------------------
1 files changed, 199 insertions(+), 198 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/21f953ff/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
index 7da4007..0aaece0 100644
--- a/ui/scripts/regions.js
+++ b/ui/scripts/regions.js
@@ -18,6 +18,10 @@
cloudStack.sections.regions = {
title: 'label.menu.regions',
id: 'regions',
+ sectionSelect: {
+ label: 'label.select-view',
+ preFilter: function() { return ['regions']; }
+ },
regionSelector: {
dataProvider: function(args) {
$.ajax({
@@ -31,215 +35,212 @@
]
});
}
- });
+ });
}
- },
- sections: {
+ },
+ sections: {
regions: {
- listView: {
- section: 'regions',
- id: 'regions',
+ id: 'regions',
+ type: 'select',
+ title: 'label.menu.regions',
+ listView: {
+ section: 'regions',
+ id: 'regions',
label: 'label.menu.regions',
- fields: {
- name: { label: 'label.name' },
- id: { label: 'ID' },
- endpoint: { label: 'label.endpoint' }
- },
- actions: {
- add: {
- label: 'label.add.region',
- messages: {
- notification: function() { return 'label.add.region'; }
- },
- createForm: {
- title: 'label.add.region',
- desc: 'message.add.region',
- fields: {
- id: { label: 'label.id', validation: { required: true } },
- name: { label: 'label.name', validation: { required: true } },
- endpoint: { label: 'label.endpoint', validation: { required: true } }
- }
- },
- action: function(args) {
- var data = {
- id: args.data.id,
- name: args.data.name,
- endpoint: args.data.endpoint
- };
-
- $.ajax({
- url: createURL('addRegion'),
- data: data,
- success: function(json) {
- var item = json.addregionresponse.region;
- args.response.success({data: item});
- $(window).trigger('cloudStack.refreshRegions');
- },
- error: function(json) {
- args.response.error(parseXMLHttpResponse(json));
- }
- });
- },
- notification: {
- poll: function(args) {
- args.complete();
- }
- }
- }
- },
- dataProvider: function(args) {
- $.ajax({
- url: createURL('listRegions&listAll=true'),
- success: function(json) {
- var regions = json.listregionsresponse.region
+ fields: {
+ name: { label: 'label.name' },
+ id: { label: 'ID' },
+ endpoint: { label: 'label.endpoint' }
+ },
+ actions: {
+ add: {
+ label: 'label.add.region',
+ messages: {
+ notification: function() { return 'label.add.region'; }
+ },
+ createForm: {
+ title: 'label.add.region',
+ desc: 'message.add.region',
+ fields: {
+ id: { label: 'label.id', validation: { required: true } },
+ name: { label: 'label.name', validation: { required: true } },
+ endpoint: { label: 'label.endpoint', validation: { required: true } }
+ }
+ },
+ action: function(args) {
+ var data = {
+ id: args.data.id,
+ name: args.data.name,
+ endpoint: args.data.endpoint
+ };
+
+ $.ajax({
+ url: createURL('addRegion'),
+ data: data,
+ success: function(json) {
+ var item = json.addregionresponse.region;
+ args.response.success({data: item});
+ $(window).trigger('cloudStack.refreshRegions');
+ },
+ error: function(json) {
+ args.response.error(parseXMLHttpResponse(json));
+ }
+ });
+ },
+ notification: {
+ poll: function(args) {
+ args.complete();
+ }
+ }
+ }
+ },
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL('listRegions&listAll=true'),
+ success: function(json) {
+ var regions = json.listregionsresponse.region
+
+ args.response.success({
+ data: regions ? regions : []
+ });
+ },
+ error: function(json) {
+ args.response.error(parseXMLHttpResponse(json));
+ }
+ });
+ },
+ detailView: {
+ name: 'Region details',
+ viewAll: { path: 'regions.GSLB', label: 'GSLB' },
+ actions: {
+ edit: {
+ label: 'label.edit.region',
+ action: function(args) {
+ var data = {
+ id: args.context.regions[0].id,
+ name: args.data.name,
+ endpoint: args.data.endpoint
+ };
+
+ $.ajax({
+ url: createURL('updateRegion'),
+ data: data,
+ success: function(json) {
+ args.response.success();
+ $(window).trigger('cloudStack.refreshRegions');
+ },
+ error: function(json) {
+ args.response.error(parseXMLHttpResponse(json));
+ }
+ });
+ }
+ },
+ remove: {
+ label: 'label.remove.region',
+ messages: {
+ notification: function() { return 'label.remove.region'; },
+ confirm: function() { return 'message.remove.region'; }
+ },
+ preAction: function(args) {
+ var region = args.context.regions[0];
- args.response.success({
- data: regions ? regions : []
- });
- },
- error: function(json) {
- args.response.error(parseXMLHttpResponse(json));
- }
- });
- },
- detailView: {
- name: 'Region details',
- //viewAll: { path: 'regions.GSLB', label: 'GSLB' },
- actions: {
- edit: {
- label: 'label.edit.region',
- action: function(args) {
- var data = {
- id: args.context.regions[0].id,
- name: args.data.name,
- endpoint: args.data.endpoint
- };
-
- $.ajax({
- url: createURL('updateRegion'),
- data: data,
- success: function(json) {
- args.response.success();
- $(window).trigger('cloudStack.refreshRegions');
- },
- error: function(json) {
- args.response.error(parseXMLHttpResponse(json));
- }
- });
- }
- },
- remove: {
- label: 'label.remove.region',
- messages: {
- notification: function() { return 'label.remove.region'; },
- confirm: function() { return 'message.remove.region'; }
- },
- preAction: function(args) {
- var region = args.context.regions[0];
-
- /* e.g.
- region.endpoint == "http://localhost:8080/client/"
- document.location.href == "http://localhost:8080/client/#"
- */
- /*
- if(document.location.href.indexOf(region.endpoint) != -1) {
- cloudStack.dialog.notice({ message: _l('You can not remove the region that you are currently in.') });
- return false;
- }
- */
- return true;
- },
- action: function(args) {
- var region = args.context.regions[0];
+ /* e.g.
+ region.endpoint == "http://localhost:8080/client/"
+ document.location.href == "http://localhost:8080/client/#"
+ */
+ /*
+ if(document.location.href.indexOf(region.endpoint) != -1) {
+ cloudStack.dialog.notice({ message: _l('You can not remove the region that you are currently in.') });
+ return false;
+ }
+ */
+ return true;
+ },
+ action: function(args) {
+ var region = args.context.regions[0];
- $.ajax({
- url: createURL('removeRegion'),
- data: { id: region.id },
- success: function(json) {
- args.response.success();
- $(window).trigger('cloudStack.refreshRegions');
- },
- error: function(json) {
- args.response.error(parseXMLHttpResponse(json));
- }
- });
- }
- }
- },
- tabs: {
- details: {
- title: 'label.details',
- fields: [
- {
- id: { label: 'label.id' }
- },
- {
- name: { label: 'label.name', isEditable: true },
- endpoint: { label: 'label.endpoint', isEditable: true }
- }
- ],
- dataProvider: function(args) {
- $.ajax({
- url: createURL('listRegions&listAll=true'),
- data: { id: args.context.regions[0].id },
- success: function(json) {
- var region = json.listregionsresponse.region
+ $.ajax({
+ url: createURL('removeRegion'),
+ data: { id: region.id },
+ success: function(json) {
+ args.response.success();
+ $(window).trigger('cloudStack.refreshRegions');
+ },
+ error: function(json) {
+ args.response.error(parseXMLHttpResponse(json));
+ }
+ });
+ }
+ }
+ },
+ tabs: {
+ details: {
+ title: 'label.details',
+ fields: [
+ {
+ id: { label: 'label.id' }
+ },
+ {
+ name: { label: 'label.name', isEditable: true },
+ endpoint: { label: 'label.endpoint', isEditable: true }
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL('listRegions&listAll=true'),
+ data: { id: args.context.regions[0].id },
+ success: function(json) {
+ var region = json.listregionsresponse.region
- args.response.success({
- data: region ? region[0] : {}
- });
- },
- error: function(json) {
- args.response.error(parseXMLHttpResponse(json));
- }
- });
- }
- }
- }
- }
- }
- }
-
-
- /*
- ,
- GSLB: {
+ args.response.success({
+ data: region ? region[0] : {}
+ });
+ },
+ error: function(json) {
+ args.response.error(parseXMLHttpResponse(json));
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ },
+ GSLB: {
+ id: 'GSLB',
type: 'select',
title: 'GSLB',
listView: {
id: 'GSLB',
label: 'GSLB',
fields: {
- name: { label: 'label.name' }
- },
- dataProvider: function(args) {
- if('regions' in args.context) {
- var data = {
- regionid: args.context.regions[0].id
- };
- $.ajax({
- url: createURL('listGlobalLoadBalancerRules'),
- data: data,
- success: function(json) {
- debugger;
- var items = json.listgloballoadbalancerrulesresponse.globalloadbalancerrule;
- args.response.success({
- data: items
- });
- }
- });
- }
- else {
- args.response.success({
- data: null
- });
- }
- }
- }
- }
- */
-
-
- }
+ name: { label: 'label.name' }
+ },
+ dataProvider: function(args) {
+ if('regions' in args.context) {
+ var data = {
+ regionid: args.context.regions[0].id
+ };
+ $.ajax({
+ url: createURL('listGlobalLoadBalancerRules'),
+ data: data,
+ success: function(json) {
+ debugger;
+ var items = json.listgloballoadbalancerrulesresponse.globalloadbalancerrule;
+ args.response.success({
+ data: items
+ });
+ }
+ });
+ }
+ else {
+ args.response.success({
+ data: null
+ });
+ }
+ }
+ }
+ }
+ }
};
})(cloudStack);