Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Commit f5dd299

Browse files
authored
Merge pull request #205 from pixlie/fixes/admin_ui_domain_node_error
Fixes for domain node name issues
2 parents 79a7df5 + 6588057 commit f5dd299

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

admin/src/routes/RouteList.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const PerProjectRoutes: Component = () => {
8888
},
8989
{
9090
label: "Crawl",
91-
children: ["Domain", "Link"].map((label) => ({
91+
children: ["DomainName", "Link"].map((label) => ({
9292
label: `${label}s`,
9393
href: `/p/${params.projectId}/crawl?label=${label}`,
9494
isActive:
@@ -102,8 +102,9 @@ const PerProjectRoutes: Component = () => {
102102
label: `${label}s`.replace(/([a-z])([A-Z])/g, "$1 $2"),
103103
href: `/p/${params.projectId}/results?label=${label}`,
104104
isActive:
105-
location.pathname.startsWith(`/p/${params.projectId}/results`) &&
106-
location.search.includes(`label=${label}`),
105+
location.pathname.startsWith(
106+
`/p/${params.projectId}/results`,
107+
) && location.search.includes(`label=${label}`),
107108
})),
108109
},
109110
]

admin/src/routes/projects/Crawl.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Heading from "../../widgets/typography/Heading";
66
import { NodeLabel } from "../../api_types/NodeLabel";
77
import ResultsCount from "../../widgets/generic/ResultsCount";
88

9-
const labelTypes: string[] = ["Domain", "Link"];
9+
const labelTypes: string[] = ["DomainName", "Link"];
1010
type LabelType = (typeof labelTypes)[number];
1111

1212
const Crawl: Component = () => {
@@ -31,10 +31,10 @@ const Crawl: Component = () => {
3131
.filter((x) => x.labels.includes(searchParams.label as NodeLabel))
3232
.map((x) => x.id);
3333
}
34-
if (searchParams.label === "Link") {
34+
if (searchParams.label === ("Link" as NodeLabel)) {
3535
setLinkCount(items.length);
3636
}
37-
if (searchParams.label === "Domain") {
37+
if (searchParams.label === ("DomainName" as NodeLabel)) {
3838
setDomainCount(items.length);
3939
}
4040
return items;
@@ -56,7 +56,7 @@ const Crawl: Component = () => {
5656
<ResultsCount count={linkCount()} />
5757
</>
5858
)}
59-
{searchParams.label === "Domain" && (
59+
{searchParams.label === ("DomainName" as NodeLabel) && (
6060
<>
6161
<Heading size={3}>Domains</Heading>
6262
<ResultsCount count={domainCount()} />

admin/src/widgets/node/DomainNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const DomainNode: Component<INodeProps> = (props) => {
2525
if (getProject() && props.nodeId in getProject()!.nodes) {
2626
let node = getProject()!.nodes[props.nodeId];
2727
if (
28-
node.labels.includes("Domain" as NodeLabel) &&
28+
node.labels.includes("DomainName" as NodeLabel) &&
2929
node.payload.type === "Text"
3030
) {
3131
return node.payload.data as string;

admin/src/widgets/node/NodeGrid.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ContentContainerNode from "./ContentContainerNode.tsx";
77
import { INodeListItemProps } from "../../utils/types.tsx";
88
import WebPageNode from "./WebPageNode.tsx";
99
import URLNode from "./URLNode.tsx";
10+
import { NodeLabel } from "../../api_types/NodeLabel.ts";
1011

1112
const NodeGrid: Component<INodeListItemProps> = (props) => {
1213
const getN = createMemo<Array<number>>(() => {
@@ -17,21 +18,21 @@ const NodeGrid: Component<INodeListItemProps> = (props) => {
1718
<>
1819
{props.nodeType ? (
1920
<>
20-
{props.nodeType === "Link" && (
21+
{props.nodeType === ("Link" as NodeLabel) && (
2122
<div class="grid grid-cols-1 gap-2 pt-1 pb-8">
2223
<For each={getN()}>
2324
{(nodeId) => <LinkNode nodeId={nodeId} showFlags={true} />}
2425
</For>
2526
</div>
2627
)}
27-
{props.nodeType === "Domain" && (
28+
{props.nodeType === ("DomainName" as NodeLabel) && (
2829
<div class="grid grid-cols-[1fr_auto] gap-2 pt-1 pb-8">
2930
<For each={getN()}>
3031
{(nodeId) => <DomainNode nodeId={nodeId} />}
3132
</For>
3233
</div>
3334
)}
34-
{props.nodeType === "SearchTerm" && (
35+
{props.nodeType === ("SearchTerm" as NodeLabel) && (
3536
<div class="grid grid-cols-[1fr_auto] gap-2">
3637
<For each={props.source()}>
3738
{(nodeId) => (
@@ -40,14 +41,14 @@ const NodeGrid: Component<INodeListItemProps> = (props) => {
4041
</For>
4142
</div>
4243
)}
43-
{props.nodeType === "Topic" && (
44+
{props.nodeType === ("Topic" as NodeLabel) && (
4445
<div class="grid grid-cols-[1fr_auto] gap-2">
4546
<For each={props.source()}>
4647
{(nodeId) => <TopicNode nodeId={nodeId} mode={props.mode} />}
4748
</For>
4849
</div>
4950
)}
50-
{props.nodeType === "Search" && (
51+
{props.nodeType === ("Search" as NodeLabel) && (
5152
<div class="grid grid-cols-1 gap-2">
5253
<For each={getN()}>
5354
{(nodeId) => (
@@ -61,7 +62,7 @@ const NodeGrid: Component<INodeListItemProps> = (props) => {
6162
</For>
6263
</div>
6364
)}
64-
{props.nodeType === "WebPage" && (
65+
{props.nodeType === ("WebPage" as NodeLabel) && (
6566
<div class="columns-1 lg:columns-3 space-y-8 gap-8 mt-2 pb-4">
6667
<For each={getN()}>
6768
{(nodeId) => (

0 commit comments

Comments
 (0)