mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
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
79410f90bc
commit
aac1ac555d
@ -365,9 +365,26 @@
|
||||
});
|
||||
|
||||
var array2 = [];
|
||||
array2.push("&ispublic=" + (args.data.ispublic=="on"));
|
||||
array2.push("&isfeatured=" + (args.data.isfeatured=="on"));
|
||||
array2.push("&isextractable=" + (args.data.isextractable=="on"));
|
||||
|
||||
//array2.push("&ispublic=" + (args.data.ispublic=="on"));
|
||||
if(args.data.ispublic == "on")
|
||||
array2.push("&ispublic=true");
|
||||
else if(args.data.ispublic == "off")
|
||||
array2.push("&ispublic=false");
|
||||
//if args.data.ispublic is undefined, do not pass ispublic to API call.
|
||||
|
||||
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 +602,12 @@
|
||||
isextractable: {
|
||||
label: 'extractable',
|
||||
isBoolean: true,
|
||||
isEditable: true,
|
||||
isEditable: function() {
|
||||
if(isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
converter:cloudStack.converters.toBooleanText
|
||||
},
|
||||
passwordenabled: {
|
||||
@ -597,13 +619,28 @@
|
||||
ispublic: {
|
||||
label: 'label.public',
|
||||
isBoolean: true,
|
||||
isEditable: true,
|
||||
isEditable: function() {
|
||||
if(isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (g_userPublicTemplateEnabled == "true")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
},
|
||||
converter:cloudStack.converters.toBooleanText
|
||||
},
|
||||
isfeatured: {
|
||||
label: 'label.featured',
|
||||
isBoolean: true,
|
||||
isEditable: true,
|
||||
isEditable: function() {
|
||||
if(isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
converter:cloudStack.converters.toBooleanText
|
||||
},
|
||||
crossZones: {
|
||||
|
||||
@ -347,7 +347,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();
|
||||
}
|
||||
@ -703,7 +703,10 @@
|
||||
$value.html(_s(content));
|
||||
|
||||
// Set up editable metadata
|
||||
$value.data('detail-view-is-editable', value.isEditable);
|
||||
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…
x
Reference in New Issue
Block a user