Skip to content

Commit 874da08

Browse files
authored
ResourceIDs: badge engine IDs on the Automation > AI engines screen (#7)
Adds Resource ID badges to the Automation > AI engines screen. Extraction and splitting/sorting engine tiles carry data-cy="engine-tile" and data-id directly, so this reuses the cheapest existing strategy (same as sidebar queues and rule tiles — no API call). Dedicated and generic engine tiles render without data-cy/data-id and are not clickable in the Rossum UI, so they intentionally get no badge. Co-authored-by: Jan Sedo <sedojj@centrum.cz>
1 parent ddaf1f5 commit 874da08

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ All features are configurable via the extension popup and can be toggled on or o
1616
### Rossum
1717

1818
- **Schema ID overlays** — displays `schema_id` on annotation fields (headers and line items)
19-
- **Resource ID overlays** — displays internal IDs on queues, hooks, extensions, labels, rules, and users (click to copy)
19+
- **Resource ID overlays** — displays internal IDs on queues, hooks, extensions, labels, rules, users, and AI engines (click to copy)
2020
- **Expand formulas** — automatically opens formula field source code
2121
- **Expand reasoning** — automatically opens reasoning field options
2222
- **Sidebar scroll lock** — prevents the annotation sidebar from auto-scrolling to the top

src/rossum/features/resource-ids.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ export function init() {
2020
the name overflow into adjacent space (graph: pushes the gear/squares
2121
buttons past the bubble border; users: name spills into the email column).
2222
The badge sits inside the cell at bottom-right or cell-overlay, so clipping
23-
is fine. */
23+
is fine. Engine tiles likewise only need the anchor — the badge sits inside
24+
the tile at top-right. */
2425
[data-cy^="extension-cell-"],
26+
[data-cy="engine-tile"],
2527
[data-field="name"] {
2628
position: relative !important;
2729
}
@@ -209,6 +211,13 @@ export function handleNode(node) {
209211
displayResourceId(node, node.dataset.id);
210212
}
211213

214+
// Automation > AI engines: extraction and splitting/sorting engine tiles carry
215+
// data-id directly. Dedicated/generic engine tiles render without
216+
// data-cy/data-id (not clickable in the UI), so they get no badge.
217+
if (node.matches('[data-cy="engine-tile"]') && node.dataset.id) {
218+
displayResourceId(node, node.dataset.id);
219+
}
220+
212221
// Settings > Users screen: label on the name cell, ID from parent anchor href.
213222
// Use bottom-right placement so the badge sits in the cell's lower whitespace
214223
// below the vertically-centered name text, avoiding overlap with long names.

tests/rossum-features.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,29 @@ describe('resource-ids', () => {
179179
expect(badge.textContent).toBe('101');
180180
});
181181

182+
it('displays ID for AI engine tile (data-id attribute)', () => {
183+
const el = document.createElement('div');
184+
el.setAttribute('data-cy', 'engine-tile');
185+
el.dataset.id = '777';
186+
document.body.appendChild(el);
187+
188+
handleNode(el);
189+
190+
const badge = el.querySelector('.rossum-sa-extension-resource-id');
191+
expect(badge).not.toBeNull();
192+
expect(badge.textContent).toBe('777');
193+
});
194+
195+
it('ignores engine tiles without data-id (dedicated/generic engines)', () => {
196+
const el = document.createElement('div');
197+
el.setAttribute('data-cy', 'engine-tile');
198+
document.body.appendChild(el);
199+
200+
handleNode(el);
201+
202+
expect(el.querySelector('.rossum-sa-extension-resource-id')).toBeNull();
203+
});
204+
182205
it('displays ID for extension name (extracted from parent href)', () => {
183206
const anchor = document.createElement('a');
184207
anchor.setAttribute('href', '/extensions/my-extensions/333');

0 commit comments

Comments
 (0)