Fix errored

This commit is contained in:
ferreo 2024-07-30 20:43:27 +01:00
parent 63171686dd
commit 352d7aa896
2 changed files with 14 additions and 19 deletions

View File

@ -66,11 +66,10 @@ const Errored: React.FC = () => {
}, [loadPackages]);
const handleRebuildClick = (pkg: any) => {
const firstPackage = Object.values(pkg.Packages)[0] as any;
setSelectedPackage(pkg);
setRebuildData({
packageName: pkg.Name,
version: firstPackage.NewVersion || firstPackage.Version,
version: pkg.BuildVersion,
buildType: "lto",
rebuild: false,
});
@ -130,7 +129,6 @@ const Errored: React.FC = () => {
</TableRow>
) : (
errPackages.map((pkg) => {
const firstPackage = Object.values(pkg.Packages)[0];
return (
<TableRow
key={pkg.Name}
@ -143,36 +141,26 @@ const Errored: React.FC = () => {
{pkg.Name}
</span>
<span className="text-sm md:hidden truncate">
{firstPackage.Status}
{pkg.Status}
</span>
</div>
<div className="md:hidden text-sm text-muted-foreground text-center">
<span className="truncate">
{firstPackage.Version}
{pkg.BuildVersion}
</span>
{firstPackage.NewVersion && (
<span className="truncate block">
{firstPackage.NewVersion}
</span>
)}
</div>
</div>
</TableCell>
<TableCell className="hidden md:table-cell md:w-1/4 py-4 text-left">
<div className="flex flex-col">
<span className="truncate">
{firstPackage.Version}
{pkg.BuildVersion}
</span>
{firstPackage.NewVersion && (
<span className="text-sm text-muted-foreground truncate">
{firstPackage.NewVersion}
</span>
)}
</div>
</TableCell>
<TableCell className="hidden md:table-cell md:w-1/4 py-2 md:py-4 text-left">
<span className="truncate">
{firstPackage.Status}
{pkg.Status}
</span>
</TableCell>
{isLoggedIn && (

View File

@ -25,6 +25,13 @@ interface PackageData {
};
}
interface ErrorData {
Name: string;
Status: string;
BuildVersion: string;
BuildNumber: number;
}
interface PackagesResponse {
total: number;
packages: PackageData[];
@ -37,7 +44,7 @@ const usePackageData = () => {
const [pkg, setPackage] = useState<PackageData | null>(null);
const [totalCount, setTotalCount] = useState(0);
const [loading, setLoading] = useState(false);
const [errPackages, setErrPackages] = useState<PackageData[]>([]);
const [errPackages, setErrPackages] = useState<ErrorData[]>([]);
const fetchStatsAttempted = useRef(false);
const fetchStats = useCallback(async () => {
@ -104,7 +111,7 @@ const usePackageData = () => {
setLoading(true);
try {
const response = await fetch('/api/errored');
const data: PackageData[] = await response.json();
const data: ErrorData[] = await response.json();
setErrPackages(data);
} catch (error) {
console.error("Error fetching errored:", error);