Skip to content

Commit 48e66d2

Browse files
committed
add ignore to igored_fields
1 parent 674377d commit 48e66d2

12 files changed

Lines changed: 2355 additions & 1988 deletions

File tree

web/load.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const run = async (url, branch, arch) => {
6666
family: pkg_family || data.pkg_id,
6767
version: data.version,
6868
sha: data.shasum,
69-
type: "base",
69+
type: data.pkg_type || "none",
7070
size: data.size,
7171
sizeNum: genSize(data.size),
7272
category: data.category,

web/src/components/app.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface AppProps {
1313
downloadable?: boolean;
1414
}
1515

16-
type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags" | "repology" | "provides" | "string[]" | "license";
16+
type FieldType = "link" | "version" | "size" | "date" | "hash" | "files" | "number" | "metric" | "category" | "default" | "links" | "tags" | "repology" | "provides" | "string[]" | "license" | "note";
1717

1818
interface ResolverField {
1919
label: string;
@@ -36,7 +36,7 @@ const resolver: { [key: string]: ResolverField } = {
3636
app_id: { label: "Application ID", type: "default" },
3737
version: { label: "Version", type: "version" },
3838
version_upstream: { label: "Upstream Version", type: "version" },
39-
note: { label: "Note", type: "string[]", joinWith: "\n" },
39+
note: { label: "Note", type: "note", joinWith: "\n" },
4040
build_date: { label: "Build Date", type: "date" },
4141
size: { label: "Size", type: "size" },
4242
download_url: { label: "Download URL", type: "link" },
@@ -70,6 +70,8 @@ const resolver: { [key: string]: ResolverField } = {
7070
build_id: { label: "Build ID", type: "hash" },
7171
};
7272

73+
const ignored_fields = ["distro_pkg"];
74+
7375
function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string }) {
7476
const { copy, copied } = useClipboard();
7577
const field: ResolverField = Key ? resolver[Key] || { label: Key, type: "default" } : { label: "Default", type: "default" };
@@ -176,6 +178,18 @@ function Show({ value, Key, props }: { value: any, props: AppProps, Key?: string
176178
</div>
177179
);
178180

181+
case "note":
182+
const n = value as string[];
183+
return (
184+
<div className="flex flex-col flex-wrap gap-1">
185+
{n.map((s) => {
186+
return (
187+
<span>{s}</span>
188+
);
189+
})}
190+
</div>
191+
);
192+
179193
case "license":
180194
const l = value as string[];
181195
return (
@@ -310,6 +324,7 @@ export default function App({ data, logs: build, repo, downloadable = true }: Ap
310324

311325
{
312326
Object.entries(data)
327+
.filter(([key,]) => !ignored_fields.includes(key))
313328
.map(([Key, Value]) => (
314329
<TableRow key={"index_" + Key + Value}>
315330

web/src/components/data-table.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,26 @@ const updateUrlParams = (params: typeof initialFilters) => {
8080
if (params.column !== initialFilters.column) urlParams.set('searchBy', params.column);
8181
if (params.page !== initialFilters.page) urlParams.set('repo', params.page);
8282
if (params.search) urlParams.set('search', params.search);
83-
83+
8484
const newUrl = `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`;
8585
window.history.replaceState({}, '', newUrl);
8686
};
8787

88-
export function DataTable<TData, TValue>({
89-
columns,
90-
}: DataTableProps<TData, TValue>) {
88+
export function DataTable<TData>({
89+
columns: col,
90+
}: { columns: (_: string) => ColumnDef<TData>[] }) {
9191
const urlParams = getUrlParams();
92+
9293
const [sorting, setSorting] = React.useState<SortingState>([])
9394
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([])
9495
const [column, setColumn] = React.useState(urlParams.column);
9596
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>(getColumnVis());
9697
const [page, setPage] = React.useState(urlParams.page);
9798
const [data, setData] = React.useState<TData[] | "loading">(binX86 as unknown as TData[]);
9899

100+
const columns = React.useMemo(() => {
101+
return col(page)
102+
}, [page]);
99103

100104
React.useEffect(() => {
101105
updateUrlParams(

web/src/components/list.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ interface ListItem {
2929
// unitDisplay: "narrow",
3030
// });
3131

32-
interface ListProps {
33-
list: ListItem[]
34-
}
35-
const columns: ColumnDef<ListItem>[] = [
32+
const columns: (page: string) => ColumnDef<ListItem>[] = (page) => ([
3633
{
3734
accessorKey: "name",
3835
header: ({ column }) => {
@@ -159,30 +156,34 @@ const columns: ColumnDef<ListItem>[] = [
159156
}
160157
},
161158
{
162-
accessorKey: "build_date",
159+
accessorKey: page != "soarpkgs" ? "Build Date" : "Package Type",
163160
header: ({ column }) => {
164161
return (
165162
<div
166163
className="flex"
167164
>
168-
Build Date
169-
<Button
165+
{page != "soarpkgs" ? "Build Date" : "Package Type"}
166+
{page != "soarpkgs" && <Button
170167
variant="ghost"
171168
size="sm"
172169
className="ml-1 h-6 w-8 rounded-full"
173170
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
174171
>
175172
<ArrowUpDown className="h-4 w-4" />
176-
</Button>
173+
</Button>}
177174
</div>
178175
)
179176
},
180177
cell: ({ row }) => {
181-
const dat = row.getValue("build_date") as string;
178+
const dat = row.original.build_date || row.original.type as string;
182179
const date = new Date(dat);
183180

184181
const day = date.toLocaleDateString();
185182

183+
if (row.original.type) {
184+
return <span className="text-gray-500 dark:text-gray-400 font-mono text-sm">{dat}</span>;
185+
}
186+
186187
if (day == "Invalid Date") {
187188
return <Tooltip>
188189
<TooltipTrigger>
@@ -204,18 +205,18 @@ const columns: ColumnDef<ListItem>[] = [
204205
</Tooltip>;
205206
},
206207
}
207-
]
208+
]);
208209

209-
function ShowList({ list }: ListProps) {
210+
function ShowList() {
210211
return <TooltipProvider>
211212
<div className="mt-2 flex flex-col md:px-6 space-y-2 pb-3">
212-
<DataTable columns={columns} data={list} />
213+
<DataTable columns={columns} />
213214
</div>
214215
</TooltipProvider>;
215216
}
216217

217218
export default function List() {
218-
return <ShowList list={[]} />;
219+
return <ShowList />;
219220
}
220221

221222
function Category({ cat }: { cat: string }) {

web/src/metadata_bincache_aarch64-linux.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

web/src/metadata_bincache_x86_64-linux.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

web/src/metadata_soarpkgs_[category].json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)