예제 #1
0
    def get_data(self):
        filters = self.get_filters()

        prev_marker = self.request.GET.get(
            ProfilesTable._meta.prev_pagination_param, None)

        if prev_marker is not None:
            marker = prev_marker
        else:
            marker = self.request.GET.get(
                ProfilesTable._meta.pagination_param, None)
        reversed_order = prev_marker is not None
        try:
            profiles, self._more, self._prev = senlin.profile_list(
                self.request,
                marker=marker,
                paginate=True,
                reversed_order=reversed_order,
                filters=filters)
        except Exception:
            self._prev = self._more = False
            profiles = []
            msg = _('Unable to retrieve profiles.')
            exceptions.handle(self.request, msg)
        return profiles
예제 #2
0
    def get_data(self):
        filters = self.get_filters()

        prev_marker = self.request.GET.get(
            ProfilesTable._meta.prev_pagination_param, None)

        if prev_marker is not None:
            marker = prev_marker
        else:
            marker = self.request.GET.get(
                ProfilesTable._meta.pagination_param, None)
        reversed_order = prev_marker is not None
        try:
            profiles, self._more, self._prev = senlin.profile_list(
                self.request,
                marker=marker,
                paginate=True,
                reversed_order=reversed_order,
                filters=filters)
        except Exception:
            self._prev = self._more = False
            profiles = []
            msg = _('Unable to retrieve profiles.')
            exceptions.handle(self.request, msg)
        return profiles
예제 #3
0
    def get_data(self):
        try:
            params = {}
            profiles = senlin.profile_list(self.request, params)
        except Exception:
            profiles = []
            msg = _('Unable to retrieve profiles.')
            exceptions.handle(self.request, msg)

        return profiles
예제 #4
0
    def __init__(self, request, *args, **kwargs):
        super(CreateForm, self).__init__(request, *args, **kwargs)
        profiles = senlin.profile_list(request, params={})
        self.fields['profile_id'].choices = (
            [("", _("Select Profile"))] + [(profile.id, profile.name)
                                           for profile in profiles])

        clusters = senlin.cluster_list(request, params={})
        self.fields['cluster_id'].choices = (
            [("", _("Select Cluster"))] + [(cluster.id, cluster.name)
                                           for cluster in clusters])
예제 #5
0
    def __init__(self, request, *args, **kwargs):
        super(CreateForm, self).__init__(request, *args, **kwargs)
        profiles = senlin.profile_list(request)[0]
        self.fields['profile_id'].choices = (
            [("", _("Select Profile"))] + [(profile.id, profile.name)
                                           for profile in profiles])

        clusters = senlin.cluster_list(request)[0]
        self.fields['cluster_id'].choices = (
            [("", _("Select Cluster"))] + [(cluster.id, cluster.name)
                                           for cluster in clusters])
예제 #6
0
    def get(self, request):
        """Get a list of profiles."""

        filters, kwargs = rest_utils.parse_filters_kwargs(request,
                                                          CLIENT_KEYWORDS)

        profiles, has_more_data, has_prev_data = senlin.profile_list(
            request, filters=filters, **kwargs)

        return {
            'items': [p.to_dict() for p in profiles],
            'has_more_data': has_more_data,
            'has_prev_data': has_prev_data,
        }
예제 #7
0
    def get(self, request):
        """Get a list of profiles."""

        filters, kwargs = rest_utils.parse_filters_kwargs(
            request, CLIENT_KEYWORDS)

        profiles, has_more_data, has_prev_data = senlin.profile_list(
            request, filters=filters, **kwargs)

        return {
            'items': [p.to_dict() for p in profiles],
            'has_more_data': has_more_data,
            'has_prev_data': has_prev_data,
        }
예제 #8
0
 def __init__(self, request, *args, **kwargs):
     super(CreateForm, self).__init__(request, *args, **kwargs)
     profiles = senlin.profile_list(request)[0]
     self.fields["profile_id"].choices = [("", _("Select Profile"))] + [
         (profile.id, profile.name) for profile in profiles
     ]
예제 #9
0
 def __init__(self, request, *args, **kwargs):
     super(UpdateNodeForm, self).__init__(request, *args, **kwargs)
     profiles = senlin.profile_list(request)[0]
     self.fields['profile_id'].choices = (
         [("", _("Select Profile"))] + [(profile.id, profile.name)
                                        for profile in profiles])