Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #908 from chgibb/master
0.12.0-beta.3
- Loading branch information
Showing
24 changed files
with
1,879 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
./node_modules/.bin/eslint "src/**/*.ts" --cache --fix | ||
./node_modules/.bin/eslint "src/**/*.tsx" --fix --cache-location ".eslintcache-tsx" | ||
|
||
./node_modules/.bin/eslint "src/**/*.tsx" --cache --fix | ||
./node_modules/.bin/eslint "src/**/*.ts" --fix --cache-location ".eslintcache-ts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const Input : typeof import("@material-ui/core/Input").default = require("@material-ui/core/Input").default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const InputLabel : typeof import("@material-ui/core/InputLabel").default = require("@material-ui/core/InputLabel").default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as React from "react"; | ||
|
||
import {FormControl} from "./formControl"; | ||
import {InputLabel} from "./inputLabel"; | ||
|
||
const MuiOutlinedInput: typeof import("@material-ui/core/OutlinedInput").default = require("@material-ui/core/OutlinedInput").default; | ||
|
||
type MuiOutlinedInputProps = import("@material-ui/core/OutlinedInput/index").OutlinedInputProps; | ||
|
||
export interface OutlinedInputProps { | ||
label: string; | ||
inputProps: Omit<MuiOutlinedInputProps, "labelWidth">; | ||
} | ||
|
||
export function OutlinedInput(props: OutlinedInputProps): JSX.Element | ||
{ | ||
const [labelWidth, setLabelWidth] = React.useState(0); | ||
const labelRef = React.useRef<HTMLLabelElement>(null); | ||
|
||
React.useEffect(() => | ||
{ | ||
setLabelWidth(labelRef.current!.offsetWidth); | ||
}, []); | ||
|
||
return ( | ||
<div style={{ | ||
display: "flex", | ||
flexWrap: "wrap" | ||
}}> | ||
<FormControl variant="outlined"> | ||
<InputLabel ref={labelRef}> | ||
{props.label} | ||
</InputLabel> | ||
<MuiOutlinedInput | ||
{...props.inputProps} | ||
|
||
labelWidth={labelWidth} | ||
/> | ||
</FormControl> | ||
</div> | ||
); | ||
} |
133 changes: 133 additions & 0 deletions
133
src/req/renderer/containers/charts/QCStatusDoughnut.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import * as React from "react"; | ||
import {Chart} from "chart.js"; | ||
|
||
import {Fastq} from "../../../fastq"; | ||
|
||
export interface QCStatusDoughnutProps { | ||
fastqs: Array<Fastq>; | ||
height: string; | ||
width: string; | ||
marginBottom: string; | ||
} | ||
|
||
export class QCStatusDoughnut extends React.Component<QCStatusDoughnutProps, {}> | ||
{ | ||
private chartRef = React.createRef<HTMLCanvasElement>(); | ||
private chart: Chart | undefined; | ||
|
||
public colour1: string; | ||
public colour2: string; | ||
public colour3: string; | ||
public colour4: string; | ||
|
||
public constructor(props: QCStatusDoughnutProps) | ||
{ | ||
super(props); | ||
|
||
const randomColour = require("randomcolor"); | ||
|
||
this.colour1 = randomColour(); | ||
this.colour2 = randomColour(); | ||
this.colour3 = randomColour(); | ||
this.colour4 = randomColour(); | ||
} | ||
|
||
public updateChart() | ||
{ | ||
let numPass = 0; | ||
let numWarn = 0; | ||
let numFail = 0; | ||
let numNoData = 0; | ||
|
||
if (this.props.fastqs) | ||
{ | ||
for (let i = 0; i != this.props.fastqs.length; ++i) | ||
{ | ||
|
||
if (this.props.fastqs[i].QCData.summary && this.props.fastqs[i].QCData.summary.length > 0) | ||
{ | ||
for (let j = 0; j != this.props.fastqs[i].QCData.summary.length; ++j) | ||
{ | ||
let status = this.props.fastqs[i].QCData.summary[j].status; | ||
console.log(status); | ||
if (status == "pass") | ||
numPass++; | ||
else if (status == "warn") | ||
numWarn++; | ||
else if (status == "fail") | ||
numFail++; | ||
else if (status == "No Data") | ||
numNoData++; | ||
else if (status === undefined) | ||
numNoData++; | ||
} | ||
} | ||
else | ||
numNoData += 5; | ||
} | ||
|
||
if (this.chartRef.current) | ||
{ | ||
if (!this.chart) | ||
{ | ||
this.chart = new Chart(this.chartRef.current.getContext("2d")!, { | ||
type: "doughnut", | ||
options: { | ||
animation: { | ||
animateRotate: true | ||
} | ||
} | ||
}); | ||
} | ||
|
||
let data = { | ||
datasets: [ | ||
{ | ||
data: [numPass, numWarn, numFail, numNoData], | ||
backgroundColor: [ | ||
this.colour1, | ||
this.colour2, | ||
this.colour3, | ||
this.colour4 | ||
] | ||
} | ||
], | ||
labels: [ | ||
"Pass", | ||
"Warning", | ||
"Failure", | ||
"No Data" | ||
] | ||
}; | ||
|
||
console.log(data); | ||
this.chart.data = data; | ||
this.chart.update(); | ||
} | ||
} | ||
} | ||
|
||
public componentDidUpdate() | ||
{ | ||
this.updateChart(); | ||
} | ||
|
||
public componentDidMount() | ||
{ | ||
this.updateChart(); | ||
} | ||
|
||
public render(): JSX.Element | ||
{ | ||
return ( | ||
<div style={{ | ||
position: "relative", | ||
height: this.props.height, | ||
width: this.props.width, | ||
marginBottom: this.props.marginBottom | ||
}}> | ||
<canvas ref={this.chartRef}></canvas> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.