示例#1
0
 def display_state(self, ticket):
     """ State colored for change_form """
     return colored('state', STATE_COLORS, bold=False, verbose=True)(ticket)
示例#2
0
 def colored_priority(self, instance):
     return colored('priority', PRIORITY_COLORS, bold=False)(instance)
示例#3
0
 def display_priority(self, ticket):
     """ State colored for change_form """
     return colored('priority', PRIORITY_COLORS, bold=False, verbose=True)(ticket)
示例#4
0
文件: admin.py 项目: m00dy/controller
def colored_state(instance):
    color = colored('state', STATE_COLORS)
    return mark_safe(color(instance))
示例#5
0
 def colored_state(self, instance):
     return colored('state', STATE_COLORS, bold=False)(instance)
示例#6
0
文件: admin.py 项目: m00dy/controller
 def display_set_state(self, node):
     return colored('set_state', STATES_COLORS, verbose=True, bold=False)(node)
示例#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'

示例#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...
示例#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))
示例#10
0
 def display_set_state(self, node):
     return colored('set_state', STATES_COLORS, verbose=True,
                    bold=False)(node)
示例#11
0
文件: admin.py 项目: m00dy/controller
 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))
示例#12
0
def colored_state(instance):
    color = colored('state', STATE_COLORS)
    return mark_safe(color(instance))
示例#13
0
 def colored_state(self, build):
     return colored('state', STATE_COLORS)(build)
示例#14
0
 def colored_state(self, build):
     return colored('state', STATE_COLORS)(build)