|
1 | 1 | {% extends "includes/crud/table_list.html" %}
|
2 | 2 |
|
3 | 3 | {% load trans blocktrans from i18n %}
|
| 4 | +{% load naturaltime from humanize %} |
4 | 5 |
|
5 | 6 | {% block top_left_menu_items %}
|
6 | 7 | {% endblock top_left_menu_items %}
|
|
35 | 36 | {% endblock list_placeholder_text %}
|
36 | 37 |
|
37 | 38 | {% block list_item_right_buttons %}
|
38 |
| - <a class="ui icon button" |
39 |
| - href="{% url 'projects_integrations_detail' project_slug=project.slug integration_pk=object.pk %}"> |
40 |
| - <i class="fa-duotone fa-wrench icon"></i> |
41 |
| - </a> |
| 39 | + {# This URL is to the detail page for the integration or for the GitHub App page #} |
| 40 | + {% with url=object.get_absolute_url %} |
| 41 | + <a class="ui {% if not url %}disabled{% endif %} icon button" |
| 42 | + href="{% firstof url '#' %}" |
| 43 | + {% if object.is_remote_only %}target="_blank"{% endif %}> |
| 44 | + <i class="fa-duotone fa-wrench icon"></i> |
| 45 | + </a> |
| 46 | + {% endwith %} |
42 | 47 |
|
43 | 48 | {% url 'projects_integrations_delete' project_slug=project.slug integration_pk=object.pk as form_url %}
|
44 | 49 | {% trans "Remove integration" as action_text %}
|
45 | 50 | {% blocktrans trimmed asvar content_text with description=object.get_integration_type_display %}
|
46 | 51 | Remove integration {{ description }}?
|
47 | 52 | {% endblocktrans %}
|
48 |
| - {% include "includes/crud/remove_button.html" with id=object.pk form_url=form_url action_text=action_text content_text=content_text %} |
| 53 | + {% include "includes/crud/remove_button.html" with id=object.pk form_url=form_url action_text=action_text content_text=content_text is_disabled=object.is_remote_only %} |
49 | 54 | {% endblock list_item_right_buttons %}
|
50 | 55 |
|
51 | 56 | {% block list_item_icon %}
|
52 | 57 | <i class="fa-duotone fa-exchange icon"></i>
|
53 | 58 | {% endblock list_item_icon %}
|
54 | 59 |
|
55 | 60 | {% block list_item_header %}
|
56 |
| - <a href="{% url 'projects_integrations_detail' project_slug=project.slug integration_pk=object.pk %}"> |
57 |
| - {{ object.get_integration_type_display }} |
58 |
| - </a> |
59 |
| - {% if object.has_sync and object.can_sync %} |
60 |
| - <i class="fa-duotone fa-wand-magic-sparkles icon" |
61 |
| - data-content="{% trans "Automatically managed" %}"></i> |
| 61 | + {# This URL is to the detail page for the integration or for the GitHub App page #} |
| 62 | + {% with url=object.get_absolute_url %} |
| 63 | + {% if url %} |
| 64 | + <a href="{{ url }}" |
| 65 | + {% if object.is_remote_only %}target="_blank"{% endif %}> |
| 66 | + {{ object.get_integration_type_display }} |
| 67 | + </a> |
| 68 | + {% else %} |
| 69 | + {# Mostly for GHA integrations that are disconnected. We have nothing to link to #} |
| 70 | + {{ object.get_integration_type_display }} |
| 71 | + {% endif %} |
| 72 | + {% endwith %} |
| 73 | + |
| 74 | + {% if object.is_remote_only %} |
| 75 | + {% blocktrans trimmed asvar popup %} |
| 76 | + This integration is managed by the provider and cannot be removed |
| 77 | + {% endblocktrans %} |
| 78 | + {% include "includes/components/config_label.html" with icon="fa-duotone fa-lock" popup=popup %} |
| 79 | + {% elif not object.has_sync and not object.can_sync %} |
| 80 | + {% blocktrans trimmed asvar popup %} |
| 81 | + This integration is not automatically managed and will require manual setup |
| 82 | + {% endblocktrans %} |
| 83 | + {% include "includes/components/config_label.html" with icon="fa-duotone fa-user-gear" popup=popup %} |
62 | 84 | {% endif %}
|
63 | 85 | {% endblock list_item_header %}
|
64 | 86 |
|
65 |
| -{% block list_item_meta %} |
66 |
| - <div class="item">{{ object.exchanges.count }} exchanges</div> |
67 |
| -{% endblock list_item_meta %} |
| 87 | +{% block list_item_meta_items %} |
| 88 | + {% if object.is_remote_only and not object.is_active %} |
| 89 | + {% trans "Disconnected" context "The integration is in a disconnected state" as text %} |
| 90 | + {% blocktrans trimmed with version=object.verbose_name asvar popup %} |
| 91 | + This integration is disconnected, check with your provider |
| 92 | + {% endblocktrans %} |
| 93 | + <div class="item"> |
| 94 | + {% include "includes/components/config_label.html" with classes="red" icon="fa-solid fa-circle-exclamation" text=text popup=popup %} |
| 95 | + </div> |
| 96 | + {% elif object.is_remote_only and object.is_active %} |
| 97 | + {# `is_active` ensures there is a connected remote repository #} |
| 98 | + <div class="item"> |
| 99 | + {# Translators: this is time since connecting this integraiton and will read "Connected 1 year, 5 months ago" #} |
| 100 | + {% blocktrans with time_since=object.created|naturaltime trimmed %} |
| 101 | + Connected {{ time_since }} |
| 102 | + {% endblocktrans %} |
| 103 | + </div> |
| 104 | + {% elif not object.is_remote_only %} |
| 105 | + <div class="item"> |
| 106 | + {# Translators: this is the number of HTTP request/response exchanges for this integration, as in "10 exchanges" #} |
| 107 | + {% blocktrans with count=object.exchanges.count trimmed %} |
| 108 | + {{ count }} exchanges |
| 109 | + {% endblocktrans %} |
| 110 | + </div> |
| 111 | + {% endif %} |
| 112 | +{% endblock list_item_meta_items %} |
0 commit comments