コード例 #1
0
ファイル: create.py プロジェクト: 1oscar/horizon
    def __init__(self, request, *args, **kwargs):
        super(SelectPluginAction, self).__init__(request, *args, **kwargs)

        try:
            plugins = saharaclient.plugin_list(request)
        except Exception:
            plugins = []
            exceptions.handle(request,
                              _("Unable to fetch plugin list."))
        plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]

        self.fields["plugin_name"] = forms.ChoiceField(
            label=_("Plugin name"),
            choices=plugin_choices,
            widget=forms.Select(attrs={"class": "plugin_name_choice"}))

        for plugin in plugins:
            field_name = plugin.name + "_version"
            choice_field = forms.ChoiceField(
                label=_("Version"),
                choices=[(version, version) for version in plugin.versions],
                widget=forms.Select(
                    attrs={"class": "plugin_version_choice "
                                    + field_name + "_choice"})
            )
            self.fields[field_name] = choice_field
コード例 #2
0
ファイル: create.py プロジェクト: sorube13/horizon
    def __init__(self, request, *args, **kwargs):
        super(SelectPluginAction, self).__init__(request, *args, **kwargs)

        try:
            plugins = saharaclient.plugin_list(request)
        except Exception:
            plugins = []
            exceptions.handle(request,
                              _("Unable to fetch plugin list."))
        plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]

        self.fields["plugin_name"] = forms.ChoiceField(
            label=_("Plugin name"),
            choices=plugin_choices,
            widget=forms.Select(attrs={"class": "plugin_name_choice"}))

        for plugin in plugins:
            field_name = plugin.name + "_version"
            choice_field = forms.ChoiceField(
                label=_("Hadoop version"),
                choices=[(version, version) for version in plugin.versions],
                widget=forms.Select(
                    attrs={"class": "plugin_version_choice "
                                    + field_name + "_choice"})
            )
            self.fields[field_name] = choice_field
コード例 #3
0
 def get_data(self):
     try:
         plugins = saharaclient.plugin_list(self.request)
     except Exception:
         plugins = []
         msg = _('Unable to retrieve data processing plugins.')
         exceptions.handle(self.request, msg)
     return plugins
コード例 #4
0
ファイル: views.py プロジェクト: dlq84/horizon
def update_context_with_plugin_tags(request, context):
    try:
        plugins = saharaclient.plugin_list(request)
    except Exception:
        plugins = []
        msg = _("Unable to process plugin tags")
        exceptions.handle(request, msg)

    plugins_object = dict()
    for plugin in plugins:
        plugins_object[plugin.name] = dict()
        for version in plugin.versions:
            try:
                details = saharaclient.plugin_get_version_details(request, plugin.name, version)
                plugins_object[plugin.name][version] = details.required_image_tags
            except Exception:
                msg = _("Unable to process plugin tags")
                exceptions.handle(request, msg)

    context["plugins"] = plugins_object
コード例 #5
0
ファイル: views.py プロジェクト: yianjiajia/openstack_horizon
def update_context_with_plugin_tags(request, context):
    try:
        plugins = saharaclient.plugin_list(request)
    except Exception:
        plugins = []
        msg = _("Unable to process plugin tags")
        exceptions.handle(request, msg)

    plugins_object = dict()
    for plugin in plugins:
        plugins_object[plugin.name] = dict()
        for version in plugin.versions:
            try:
                details = saharaclient. \
                    plugin_get_version_details(request,
                                               plugin.name,
                                               version)
                plugins_object[plugin.name][version] = (
                    details.required_image_tags)
            except Exception:
                msg = _("Unable to process plugin tags")
                exceptions.handle(request, msg)

    context["plugins"] = plugins_object