Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1745.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve maintenace column by adding a dropdown with tasks that affect the incident
27 changes: 27 additions & 0 deletions src/argus/htmx/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -5616,6 +5616,10 @@ details.collapse summary::-webkit-details-marker {
width: 13rem;
}

.w-72 {
width: 18rem;
}

.w-\[1\%\] {
width: 1%;
}
Expand All @@ -5633,6 +5637,14 @@ details.collapse summary::-webkit-details-marker {
width: 100%;
}

.w-80 {
width: 20rem;
}

.\!w-full {
width: 100% !important;
}

.min-w-48 {
min-width: 12rem;
}
Expand Down Expand Up @@ -6439,6 +6451,10 @@ details.collapse summary::-webkit-details-marker {
opacity: 0;
}

.opacity-60 {
opacity: 0.6;
}

.opacity-70 {
opacity: 0.7;
}
Expand Down Expand Up @@ -6504,6 +6520,12 @@ details.collapse summary::-webkit-details-marker {
transition-duration: 150ms;
}

.transition-colors {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}

.duration-300 {
transition-duration: 300ms;
}
Expand Down Expand Up @@ -6549,6 +6571,11 @@ details.collapse summary::-webkit-details-marker {
background-color: var(--fallback-b2,oklch(var(--b2)/0.4));
}

.hover\:bg-base-200:hover {
--tw-bg-opacity: 1;
background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity, 1)));
}

.hover\:text-primary:hover {
--tw-text-opacity: 1;
color: var(--fallback-p,oklch(var(--p)/var(--tw-text-opacity, 1)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
<!-- htmx/templates/htmx/incident/cells/_incident_maintenance.html -->
{% if incident.planned_maintenance_tasks.exists %}
<i class="text-primary text-lg fa-solid fa-person-digging"></i>
{% endif %}
{% with tasks=incident.planned_maintenance_tasks.all %}
{% if tasks %}
<div class="dropdown dropdown-hover dropdown-bottom dropdown-end">
<button tabindex="0"
class="btn btn-ghost btn-sm cursor-pointer flex items-center gap-1 text-primary">
<i class="fa-solid fa-person-digging"></i>
<span class="text-xs">{{ tasks|length }} task{{ tasks|length|pluralize }}</span>
</button>
<div tabindex="0"
class="dropdown-content bg-base-100 rounded-box z-20 w-72 p-2 shadow-lg flex flex-col gap-1">
<span class="text-xs font-medium opacity-60 px-2">Planned Maintenance</span>
{% for task in tasks %}
<a href="{% url 'htmx:plannedmaintenance-detail' pk=task.pk %}"
class="flex flex-col gap-0.5 p-2 rounded-lg hover:bg-base-200 transition-colors">
<span class="font-medium truncate" title="{{ task.description }}">{{ task.description|default:"No description" }}</span>
<div class="flex items-center justify-between gap-2 text-xs opacity-60">
<span>{{ task.start_time|date:"M d, H:i" }}
{% if task.end_time.year >= 9999 %}
- now
{% else %}
- {{ task.end_time|date:"M d, H:i" }}
Copy link
Contributor

@hmpf hmpf Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be consistent with the date formats please. Always use the formats chosen in preferences.

  • |date:preferences.argus_htmx.datetime_format
  • |date:preferences.argus_htmx.date_format
  • |date:preferences.argus_htmx.time_format

If another is needed, for "datetime without year", let's add another to the above list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, it is now using the date_format from user preferences. The idea behind using a custom date format was to present the information in the same way to all users, and keep the UI compact. E.g. an EPOCH timestamp is not very user friendly when used in ranges. However, I agree that it makes sense to be consistent, and leave it up to the user to use a proper date format.

{% endif %}
</span>
{% if task.current %}
<span class="badge badge-success badge-sm">Ongoing</span>
{% elif task.future %}
<span class="badge badge-info badge-sm">Scheduled</span>
{% else %}
<span class="badge badge-ghost badge-sm">Completed</span>
{% endif %}
</div>
</a>
{% endfor %}
</div>
</div>
{% endif %}
{% endwith %}
Loading