Skip to content

Commit

Permalink
feat: highlight draft PRs, correctly color secret scanning and branch…
Browse files Browse the repository at this point in the history
… protection card
  • Loading branch information
netomi committed Feb 29, 2024
1 parent 654b828 commit ebbc2ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions otterdog/webapp/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# which is available at http://www.eclipse.org/legal/epl-v20.html
# SPDX-License-Identifier: EPL-2.0
# *******************************************************************************
import json


def register_filters(app):
Expand All @@ -22,6 +23,17 @@ def status_color(status):
case _:
return "info"

@app.template_filter("int_status")
def int_status_color(value):
if value == 0:
return "success"
else:
return "warning"

@app.template_filter("from_json")
def from_json(value):
return json.loads(value)

@app.template_filter("is_dict")
def is_dict(value):
return isinstance(value, dict)
Expand Down
4 changes: 2 additions & 2 deletions otterdog/webapp/templates/home/organization.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h3 class="card-title">General</h3>
</div>
</div>
<div class="col-sm-3">
<div class="card card-{{ 'warning' if secret_scanning_data[0] != 0 else 'success' }}">
<div class="card card-{{ secret_scanning_data|from_json|first|int_status }}">
<div class="card-header">
<h3 class="card-title">Secret Scanning</h3>
</div>
Expand All @@ -148,7 +148,7 @@ <h3 class="card-title">Secret Scanning</h3>
</div>
</div>
<div class="col-sm-3">
<div class="card card-{{ 'warning' if branch_protection_data[0] != 0 else 'success' }}">
<div class="card card-{{ branch_protection_data|from_json|first|int_status }}">
<div class="card-header">
<h3 class="card-title">Branch Protections</h3>
</div>
Expand Down
4 changes: 2 additions & 2 deletions otterdog/webapp/templates/home/pullrequests.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ <h3 class="card-title">Currently open Pull Requests:</h3>
</thead>
<tbody>
{% for pr in open_pull_requests %}
<tr>
<tr class="{{ 'table-secondary' if pr.draft == True else ''}}">
<td><a href="https://github.com/{{ pr.org_id }}">{{ pr.org_id }}</a></td>
<td><a href="https://github.com/{{ pr.org_id }}/{{ pr.repo_name }}">{{ pr.repo_name }}</a></td>
<td><a href="https://github.com/{{ pr.org_id }}/{{ pr.repo_name }}/pull/{{ pr.pull_request }}">#{{ pr.pull_request }}</a></td>
<td>{{ pr.created_at }}</td>
<td>{{ pr.status }}</td>
<td>{{ pr.draft }}</td>
<td class="{{ 'text-primary' if pr.draft == True else '' }}">{{ pr.draft }}</td>
<td>{{ pr.in_sync }}</td>
<td>{{ pr.requires_manual_apply }}</td>
<td>{{ pr.apply_status }}</td>
Expand Down

0 comments on commit ebbc2ee

Please sign in to comment.