Skip to content

Commit

Permalink
Improve operation display in Request list
Browse files Browse the repository at this point in the history
  • Loading branch information
a-belhadj committed Sep 18, 2023
1 parent 319c4d2 commit 05475c2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions service_catalog/tables/request_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ class Meta:
model = Request
attrs = {"id": "request_table", "class": "table squest-pagination-tables"}
fields = ("selection", "id", "user__username", "instance__quota_scope__name",
"instance__service", "operation", "state", "instance", "date_submitted", "last_updated")
"instance__service", "operation", "operation__type", "state", "instance", "date_submitted",
"last_updated")

def render_operation__type(self, value, record):
from service_catalog.views import map_operation_type
return format_html(
f'<strong class="text-{map_operation_type(record.operation.type)}">{record.operation.type}</strong>')

def render_id(self, value, record):
return format_html(f'<a title={value} href="{record.get_absolute_url()}">{record}</a>')

def render_operation(self, value, record):
return value.name

def render_state(self, record, value):
from service_catalog.views import map_request_state
return format_html(
f'<a href="{record.get_absolute_url()}"><strong class="text-{map_request_state(record.state)}">{value}</strong></a>')
f'<strong class="text-{map_request_state(record.state)}">{value}</strong>')

0 comments on commit 05475c2

Please sign in to comment.