bimberlab / discvr-components Goto Github PK
View Code? Open in Web Editor NEWThis holds npm packages designed to support DISCVR web applications
License: Apache License 2.0
This holds npm packages designed to support DISCVR web applications
License: Apache License 2.0
We should research packages to help us develop and test React components in a vacuum prior to integrating them with our LabKey modules. The workflow I'm aware of is the following:
Evaluate that workflow and those packages, and see if there are newer or more fully-featured alternatives.
Research:
Implementation:
We anticipate to begin with these packages:
We may eventually also want project-specific repos, such as mgap or mcc.
We need a solution for publishing/hosting NPM packages, with a focus on reliability, ease of use, and integration with GitHub Actions. We should be able to use an Action to run our testing/linting setup on every commit to any branch, and on a commit to main publish a package to our package repository of choice. I'm aware of two options:
Per the GitHub docs, I think the expected workflow is an Action that publishes to NPM, but we need to do more research on if that's a good solution. In particular, determining how to do semantic versioning properly and documenting the process in the Wiki will be important.
We have a page that displays data in a table format. You can filter the table using a field + operator + value UI, and you can have multiple filters. An example of a filter for "Allele Frequency > 0.2":
The rendered JSX for the Value input changes depending on the type of Field you're filtering on. In the vast majority of cases, it's just a simple MUI TextField, like the "Allele Frequency" case. However, for fields with a defined set of possible values, like "Samples With Variant" it'll render a Select:
If there are a lot of possible values, we render a more complex component -- an AsyncSelect from react-select:
The exact specifics vary depending on the Field and Operator. Our goal is to extract these various cases into a component with a clean interface and put it in discvr-components, as an example use-case for our monorepo.
The file containing the filter form is here. The lines that control the Value portion of the form are highlighted. In short:
As you can see, there's a bit of logic behind how we determine which version of the Value input to render. This logic is based on a bunch of external data, i.e. the current filter, the fieldTypeInfo object, and others. In order to refactor this out into a separate component, we need to identify what values we'd need to pass into the component as props in order for all the logic to work. I think the prop list looks like:
index
, which refers to the position of this filter in the filter listfilter
, so that lines like filter.operator === "in set"
can workfieldTypeInfo
, for fieldTypeInfo.find(obj => obj.name === filter.field)?.allowableValues?.length > 10
highlightedInputs
, for the various highlightedInputs[index]
callshandleFilterChange
for all the onChange callbacksSo, we should produce something that looks like
const ValueComponent = ({ index, filter, fieldTypeInfo, highlightedInputs, handleFilterChange }) => {<a lot of JSX>}
such that we can delete the aforementioned lines of code and replace it with this new ValueComponent. We should identify how to test/build this as well.
We should research how to do NPM monorepo management. The library I'm aware of to automate this is Turborepo. Evaluate any other options in the space that can be easily deployed and incrementally adopted. A library of some kind is preferable to npm/yarn workspaces. If Turborepo is what we end up going with, you should familiarize yourself with it.
After determining which framework we want to use per #3, we should push the configuration/code for a monorepo management solution to a feature branch on this repo, with stubs for three packages named the following:
These will be empty for now, but later on we'll determine what to pull out of our main repo and put in them.
In https://github.com/BimberLab/DiscvrLabKeyModules, we use React for page layout/behavior, and MUI v4 for styling. You should familiarize yourself with React, and briefly with some MUI concepts.
React's quickstart teaches you about components, JSX, and state management. We heavily use hooks for state management, so understanding them will be important. We mostly use functional components, which is React's default component format, but it's worth at least knowing about class components since you'll sometimes see those as well.
We use MUI components rather than default browser buttons, select boxes, etc. MUI also controls the layout of our webpages. In general MUI code should be reasonably readable without deep knowledge of the library, but it's worth skimming the getting started docs so you know how it works differently from normal CSS.
You should get familiarized with NPM basics, specifically creating an NPM package with a package.json. We've enumerated here and in other issues the basic workflow we're expecting to implement:
We should be able to answer the question: are we missing anything critical about maintaining or developing NPM packages?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.