Skip to content

Commit fcfba7a

Browse files
committed
Add a slider to control the alias similarity to show
The slider controls the "similarity threshold" (referred to as "closeness" in the UI).
1 parent 7f2c63b commit fcfba7a

2 files changed

Lines changed: 91 additions & 3 deletions

File tree

static/css/metrics.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,3 +466,73 @@ tr.selected td:first-child {
466466
color: #6b7280;
467467
padding: 16px;
468468
}
469+
470+
/* Similarity Threshold Slider */
471+
.threshold-slider-container {
472+
display: flex;
473+
align-items: center;
474+
gap: 12px;
475+
margin-left: auto;
476+
margin-right: 20px;
477+
}
478+
479+
.threshold-slider-container label {
480+
font-size: 0.875rem;
481+
font-weight: 600;
482+
color: #374151;
483+
white-space: nowrap;
484+
}
485+
486+
.threshold-slider {
487+
width: 200px;
488+
height: 4px;
489+
border-radius: 2px;
490+
background: #e5e7eb;
491+
outline: none;
492+
-webkit-appearance: none;
493+
appearance: none;
494+
}
495+
496+
.threshold-slider::-webkit-slider-thumb {
497+
-webkit-appearance: none;
498+
appearance: none;
499+
width: 16px;
500+
height: 16px;
501+
border-radius: 50%;
502+
background: #3b82f6;
503+
cursor: pointer;
504+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
505+
}
506+
507+
.threshold-slider::-moz-range-thumb {
508+
width: 16px;
509+
height: 16px;
510+
border-radius: 50%;
511+
background: #3b82f6;
512+
cursor: pointer;
513+
border: none;
514+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
515+
}
516+
517+
.threshold-slider::-webkit-slider-thumb:hover {
518+
background: #2563eb;
519+
}
520+
521+
.threshold-slider::-moz-range-thumb:hover {
522+
background: #2563eb;
523+
}
524+
525+
.slider-with-labels {
526+
display: flex;
527+
flex-direction: column;
528+
gap: 4px;
529+
}
530+
531+
.slider-labels {
532+
display: flex;
533+
justify-content: space-between;
534+
width: 200px;
535+
font-size: 0.75rem;
536+
color: #6b7280;
537+
font-weight: 500;
538+
}

templates/similar_aliases.html

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
const { useState, useEffect, useMemo } = React;
1818
const runPath = "{{ run_path|e }}";
1919

20-
const similarityThreshold = 5;
21-
2220
{% raw %}
2321
function SimilarAliasesDashboard() {
2422
const urlParams = new URLSearchParams(window.location.search);
@@ -39,6 +37,7 @@
3937
const [sortConfig, setSortConfig] = useState({ key: 'entity', direction: 'asc' });
4038
const [maxAliasSimilarity, setMaxAliasSimilarity] = useState(0);
4139
const [minAliasSimilarity, setMinAliasSimilarity] = useState(0);
40+
const [similarityThreshold, setSimilarityThreshold] = useState(5);
4241

4342
// Sync URL with filters
4443
useEffect(() => {
@@ -138,7 +137,7 @@
138137
});
139138

140139
return result.filter(e => e.similar_aliases.length > 0);
141-
}, [entities, filters]);
140+
}, [entities, filters, similarityThreshold]);
142141

143142
const sortedEntities = useMemo(() => {
144143
let sortableItems = [...filteredEntities];
@@ -233,6 +232,25 @@
233232
</div>
234233
))}
235234
<button className="add-filter-btn" onClick={addFilter}>+ Add filter</button>
235+
<div className="threshold-slider-container">
236+
<label htmlFor="similarity-threshold">Closeness:</label>
237+
<div className="slider-with-labels">
238+
<input
239+
id="similarity-threshold"
240+
type="range"
241+
min={minAliasSimilarity}
242+
max={maxAliasSimilarity}
243+
step="1"
244+
value={similarityThreshold}
245+
onChange={e => setSimilarityThreshold(e.target.value)}
246+
className="threshold-slider"
247+
/>
248+
<div className="slider-labels">
249+
<span className="slider-label-start">more</span>
250+
<span className="slider-label-end">less</span>
251+
</div>
252+
</div>
253+
</div>
236254
</div>
237255

238256
{/* Master Table */}

0 commit comments

Comments
 (0)