Skip to content

Commit

Permalink
fix: add handlers to lib.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-harris committed Oct 2, 2024
1 parent 0a16c19 commit b6749a1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
32 changes: 30 additions & 2 deletions frontends/dashboard/src/pages/dataset/CrawlingSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { createQuery } from "@tanstack/solid-query";
import { useContext } from "solid-js";
import { Show, useContext } from "solid-js";
import { DatasetContext } from "../../contexts/DatasetContext";
import { useTrieve } from "../../hooks/useTrieve";
import { CrawlOptions } from "trieve-ts-sdk";

const defaultCrawlOptions: CrawlOptions = {
boost_titles: false,
exclude_paths: [],
exclude_tags: [],
include_paths: [],
include_tags: [],
interval: "daily",
limit: 1000,
max_depth: 10,
site_url: "",
};

export const CrawlingSettings = () => {
const datasetId = useContext(DatasetContext).datasetId;
Expand All @@ -21,9 +34,24 @@ export const CrawlingSettings = () => {
},
}));

return (
<Show when={crawlSettingsQuery.isSuccess}>
<div>success</div>
<RealCrawlingSettings
initialCrawlingSettings={crawlSettingsQuery.data || defaultCrawlOptions}
/>
</Show>
);
};

interface RealCrawlingSettingsProps {
initialCrawlingSettings: CrawlOptions;
}

const RealCrawlingSettings = (props: RealCrawlingSettingsProps) => {

Check failure on line 51 in frontends/dashboard/src/pages/dataset/CrawlingSettings.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

frontends/dashboard/src/pages/dataset/CrawlingSettings.tsx#L51

[@typescript-eslint/no-unused-vars] 'props' is defined but never used. Allowed unused args must match /^_/u.
return (
<div>
<div>Crawling settings</div>
<div>Crawling Options</div>
</div>
);
};
15 changes: 10 additions & 5 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,16 @@ pub fn main() -> std::io::Result<()> {
.route(web::post().to(handlers::dataset_handler::get_all_tags)),
)
.service(
web::resource("/{dataset_id}")
.route(web::get().to(handlers::dataset_handler::get_dataset))
.route(
web::delete().to(handlers::dataset_handler::delete_dataset),
)
web::scope("/{dataset_id}")
.service(
web::resource("")
.route(web::get().to(handlers::dataset_handler::get_dataset))
.route(web::delete().to(handlers::dataset_handler::delete_dataset))
).service(
web::resource("/crawl_options").route(
web::get().to(handlers::dataset_handler::get_dataset_crawl_options)
)
)
)
.service(
web::resource("/clear/{dataset_id}")
Expand Down

0 comments on commit b6749a1

Please sign in to comment.