Skip to content

Commit 69c2181

Browse files
authored
chore: bump repo review to 0.6.1 (#163)
1 parent 205fb5f commit 69c2181

2 files changed

Lines changed: 61 additions & 33 deletions

File tree

docs/_includes/head_custom.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{%- if page.interactive_repo_review %}
44

55
<script
6-
src="https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"
6+
src="https://cdn.jsdelivr.net/pyodide/v0.23.2/full/pyodide.js"
77
crossorigin
88
></script>
99

@@ -16,7 +16,7 @@
1616
crossorigin
1717
></script>
1818
<script
19-
src="https://unpkg.com/@mui/material@v5.6.1/umd/material-ui.production.min.js"
19+
src="https://unpkg.com/@mui/material@v5.13.3/umd/material-ui.production.min.js"
2020
crossorigin
2121
></script>
2222

docs/assets/js/webapp.js

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ function Results(props) {
3939
for (const key in props.results) {
4040
const inner_results = props.results[key];
4141
const results_components = inner_results.map((result) => {
42+
const text_color =
43+
result.state === false
44+
? "error.main"
45+
: result.state === true
46+
? "text.primary"
47+
: "info.main";
4248
const details =
4349
result.state === false ? (
4450
<span dangerouslySetInnerHTML={{ __html: result.err_msg }} />
@@ -48,21 +54,23 @@ function Results(props) {
4854
? "error"
4955
: result.state === true
5056
? "success"
51-
: "warning";
57+
: "info";
5258
const icon = (
5359
<MaterialUI.Icon color={color}>
5460
{result.state === false
55-
? "error"
61+
? "report"
5662
: result.state === true
57-
? "check_circle"
58-
: "warning"}
63+
? "check_box"
64+
: "info"}
5965
</MaterialUI.Icon>
6066
);
67+
6168
const skipped = (
6269
<MaterialUI.Typography
6370
sx={{ display: "inline" }}
6471
component="span"
6572
variant="body2"
73+
color="text.disabled"
6674
>
6775
{" [skipped]"}
6876
</MaterialUI.Typography>
@@ -73,11 +81,19 @@ function Results(props) {
7381
sx={{ display: "inline" }}
7482
component="span"
7583
variant="body2"
76-
color="text.primary"
84+
color={text_color}
7785
>
7886
{result.name + ": "}
7987
</MaterialUI.Typography>
80-
<React.Fragment>{result.description}</React.Fragment>
88+
<React.Fragment>
89+
<MaterialUI.Typography
90+
sx={{ display: "inline" }}
91+
component="span"
92+
color={text_color}
93+
>
94+
{result.description}
95+
</MaterialUI.Typography>
96+
</React.Fragment>
8197
{result.state === undefined && skipped}
8298
</React.Fragment>
8399
);
@@ -92,7 +108,9 @@ function Results(props) {
92108
output.push(
93109
<li key={`section-${key}`}>
94110
<ul>
95-
<MaterialUI.ListSubheader>{key}</MaterialUI.ListSubheader>
111+
<MaterialUI.ListSubheader>
112+
{props.families[key]}
113+
</MaterialUI.ListSubheader>
96114
{results_components}
97115
</ul>
98116
</li>
@@ -114,7 +132,7 @@ async function prepare_pyodide() {
114132
await pyodide.loadPackage("micropip");
115133
await pyodide.runPythonAsync(`
116134
import micropip
117-
await micropip.install(["scikit_hep_repo_review==0.5.0"])
135+
await micropip.install(["scikit_hep_repo_review==0.6.1"])
118136
`);
119137
return pyodide;
120138
}
@@ -177,19 +195,18 @@ class App extends React.Component {
177195
});
178196
const state = this.state;
179197
pyodide_promise.then((pyodide) => {
180-
var results_dict;
198+
var families_checks;
181199
try {
182-
results_dict = pyodide.runPython(`
183-
from pyodide.http import open_url
184-
from scikit_hep_repo_review.processor import process
185-
from scikit_hep_repo_review.ghpath import GHPath
200+
families_checks = pyodide.runPython(`
201+
from pyodide.http import open_url
202+
from scikit_hep_repo_review.processor import process
203+
from scikit_hep_repo_review.ghpath import GHPath
186204
187-
GHPath.open_url = staticmethod(open_url)
205+
GHPath.open_url = staticmethod(open_url)
188206
189-
package = GHPath(repo="${state.repo}", branch="${state.branch}")
190-
results_dict = process(package)
191-
results_dict
192-
`);
207+
package = GHPath(repo="${state.repo}", branch="${state.branch}")
208+
process(package)
209+
`);
193210
} catch (e) {
194211
if (e.message.includes("KeyError: 'tree'")) {
195212
this.setState({
@@ -206,27 +223,35 @@ class App extends React.Component {
206223
return;
207224
}
208225

226+
const families_dict = families_checks.get(0);
227+
const results_list = families_checks.get(1);
228+
209229
const results = {};
210-
for (const res of results_dict) {
211-
const vals = results_dict.get(res);
212-
const inner_results = [];
213-
for (const val of vals) {
214-
inner_results.push({
215-
name: val.name.toString(),
216-
description: val.description.toString(),
217-
state: val.result,
218-
err_msg: val.err_markdown().toString(),
219-
});
220-
}
221-
results[res] = inner_results;
230+
const families = {};
231+
for (const val of families_dict) {
232+
results[val] = [];
233+
families[val] = families_dict.get(val).get("name");
234+
}
235+
console.log(families);
236+
for (const val of results_list) {
237+
results[val.family].push({
238+
name: val.name.toString(),
239+
description: val.description.toString(),
240+
state: val.result,
241+
err_msg: val.err_markdown().toString(),
242+
});
222243
}
223244

224245
this.setState({
225246
results: results,
247+
families: families,
226248
msg: `Results for ${state.repo}@${state.branch}`,
227249
progress: false,
228250
err_msg: "",
229251
});
252+
253+
results_list.destroy();
254+
families_dict.destroy();
230255
});
231256
}
232257

@@ -305,7 +330,10 @@ class App extends React.Component {
305330
</MaterialUI.Typography>
306331
)}
307332
</MaterialUI.Box>
308-
<Results results={this.state.results} />
333+
<Results
334+
results={this.state.results}
335+
families={this.state.families}
336+
/>
309337
</MaterialUI.Paper>
310338
</MaterialUI.Box>
311339
</MyThemeProvider>

0 commit comments

Comments
 (0)