|
1025 | 1025 | }), |
1026 | 1026 |
|
1027 | 1027 |
|
1028 | | - dataProvider: function(args) { |
1029 | | - var jsonObj = args.context.templates[0]; |
1030 | | - var apiCmd = "listTemplates&templatefilter=self&id=" + jsonObj.id; |
1031 | | - if (jsonObj.zoneid != null) |
1032 | | - apiCmd = apiCmd + "&zoneid=" + jsonObj.zoneid; |
1033 | | - |
| 1028 | + dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab |
1034 | 1029 | $.ajax({ |
1035 | | - url: createURL(apiCmd), |
1036 | | - dataType: "json", |
| 1030 | + url: createURL("listTemplates"), |
| 1031 | + data: { |
| 1032 | + templatefilter: "self", |
| 1033 | + id: args.context.templates[0].id |
| 1034 | + }, |
1037 | 1035 | success: function(json) { |
1038 | 1036 | var jsonObj = json.listtemplatesresponse.template[0]; |
1039 | | - |
| 1037 | + |
1040 | 1038 | if ('details' in jsonObj && 'hypervisortoolsversion' in jsonObj.details) { |
1041 | 1039 | if (jsonObj.details.hypervisortoolsversion == 'xenserver61') |
1042 | 1040 | jsonObj.xenserverToolsVersion61plus = true; |
1043 | 1041 | else |
1044 | 1042 | jsonObj.xenserverToolsVersion61plus = false; |
1045 | 1043 | } |
1046 | | - |
| 1044 | + |
1047 | 1045 | args.response.success({ |
1048 | 1046 | actionFilter: templateActionfilter, |
1049 | 1047 | data: jsonObj |
|
1072 | 1070 | hideSearchBar: true, |
1073 | 1071 |
|
1074 | 1072 |
|
1075 | | - dataProvider: function(args) { |
1076 | | - var jsonObj = args.context.templates[0]; |
1077 | | - var apiCmd = "listTemplates&templatefilter=self&id=" + jsonObj.id; |
1078 | | - |
1079 | | - $.ajax({ |
1080 | | - url: createURL(apiCmd), |
1081 | | - dataType: "json", |
1082 | | - success: function(json) { |
1083 | | - var templates = json.listtemplatesresponse.template; |
1084 | | - var zones = []; |
1085 | | - zones = templates; |
1086 | | - |
1087 | | - args.response.success({ |
1088 | | - actionFilter: templateActionfilter, |
1089 | | - data: zones |
1090 | | - }); |
1091 | | - } |
1092 | | - }); |
| 1073 | + dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab > Zones tab (listing) |
| 1074 | + $.ajax({ |
| 1075 | + url: createURL("listTemplates"), |
| 1076 | + data: { |
| 1077 | + templatefilter: "self", |
| 1078 | + id: args.context.templates[0].id |
| 1079 | + }, |
| 1080 | + success: function(json) { |
| 1081 | + var jsonObjs = json.listtemplatesresponse.template; |
| 1082 | + |
| 1083 | + if (jsonObjs != undefined) { |
| 1084 | + for (var i = 0; i < jsonObjs.length; i++) { |
| 1085 | + var jsonObj = jsonObjs[i]; |
| 1086 | + if ('details' in jsonObj && 'hypervisortoolsversion' in jsonObj.details) { |
| 1087 | + if (jsonObj.details.hypervisortoolsversion == 'xenserver61') |
| 1088 | + jsonObj.xenserverToolsVersion61plus = true; |
| 1089 | + else |
| 1090 | + jsonObj.xenserverToolsVersion61plus = false; |
| 1091 | + } |
| 1092 | + } |
| 1093 | + } |
| 1094 | + |
| 1095 | + args.response.success({ |
| 1096 | + actionFilter: templateActionfilter, |
| 1097 | + data: jsonObjs |
| 1098 | + }); |
| 1099 | + } |
| 1100 | + }); |
1093 | 1101 | }, |
1094 | 1102 |
|
1095 | 1103 | detailView: { |
|
1410 | 1418 | }), |
1411 | 1419 |
|
1412 | 1420 |
|
1413 | | - dataProvider: function(args) { |
1414 | | - var jsonObj = args.context.templates[0]; |
1415 | | - var apiCmd = "listTemplates&templatefilter=self&id=" + jsonObj.id; |
1416 | | - if (jsonObj.zoneid != null) |
1417 | | - apiCmd = apiCmd + "&zoneid=" + jsonObj.zoneid; |
1418 | | - |
1419 | | - $.ajax({ |
1420 | | - url: createURL(apiCmd), |
1421 | | - dataType: "json", |
1422 | | - success: function(json) { |
1423 | | - var jsonObj = json.listtemplatesresponse.template[0]; |
| 1421 | + dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab > Zones tab (listing) > select a zone from listing > Details tab |
| 1422 | + var jsonObj = args.context.zones[0]; |
1424 | 1423 |
|
1425 | | - if ('details' in jsonObj && 'hypervisortoolsversion' in jsonObj.details) { |
1426 | | - if (jsonObj.details.hypervisortoolsversion == 'xenserver61') |
1427 | | - jsonObj.xenserverToolsVersion61plus = true; |
1428 | | - else |
1429 | | - jsonObj.xenserverToolsVersion61plus = false; |
1430 | | - } |
| 1424 | + if ('details' in jsonObj && 'hypervisortoolsversion' in jsonObj.details) { |
| 1425 | + if (jsonObj.details.hypervisortoolsversion == 'xenserver61') |
| 1426 | + jsonObj.xenserverToolsVersion61plus = true; |
| 1427 | + else |
| 1428 | + jsonObj.xenserverToolsVersion61plus = false; |
| 1429 | + } |
1431 | 1430 |
|
1432 | | - args.response.success({ |
1433 | | - actionFilter: templateActionfilter, |
1434 | | - data: jsonObj |
1435 | | - }); |
1436 | | - } |
1437 | | - }); |
| 1431 | + args.response.success({ |
| 1432 | + actionFilter: templateActionfilter, |
| 1433 | + data: jsonObj |
| 1434 | + }); |
1438 | 1435 | } |
1439 | 1436 | } |
1440 | 1437 | }} |
|
0 commit comments