Skip to content

Commit b91ebc4

Browse files
author
Marcus Kessel
committed
refactor results
1 parent d3959bb commit b91ebc4

File tree

81 files changed

+490
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+490
-261
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// src/components/CodeUnitTable.tsx
2+
import React, { useState } from "react";
3+
import {
4+
Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, IconButton, Collapse, Box, Typography,
5+
Stack,
6+
Chip
7+
} from "@mui/material";
8+
import { KeyboardArrowDown, KeyboardArrowUp } from "@mui/icons-material";
9+
import { CodeSnippetCard } from "@site/src/components/CodeSnippet/CodeSnippetCard";
10+
import { CodeSnippet } from "@site/src/services/models";
11+
import CodeIcon from "@mui/icons-material/Code";
12+
import PackageIcon from "@mui/icons-material/Archive";
13+
14+
// Accept codeUnits as prop
15+
type Props = {
16+
codeUnits: CodeSnippet[]
17+
}
18+
19+
export const CodeUnitTable: React.FC<Props> = ({ codeUnits }) => {
20+
const [openRow, setOpenRow] = useState<number | null>(null);
21+
22+
return (
23+
<TableContainer component={Paper}>
24+
<Table size="small" aria-label="Code Units table">
25+
<TableHead>
26+
<TableRow>
27+
<TableCell />
28+
<TableCell>Name</TableCell>
29+
{/* Add more TableCell for extra fields */}
30+
</TableRow>
31+
</TableHead>
32+
<TableBody>
33+
{codeUnits.map((unit, idx) => (
34+
<React.Fragment key={unit.id}>
35+
<TableRow hover>
36+
<TableCell width={48}>
37+
<IconButton
38+
size="small"
39+
onClick={() => setOpenRow(openRow === idx ? null : idx)}
40+
>
41+
{openRow === idx ? <KeyboardArrowUp /> : <KeyboardArrowDown />}
42+
</IconButton>
43+
</TableCell>
44+
<TableCell><Typography sx={{ fontWeight: 'bold' }}>
45+
{unit.name}
46+
</Typography><Stack direction="row" spacing={1}>
47+
<Chip icon={<PackageIcon />} size="small" label={unit.packagename} />
48+
<Chip
49+
icon={<CodeIcon />}
50+
size="small"
51+
color="primary"
52+
label={unit.groupId + ":" + unit.artifactId}
53+
/>
54+
<Chip size="small" label={unit.version} />
55+
{/* <Chip
56+
label={snippet.dataSource?.toUpperCase()}
57+
size="small" /> */}
58+
</Stack></TableCell>
59+
{/* More fields */}
60+
</TableRow>
61+
<TableRow>
62+
<TableCell colSpan={2} style={{ padding: 0, border: 0 }}>
63+
<Collapse in={openRow === idx} timeout="auto" unmountOnExit>
64+
<Box sx={{ margin: 2 }}>
65+
<CodeSnippetCard snippet={unit} />
66+
{/* You can add more content here */}
67+
</Box>
68+
</Collapse>
69+
</TableCell>
70+
</TableRow>
71+
</React.Fragment>
72+
))}
73+
</TableBody>
74+
</Table>
75+
</TableContainer>
76+
);
77+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// src/components/TestTable.tsx
2+
import React, { useState } from "react";
3+
import {
4+
Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, IconButton, Collapse, Box, Typography
5+
} from "@mui/material";
6+
import { KeyboardArrowDown, KeyboardArrowUp } from "@mui/icons-material";
7+
import Code from "@mui/icons-material/Code";
8+
import CodeBlock from "@theme/CodeBlock";
9+
import ActuationSheet from "@site/src/components/Sheet/ActuationSheet";
10+
import SheetService from "@site/src/components/Sheet/SheetService";
11+
12+
interface TestItem {
13+
signature: string;
14+
ssn?: boolean;
15+
body?: string;
16+
/* ... */
17+
}
18+
19+
type Props = {
20+
tests: TestItem[];
21+
};
22+
23+
export const TestTable: React.FC<Props> = ({ tests }) => {
24+
const [openRow, setOpenRow] = useState<number | null>(null);
25+
26+
return (
27+
<TableContainer component={Paper} sx={{ my: 2 }}>
28+
<Table size="small" aria-label="Tests Table">
29+
<TableHead>
30+
<TableRow>
31+
<TableCell />
32+
<TableCell>Signature</TableCell>
33+
<TableCell>Type</TableCell>
34+
</TableRow>
35+
</TableHead>
36+
<TableBody>
37+
{tests.map((test, idx) => (
38+
<React.Fragment key={test.signature + idx}>
39+
<TableRow hover>
40+
<TableCell>
41+
<IconButton
42+
size="small"
43+
onClick={() => setOpenRow(openRow === idx ? null : idx)}
44+
>
45+
{openRow === idx ? <KeyboardArrowUp /> : <KeyboardArrowDown />}
46+
</IconButton>
47+
</TableCell>
48+
<TableCell>{test.signature}</TableCell>
49+
<TableCell>{test.ssn ? "SSN" : "Code"}</TableCell>
50+
</TableRow>
51+
<TableRow>
52+
<TableCell colSpan={3} style={{ padding: 0, border: 0 }}>
53+
<Collapse in={openRow === idx} timeout="auto" unmountOnExit>
54+
<Box sx={{ margin: 2 }}>
55+
<Typography variant="subtitle2" sx={{ mb: 1 }}>
56+
{test.ssn ? "Actuation Sheet" : "Test Implementation"}
57+
</Typography>
58+
{test.ssn
59+
? <ActuationSheet sheetSignature={test.signature} sheetData={SheetService.parseActuationSheet(test)} implementation="" />
60+
: <CodeBlock language="java">{test.body}</CodeBlock>
61+
}
62+
</Box>
63+
</Collapse>
64+
</TableCell>
65+
</TableRow>
66+
</React.Fragment>
67+
))}
68+
</TableBody>
69+
</Table>
70+
</TableContainer>
71+
);
72+
}

lasso/src/components/SrmViewer/ClusteredSRMAccordionViewer.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,14 @@ SELECT count(*) AS cluster_size, list(SYSTEMID) AS cluster_implementations, * EX
479479
...sortedImpls.map((impl) => {
480480
const implKey = `${impl.id}_${impl.variantId}_${impl.adapterId}`;
481481
const meta = implMeta[implKey];
482-
const codeUnit = getCodeCandidate(impl.id);
482+
// Try to resolve code candidate for link (safe check)
483+
let cand;
484+
try {
485+
cand = getCodeCandidate(impl.id); // "getCodeCandidate" in scope
486+
} catch {
487+
cand = undefined;
488+
}
489+
483490
return {
484491
field: implKey,
485492
headerName: impl.id,
@@ -500,7 +507,7 @@ SELECT count(*) AS cluster_size, list(SYSTEMID) AS cluster_implementations, * EX
500507
}}
501508
title="Show details for this implementation"
502509
>
503-
{impl.id}
510+
{cand ? cand.name : impl.id}
504511
</Box>
505512
<Stack direction="row" spacing={0.5}>
506513
{meta.isOracle && (
@@ -535,14 +542,14 @@ SELECT count(*) AS cluster_size, list(SYSTEMID) AS cluster_implementations, * EX
535542
setGridRows(rows);
536543
setGridCols(columns);
537544

538-
}, [clusters]);
545+
}, [clusters, queryResponse]);
539546

540547
// ----------- END ORACLE CLUSTER MATRIX LOGIC -----------
541548
// ----------- RENDER -----------
542549
return (
543550
<Box sx={{ p: 2 }}>
544551
<Typography variant="h5" mb={2}>
545-
Behavioral Clustering (Implementations by Abstraction)
552+
Behavioral Clustering (by Abstraction)
546553
<Typography variant="h6" component="div">Clusters implementations by their exhibited run-time behavior (based on output SRM)</Typography>
547554
</Typography>
548555
{/* <Typography>
@@ -608,7 +615,6 @@ SELECT count(*) AS cluster_size, list(SYSTEMID) AS cluster_implementations, * EX
608615
<DataGrid
609616
rows={gridRows}
610617
columns={gridCols}
611-
hideFooter
612618
density="compact"
613619
getRowId={row => row.id}
614620
getRowClassName={params =>

lasso/src/components/SrmViewer/TestClusteredSRMAccordionViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ from tdse_srm.parquet as tbl1 where TYPE = 'value' ${abstractionFilter ? `AND AB
291291
return (
292292
<Box sx={{ p: 2 }}>
293293
<Typography variant="h5" mb={2}>
294-
Test Clustering (by Abstraction)
294+
Test Output Clustering (by Abstraction)
295295
<Typography variant="h6" component="div">Identifies most frequent outputs that may serve as oracle values (based on output SRM)</Typography>
296296
</Typography>
297297

lasso/src/pages/index.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434

3535
.screenshot {
36-
width: 300px;
36+
width: 150px;
3737
align-items: center;
3838
}
3939

lasso/src/pages/index.tsx

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ function HomepageHeader() {
9595
);
9696
}
9797

98+
// You can customize this value
99+
const featuredSearchUrl = 'lasso/result?executionId=69184769-d4c2-43d0-a101-987e5c30d674';
100+
const featuredSearchTitle = 'LSL Study Pipelines in Action';
101+
const featuredSearchDesc = 'Explore LSL pipeline results';
102+
98103
export default function Home(): JSX.Element {
99104
const { siteConfig } = useDocusaurusContext();
100105

@@ -133,29 +138,92 @@ export default function Home(): JSX.Element {
133138
</section>
134139

135140
<section>
136-
<br/>
137141
<div className="container padding--sm">
138142
<div className="text--center">
139143
<Heading as="h2">Try LASSO in 5 Minutes</Heading>
140144
</div>
141145
<div className="row margin--lg padding--lg shadow--md">
142-
<div className="row">
143-
<div className={clsx('col col--10')}>
144-
<div>
145-
<p>To get started, run the following two commands in a local directory on your machine (requires <a href="https://docs.docker.com/compose/">docker compose</a>):</p>
146-
<CodeBlock
147-
language="bash">
148-
{`curl https://raw.githubusercontent.com/SoftwareObservatorium/lasso/refs/heads/develop/docker/compose/docker-compose-embedded.yml -o docker-compose.yml
149-
docker compose up
150-
`}
151-
</CodeBlock>
152-
<p>Wait until all services started (LASSO platform, Code Search Index and Artifact Repository) and then open LASSO's dashboard at <a href="http://localhost:10222/webui/">http://localhost:10222/webui/</a> (login: admin / admin123). See <a href="./docs/quickstart/scenario">5 Minute Tutorial</a> for details, and <a href="./labs">Labs (Playground)</a> for more options.</p>
146+
<div className={clsx('col col--10 col--offset-1')}>
147+
<p>
148+
To get started, run the following two commands in a local directory on your machine (requires{' '}
149+
<a href="https://docs.docker.com/compose/">docker compose</a>):
150+
</p>
151+
<div className="codeBlockWrapper">
152+
<CodeBlock language="bash">
153+
{`curl https://raw.githubusercontent.com/SoftwareObservatorium/lasso/refs/heads/develop/docker/compose/docker-compose-embedded.yml -o docker-compose.yml
154+
docker compose up`}
155+
</CodeBlock>
156+
</div>
157+
<p>
158+
Wait until all services started (LASSO platform, Code Search Index and Artifact Repository) and then open LASSO's dashboard at{' '}
159+
<a href="http://localhost:10222/webui/">http://localhost:10222/webui/</a> (login: admin / admin123).
160+
See <a href="./docs/quickstart/scenario">5 Minute Tutorial</a> for details, and{' '}
161+
<a href="./labs">Labs (Playground)</a> for more options.
162+
</p>
163+
164+
{/* --- "Eye-catcher" Card Section --- */}
165+
<div className="featured-search-card margin-top--lg margin-bottom--lg">
166+
<div className="featured-search-card-header">
167+
168+
Example Run
169+
</div>
170+
<div className="featured-search-card-body">
171+
<div className="featured-search-title">{featuredSearchTitle}</div>
172+
<div className="featured-search-desc">{featuredSearchDesc}</div>
173+
<a
174+
className="button button--primary"
175+
href={featuredSearchUrl}
176+
target="_blank"
177+
rel="noopener noreferrer"
178+
style={{ marginTop: "1em" }}>
179+
View Pipeline Results
180+
</a>
153181
</div>
154182
</div>
183+
<style>{`
184+
.featured-search-card {
185+
border: 2px solid #0075FF;
186+
border-radius: 0.7em;
187+
background: #F1F7FF;
188+
text-align: center;
189+
padding: 2em 1em;
190+
box-shadow: 0 2px 16px 0 #0075ff33;
191+
margin: 2em 0;
192+
max-width: 480px;
193+
margin-left: auto;
194+
margin-right: auto;
195+
transition: box-shadow 0.18s;
196+
}
197+
.featured-search-card:hover {
198+
box-shadow: 0 4px 32px 0 #0075ff66;
199+
}
200+
.featured-search-card-header {
201+
color: #0075FF;
202+
font-weight: bold;
203+
font-size: 1.2em;
204+
margin-bottom: 0.7em;
205+
letter-spacing: 0.02em;
206+
display: flex;
207+
align-items: center;
208+
justify-content: center;
209+
gap: 0.3em;
210+
}
211+
.featured-search-title {
212+
font-size: 1.1em;
213+
font-weight: 600;
214+
margin-bottom: 0.2em;
215+
}
216+
.featured-search-desc {
217+
color: #444;
218+
font-size: 0.97em;
219+
margin-bottom: 0.9em;
220+
}
221+
`}</style>
222+
{/* --- End eye-catcher --- */}
223+
155224
</div>
156225
</div>
157226
</div>
158-
159227
</section>
160228

161229
<HomepageFeatures />

0 commit comments

Comments
 (0)