senlin_dashboard.cluster.policies package

Submodules

senlin_dashboard.cluster.policies.forms module

Forms for managing policies.

class senlin_dashboard.cluster.policies.forms.CreatePolicyForm(request, *args, **kwargs)[source]

Bases: SelfHandlingForm

base_fields = {'cooldown': <django.forms.fields.IntegerField object>, 'level': <django.forms.fields.IntegerField object>, 'name': <django.forms.fields.CharField object>, 'spec': <django.forms.fields.CharField object>}
declared_fields = {'cooldown': <django.forms.fields.IntegerField object>, 'level': <django.forms.fields.IntegerField object>, 'name': <django.forms.fields.CharField object>, 'spec': <django.forms.fields.CharField object>}
handle(request, data)[source]
property media

Return all media required to render the widgets on this form.

class senlin_dashboard.cluster.policies.forms.UpdatePolicyForm(request, *args, **kwargs)[source]

Bases: SelfHandlingForm

base_fields = {'name': <django.forms.fields.CharField object>, 'policy_id': <django.forms.fields.CharField object>}
declared_fields = {'name': <django.forms.fields.CharField object>, 'policy_id': <django.forms.fields.CharField object>}
handle(request, data)[source]
property media

Return all media required to render the widgets on this form.

senlin_dashboard.cluster.policies.panel module

class senlin_dashboard.cluster.policies.panel.Policies[source]

Bases: Panel

name = 'Policies'
slug = 'policies'

senlin_dashboard.cluster.policies.tables module

class senlin_dashboard.cluster.policies.tables.CreatePolicy(*args, **kwargs)[source]

Bases: LinkAction

base_options = {'__classcell__': <cell at 0x7f750051e9e0: BaseActionMetaClass object>, '__doc__': 'A table action which is simply a link rather than a form POST.\n\n    .. attribute:: name\n\n        Required. The short name or "slug" representing this\n        action. This name should not be changed at runtime.\n\n    .. attribute:: verbose_name\n\n        A string which will be rendered as the link text. (Required)\n\n    .. attribute:: url\n\n        A string or a callable which resolves to a url to be used as the link\n        target. You must either define the ``url`` attribute or override\n        the ``get_link_url`` method on the class.\n\n    .. attribute:: allowed_data_types\n\n        A list that contains the allowed data types of the action.  If the\n        datum\'s type is in this list, the action will be shown on the row\n        for the datum.\n\n        Defaults to be an empty list (``[]``). When set to empty, the action\n        will accept any kind of data.\n    ', '__init__': <function LinkAction.__init__>, '__module__': 'senlin_dashboard.cluster.policies.tables', '__qualname__': 'CreatePolicy', '__repr__': <function BaseAction.__repr__>, '_allowed': <function BaseAction._allowed>, 'ajax': False, 'allowed': <function BaseAction.allowed>, 'associate_with_table': <function LinkAction.associate_with_table>, 'classes': ('ajax-modal',), 'data_type_matched': <function BaseAction.data_type_matched>, 'get_ajax_update_url': <function LinkAction.get_ajax_update_url>, 'get_default_attrs': <function BaseAction.get_default_attrs>, 'get_default_classes': <function BaseAction.get_default_classes>, 'get_link_url': <function LinkAction.get_link_url>, 'get_policy_target': <function BaseAction.get_policy_target>, 'icon': 'plus', 'name': 'create', 'render': <function LinkAction.render>, 'update': <function BaseAction.update>, 'url': 'horizon:cluster:policies:create', 'verbose_name': 'Create Policy'}
classes = ('ajax-modal',)
icon = 'plus'
name = 'create'
url = 'horizon:cluster:policies:create'
verbose_name = 'Create Policy'
class senlin_dashboard.cluster.policies.tables.DeletePolicy(*args, **kwargs)[source]

Bases: DeleteAction

static action_past(count)[source]
static action_present(count)[source]
base_options = {'__classcell__': <cell at 0x7f750051edd0: BaseActionMetaClass object>, '__doc__': 'A table action used to perform delete operations on table data.\n\n    .. attribute:: name\n\n        A short name or "slug" representing this action.\n        Defaults to \'delete\'\n\n    .. method:: action_present\n\n       Method returning a present action name. This is used as an action label.\n\n       Method must accept an integer/long parameter and return the display\n       forms of the name properly pluralised (depending on the integer) and\n       translated in a string or tuple/list.\n\n       The returned display form is highly recommended to be a complete action\n       name with a form of a transitive verb and an object noun. Each word is\n       capitalized and the string should be marked as translatable.\n\n       If tuple or list - then setting self.current_present_action = n will\n       set the current active item from the list(action_present[n])\n\n    .. method:: action_past\n\n       Method returning a past action name. This is usually used to display\n       a message when the action is completed.\n\n       Method must accept an integer/long parameter and return the display\n       forms of the name properly pluralised (depending on the integer) and\n       translated in a string or tuple/list.\n\n       The detail is same as that of ``action_present``.\n\n    .. attribute:: success_url\n\n       Optional location to redirect after completion of the delete\n       action. Defaults to the current page.\n\n    .. attribute:: help_text\n\n       Optional message for providing an appropriate help text for\n       the horizon user.\n\n    ', '__init__': <function DeleteAction.__init__>, '__module__': 'senlin_dashboard.cluster.policies.tables', '__qualname__': 'DeletePolicy', '__repr__': <function BaseAction.__repr__>, '_allowed': <function BatchAction._allowed>, '_get_action_name': <function BatchAction._get_action_name>, 'action': <function DeleteAction.action>, 'action_past': <staticmethod(<function DeletePolicy.action_past>)>, 'action_present': <staticmethod(<function DeletePolicy.action_present>)>, 'allowed': <function BaseAction.allowed>, 'associate_with_table': <function BaseAction.associate_with_table>, 'data_type_matched': <function BaseAction.data_type_matched>, 'default_message_level': 'success', 'delete': <function DeletePolicy.delete>, 'get_default_attrs': <function BatchAction.get_default_attrs>, 'get_default_classes': <function BaseAction.get_default_classes>, 'get_param_name': <function Action.get_param_name>, 'get_policy_target': <function BaseAction.get_policy_target>, 'get_success_url': <function BatchAction.get_success_url>, 'handle': <function BatchAction.handle>, 'help_text': 'This action cannot be undone.', 'name': 'delete', 'update': <function BatchAction.update>}
delete(request, obj_id)[source]

Required. Deletes an object referenced by obj_id.

Override to provide delete functionality specific to your data.

class senlin_dashboard.cluster.policies.tables.PoliciesTable(request, data=None, needs_form_wrapper=None, **kwargs)[source]

Bases: DataTable

class Meta[source]

Bases: object

name = 'policies'
row_actions = (<class 'senlin_dashboard.cluster.policies.tables.UpdatePolicy'>, <class 'senlin_dashboard.cluster.policies.tables.DeletePolicy'>)
table_actions = (<class 'senlin_dashboard.cluster.policies.tables.PolicyFilterAction'>, <class 'senlin_dashboard.cluster.policies.tables.CreatePolicy'>, <class 'senlin_dashboard.cluster.policies.tables.DeletePolicy'>)
verbose_name = 'Policies'
base_actions = {'create': <CreatePolicy: create>, 'delete': <DeletePolicy: delete>, 'filter': <PolicyFilterAction: filter>, 'update': <UpdatePolicy: update>}
base_columns = {'created': <Column: created>, 'name': <WrappingColumn: name>, 'type': <Column: type>, 'updated': <Column: updated>}
class senlin_dashboard.cluster.policies.tables.PolicyFilterAction(*args, **kwargs)[source]

Bases: FilterAction

base_options = {'__classcell__': <cell at 0x7f750051eaa0: BaseActionMetaClass object>, '__doc__': 'A base class representing a filter action for a table.\n\n    .. attribute:: name\n\n        The short name or "slug" representing this action. Defaults to\n        ``"filter"``.\n\n    .. attribute:: verbose_name\n\n        A descriptive name used for display purposes. Defaults to the\n        value of ``name`` with the first letter of each word capitalized.\n\n    .. attribute:: param_name\n\n        A string representing the name of the request parameter used for the\n        search term. Default: ``"q"``.\n\n    .. attribute:: filter_type\n\n        A string representing the type of this filter. If this is set to\n        ``"server"`` then ``filter_choices`` must also be provided.\n        Default: ``"query"``.\n\n    .. attribute:: filter_choices\n\n        Required for server type filters. A tuple of tuples representing the\n        filter options. Tuple composition should evaluate to (string, string,\n        boolean, string, boolean), representing the following:\n\n        * The first value is the filter parameter.\n        * The second value represents display value.\n        * The third optional value indicates whether or not it should be\n          applied to the API request as an API query attribute. API type\n          filters do not need to be accounted for in the filter method since\n          the API will do the filtering. However, server type filters in\n          general will need to be performed in the filter method.\n          By default this attribute is not provided (``False``).\n        * The fourth optional value is used as help text if provided.\n          The default is ``None`` which means no help text.\n        * The fifth optional value determines whether or not the choice\n          is displayed to users. It defaults to ``True``. This is useful\n          when the choice needs to be displayed conditionally.\n\n    .. attribute:: needs_preloading\n\n        If True, the filter function will be called for the initial\n        GET request with an empty ``filter_string``, regardless of the\n        value of ``method``.\n\n    ', '__init__': <function FilterAction.__init__>, '__module__': 'senlin_dashboard.cluster.policies.tables', '__qualname__': 'PolicyFilterAction', '__repr__': <function BaseAction.__repr__>, '_allowed': <function BaseAction._allowed>, 'allowed': <function BaseAction.allowed>, 'assign_type_string': <function FilterAction.assign_type_string>, 'associate_with_table': <function BaseAction.associate_with_table>, 'data_type_filter': <function FilterAction.data_type_filter>, 'data_type_matched': <function BaseAction.data_type_matched>, 'filter': <function FilterAction.filter>, 'filter_choices': (('name', 'Policy Name =', True), ('type', 'Type =', True), ('level', 'Level =', True)), 'filter_type': 'server', 'get_default_attrs': <function BaseAction.get_default_attrs>, 'get_default_classes': <function BaseAction.get_default_classes>, 'get_param_name': <function FilterAction.get_param_name>, 'get_policy_target': <function BaseAction.get_policy_target>, 'get_select_options': <function FilterAction.get_select_options>, 'is_api_filter': <function FilterAction.is_api_filter>, 'name': 'filter', 'update': <function BaseAction.update>}
filter_choices = (('name', 'Policy Name =', True), ('type', 'Type =', True), ('level', 'Level =', True))
filter_type = 'server'
class senlin_dashboard.cluster.policies.tables.UpdatePolicy(*args, **kwargs)[source]

Bases: LinkAction

base_options = {'__classcell__': <cell at 0x7f750051e9e0: BaseActionMetaClass object>, '__doc__': 'A table action which is simply a link rather than a form POST.\n\n    .. attribute:: name\n\n        Required. The short name or "slug" representing this\n        action. This name should not be changed at runtime.\n\n    .. attribute:: verbose_name\n\n        A string which will be rendered as the link text. (Required)\n\n    .. attribute:: url\n\n        A string or a callable which resolves to a url to be used as the link\n        target. You must either define the ``url`` attribute or override\n        the ``get_link_url`` method on the class.\n\n    .. attribute:: allowed_data_types\n\n        A list that contains the allowed data types of the action.  If the\n        datum\'s type is in this list, the action will be shown on the row\n        for the datum.\n\n        Defaults to be an empty list (``[]``). When set to empty, the action\n        will accept any kind of data.\n    ', '__init__': <function LinkAction.__init__>, '__module__': 'senlin_dashboard.cluster.policies.tables', '__qualname__': 'UpdatePolicy', '__repr__': <function BaseAction.__repr__>, '_allowed': <function BaseAction._allowed>, 'ajax': False, 'allowed': <function BaseAction.allowed>, 'associate_with_table': <function LinkAction.associate_with_table>, 'classes': ('ajax-modal',), 'data_type_matched': <function BaseAction.data_type_matched>, 'get_ajax_update_url': <function LinkAction.get_ajax_update_url>, 'get_default_attrs': <function BaseAction.get_default_attrs>, 'get_default_classes': <function BaseAction.get_default_classes>, 'get_link_url': <function LinkAction.get_link_url>, 'get_policy_target': <function BaseAction.get_policy_target>, 'icon': 'pencil', 'name': 'update', 'render': <function LinkAction.render>, 'update': <function BaseAction.update>, 'url': 'horizon:cluster:policies:update', 'verbose_name': 'Update Policy'}
classes = ('ajax-modal',)
icon = 'pencil'
name = 'update'
url = 'horizon:cluster:policies:update'
verbose_name = 'Update Policy'
senlin_dashboard.cluster.policies.tables.get_updated_time(object)[source]

senlin_dashboard.cluster.policies.tabs module

class senlin_dashboard.cluster.policies.tabs.OverviewTab(tab_group, request=None, policy_rules=None)[source]

Bases: Tab

get_context_data(request)[source]

Return a dictionary of context data used to render the tab.

Required.

name = 'Overview'
slug = 'overview'
template_name = 'cluster/policies/_detail_overview.html'
class senlin_dashboard.cluster.policies.tabs.PolicyDetailTabs(request, **kwargs)[source]

Bases: TabGroup

slug = 'policy_details'
tabs = (<class 'senlin_dashboard.cluster.policies.tabs.OverviewTab'>,)

senlin_dashboard.cluster.policies.tests module

class senlin_dashboard.cluster.policies.tests.PoliciesTest(methodName='runTest')[source]

Bases: TestCase

test_create_policy()[source]
test_index()[source]
test_index_no_policy()[source]
test_index_policy_list_exception()[source]
test_policy_detail()[source]

senlin_dashboard.cluster.policies.urls module

senlin_dashboard.cluster.policies.views module

class senlin_dashboard.cluster.policies.views.CreateView(*args, **kwargs)[source]

Bases: ModalFormView

form_class

alias of CreatePolicyForm

modal_header = 'Create Policy'
page_title = 'Create Policy'
submit_label = 'Create Policy'
submit_url = '/cluster/policies/create/'
success_url = '/cluster/policies/'
template_name = 'cluster/policies/create.html'
text = 'Create Policy'
class senlin_dashboard.cluster.policies.views.DetailView[source]

Bases: TabView

get_context_data(**kwargs)[source]

Adds the tab_group variable to the context data.

get_object()[source]
get_tabs(request, *args, **kwargs)[source]

Returns the initialized tab group for this view.

page_title = '{{ policy.name }}'
tab_group_class

alias of PolicyDetailTabs

template_name = 'horizon/common/_detail.html'
class senlin_dashboard.cluster.policies.views.IndexView(*args, **kwargs)[source]

Bases: DataTableView

get_data()[source]
has_more_data(table)[source]
has_prev_data(table)[source]
page_title = 'Policies'
table_class

alias of PoliciesTable

template_name = 'cluster/policies/index.html'
class senlin_dashboard.cluster.policies.views.UpdateView(*args, **kwargs)[source]

Bases: ModalFormView

form_class

alias of UpdatePolicyForm

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_initial()[source]

Return the initial data to use for forms on this view.

get_object()[source]
modal_header = 'Update Policy'
page_title = 'Update Policy'
submit_label = 'Update Policy'
submit_url
success_url = '/cluster/policies/'
template_name = 'cluster/policies/update.html'
text = 'Update Policy'

Module contents