import { useCollection } from "@awsui/collection-hooks"; import { Box, Pagination, Table, TableProps, TextFilter } from "@awsui/components-react"; import StatusIndicator from "@awsui/components-react/status-indicator"; import React, { useMemo, useState } from "react"; import { useLocation } from "react-router"; import { usePortingAssistantSelector } from "../../createReduxStore"; import { HistoryState } from "../../models/locationState"; import { Compatibility } from "../../models/project"; import { selectApiTableData } from "../../store/selectors/tableSelectors"; import { filteringCountText } from "../../utils/FilteringCountText"; import { InfoLink } from "../InfoLink"; import { LinkComponent } from "../LinkComponent"; import { TableHeader } from "../TableHeader"; export interface ApiTableData { apiName: string; packageName: string; packageVersion: string; calls: number; sourceFiles: Set; locations: Array<{ sourcefilePath: string; location: number; }>; replacement: string; isCompatible: Compatibility; deprecated?: boolean; } const ApiTableInternal: React.FC = () => { const location = useLocation(); const tableItems = usePortingAssistantSelector(state => selectApiTableData(state, location.pathname)); const isLoading = useMemo(() => tableItems == null, [tableItems]); const loadedItems = useMemo(() => tableItems || [], [tableItems]); const { items, filteredItemsCount, collectionProps, filterProps, paginationProps } = useCollection(loadedItems, { filtering: { filteringFunction: (item, filterText) => { var exactMatch = false; if (filterText === "") return true; else { const filterItems = filterText.toLowerCase().split(";"); return filterItems.some(fitem => { if (fitem.charAt(0) === '"' && fitem.charAt(fitem.length - 1) === '"') exactMatch = true; return exactMatch ? item.apiName.toLowerCase() === fitem.slice(1, -1) : item.apiName.toLowerCase().includes(fitem); }); } }, defaultFilteringText: location.state?.activeFilter || "", empty: empty, noMatch: noMatch }, pagination: {}, sorting: {} }); const columnDefinitions: TableProps.ColumnDefinition[] = [ { id: "api-name", header: "Name", cell: item => item.apiName, sortingField: "apiName" // width: 400 }, { id: "package-name", header: "Package", cell: item => `${item.packageName} ${item.packageVersion}`, sortingField: "packageName" }, { id: "source-files", header: "Source files", cell: item => ( {item.sourceFiles.size} ), sortingField: "sourceFiles", sortingComparator: (a: ApiTableData, b: ApiTableData) => a.sourceFiles.size - b.sourceFiles.size }, { id: "calls", header: "Calls ", cell: item => item.calls, sortingField: "calls" }, { id: "status", header: "Status", cell: item => item.isCompatible === "COMPATIBLE" ? ( Compatible ) : item.isCompatible === "UNKNOWN" ? ( Unknown ) : item.deprecated ? ( Deprecated ) : ( Incompatible ), sortingField: "isCompatible" // minWidth: "150px" }, { id: "suggested-replacement", header: "Suggested replacement", cell: item => item.replacement, sortingField: "replacement" // width: 600 } ]; return ( {...collectionProps} loadingText="Loading source files" columnDefinitions={columnDefinitions} loading={isLoading} items={items} filter={ } pagination={} header={ The following list shows how many API calls are made to incompatible packages. Porting Assistant for .NET analyzes the source code of your .NET framework application to identify every API call to either Microsoft Framework libraries or NuGet packages. Using dotnet and .NET portability analyzer tools, Porting Assistant for .NET determines which calls are incompatible to .NET Core and groups them based on their source library/package. Porting Assistant for .NET provides an interactive list of all incompatible API calls and also provides export of the list as a text-based csv file. Columns Name - Name of the API call. Package - Name of the NuGet package that includes the API. Source files - The number of source files that include the API call. Calls - The number of instances of the API call in the project. Status - Compatibility status of the API call. Suggested replacement - Suggested replacements for compatiblity. } learnMoreLinks={[]} /> } /> } empty={empty} > ); }; const PAGE_SIZE = 10; const empty = ( No APIs No APIs to display. ); const noMatch = ( No matches We can’t find a match. ); export const ApiTable = React.memo(ApiTableInternal);