Skip to content

Commit

Permalink
pavels feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nikromen committed Feb 21, 2025
1 parent 4082872 commit 12f0f55
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 38 deletions.
20 changes: 14 additions & 6 deletions frontend/coprs_frontend/coprs/templates/_helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,21 @@
{% endif %}
{% endmacro %}

{% macro log_detective_explain_button(failed_log_url) %}
{% if failed_log_url and config.LOG_DETECTIVE_BUTTON %}
{% set url = "https://log-detective.com/explain?url=%s" %}
<a href="{{ url | format(failed_log_url) }}"
{% macro log_detective_ai_link(failed_log_url, build_id, chroot_name) %}
{% if config.LOG_DETECTIVE_BUTTON %}
{% if failed_log_url %}
{% set url = "https://log-detective.com/explain?url=%s" %}
<a href="{{ url | format(failed_log_url | urlencode) }}"
class="pficon pficon-info"
title="See what AI can tell you about the build failure">
Ask AI
</a> &nbsp&nbsp / &nbsp&nbsp
{% endif %}
{% set url = "https://log-detective.com/contribute/copr/%s/%s" %}
<a href="{{ url | format(build_id, chroot_name) }}"
class="pficon pficon-info"
title="See what AI can tell you about the build failure">
Explain failure
title="Teach AI about this build failure">
Teach AI
</a>
{% endif %}
{% endmacro %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,25 +295,3 @@ <h3> New Build Options </h3>
});
</script>
{% endmacro %}

{% macro copr_build_feed_log_detective(build, class="") %}
{% set url = "https://log-detective.com/contribute/copr/%s/%s" %}
{% set chroots = build.build_chroots|selectattr("state", "equalto", "failed") %}
<div class="dropdown {{ class }}">
<button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown"
title="Annotate the failure in Log Detective to train AI to recognize this issue">
<span class="fa fa-external-link"></span>
Log Detective
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% if build.source_state == "failed" %}
<li><a href="{{ url |format(build.id, 'srpm-builds') }}">Report SRPM build</a></li>
{% else %}
{% for chroot in chroots %}
<li><a href="{{ url |format(build.id, chroot.name) }}">Report {{ chroot.name }}</a></li>
{% endfor %}
{% endif %}
</ul>
</div>
{% endmacro %}
15 changes: 5 additions & 10 deletions frontend/coprs_frontend/coprs/templates/coprs/detail/build.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
copr_build_cancel_form,
copr_build_repeat_form,
copr_resubmit_allow_user_ssh_form,
copr_build_delete_form,
copr_build_feed_log_detective
copr_build_delete_form
%}
{% from "coprs/detail/_describe_source.html" import describe_source %}
{% from "coprs/detail/_describe_failure.html" import describe_failure %}
Expand All @@ -13,7 +12,7 @@
build_state_text,
build_state,
copr_name,
log_detective_explain_button
log_detective_ai_link
%}
{% block title %}Build {{ build.id }} in {{ copr_name(build.copr) }}{% endblock %}

Expand Down Expand Up @@ -41,10 +40,6 @@ <h2 class="build-detail"> Build {{ build.id }} doesn't belong to this project. <
{% endif %}
{% endif %}

{% if config.LOG_DETECTIVE_BUTTON and build.state == "failed" %}
{{ copr_build_feed_log_detective(build, class="pull-right button-build-action") }}
{% endif %}

{% if g.user and g.user.can_build_in(copr) and build.cancelable %}
{{ copr_build_cancel_form(build, page, class="pull-right button-build-action") }}
{% endif %}
Expand Down Expand Up @@ -213,7 +208,7 @@ <h3 class="panel-title">Results</h3>
{% set link_shown = namespace(value=False) %}
{% for url in build.get_source_log_urls %}
{% if not link_shown.value %}
{{ log_detective_explain_button(url) }}
&nbsp&nbsp {{ log_detective_ai_link(url, build.id, "srpm-builds") }}
{% set link_shown.value = true %}
{% endif %}
{% endfor %}
Expand Down Expand Up @@ -262,7 +257,7 @@ <h3 class="panel-title">Results</h3>
<th>Logs</th>
<th>State</th>
{% if build.state == "failed" and build.source_state == "succeeded" %}
<th>Explain with Log Detective AI</th>
<th>Log Detective AI</th>
{% endif %}
</tr>
</thead>
Expand Down Expand Up @@ -308,7 +303,7 @@ <h3 class="panel-title">Results</h3>
{% if build.state == "failed" and build.source_state == "succeeded" %}
<td>
{% if chroot.state == "failed" %}
{{ log_detective_explain_button(chroot.rpm_live_log_url) }}
{{ log_detective_ai_link(chroot.rpm_live_log_url, build.id, chroot.name) }}
{% else %}
-
{% endif %}
Expand Down

0 comments on commit 12f0f55

Please sign in to comment.