Merge "When selecting a image for cluster, many invalid images are shown. If a project has a lot of images, options can be quite long, and cause wrong selctiong by mistake. So I add a filter after fetching images, now images that has "os_distro" property and it's value is one of "fedora-atomic", "coreos" and "ubuntu" are shown"
This commit is contained in:
commit
66f4552307
@ -33,6 +33,7 @@
|
||||
'horizon.dashboard.container-infra.cluster-templates.details'
|
||||
])
|
||||
.constant('horizon.dashboard.container-infra.cluster-templates.events', events())
|
||||
.constant('horizon.dashboard.container-infra.cluster-templates.distros', distros())
|
||||
.constant(
|
||||
'horizon.dashboard.container-infra.cluster-templates.resourceType',
|
||||
'OS::Magnum::ClusterTemplate')
|
||||
@ -52,6 +53,16 @@
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc constant
|
||||
* @name distros
|
||||
* @return [distros] available image distros
|
||||
* @description A list available image distros for magnum
|
||||
*/
|
||||
function distros() {
|
||||
return ["fedora-atomic", "coreos", "ubuntu"];
|
||||
}
|
||||
|
||||
run.$inject = [
|
||||
'horizon.framework.conf.resource-type-registry.service',
|
||||
'horizon.dashboard.container-infra.cluster-templates.service',
|
||||
|
@ -30,10 +30,20 @@
|
||||
'horizon.framework.util.i18n.gettext',
|
||||
'horizon.app.core.openstack-service-api.magnum',
|
||||
'horizon.app.core.openstack-service-api.nova',
|
||||
'horizon.app.core.openstack-service-api.glance'
|
||||
'horizon.app.core.openstack-service-api.glance',
|
||||
'horizon.dashboard.container-infra.cluster-templates.distros'
|
||||
];
|
||||
|
||||
function ClusterTemplateWorkflow($q, basePath, workflowService, gettext, magnum, nova, glance) {
|
||||
function ClusterTemplateWorkflow(
|
||||
$q,
|
||||
basePath,
|
||||
workflowService,
|
||||
gettext,
|
||||
magnum,
|
||||
nova,
|
||||
glance,
|
||||
distros
|
||||
) {
|
||||
var workflow = {
|
||||
init: init,
|
||||
update: update
|
||||
@ -512,7 +522,10 @@
|
||||
function onGetImages(response) {
|
||||
images = [{value:"", name: gettext("Choose an Image")}];
|
||||
angular.forEach(response.data.items, function(item) {
|
||||
images.push({value: item.name, name: item.name});
|
||||
if (!angular.isUndefined(item.properties) &&
|
||||
distros.indexOf(item.properties.os_distro) >= 0) {
|
||||
images.push({value: item.name, name: item.name});
|
||||
}
|
||||
});
|
||||
form[0].tabs[1].items[0].items[0].items[0].titleMap = images;
|
||||
var deferred = $q.defer();
|
||||
|
Loading…
Reference in New Issue
Block a user