|
1336 | 1336 | name: args.data.name, |
1337 | 1337 | displaytext: args.data.displaytext, |
1338 | 1338 | ostypeid: args.data.ostypeid, |
| 1339 | + templatetype: args.data.templatetype, |
1339 | 1340 | passwordenabled: (args.data.passwordenabled == "on"), |
1340 | 1341 | isdynamicallyscalable: (args.data.isdynamicallyscalable == "on") |
1341 | 1342 | }; |
| 1343 | + if (args.data.isrouting != null) { |
| 1344 | + $.extend(data, { |
| 1345 | + isrouting: (args.data.isrouting === 'on') |
| 1346 | + }); |
| 1347 | + } |
1342 | 1348 | $.ajax({ |
1343 | 1349 | url: createURL('updateTemplate'), |
1344 | 1350 | data: data, |
|
1835 | 1841 | if (isAdmin()) { |
1836 | 1842 | hiddenFields = []; |
1837 | 1843 | } else { |
1838 | | - hiddenFields = ["hypervisor", 'xenserverToolsVersion61plus']; |
| 1844 | + hiddenFields = ["hypervisor", 'xenserverToolsVersion61plus', 'isrouting']; |
1839 | 1845 | } |
1840 | 1846 |
|
1841 | 1847 | if ('templates' in args.context && args.context.templates[0].hypervisor != 'XenServer') { |
|
1867 | 1873 | } |
1868 | 1874 | } |
1869 | 1875 |
|
| 1876 | + if (!('templates' in args.context && args.context.templates[0].domainid == g_domainid && args.context.templates[0].account == g_account) && !isAdmin()) { |
| 1877 | + hiddenFields.push('url'); |
| 1878 | + } |
1870 | 1879 | return hiddenFields; |
1871 | 1880 | }, |
1872 | 1881 |
|
|
1980 | 1989 | } |
1981 | 1990 | }, |
1982 | 1991 |
|
| 1992 | + isrouting: { |
| 1993 | + label: 'label.routing', |
| 1994 | + isBoolean: true, |
| 1995 | + isEditable: function() { |
| 1996 | + if (isAdmin()) { |
| 1997 | + return true; |
| 1998 | + } else { |
| 1999 | + return false; |
| 2000 | + } |
| 2001 | + }, |
| 2002 | + converter: cloudStack.converters.toBooleanText |
| 2003 | + }, |
| 2004 | + |
1983 | 2005 | crossZones: { |
1984 | 2006 | label: 'label.cross.zones', |
1985 | 2007 | converter: cloudStack.converters.toBooleanText |
|
2002 | 2024 | label: 'label.created', |
2003 | 2025 | converter: cloudStack.converters.toLocalDate |
2004 | 2026 | }, |
| 2027 | + url: { |
| 2028 | + label: 'label.url' |
| 2029 | + }, |
2005 | 2030 |
|
2006 | 2031 | templatetype: { |
2007 | | - label: 'label.type' |
| 2032 | + label: 'label.type', |
| 2033 | + isEditable: function() { |
| 2034 | + if (isAdmin()) { |
| 2035 | + return true; |
| 2036 | + } else { |
| 2037 | + return false; |
| 2038 | + } |
| 2039 | + }, |
| 2040 | + select: function(args) { |
| 2041 | + var items = []; |
| 2042 | + items.push({ |
| 2043 | + id: 'ROUTING', |
| 2044 | + description: 'ROUTING' |
| 2045 | + }); |
| 2046 | + items.push({ |
| 2047 | + id: 'SYSTEM', |
| 2048 | + description: 'SYSTEM' |
| 2049 | + }); |
| 2050 | + items.push({ |
| 2051 | + id: 'BUILTIN', |
| 2052 | + description: 'BUILTIN' |
| 2053 | + }); |
| 2054 | + items.push({ |
| 2055 | + id: 'PERHOST', |
| 2056 | + description: 'PERHOST' |
| 2057 | + }); |
| 2058 | + items.push({ |
| 2059 | + id: 'USER', |
| 2060 | + description: 'USER' |
| 2061 | + }); |
| 2062 | + args.response.success({ |
| 2063 | + data: items |
| 2064 | + }); |
| 2065 | + } |
2008 | 2066 | }, |
2009 | 2067 |
|
2010 | 2068 | id: { |
|
2034 | 2092 | else |
2035 | 2093 | jsonObj.xenserverToolsVersion61plus = false; |
2036 | 2094 | } |
| 2095 | + if (jsonObj.templatetype == 'ROUTING') { |
| 2096 | + jsonObj.isrouting = true; |
| 2097 | + } else { |
| 2098 | + jsonObj.isrouting = false; |
| 2099 | + } |
2037 | 2100 |
|
2038 | 2101 | args.response.success({ |
2039 | 2102 | actionFilter: templateActionfilter, |
|
3175 | 3238 | //zoneid: args.context.isos[0].zoneid, //can't update template/ISO in only one zone. It always get updated in all zones. |
3176 | 3239 | name: args.data.name, |
3177 | 3240 | displaytext: args.data.displaytext, |
| 3241 | + bootable: (args.data.bootable == "on"), |
3178 | 3242 | ostypeid: args.data.ostypeid |
3179 | 3243 | }; |
3180 | 3244 | $.ajax({ |
|
3662 | 3726 | }, |
3663 | 3727 | bootable: { |
3664 | 3728 | label: 'label.bootable', |
| 3729 | + isBoolean: true, |
| 3730 | + isEditable: true, |
3665 | 3731 | converter: cloudStack.converters.toBooleanText |
3666 | 3732 | }, |
3667 | 3733 | ispublic: { |
|
3722 | 3788 | created: { |
3723 | 3789 | label: 'label.created', |
3724 | 3790 | converter: cloudStack.converters.toLocalDate |
| 3791 | + }, |
| 3792 | + url: { |
| 3793 | + label: 'label.url' |
3725 | 3794 | } |
3726 | 3795 | }], |
3727 | 3796 |
|
|
4057 | 4126 |
|
4058 | 4127 | // "Edit Template", "Copy Template", "Create VM" |
4059 | 4128 | if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project |
4060 | | - || jsonObj.templatetype == "SYSTEM" || jsonObj.isready == false) { |
| 4129 | + || jsonObj.isready == false) { |
4061 | 4130 | //do nothing |
4062 | 4131 | } else { |
4063 | 4132 | allowedActions.push("edit"); |
|
4067 | 4136 |
|
4068 | 4137 | // "Download Template" , "Update Template Permissions" |
4069 | 4138 | if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project |
4070 | | - || (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") { |
| 4139 | + || (jsonObj.isready == false)) { |
4071 | 4140 | //do nothing |
4072 | 4141 | } else { |
4073 | 4142 | if (jsonObj.isextractable){ |
|
0 commit comments