Example #1
0
 def display_state(self, ticket):
     """ State colored for change_form """
     return colored('state', STATE_COLORS, bold=False, verbose=True)(ticket)
Example #2
0
 def colored_priority(self, instance):
     return colored('priority', PRIORITY_COLORS, bold=False)(instance)
Example #3
0
 def display_priority(self, ticket):
     """ State colored for change_form """
     return colored('priority', PRIORITY_COLORS, bold=False, verbose=True)(ticket)
Example #4
0
def colored_state(instance):
    color = colored('state', STATE_COLORS)
    return mark_safe(color(instance))
Example #5
0
 def colored_state(self, instance):
     return colored('state', STATE_COLORS, bold=False)(instance)
Example #6
0
 def display_set_state(self, node):
     return colored('set_state', STATES_COLORS, verbose=True, bold=False)(node)
Example #7
0
                      log_sliver_history, remove_slice_id, state_value,
                      wrap_action)
from .models import (Slice, SliceProp, Sliver, SliverDefaults, SliverProp,
                     SliverIface, Template)

# List of ifaces displayed in SliverInline (and subclasses)
SLIVER_IFACES = ['public6', 'public4', 'management', 'isolated', 'debug']

STATE_COLORS = {
    Slice.REGISTER: 'grey',
    Slice.DEPLOY: 'darkorange',
    Slice.START: 'green'
}

colored_set_state = colored('set_state',
                            STATE_COLORS,
                            verbose=True,
                            bold=False)


def num_slivers(instance):
    """ return num slivers as a link to slivers changelist view """
    num = instance.slivers.count()
    url = reverse('admin:slices_sliver_changelist')
    url += '?my_slivers=False&%s=%s' % (instance._meta.model_name, instance.pk)
    return mark_safe('<a href="%s">%d</a>' % (url, num))


num_slivers.short_description = 'Slivers'
num_slivers.admin_order_field = 'slivers__count'

Example #8
0
    log_sliver_history, remove_slice_id, state_value, wrap_action)
from .models import (Slice, SliceProp, Sliver, SliverDefaults, SliverProp,
    SliverIface, Template)


# List of ifaces displayed in SliverInline (and subclasses)
SLIVER_IFACES = ['public6', 'public4', 'management', 'isolated', 'debug']

STATE_COLORS = {
    Slice.REGISTER: 'grey',
    Slice.DEPLOY: 'darkorange',
    Slice.START: 'green'
}


colored_set_state = colored('set_state', STATE_COLORS, verbose=True, bold=False)

def num_slivers(instance):
    """ return num slivers as a link to slivers changelist view """
    num = instance.slivers.count()
    url = reverse('admin:slices_sliver_changelist')
    url += '?my_slivers=False&%s=%s' % (instance._meta.model_name, instance.pk)
    return mark_safe('<a href="%s">%d</a>' % (url, num))
num_slivers.short_description = 'Slivers'
num_slivers.admin_order_field = 'slivers__count'


def computed_sliver_set_state(sliver):
    title = ''

    # compute if state is overridden...
Example #9
0
 def display_value(self, instance):
     value = colored('value', STATES_COLORS, verbose=True)(instance)
     url = reverse('admin:state_history_data', args=[instance.pk])
     return mark_safe('<a class="show-popup" href="#" url="%s">%s</a>' %
                      (url, value))
Example #10
0
 def display_set_state(self, node):
     return colored('set_state', STATES_COLORS, verbose=True,
                    bold=False)(node)
Example #11
0
 def display_value(self, instance):
     value = colored('value', STATES_COLORS, verbose=True)(instance)
     url = reverse('admin:state_history_data', args=[instance.pk])
     return mark_safe('<a class="show-popup" href="#" url="%s">%s</a>' % (url, value))
Example #12
0
def colored_state(instance):
    color = colored('state', STATE_COLORS)
    return mark_safe(color(instance))
Example #13
0
 def colored_state(self, build):
     return colored('state', STATE_COLORS)(build)
Example #14
0
 def colored_state(self, build):
     return colored('state', STATE_COLORS)(build)