CLOUDSTACK-8075: UI > Instances menu > Add Instance > Select template/ISO > add a new tab "shared" which will list shared templates/ISOs when being clicked.

This commit is contained in:
Jessica Wang 2014-12-16 16:15:34 -08:00
parent 5f9e0fcd7e
commit 1a8c85a7a8

View File

@ -16,7 +16,7 @@
// under the License. // under the License.
(function($, cloudStack) { (function($, cloudStack) {
var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, serviceOfferingObjs, community, networkObjs; var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, sharedTemplateObjs, featuredIsoObjs, communityIsoObjs, myIsoObjs, sharedIsoObjs, serviceOfferingObjs, community, networkObjs;
var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj; var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj;
var selectedTemplateOrIso; //'select-template', 'select-iso' var selectedTemplateOrIso; //'select-template', 'select-iso'
var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone) var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone)
@ -184,7 +184,22 @@
}); });
} }
} }
}); });
$.ajax({
url: createURL("listTemplates&templatefilter=sharedexecutable&zoneid=" + args.currentData.zoneid),
dataType: "json",
async: false,
success: function(json) {
if (json.listtemplatesresponse.template == null) {
sharedTemplateObjs = null;
} else {
sharedTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true;
});
}
}
});
} else if (selectedTemplateOrIso == 'select-iso') { } else if (selectedTemplateOrIso == 'select-iso') {
$.ajax({ $.ajax({
url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"), url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"),
@ -222,6 +237,18 @@
} }
} }
}); });
$.ajax({
url: createURL("listIsos&isofilter=sharedexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"),
dataType: "json",
async: false,
success: function(json) {
if (json.listisosresponse.iso == null) {
sharedIsoObjs = null;
} else {
sharedIsoObjs = json.listisosresponse.iso;
}
}
});
} }
//***** get templates/ISOs (end) ***** //***** get templates/ISOs (end) *****
@ -232,14 +259,14 @@
featuredtemplates: featuredTemplateObjs, featuredtemplates: featuredTemplateObjs,
communitytemplates: communityTemplateObjs, communitytemplates: communityTemplateObjs,
mytemplates: myTemplateObjs, mytemplates: myTemplateObjs,
sharedtemplates: [] // ** Needs implementation ** sharedtemplates: sharedTemplateObjs
}; };
} else if (selectedTemplateOrIso == 'select-iso') { } else if (selectedTemplateOrIso == 'select-iso') {
templatesObj = { templatesObj = {
featuredisos: featuredIsoObjs, featuredisos: featuredIsoObjs,
communityisos: communityIsoObjs, communityisos: communityIsoObjs,
myisos: myIsoObjs, myisos: myIsoObjs,
sharedisos: [] // ** Needs implementation ** sharedisos: sharedIsoObjs
}; };
} }
args.response.success({ args.response.success({