Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #48

Merged
merged 4 commits into from
Jan 18, 2023
Merged

Dev #48

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lang/en/indexes.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"build": "Build indexes",
"rebuild": "Rebuild indexes",
"paths_to_update": "Paths to update",
"max_depth": "Max depth",
"update": "Update indexes",
"obj_count": "Object count",
"last_done_time": "Last done time",
Expand Down
42 changes: 22 additions & 20 deletions src/pages/home/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,29 @@ export const Header = () => {
</HStack>
<HStack class="header-right" spacing="$2">
<Show when={objStore.state === State.Folder}>
<HStack
bg="$neutral4"
w="$32"
p="$2"
rounded="$md"
justifyContent="space-between"
border="2px solid transparent"
cursor="pointer"
_hover={{
borderColor: "$info6",
}}
onClick={() => {
bus.emit("tool", "search")
}}
>
<Icon as={BsSearch} />
<HStack>
<Kbd>Ctrl</Kbd>
<Kbd>K</Kbd>
<Show when={getSetting("search_index") !== "none"}>
<HStack
bg="$neutral4"
w="$32"
p="$2"
rounded="$md"
justifyContent="space-between"
border="2px solid transparent"
cursor="pointer"
_hover={{
borderColor: "$info6",
}}
onClick={() => {
bus.emit("tool", "search")
}}
>
<Icon as={BsSearch} />
<HStack>
<Kbd>Ctrl</Kbd>
<Kbd>K</Kbd>
</HStack>
</HStack>
</HStack>
</Show>
<Layout />
</Show>
</HStack>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/previews/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ const Preview = () => {
const hls = new Hls()
hls.loadSource(url)
hls.attachMedia(video)
if (!video.src) {
video.src = url
}
},
},
lang: ["en", "zh-cn", "zh-tw"].includes(currentLang().toLowerCase())
Expand Down
41 changes: 35 additions & 6 deletions src/pages/manage/indexes/indexes.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import {
Badge,
Button,
createDisclosure,
Heading,
HStack,
Icon,
Input,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Text,
Textarea,
useColorModeValue,
Expand Down Expand Up @@ -70,16 +79,22 @@ const Indexes = () => {
}

let updatePathsRef: HTMLTextAreaElement
let updateMaxDepthRef: HTMLInputElement
const [updateLoading, updateReq] = useFetch(updateIndex)
const update = async () => {
let updatePaths: string[] = []
if (updatePathsRef.value) {
updatePaths = updatePathsRef.value.split("\n")
}
const resp = await updateReq(updatePaths)
let updateMaxDepth = 20
if (updateMaxDepthRef.value) {
updateMaxDepth = parseInt(updateMaxDepthRef.value)
}
const resp = await updateReq(updatePaths, updateMaxDepth)
handleRespWithNotifySuccess(resp)
refreshProgress()
}
const { isOpen, onOpen, onClose } = createDisclosure()
return (
<VStack spacing="$2" w="$full" alignItems="start">
<Heading>{t("manage.sidemenu.settings")}</Heading>
Expand Down Expand Up @@ -156,11 +171,25 @@ const Indexes = () => {
{t(`indexes.${progress()?.is_done ? "rebuild" : "build"}`)}
</Button>
</HStack>
<Heading>{t("indexes.paths_to_update")}</Heading>
<Textarea ref={updatePathsRef!}></Textarea>
<Button onClick={[update, undefined]} loading={updateLoading()}>
{t(`indexes.update`)}
</Button>
<Button onClick={onOpen}>{t(`indexes.update`)}</Button>
<Modal opened={isOpen()} onClose={onClose}>
<ModalOverlay />
<ModalContent>
<ModalCloseButton />
<ModalHeader>{t(`indexes.update`)}</ModalHeader>
<ModalBody>
<Heading>{t("indexes.paths_to_update")}</Heading>
<Textarea ref={updatePathsRef!}></Textarea>
<Heading>{t("indexes.max_depth")}</Heading>
<Input value={20} type="number" ref={updateMaxDepthRef!} />
</ModalBody>
<ModalFooter>
<Button onClick={[update, undefined]} loading={updateLoading()}>
{t(`indexes.update`)}
</Button>
</ModalFooter>
</ModalContent>
</Modal>
</VStack>
)
}
Expand Down