Add burst job scheduling, enhance timeline lane management, and improve tooltip functionality
This commit is contained in:
1 parent
3be35f6b0a
commit
469ac9bc5a
8 files changed
+105
-10
No files matched your search
@@ -140,6 +140,27 @@ def get_fake_jobs(now: datetime) -> list[FakeReconJob]:
|
||||
),
|
||||
]
|
||||
|
||||
# A burst of jobs all scheduled at the same time (16:00) — the engine will
|
||||
# serialise these so the dashboard caps the stack at 3 lanes and chains the
|
||||
# rest horizontally on the bottom lane.
|
||||
burst_due = _at(today, 16, 0) if now < _at(today, 16, 0) else now + timedelta(minutes=30)
|
||||
burst_names = [
|
||||
("Branch Cash Recon", "branch-cash"),
|
||||
("Card Settlement Recon", "card-settlement"),
|
||||
("ATM Float Recon", "atm-float"),
|
||||
("Loan Disbursement Recon","loan-disb"),
|
||||
("Mortgage Payment Recon", "mortgage-pmt"),
|
||||
("Term Deposit Recon", "term-deposit"),
|
||||
("Wire Transfer Recon", "wire-transfer"),
|
||||
]
|
||||
for i, (name, ref) in enumerate(burst_names):
|
||||
jobs.append(FakeReconJob(
|
||||
id=210 + i, name=name, as_at_date=today,
|
||||
recon_config_reference=ref,
|
||||
due_datetime=burst_due,
|
||||
status="created",
|
||||
))
|
||||
|
||||
# Add a 7-day history (excluding the two days above) so totals look real.
|
||||
history_template = [
|
||||
("FX Settlement Recon", "fx-settlement", 6, 45, "completed"),
|
||||
|
||||
+10
-1
@@ -1,16 +1,25 @@
|
||||
from fastapi import APIRouter, Request
|
||||
from fastapi.openapi.docs import get_swagger_ui_html
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.responses import HTMLResponse, Response
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/.well-known/appspecific/com.chrome.devtools.json", include_in_schema=False)
|
||||
async def chrome_devtools_probe() -> Response:
|
||||
"""Chrome DevTools probes this path whenever DevTools opens. Return an
|
||||
empty 204 so it doesn't show as a 404 in the access log."""
|
||||
return Response(status_code=204)
|
||||
|
||||
|
||||
@router.get("/api/docs", include_in_schema=False)
|
||||
async def swagger_ui_dark(request: Request) -> HTMLResponse:
|
||||
base = get_swagger_ui_html(
|
||||
openapi_url=request.app.openapi_url,
|
||||
title="Recon Ranger — API Docs",
|
||||
swagger_js_url="/static/api/swagger-ui-bundle.js",
|
||||
swagger_css_url="/static/api/swagger-ui.css",
|
||||
swagger_favicon_url="/static/api/favicon.png",
|
||||
)
|
||||
html = base.body.decode()
|
||||
|
||||
|
||||
+25
-4
@@ -87,22 +87,43 @@ def _build_day_timeline(
|
||||
# Lane (row) assignment so overlapping/adjacent bars stack vertically.
|
||||
# An entry occupies [left, left+width); for collision purposes scheduled
|
||||
# markers are widened slightly so back-to-back scheduled jobs separate.
|
||||
# Lanes are capped at MAX_LANES — additional collisions are pushed to the
|
||||
# right of the last entry on the bottom lane (visualising "and N more
|
||||
# serialised after this one") rather than growing the track vertically.
|
||||
GAP = 0.2 # % units
|
||||
MIN_COLLISION_WIDTH = 1.2
|
||||
MAX_LANES = 3
|
||||
lane_ends: list[float] = []
|
||||
lane_visible_ends: list[float] = []
|
||||
for e in entries:
|
||||
coll_width = max(e["width"], MIN_COLLISION_WIDTH)
|
||||
coll_end = e["left"] + coll_width
|
||||
placed = False
|
||||
for i, end in enumerate(lane_ends):
|
||||
if e["left"] >= end + GAP:
|
||||
lane_ends[i] = coll_end
|
||||
lane_ends[i] = e["left"] + coll_width
|
||||
e["lane"] = i
|
||||
placed = True
|
||||
break
|
||||
if not placed:
|
||||
e["lane"] = len(lane_ends)
|
||||
lane_ends.append(coll_end)
|
||||
if len(lane_ends) < MAX_LANES:
|
||||
e["lane"] = len(lane_ends)
|
||||
lane_ends.append(e["left"] + coll_width)
|
||||
lane_visible_ends.append(e["left"] + e["width"])
|
||||
else:
|
||||
# All lanes occupied — shunt this entry horizontally onto the
|
||||
# last lane, immediately after whatever is already there. We
|
||||
# advance by the previous entry's *visible* width (tracked
|
||||
# separately) rather than the inflated collision width, so
|
||||
# scheduled markers sit flush against each other.
|
||||
last = MAX_LANES - 1
|
||||
new_left = lane_visible_ends[last] + GAP
|
||||
e["left"] = new_left
|
||||
e["lane"] = last
|
||||
lane_ends[last] = new_left + coll_width
|
||||
lane_visible_ends[last] = new_left + e["width"]
|
||||
continue
|
||||
# Track visible end too (used only for chaining on the last lane).
|
||||
lane_visible_ends[e["lane"]] = e["left"] + e["width"]
|
||||
|
||||
return {
|
||||
"date": day,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,2 @@
|
||||
/*! For license information please see swagger-ui-bundle.js.LICENSE.txt */
|
||||
!function webpackUniversalModuleDefinition(s,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.SwaggerUIBundle=o():s.SwaggerUIBundle=o()}(this,(()=>(()=>{var s={67526(s,o){"use strict";o.byteLength=function byteLength(s){var o=getLens(s),i=o[0],a=o[1];return 3*(i+a)/4-a},o.toByteArray=function toByteArray(s){var o,i,_=getLens(s),w=_[0],x=_[1],C=new u(function _byteLength(s,o,i){return 3*(o+i)/4-i}(0,w,x)),j=0,L=x>0?w-4:w;for(i=0;i<L;i+=4)o=a[s.charCodeAt(i)]<<18|a[s.charCodeAt(i+1)]<<12|a[s.charCodeAt(i+2)]<<6|a[s.charCodeAt(i+3)],C[j++]=o>>16&255,C[j++]=o>>8&255,C[j++]=255&o;2===x&&(o=a[s.charCodeAt(i)]<<2|a[s.charCodeAt(i+1)]>>4,C[j++]=255&o);1===x&&(o=a[s.charCodeAt(i)]<<10|a[s.charCodeAt(i+1)]<<4|a[s.charCodeAt(i+2)]>>2,C[j++]=o>>8&255,C[j++]=255&o);return C},o.fromByteArray=function fromByteArray(s){for(var o,a=s.length,u=a%3,_=[],w=16383,x=0,C=a-u;x<C;x+=w)_.push(encodeChunk(s,x,x+w>C?C:x+w));1===u?(o=s[a-1],_.push(i[o>>2]+i[o<<4&63]+"==")):2===u&&(o=(s[a-2]<<8)+s[a-1],_.push(i[o>>10]+i[o>>4&63]+i[o<<2&63]+"="));return _.join("")};for(var i=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=0;w<64;++w)i[w]=_[w],a[_.charCodeAt(w)]=w;function getLens(s){var o=s.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=s.indexOf("=");return-1===i&&(i=o),[i,i===o?0:4-i%4]}function encodeChunk(s,o,a){for(var u,_,w=[],x=o;x<a;x+=3)u=(s[x]<<16&16711680)+(s[x+1]<<8&65280)+(255&s[x+2]),w.push(i[(_=u)>>18&63]+i[_>>12&63]+i[_>>6&63]+i[63&_]);return w.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},48287(s,o,i){"use strict";const a=i(67526),u=i(251),_="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=Buffer,o.SlowBuffer=function SlowBuffer(s){+s!=s&&(s=0);return Buffer.alloc(+s)},o.INSPECT_MAX_BYTES=50;const w=2147483647;function createBuffer(s){if(s>w)throw new RangeError('The value "'+s+'" is invalid for option "size"');const o=new Uint8Array(s);return Object.setPrototypeOf(o,Buffer.prototype),o}function Buffer(s,o,i){if("number"==typeof s){if("string"==typeof o)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(s)}return from(s,o,i)}function from(s,o,i){if("string"==typeof s)return function fromString(s,o){"string"==typeof o&&""!==o||(o="utf8");if(!Buffer.isEncoding(o))throw new TypeError("Unknown encoding: "+o);const i=0|byteLength(s,o);let a=createBuffer(i);const u=a.write(s,o);u!==i&&(a=a.slice(0,u));return a}(s,o);if(ArrayBuffer.isView(s))return function fromArrayView(s){if(isInstance(s,Uint8Array)){const o=new Uint8Array(s);return fromArrayBuffer(o.buffer,o.byteOffset,o.byteLength)}return fromArrayLike(s)}(s);if(null==s)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if(isInstance(s,ArrayBuffer)||s&&isInstance(s.buffer,ArrayBuffer))return fromArrayBuffer(s,o,i);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(s,SharedArrayBuffer)||s&&isInstance(s.buffer,SharedArrayBuffer)))return fromArrayBuffer(s,o,i);if("number"==typeof s)throw new TypeError('The "value" argument must not be of type number. Received type number');const a=s.valueOf&&s.valueOf();if(null!=a&&a!==s)return Buffer.from(a,o,i);const u=function fromObject(s){if(Buffer.isBuffer(s)){const o=0|checked(s.length),i=createBuffer(o);return 0===i.length||s.copy(i,0,0,o),i}if(void 0!==s.length)return"number"!=typeof s.length||numberIsNaN(s.length)?createBuffer(0):fromArrayLike(s);if("Buffer"===s.type&&Array.isArray(s.data))return fromArrayLike(s.data)}(s);if(u)return u;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof s[Symbol.toPrimitive])return Buffer.from(s[Symbol.toPrimitive]("string"),o,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s)}function assertSize(s){if("number"!=typeof s)throw new TypeError('"size" argument must be of type number');if(s<0)throw new RangeError('The value "'+s+'" is invalid for option "size"')}function allocUnsafe(s){return assertSize(s),createBuffer(s<0?0:0|checked(s))}function fromArrayLike(s){const o=s.length<0?0:0|checked(s.length),i=createBuffer(o);for(let a=0;a<o;a+=1)i[a]=255&s[a];return i}function fromArrayBuffer(s,o,i){if(o<0||s.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(s.byteLength<o+(i||0))throw new RangeError('"length" is outside of buffer bounds');let a;return a=void 0===o&&void 0===i?new Uint8Array(s):void 0===i?new Uint8Array(s,o):new Uint8Array(s,o,i),Object.setPrototypeOf(a,Buffer.prototype),a}function checked(s){if(s>=w)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+w.toString(16)+"
Line truncated
|
||||
@@ -364,7 +364,7 @@ footer {
|
||||
min-height: 32px;
|
||||
height: calc(var(--lane-count) * var(--lane-height) + 6px);
|
||||
padding: 3px 0;
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
}
|
||||
.gridline {
|
||||
position: absolute;
|
||||
@@ -399,7 +399,6 @@ footer {
|
||||
padding: 0 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
color: #0f172a;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
@@ -412,6 +411,8 @@ footer {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.job-bar-completed { background: rgba(74, 222, 128, 0.85); }
|
||||
.job-bar-running { background: rgba(250, 204, 21, 0.85); }
|
||||
@@ -491,6 +492,12 @@ footer {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.metric-table-scroll {
|
||||
/* Let the table scroll horizontally inside a narrow card instead of
|
||||
spilling out. The card itself stays put. */
|
||||
overflow-x: auto;
|
||||
margin: 0 -4px;
|
||||
}
|
||||
.metric-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
@@ -500,6 +507,7 @@ footer {
|
||||
padding: 6px 6px;
|
||||
text-align: right;
|
||||
color: #cbd5e1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.metric-table thead th {
|
||||
color: #94a3b8;
|
||||
@@ -613,7 +621,7 @@ a.job-bar:hover { filter: brightness(1.1); box-shadow: 0 0 0 1px rgba(255,255,25
|
||||
border-radius: 6px;
|
||||
height: 56px;
|
||||
margin-bottom: 6px;
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
}
|
||||
.history-dot {
|
||||
position: absolute;
|
||||
@@ -664,3 +672,35 @@ a.job-bar:hover { filter: brightness(1.1); box-shadow: 0 0 0 1px rgba(255,255,25
|
||||
}
|
||||
.nested-item { display: block; font-size: 13px; }
|
||||
.nested-key { color: #94a3b8; margin-right: 6px; }
|
||||
|
||||
/* ── Instant CSS tooltip (replaces native title= delay) ── */
|
||||
/* Note: do NOT add `position: relative` here — it would override the
|
||||
`position: absolute` on .job-bar / .history-dot. The pseudo-element below
|
||||
positions relative to whichever ancestor is already positioned. */
|
||||
[data-tip]::after {
|
||||
content: attr(data-tip);
|
||||
position: absolute;
|
||||
bottom: calc(100% + 6px);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: #0f1117;
|
||||
color: #e2e8f0;
|
||||
border: 1px solid #2d2d3a;
|
||||
border-radius: 6px;
|
||||
padding: 6px 9px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
z-index: 50;
|
||||
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
[data-tip]:hover::after,
|
||||
[data-tip]:focus-visible::after {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
<a class="job-bar job-bar-{{ e.kind }}"
|
||||
href="/jobs/{{ e.id }}"
|
||||
style="left: {{ e.left }}%; width: {{ e.width }}%; --lane: {{ e.lane }}"
|
||||
title="{{ e.name }} — {{ e.kind }}{% if e.start %} | start {{ e.start }}{% endif %}{% if e.finish %} | finish {{ e.finish }}{% endif %}{% if e.due and not e.start %} | due {{ e.due }}{% endif %}">
|
||||
data-tip="{{ e.name }} — {{ e.kind }}{% if e.start %} | start {{ e.start }}{% endif %}{% if e.finish %} | finish {{ e.finish }}{% endif %}{% if e.due and not e.start %} | due {{ e.due }}{% endif %}">
|
||||
<span class="job-bar-label">{{ e.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
@@ -56,6 +56,7 @@
|
||||
|
||||
<section class="metric-card">
|
||||
<h3>Job Outcomes</h3>
|
||||
<div class="metric-table-scroll">
|
||||
<table class="metric-table">
|
||||
<thead>
|
||||
<tr><th></th><th>✓ Done</th><th>✗ Failed</th><th>Running</th><th>Pending</th><th>Success</th></tr>
|
||||
@@ -95,6 +96,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="metric-card">
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<a class="history-dot history-dot-{{ e.kind }}{% if e.id == job.id %} is-current{% endif %}"
|
||||
href="/jobs/{{ e.id }}"
|
||||
style="left: {{ e.left }}%"
|
||||
title="{{ e.name }} · {{ e.as_at }}{% if e.when %} · {{ e.when }}{% endif %} · {{ e.status }}">
|
||||
data-tip="{{ e.name }} · {{ e.as_at }}{% if e.when %} · {{ e.when }}{% endif %} · {{ e.status }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user