Revert "bug 13099: global settings page - when name is xennetworklabel/kvmnetworklabel/vmwarenetworklabel and value is null, show "Use default gateway" instead of null."

This reverts commit 0237dd43b222c10abb56b5d03eaa0189fd0953d4.
This commit is contained in:
Jessica Wang 2012-02-10 13:07:22 -08:00
parent 277cb5633e
commit 82ae83bc9a
1 changed files with 18 additions and 39 deletions

View File

@ -1,11 +1,4 @@
(function(cloudStack) {
var replaceNullValueWith = {
'xennetworklabel': 'Use default gateway',
'xennetworklabel': 'Use default gateway',
'xennetworklabel': 'Use default gateway'
};
cloudStack.sections['global-settings'] = {
title: 'Global Settings',
id: 'global-settings',
@ -15,29 +8,24 @@
edit: {
label: 'Change value',
action: function(args) {
var name = args.context["global-settings"].name;
var name = args.data.jsonObj.name;
var value = args.data.value;
if((name in replaceNullValueWith) && (value == replaceNullValueWith[name])) {
args.response.success({data: args.context["global-settings"]});
}
else {
$.ajax({
url: createURL(
'updateConfiguration&name=' + todb(name) + '&value=' + todb(value)
),
dataType: 'json',
async: true,
success: function(json) {
var item = json.updateconfigurationresponse.configuration;
cloudStack.dialog.notice({ message: 'Please restart your management server for your change to take effect.' });
args.response.success({data: item});
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
});
}
$.ajax({
url: createURL(
'updateConfiguration&name=' + name + '&value=' + value
),
dataType: 'json',
async: true,
success: function(json) {
var item = json.updateconfigurationresponse.configuration;
cloudStack.dialog.notice({ message: 'Please restart your management server for your change to take effect.' });
args.response.success({data: item});
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
});
}
}
},
@ -62,16 +50,7 @@
dataType: "json",
async: true,
success: function(json) {
var configurationObjs = json.listconfigurationsresponse.configuration;
var items = [];
$(configurationObjs).each(function(){
if((this.name in replaceNullValueWith) && (this.value == null)) {
this.value = replaceNullValueWith[this.name];
}
items.push(this);
});
var items = json.listconfigurationsresponse.configuration;
args.response.success({ data: items });
}
});