@@ -84,16 +84,27 @@ <h1 class="text-2xl font-bold mb-6">Management Commands</h1>
84
84
< td class ="px-6 py-4 whitespace-nowrap text-sm text-gray-500 "> {{ command.run_count|default:"0" }}</ td >
85
85
< td class ="px-6 py-4 whitespace-nowrap text-sm text-gray-500 ">
86
86
{% if command.stats_data %}
87
- < div class ="flex items-end h-[30px] w-[100px] gap-[1px] "
88
- title ="30-day activity ">
89
- {% for data in command.stats_data %}
90
- < div class ="flex-1 bg-[#e74c3c] min-w-[2px] rounded-t-[1px] "
91
- style ="height: {% widthratio data.value 100 30 %}px "
92
- title ="{{ data.date }}: {{ data.value }} "> </ div >
93
- {% endfor %}
87
+ < div class ="relative ">
88
+ <!-- Grid background -->
89
+ < div class ="absolute inset-0 grid grid-rows-4 w-[120px] h-[30px] pointer-events-none ">
90
+ < div class ="border-t border-gray-200 "> </ div >
91
+ < div class ="border-t border-gray-200 "> </ div >
92
+ < div class ="border-t border-gray-200 "> </ div >
93
+ < div class ="border-t border-gray-200 "> </ div >
94
+ </ div >
95
+ <!-- Bars -->
96
+ < div class ="flex items-end h-[30px] w-[120px] gap-[1px] relative "
97
+ title ="30-day activity ">
98
+ {% for data in command.stats_data %}
99
+ < div class ="flex-1 {% if data.value > 0 %}bg-[#e74c3c] hover:bg-red-700{% else %}bg-gray-200 hover:bg-gray-300{% endif %} min-w-[2px] rounded-t-sm transition-all duration-200 "
100
+ style ="height: {% if data.value > 0 %}{{ data.height_percent|floatformat:0 }}{% else %}1{% endif %}% "
101
+ title ="{{ data.date }}: {{ data.value }} "> </ div >
102
+ {% endfor %}
103
+ </ div >
94
104
</ div >
105
+ < div class ="text-xs text-gray-500 mt-1 "> Max: {{ command.max_value }}</ div >
95
106
{% else %}
96
- < div class ="flex items-center justify-center h-[30px] w-[100px ] text-gray-400 text-[10px] "> No data</ div >
107
+ < div class ="flex items-center justify-center h-[30px] w-[120px ] text-gray-400 text-[10px] "> No data</ div >
97
108
{% endif %}
98
109
</ td >
99
110
< td class ="px-6 py-4 whitespace-nowrap text-sm text-gray-500 ">
@@ -276,6 +287,64 @@ <h4 class="text-lg font-medium text-gray-900 mb-2">Command Results</h4>
276
287
submitCommandForm ( this ) ;
277
288
} ) ;
278
289
}
290
+
291
+ // Enhanced tooltips for activity bars
292
+ const activityBars = document . querySelectorAll ( '.flex-1[title]' ) ;
293
+ activityBars . forEach ( bar => {
294
+ bar . addEventListener ( 'mouseenter' , function ( ) {
295
+ const title = this . getAttribute ( 'title' ) ;
296
+ if ( ! title ) return ;
297
+
298
+ // Parse the title to get date and value
299
+ const [ date , valueStr ] = title . split ( ': ' ) ;
300
+ const value = parseInt ( valueStr ) || 0 ;
301
+
302
+ // Format the date
303
+ const formattedDate = new Date ( date ) . toLocaleDateString ( 'en-US' , {
304
+ month : 'short' ,
305
+ day : 'numeric' ,
306
+ year : 'numeric'
307
+ } ) ;
308
+
309
+ // Create tooltip
310
+ const tooltip = document . createElement ( 'div' ) ;
311
+ tooltip . className = 'absolute z-10 bg-gray-900 text-white text-xs rounded py-1 px-2 pointer-events-none' ;
312
+ tooltip . innerHTML = `
313
+ <div class="font-bold">${ formattedDate } </div>
314
+ <div class="flex justify-between gap-2">
315
+ <span>Executions:</span>
316
+ <span class="font-bold">${ value } </span>
317
+ </div>
318
+ ` ;
319
+ tooltip . style . bottom = '40px' ;
320
+ tooltip . style . left = '50%' ;
321
+ tooltip . style . transform = 'translateX(-50%)' ;
322
+ tooltip . style . whiteSpace = 'nowrap' ;
323
+
324
+ // Position tooltip
325
+ this . style . position = 'relative' ;
326
+ this . appendChild ( tooltip ) ;
327
+
328
+ // Remove title to prevent default tooltip
329
+ this . setAttribute ( 'data-original-title' , title ) ;
330
+ this . removeAttribute ( 'title' ) ;
331
+ } ) ;
332
+
333
+ bar . addEventListener ( 'mouseleave' , function ( ) {
334
+ // Restore title
335
+ const originalTitle = this . getAttribute ( 'data-original-title' ) ;
336
+ if ( originalTitle ) {
337
+ this . setAttribute ( 'title' , originalTitle ) ;
338
+ this . removeAttribute ( 'data-original-title' ) ;
339
+ }
340
+
341
+ // Remove tooltip
342
+ const tooltip = this . querySelector ( 'div' ) ;
343
+ if ( tooltip ) {
344
+ this . removeChild ( tooltip ) ;
345
+ }
346
+ } ) ;
347
+ } ) ;
279
348
} ) ;
280
349
281
350
// Command modal functions
0 commit comments