mirror of https://github.com/apache/cloudstack.git
CS-14854: cloudstack 3.0 UI - (1) extend detailView widget to take in dynamic isEditable value. (2) template page - edit template action - for regular user and domain admin: make Extractable field and Featured field non-editable. Do NOT send “isfeatured”, “isextractable” to updateTemplatePermission API when they are non-editable.
This commit is contained in:
parent
b9263b0c51
commit
1656176971
|
|
@ -366,8 +366,19 @@
|
|||
|
||||
var array2 = [];
|
||||
array2.push("&ispublic=" + (args.data.ispublic=="on"));
|
||||
array2.push("&isfeatured=" + (args.data.isfeatured=="on"));
|
||||
array2.push("&isextractable=" + (args.data.isextractable=="on"));
|
||||
|
||||
if(args.data.isfeatured == "on")
|
||||
array2.push("&isfeatured=true");
|
||||
else if(args.data.isfeatured == "off")
|
||||
array2.push("&isfeatured=false");
|
||||
//if args.data.isfeatured is undefined, do not pass isfeatured to API call.
|
||||
|
||||
if(args.data.isextractable == "on")
|
||||
array2.push("&isextractable=true");
|
||||
else if(args.data.isextractable == "off")
|
||||
array2.push("&isextractable=false");
|
||||
//if args.data.isextractable is undefined, do not pass isextractable to API call.
|
||||
|
||||
$.ajax({
|
||||
url: createURL("updateTemplatePermissions&id=" + args.context.templates[0].id + "&zoneid=" + args.context.templates[0].zoneid + array2.join("")),
|
||||
dataType: "json",
|
||||
|
|
@ -585,7 +596,12 @@
|
|||
isextractable: {
|
||||
label: 'extractable',
|
||||
isBoolean: true,
|
||||
isEditable: true,
|
||||
isEditable: function() {
|
||||
if(isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
converter:cloudStack.converters.toBooleanText
|
||||
},
|
||||
passwordenabled: {
|
||||
|
|
@ -603,7 +619,12 @@
|
|||
isfeatured: {
|
||||
label: 'label.featured',
|
||||
isBoolean: true,
|
||||
isEditable: true,
|
||||
isEditable: function() {
|
||||
if(isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
converter:cloudStack.converters.toBooleanText
|
||||
},
|
||||
crossZones: {
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@
|
|||
var $input = $(this);
|
||||
|
||||
if ($input.is('[type=checkbox]')) {
|
||||
data[$input.attr('name')] = $input.is(':checked') ? 'on' : null;
|
||||
data[$input.attr('name')] = $input.is(':checked') ? 'on' : 'off';
|
||||
} else {
|
||||
data[$input.attr('name')] = $input.val();
|
||||
}
|
||||
|
|
@ -700,8 +700,11 @@
|
|||
$name.html(_l(value.label));
|
||||
$value.html(_s(content));
|
||||
|
||||
// Set up editable metadata
|
||||
$value.data('detail-view-is-editable', value.isEditable);
|
||||
// Set up editable metadata
|
||||
if(typeof(value.isEditable) == 'function')
|
||||
$value.data('detail-view-is-editable', value.isEditable());
|
||||
else //typeof(value.isEditable) == 'boolean' or 'undefined'
|
||||
$value.data('detail-view-is-editable', value.isEditable);
|
||||
if (value.select) {
|
||||
value.selected = $value.html();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue