diff --git a/sahara_dashboard/content/data_processing/clusters/image_registry/views.py b/sahara_dashboard/content/data_processing/clusters/image_registry/views.py index 622406a..6431eb7 100644 --- a/sahara_dashboard/content/data_processing/clusters/image_registry/views.py +++ b/sahara_dashboard/content/data_processing/clusters/image_registry/views.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from collections import OrderedDict import json from django.core.urlresolvers import reverse_lazy @@ -37,8 +38,8 @@ def update_context_with_plugin_tags(request, context): plugins_object = dict() for plugin in plugins: - plugins_object[plugin.name] = dict() - for version in plugin.versions: + plugins_object[plugin.name] = OrderedDict() + for version in sorted(plugin.versions, reverse=True): try: details = saharaclient. \ plugin_get_version_details(request, diff --git a/sahara_dashboard/content/data_processing/clusters/wizard/forms.py b/sahara_dashboard/content/data_processing/clusters/wizard/forms.py index 292c090..59f77d2 100644 --- a/sahara_dashboard/content/data_processing/clusters/wizard/forms.py +++ b/sahara_dashboard/content/data_processing/clusters/wizard/forms.py @@ -60,10 +60,12 @@ class ChoosePluginForm(forms.SelfHandlingForm): for plugin in plugins: field_name = plugin.name + "_version" + version_choices = (sorted([(version, version) + for version in plugin.versions], reverse=True)) choice_field = forms.ChoiceField( label=_("Version"), required=False, - choices=[(version, version) for version in plugin.versions], + choices=version_choices, widget=forms.Select( attrs={"class": "switched", "data-switch-on": "plugin", diff --git a/sahara_dashboard/content/data_processing/utils/workflow_helpers.py b/sahara_dashboard/content/data_processing/utils/workflow_helpers.py index ce7b88c..2b16d82 100644 --- a/sahara_dashboard/content/data_processing/utils/workflow_helpers.py +++ b/sahara_dashboard/content/data_processing/utils/workflow_helpers.py @@ -261,11 +261,13 @@ class PluginAndVersionMixin(object): 'data-slug': 'pluginname'})) for plugin in plugins: + version_choices = (sorted( + [(version, version) + for version in get_enabled_versions(plugin)], reverse=True)) field_name = plugin.name + "_version" choice_field = forms.ChoiceField( label=_("Version"), - choices=[(version, version) - for version in get_enabled_versions(plugin)], + choices=version_choices, widget=forms.Select( attrs={"class": "plugin_version_choice switched " + field_name + "_choice",