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

Automatic height for table #606

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Virtual environment
.venv/
venv/

# sphinx build folder
build/
Expand Down
1 change: 1 addition & 0 deletions src/components/FileTree/FileTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const FileTree = (props: React.HTMLProps<HTMLDivElement>) => {
if (alreadyRenderedTargetNode) {
// Immediate scroll possible
scrollTreeNode(alreadyRenderedTargetNode);
endProcessing();
} else {
// Wait for target node to render
pendingScrollerTimeoutId = setTimeout(() => {
Expand Down
22 changes: 13 additions & 9 deletions src/components/LicenseEntity/LicenseEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,38 @@ const LicenseEntity = (props: LicenseDetectionEntityProps) => {
: LicenseClueMatchCols
}
onGridReady={(params) => setMatchesTableColumnApi(params.columnApi)}
className="ag-theme-alpine ag-grid-customClass matches-table"
className="ag-theme-alpine ag-grid-customClass entity-table"
ensureDomOrder
enableCellTextSelection
pagination={false}
defaultColDef={DEFAULT_MATCHES_COL_DEF}
/>
</MatchedTextProvider>
<br />
<br />
File regions
<AgGridReact
rowData={file_regions}
columnDefs={DetectionFileRegionCols}
onGridReady={(params) => params.api.sizeColumnsToFit()}
onGridSizeChanged={(params) => params.api.sizeColumnsToFit()}
className="ag-theme-alpine ag-grid-customClass file-regions-table"
className="ag-theme-alpine ag-grid-customClass entity-table"
ensureDomOrder
suppressHorizontalScroll
enableCellTextSelection
pagination={false}
defaultColDef={DEFAULT_FILE_REGION_COL_DEF}
/>
<br />
Raw license {activeLicenseEntity.type}
<ReactJson
src={activeLicenseEntity.license}
enableClipboard={false}
displayDataTypes={false}
collapsed={0}
/>
<div className="raw-info-section">
Raw license {activeLicenseEntity.type}
<ReactJson
src={activeLicenseEntity.license}
enableClipboard={false}
displayDataTypes={false}
collapsed={0}
/>
</div>
</div>
);
};
Expand Down
2 changes: 2 additions & 0 deletions src/components/LicenseEntity/MatchedTextContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
import { ScanOptionKeys } from "../../utils/parsers";
import { SYNTHETIC_RULE_PREFIXES } from "../../constants/licenseRules";

import "./matchedText.css";

interface MatchedTextContextProperties {
showDiffWindow: boolean;
openDiffWindow: (
Expand Down
70 changes: 0 additions & 70 deletions src/components/LicenseEntity/licenseEntity.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,73 +15,3 @@
margin-right: 5px;
}

.matches-table,
.file-regions-table {
max-height: 30vh;
}

.matched-text-diff-modal {
overflow: auto;
max-height: calc(100vh - 120px);
}

.matched-text-diff-modal .row {
padding: 5px;
}

.matched-text-diff-modal .rule-text-section {
background-color: #f6feff;
padding: 0;
}

.matched-text-diff-modal .matched-text-section {
background-color: #f9fffc;
padding: 0;
}

.matched-text-diff-modal .diff-table {
table-layout: fixed;
width: 100%;
}

.matched-text-diff-modal .diff-table th {
padding: 15px;
padding-left: 10px;
font-weight: 500;
background-color: #fafbfc;
}

.matched-text-diff-modal .diff-line {
display: table-row-group;
margin: 0;
vertical-align: top;
white-space: pre;
overflow-wrap: anywhere;
}

.matched-text-diff-modal .line-number {
margin-right: 15px;
padding-left: 10px;
padding-right: 10px;
opacity: 0.9;
}

.matched-text-diff-modal .line-content {
padding-left: 10px;
padding-right: 10px;
}

.matched-text-diff-modal .diff-line .line-content .line-text {
margin: 0;
display: inline-block;
white-space: pre-wrap;
line-height: 20px;
}

.matched-text-diff-modal .diff-line .line-content .removed-snippet {
background-color: #fdb8c0;
}

.matched-text-diff-modal .diff-line .line-content .added-snippet {
background-color: #acf2bd;
}
62 changes: 62 additions & 0 deletions src/components/LicenseEntity/matchedText.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.matched-text-diff-modal .row {
padding: 5px;
max-height: calc(100vh - 20vh);
overflow: auto;
}

.matched-text-diff-modal .rule-text-section {
background-color: #f6feff;
padding: 0;
}

.matched-text-diff-modal .matched-text-section {
background-color: #f9fffc;
padding: 0;
}

.matched-text-diff-modal .diff-table {
table-layout: fixed;
width: 100%;
}

.matched-text-diff-modal .diff-table th {
padding: 15px;
padding-left: 10px;
font-weight: 500;
background-color: #fafbfc;
}

.matched-text-diff-modal .diff-line {
display: table-row-group;
margin: 0;
vertical-align: top;
white-space: pre;
overflow-wrap: anywhere;
}

.matched-text-diff-modal .line-number {
margin-right: 15px;
padding-left: 10px;
padding-right: 10px;
opacity: 0.9;
}

.matched-text-diff-modal .line-content {
padding-left: 10px;
padding-right: 10px;
}

.matched-text-diff-modal .diff-line .line-content .line-text {
margin: 0;
display: inline-block;
white-space: pre-wrap;
line-height: 20px;
}

.matched-text-diff-modal .diff-line .line-content .removed-snippet {
background-color: #fdb8c0;
}

.matched-text-diff-modal .diff-line .line-content .added-snippet {
background-color: #acf2bd;
}
12 changes: 6 additions & 6 deletions src/components/PackagesEntityDetails/DependenciesTableCols.ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,36 @@ export const DependenciesTableCols: DepsColDef[] = [
{
headerName: "Scope",
field: "scope",
width: 130,
width: 160,
},
{
headerName: "Resolved",
field: "is_resolved",
cellRenderer: TickRenderer,
maxWidth: 95,
maxWidth: 92,
},
{
headerName: "Runtime",
field: "is_runtime",
cellRenderer: TickRenderer,
maxWidth: 95,
maxWidth: 92,
},
{
headerName: "Optional",
field: "is_optional",
cellRenderer: TickRenderer,
maxWidth: 95,
maxWidth: 92,
},
{
headerName: "Data source ID",
field: "datasource_id",
width: 130,
width: 165,
},
{
headerName: "Data file",
field: "datafile_path",
cellRenderer: FilePathRenderer,
width: 200,
width: 400,
},
{
headerName: "Extracted requirement",
Expand Down
17 changes: 9 additions & 8 deletions src/components/PackagesEntityDetails/DependencyEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ const DependencyEntity = (props: DependencyEntityProps) => {
/>
</div>
)}
<br />
Raw dependency:
<ReactJson
src={dependency || {}}
enableClipboard={false}
displayDataTypes={false}
collapsed={0}
/>
<div className="raw-info-section">
Raw dependency:
<ReactJson
src={dependency || {}}
enableClipboard={false}
displayDataTypes={false}
collapsed={0}
/>
</div>
</div>
);
};
Expand Down
42 changes: 22 additions & 20 deletions src/components/PackagesEntityDetails/PackageEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import "../../styles/entityCommonStyles.css";
import "./packageEntity.css";

interface PackageEntityProps {
package: PackageDetails;
activePackage: PackageDetails;
goToDependency: (dependency: DependencyDetails) => void;
}
const PackageEntity = (props: PackageEntityProps) => {
const { package: activePackage } = props;
const { activePackage } = props;
const { goToFileInTableView } = useWorkbenchDB();

if (!activePackage) {
Expand Down Expand Up @@ -122,24 +122,26 @@ const PackageEntity = (props: PackageEntityProps) => {
? "1 Dependency:"
: `${activePackage.dependencies.length} Dependencies:`}
</b>
<br />
<AgGridReact
rowData={activePackage.dependencies}
columnDefs={DependenciesTableCols}
className="ag-theme-alpine ag-grid-customClass dependencies-table"
pagination
ensureDomOrder
enableCellTextSelection
defaultColDef={DEFAULT_DEPENDENCIES_COL_DEF}
/>
<br />
Raw package:
<ReactJson
src={activePackage}
enableClipboard={false}
displayDataTypes={false}
collapsed={0}
/>
{activePackage.dependencies.length > 0 && (
<AgGridReact
rowData={activePackage.dependencies}
columnDefs={DependenciesTableCols}
className="ag-theme-alpine ag-grid-customClass entity-table dependencies-table"
pagination
ensureDomOrder
enableCellTextSelection
defaultColDef={DEFAULT_DEPENDENCIES_COL_DEF}
/>
)}
<div className="raw-info-section">
Raw package:
<ReactJson
src={activePackage}
enableClipboard={false}
displayDataTypes={false}
collapsed={0}
/>
</div>
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/components/PackagesEntityDetails/packageEntity.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

.dependencies-table {
max-height: 40vh;
margin-bottom: 22px;
}
Loading