Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrthoMCL - Custom tree-table for OrthoGroup page #904

Merged
merged 162 commits into from
Nov 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
7ac2d3e
made a start - WIP
bobular Mar 1, 2024
2f4bc1f
re-render sequence table with Mesa
bobular Mar 4, 2024
4340f10
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Mar 4, 2024
3498348
tweak comments
bobular Mar 4, 2024
dc1731f
WIP
bobular Mar 4, 2024
785a9ed
loosely wire in TreeTable and get shimmimg working
bobular Mar 5, 2024
8c3d330
add patristic and basic type support
bobular Mar 5, 2024
adb464a
made a start with controlling table row height but should investigate…
bobular Mar 8, 2024
f215762
added Mesa table tooltips for td contents when in 'inline' mode (basi…
bobular Mar 8, 2024
1abea4b
use Mesa's inline option and tidy up
bobular Mar 8, 2024
ded7a66
Revert "added Mesa table tooltips for td contents when in 'inline' mo…
bobular Mar 8, 2024
a7c0e1b
remove placeholder td title
bobular Mar 8, 2024
a19369e
restore whitespace in DataCell.tsx
bobular Mar 8, 2024
5c04215
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Mar 8, 2024
5f908bd
upgrade tidytree and use new interactive option
bobular Mar 15, 2024
89d17a7
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Mar 15, 2024
ea9283d
table and tree order are the same
bobular Mar 15, 2024
76bfe05
added basic checkboxes
bobular Mar 15, 2024
cdc9d49
WIP clustal form
bobular Mar 19, 2024
1495c07
that's hopefully clustal sorted - but can't test with local ortho-site
bobular Mar 19, 2024
57f6a10
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Mar 20, 2024
8831695
improve 'must select two proteins' verbiage
bobular Mar 20, 2024
5c896a0
de-complicate .DataTable margin-bottom override
bobular Mar 20, 2024
fd446f8
rename TreeResponse to GroupTreeResponse
bobular Mar 20, 2024
a36c6ad
add PFam domain architecture column
bobular Mar 20, 2024
f489066
ugly search working as a demo on description column
bobular Mar 20, 2024
c06178d
add warning banner for data issue and tweak pfam column heading
bobular Mar 25, 2024
2599155
used RealTimeSearchBox and made regexps safer and reorganised so we c…
bobular Mar 25, 2024
7668085
more memo and remove some commented code
bobular Mar 25, 2024
95ac689
add tree filtering
bobular Mar 25, 2024
0a15ccb
tree highlighting works with filtering now, dependency issues fixed
bobular Mar 25, 2024
0c8639b
add core/peripheral filtering
bobular Mar 25, 2024
f137fa2
added pfam legend - needs wiring still
bobular Mar 25, 2024
b4e30ed
wired up pfam checkboxes to table search
bobular Mar 25, 2024
c97bcc1
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Mar 26, 2024
0599d1b
added the row count
bobular Mar 26, 2024
6bef0de
conditionally render pfam legend and add heading
bobular Mar 26, 2024
4f1e80e
Remove vert scrollbar from tidytree table
dmfalke Mar 27, 2024
8a27952
Merge branch 'main' into orthogroup-tree-table
bobular May 29, 2024
c0cb043
remove code that collapsed the main section of the orthogroup page
bobular May 29, 2024
3e47e2c
no longer request trees for 1 or 2 sequences; fix RowCounter props ch…
bobular May 29, 2024
40eacc1
fudge to sort table based on dodgy colon-containing full_ids
bobular Jun 4, 2024
8ff24e2
make tree darker and make tree/table check more robust
bobular Jun 6, 2024
fcdddbd
provide PFam descriptions in domain cartoon tooltips
bobular Jun 6, 2024
032c479
sort out row counts
bobular Jun 6, 2024
9f3d563
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Jun 6, 2024
7bf58f4
add better console logging for tree/table mismatches
bobular Jun 11, 2024
e6904a1
made tree-table comparison for console more robust
bobular Jun 11, 2024
06f4959
add inlineUseTooltips options prop but not working fully yet
bobular Jun 19, 2024
9ecec3d
attempted better handling of very large groups
bobular Jun 19, 2024
30da70a
looks good now
bobular Jun 21, 2024
443528c
removed full_id column (from display only) and added Accession aka se…
bobular Jun 24, 2024
e7abcb9
Merge pull request #1115 from VEuPathDB/mesa-inline-changes
bobular Jun 24, 2024
9567b62
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
dmfalke Jun 28, 2024
5de59a6
Use flex for label to allow for block children
dmfalke Jun 28, 2024
2e33989
Use SelectList for Pfam filter
dmfalke Jun 28, 2024
f33f711
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Jul 2, 2024
5e04d5f
Explicit empty PFam legend
bobular Jul 2, 2024
5a49184
Merge branch 'main' into orthogroup-tree-table
bobular Jul 2, 2024
5cf07bf
Use similar style for core/peripheral filter
dmfalke Jul 12, 2024
0cbb71d
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
dmfalke Jul 12, 2024
592ef2d
Merge branch 'orthogroup-tree-table' into orthogroup-tree-table__pfam…
dmfalke Jul 12, 2024
b316022
Add species filter to protein table
dmfalke Jul 16, 2024
a422072
prevent overflow in SelectTree button with many items selected; also …
bobular Jul 17, 2024
c50a85e
add shouldOnlyUpdateOnClose option to SelectTree
bobular Jul 17, 2024
96056a2
remove some unused imports
bobular Jul 17, 2024
8c05b0c
add MAX_SEQUENCES_FOR_TREE logic
bobular Jul 17, 2024
0620543
selected row highlighting
bobular Jul 17, 2024
871583e
tone down the row background color
bobular Jul 17, 2024
f00a872
Merge pull request #1140 from VEuPathDB/orthogroup-tree-table__pfam-f…
bobular Jul 18, 2024
6d50fca
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Jul 18, 2024
11deb34
don't indent search bar and filters
bobular Jul 19, 2024
a718914
add instantUpdate option to SelectList
bobular Jul 19, 2024
d168e75
Merge remote-tracking branch 'origin/orthogroup-tree-table' into orth…
bobular Jul 19, 2024
9c5ff46
revert taxon filter to instant-update
bobular Jul 19, 2024
de9d761
instantUpdate for core/peripheral filter
bobular Jul 19, 2024
9281471
Pfam architectures are now scaled by protein length
bobular Jul 19, 2024
789629b
removed core-only filter for larger groups
bobular Jul 19, 2024
209fd02
improved table sort and filter performance - added comments about fur…
bobular Aug 1, 2024
3874c5a
rename shouldOnlyUpdateOnClose to instantUpdate
bobular Aug 2, 2024
d45f975
remove an effect
bobular Aug 2, 2024
f9a19b7
Merge remote-tracking branch 'origin/orthogroup-tree-table' into orth…
bobular Aug 2, 2024
eb238e5
missed a setSelected and dependency
bobular Aug 2, 2024
66e13f2
final tweaks to button label behaviour
bobular Aug 2, 2024
969db0d
Merge pull request #1144 from VEuPathDB/ortho-instant-filters
bobular Aug 2, 2024
febb312
add reset button, revisit filter button layout
bobular Aug 3, 2024
58711a0
placeholder wrapper for image next to group stats
bobular Aug 9, 2024
5e310a1
restore the buttonless phyletic distribution
bobular Aug 9, 2024
700e277
improved comment/documentation
bobular Aug 9, 2024
3c75ebd
Merge pull request #1171 from VEuPathDB/ortho-restore-phyletic-section
bobular Aug 13, 2024
46d8b26
merge origin/main and resolve conflicts
bobular Aug 14, 2024
39da8f7
Merge branch 'orthogroup-tree-table' into ortho-stats-wrapper
bobular Aug 14, 2024
8c8f3a3
Adding update evalue histogram
Aug 15, 2024
704acd0
Merge remote-tracking branch 'origin/orthogroup-tree-table' into orth…
bobular Aug 16, 2024
15f0df3
static histogram image now shows, with elaborate width-setting for ca…
bobular Aug 16, 2024
eff237e
make caption rendering smoother - no horizontal shifting of the figure
bobular Aug 16, 2024
144c838
moved png file again
bobular Aug 16, 2024
65b065d
simplified to hardcoded dimensions
bobular Aug 16, 2024
0452f8d
Merge branch 'main' into orthogroup-tree-table
dmfalke Aug 21, 2024
9e6d939
Address typescript errors
dmfalke Aug 21, 2024
3a68137
Merge pull request #1169 from VEuPathDB/ortho-stats-wrapper
bobular Aug 27, 2024
7508ad7
remove taxon_abbrev column
bobular Aug 28, 2024
7f758f4
rename Taxon column to Clade
bobular Aug 28, 2024
0eb1a70
rename Species filter button to Organism
bobular Aug 28, 2024
c368e92
improve filter button layout, especially when buttons have expanded c…
bobular Aug 28, 2024
dd0c40a
fix Omit prop typo that wasn't detected because only consumer so far …
bobular Aug 29, 2024
d3f421b
main proteins table now has fully-fledged search box with column sele…
bobular Aug 29, 2024
6f0cad6
moved styling to .scss file
bobular Aug 29, 2024
0e09962
revert column changes now that model is updated OrthoMCLModel#5
bobular Aug 30, 2024
dacbd81
Merge pull request #1194 from VEuPathDB/ortho-table-tweaks
bobular Aug 30, 2024
4cce0b1
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
bobular Aug 30, 2024
c02d237
added new WDK record scope - record-collapsed
bobular Sep 7, 2024
5121654
added Dave's suggestions
bobular Sep 25, 2024
8b79cb6
Merge pull request #1199 from VEuPathDB/wdk-record-collapsed-scope
bobular Sep 25, 2024
506dd66
merge in npm action change
bobular Sep 25, 2024
07934e8
cherry picking missed this line
bobular Sep 26, 2024
85dc60e
Orthogroup tree table perf (#1233)
dmfalke Oct 18, 2024
d79d21c
Only call anchorNode.scrollIntoView() if the position has changed
dmfalke Oct 22, 2024
083d7e6
Update note to handle MIN_SEQUENCES_FOR_TREE
dmfalke Oct 22, 2024
fa46c14
useDeferredValue partially working
bobular Oct 22, 2024
4b73e5a
onSpeciesSelected wasn't stable, is now
bobular Oct 23, 2024
981507f
replace debouncing with deferred value for CheckboxTree searchTerm
bobular Oct 23, 2024
b1c0891
tidy up
bobular Oct 23, 2024
09d935b
new useDeferredState hook
bobular Oct 24, 2024
4638fed
Use fixed dimensions for organism filter of protein table
dmfalke Oct 24, 2024
8b024bc
Merge pull request #1243 from VEuPathDB/orthogroup-tree-table__useDef…
bobular Oct 24, 2024
355d5a4
the very basics
bobular Oct 28, 2024
f5ee686
straw man ready
bobular Oct 28, 2024
fccec4c
forgot the reset button
bobular Oct 28, 2024
ca400d5
DRYed up a bit
bobular Oct 28, 2024
ab88a2a
fixed the edge case as described in PR, improved search box responsiv…
bobular Oct 29, 2024
2f60de7
text search field selectors now more responsive
bobular Oct 29, 2024
72e4740
added asterisk and improved filter positioning
bobular Oct 31, 2024
c22b905
fixed broken logic with corePeripheral filter
bobular Oct 31, 2024
f6f9153
memoized rowsByAccession and mesaState and fixed some logic errors
bobular Oct 31, 2024
337348e
memoize treeProps just for tidiness
bobular Oct 31, 2024
2520735
replaced the key hack with ref approach
bobular Oct 31, 2024
07a9a6d
Merge pull request #1252 from VEuPathDB/orthogroup-tree-table__protei…
bobular Oct 31, 2024
4e825c0
Orthogroup tree table - tooltips (#1253)
dmfalke Oct 31, 2024
5e04a76
new warning added, no new component, sorry
bobular Nov 1, 2024
bbd65ea
improved tree error warning with link to contact form
bobular Nov 1, 2024
564f453
use display names in SelectList button labels
bobular Nov 1, 2024
6907790
standardised search behaviour with help text
bobular Nov 1, 2024
5bd7d1c
fixed broken protein popover with useImperativeHandle deps array
bobular Nov 1, 2024
494e55d
Merge remote-tracking branch 'origin/orthogroup-tree-table' into orth…
bobular Nov 1, 2024
25def36
protein filter and paged table interaction fixed
bobular Nov 1, 2024
075fff3
fixed label display issue in EDA
bobular Nov 2, 2024
470ff89
Convert to function component with simple debounce logic using setTim…
dmfalke Nov 2, 2024
07a8363
Make callbacks stable across renders
dmfalke Nov 2, 2024
0c382ac
Merge remote-tracking branch 'origin/orthogroup-tree-table' into orth…
bobular Nov 5, 2024
997837d
target _blank
bobular Nov 5, 2024
2e76120
fix import path
bobular Nov 5, 2024
6b8f7f4
show table for 1 or 2 protein groups, not the error. Changes to Check…
bobular Nov 5, 2024
5deced2
changes to CheckboxList/SelectList generics 2 of 2
bobular Nov 5, 2024
4557b84
reset button also cancels text search
bobular Nov 5, 2024
2fa75aa
error banner was showing instead of loading spinner for large groups,…
bobular Nov 5, 2024
7ef7b0e
use const for min seqs in tree
bobular Nov 6, 2024
d24c342
Merge pull request #1259 from VEuPathDB/orthogroup-tree-table__1254-f…
bobular Nov 6, 2024
81ed37c
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
dmfalke Nov 7, 2024
655c269
Remove style override that is no longer necessary
dmfalke Nov 7, 2024
4a83f7d
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
dmfalke Nov 10, 2024
8abb5d6
Merge remote-tracking branch 'origin/main' into orthogroup-tree-table
dmfalke Nov 14, 2024
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
195 changes: 64 additions & 131 deletions packages/libs/wdk-client/src/Components/SearchBox/RealTimeSearchBox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import HelpIcon from '../../Components/Icon/HelpIcon';
import { debounce } from 'lodash';
import React, { Component } from 'react';
import React, { useEffect, useState } from 'react';
import '../../Components/SearchBox/RealTimeSearchBox.css';
// use safeHtml for enabling html (e.g., italic) at helpText
import { safeHtml } from '../../Utils/ComponentUtils';
Expand Down Expand Up @@ -43,138 +42,76 @@ type Props = {
cancelBtnRightMargin?: React.CSSProperties['right'];
};

type State = {
/** local reference to search term for rendering */
searchTerm: string;
};

/**
* A 'real time' search box. Changes are throttled by 'debounce' so text
* change events are delayed to prevent repetitive costly searching. Useful
* when expensive operations are performed (e.g. search) in real time as the
* user types in the box. Also provides reset button to clear the box.
*/
export default class RealTimeSearchBox extends Component<Props, State> {
static defaultProps = {
className: '',
autoFocus: false,
searchTerm: '',
onSearchTermChange: () => {},
placeholderText: '',
helpText: '',
delayMs: 250,
iconName: 'search',
};

emitSearchTermChange = debounce((searchTerm: string) =>
this.props.onSearchTermChange!(searchTerm)
);

input: HTMLInputElement | null = null;

constructor(props: Props) {
super(props);
this.handleSearchTermChange = this.handleSearchTermChange.bind(this);
this.handleResetClick = this.handleResetClick.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
this.state = { searchTerm: this.props.searchTerm! };
}

componentDidMount() {
if (this.props.autoFocus && this.input != null) this.input.autofocus = true;
}

componentWillReceiveProps(nextProps: Props) {
if (nextProps.searchTerm !== this.state.searchTerm) {
this.setState({ searchTerm: nextProps.searchTerm! }, () =>
this.emitSearchTermChange(nextProps.searchTerm!)
);
export default function RealTimeSearchBox(props: Props) {
const {
className,
helpText,
placeholderText,
autoFocus,
iconName,
cancelBtnRightMargin,
onSearchTermChange,
delayMs,
} = props;
const [searchTerm, setSearchTerm] = useState(props.searchTerm ?? '');
const isActiveSearch = searchTerm.length > 0;
const activeModifier = isActiveSearch ? 'active' : 'inactive';
const helpModifier = helpText ? 'withHelp' : '';

useEffect(() => {
if (onSearchTermChange) {
const id = setTimeout(onSearchTermChange, 250, searchTerm);
return function cancel() {
clearTimeout(id);
};
}
}

componentWillUnmount() {
this.emitSearchTermChange.cancel();
}

/**
* Update the state of this Component, and call debounced onSearchTermSet
* callback.
*/
handleSearchTermChange(e: React.ChangeEvent<HTMLInputElement>) {
let searchTerm = e.currentTarget.value;
this.setState({ searchTerm });
this.emitSearchTermChange(searchTerm);
}

/**
* Reset input if Escape is pressed.
*/
handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {
if (e.key === 'Escape') {
this.setState({ searchTerm: '' });
this.props.onSearchTermChange!('');
e.stopPropagation();
}
}

/**
* Update the state of this Component, and call onSearchTermSet callback
* immediately.
*/
handleResetClick() {
this.setState({ searchTerm: '' });
this.props.onSearchTermChange!('');
}

render() {
let {
className,
helpText,
placeholderText,
autoFocus,
iconName,
cancelBtnRightMargin,
} = this.props;
let searchTerm = this.state.searchTerm;
let isActiveSearch = searchTerm.length > 0;
let activeModifier = isActiveSearch ? 'active' : 'inactive';
let helpModifier = helpText ? 'withHelp' : '';
return (
<div
className={
classname(baseClassName, activeModifier, helpModifier) +
' ' +
classname(className!, activeModifier, helpModifier)
}
>
<label className={labelClassName}>
<input
type="search"
autoFocus={autoFocus}
ref={(node) => (this.input = node)}
className={inputClassName}
onChange={this.handleSearchTermChange}
onKeyDown={this.handleKeyDown}
placeholder={placeholderText}
value={searchTerm}
/>
<i className={`fa fa-${iconName} ${searchIconClassName}`} />
<button
className={cancelBtnClassName}
style={
cancelBtnRightMargin ? { right: cancelBtnRightMargin } : undefined
}, [delayMs, searchTerm, onSearchTermChange]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Not using delayMs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not using delayMs?

We should fix and test this before merging, @dmfalke


return (
<div
className={
classname(baseClassName, activeModifier, helpModifier) +
' ' +
classname(className!, activeModifier, helpModifier)
}
>
<label className={labelClassName}>
<input
type="search"
autoFocus={autoFocus}
className={inputClassName}
onChange={(e) => setSearchTerm(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Escape') {
e.stopPropagation();
setSearchTerm('');
}
type="button"
onClick={this.handleResetClick}
>
<i className={'fa fa-close ' + cancelIconClassName} />
</button>
</label>
{/* use safeHtml for helpText to allow italic */}
{!helpText ? null : <HelpIcon>{safeHtml(helpText)}</HelpIcon>}
</div>
);
}
}}
placeholder={placeholderText}
value={searchTerm}
/>
<i className={`fa fa-${iconName} ${searchIconClassName}`} />
<button
className={cancelBtnClassName}
style={
cancelBtnRightMargin ? { right: cancelBtnRightMargin } : undefined
}
type="button"
onClick={() => setSearchTerm('')}
>
<i className={'fa fa-close ' + cancelIconClassName} />
</button>
</label>
{/* use safeHtml for helpText to allow italic */}
{!helpText ? null : <HelpIcon>{safeHtml(helpText)}</HelpIcon>}
</div>
);
}

/**
Expand All @@ -185,12 +122,8 @@ export default class RealTimeSearchBox extends Component<Props, State> {
* @example
* let allClassNames = className('Thing', 'active', 'blue');
* //=> 'Thing Thing__active Thing__blue'
*
* @param {string} base
* @param {string} ...modifiers
* @returns {string}
*/
function classname(base: string, ...modifiers: string[]) {
function classname(base: string, ...modifiers: string[]): string {
return modifiers.reduce((classnames, modifier) => {
return modifier ? classnames + ' ' + base + '__' + modifier : classnames;
}, base);
Expand Down