mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-06 23:43:32 +00:00
Compare commits
3 commits
944fad2115
...
6b7837a986
Author | SHA1 | Date | |
---|---|---|---|
6b7837a986 | |||
2554cfab3c | |||
6cd3d76def |
|
@ -98,6 +98,20 @@ file_path::select!(file_path_to_isolate_with_id {
|
||||||
name
|
name
|
||||||
extension
|
extension
|
||||||
});
|
});
|
||||||
|
file_path::select!(file_path_sisters {
|
||||||
|
id
|
||||||
|
materialized_path
|
||||||
|
is_dir
|
||||||
|
name
|
||||||
|
extension
|
||||||
|
cas_id
|
||||||
|
integrity_checksum
|
||||||
|
location: select {
|
||||||
|
id
|
||||||
|
path
|
||||||
|
name
|
||||||
|
}
|
||||||
|
});
|
||||||
file_path::select!(file_path_walker {
|
file_path::select!(file_path_walker {
|
||||||
pub_id
|
pub_id
|
||||||
location_id
|
location_id
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::{
|
||||||
use sd_core_file_path_helper::{FilePathError, IsolatedFilePathData};
|
use sd_core_file_path_helper::{FilePathError, IsolatedFilePathData};
|
||||||
use sd_core_heavy_lifting::media_processor::{exif_media_data, ffmpeg_media_data};
|
use sd_core_heavy_lifting::media_processor::{exif_media_data, ffmpeg_media_data};
|
||||||
use sd_core_prisma_helpers::{
|
use sd_core_prisma_helpers::{
|
||||||
file_path_to_isolate, file_path_to_isolate_with_id, object_with_file_paths,
|
file_path_sisters, file_path_to_isolate, file_path_to_isolate_with_id, object_with_file_paths,
|
||||||
object_with_media_data,
|
object_with_media_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ use sd_sync::OperationFactory;
|
||||||
use sd_utils::{db::maybe_missing, error::FileIOError, msgpack};
|
use sd_utils::{db::maybe_missing, error::FileIOError, msgpack};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
collections::HashSet,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
|
@ -171,6 +172,32 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
|
||||||
.map(|str| str.to_string()))
|
.map(|str| str.to_string()))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.procedure("getDuplicates", {
|
||||||
|
R.with2(library())
|
||||||
|
.query(|(_, library), object_id: i32| async move {
|
||||||
|
let file_paths = library
|
||||||
|
.db
|
||||||
|
.file_path()
|
||||||
|
.find_many(vec![file_path::object_id::equals(Some(object_id))])
|
||||||
|
.select(file_path_sisters::select())
|
||||||
|
.exec()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let mut unique_location_ids = HashSet::new();
|
||||||
|
let locations: Vec<_> =
|
||||||
|
file_paths
|
||||||
|
.clone()
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|file_path| {
|
||||||
|
file_path.location.as_ref().cloned().filter(|location| {
|
||||||
|
unique_location_ids.insert(location.id.clone())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Ok((locations, file_paths))
|
||||||
|
})
|
||||||
|
})
|
||||||
.procedure("setNote", {
|
.procedure("setNote", {
|
||||||
#[derive(Type, Deserialize)]
|
#[derive(Type, Deserialize)]
|
||||||
pub struct SetNoteArgs {
|
pub struct SetNoteArgs {
|
||||||
|
|
|
@ -12,6 +12,20 @@ import {
|
||||||
Icon as PhosphorIcon,
|
Icon as PhosphorIcon,
|
||||||
Snowflake
|
Snowflake
|
||||||
} from '@phosphor-icons/react';
|
} from '@phosphor-icons/react';
|
||||||
|
import clsx from 'clsx';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import {
|
||||||
|
forwardRef,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
type HTMLAttributes,
|
||||||
|
type ReactNode
|
||||||
|
} from 'react';
|
||||||
|
import { useLocation } from 'react-router';
|
||||||
|
import { Link as NavLink } from 'react-router-dom';
|
||||||
|
import Sticky from 'react-sticky-el';
|
||||||
import {
|
import {
|
||||||
FilePath,
|
FilePath,
|
||||||
FilePathForFrontend,
|
FilePathForFrontend,
|
||||||
|
@ -28,20 +42,6 @@ import {
|
||||||
type ExplorerItem
|
type ExplorerItem
|
||||||
} from '@sd/client';
|
} from '@sd/client';
|
||||||
import { Button, Divider, DropdownMenu, toast, Tooltip, tw } from '@sd/ui';
|
import { Button, Divider, DropdownMenu, toast, Tooltip, tw } from '@sd/ui';
|
||||||
import clsx from 'clsx';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import {
|
|
||||||
forwardRef,
|
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useState,
|
|
||||||
type HTMLAttributes,
|
|
||||||
type ReactNode
|
|
||||||
} from 'react';
|
|
||||||
import { useLocation } from 'react-router';
|
|
||||||
import { Link as NavLink } from 'react-router-dom';
|
|
||||||
import Sticky from 'react-sticky-el';
|
|
||||||
import { LibraryIdParamsSchema } from '~/app/route-schemas';
|
import { LibraryIdParamsSchema } from '~/app/route-schemas';
|
||||||
import { Folder, Icon } from '~/components';
|
import { Folder, Icon } from '~/components';
|
||||||
import { useLocale, useZodRouteParams } from '~/hooks';
|
import { useLocale, useZodRouteParams } from '~/hooks';
|
||||||
|
@ -233,6 +233,10 @@ export const SingleItemMetadata = ({ item }: { item: ExplorerItem }) => {
|
||||||
enabled: filePathData != null && readyToFetch
|
enabled: filePathData != null && readyToFetch
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const duplicateFilePaths = useLibraryQuery(['files.getDuplicates', objectData?.id ?? -1], {
|
||||||
|
enabled: objectData != null && readyToFetch
|
||||||
|
});
|
||||||
|
|
||||||
const filesMediaData = useLibraryQuery(['files.getMediaData', objectData?.id ?? -1], {
|
const filesMediaData = useLibraryQuery(['files.getMediaData', objectData?.id ?? -1], {
|
||||||
enabled: objectData != null && readyToFetch
|
enabled: objectData != null && readyToFetch
|
||||||
});
|
});
|
||||||
|
@ -526,7 +530,6 @@ const MultiItemMetadata = ({ items }: { items: ExplorerItem[] }) => {
|
||||||
const onlyNonIndexed = metadata.types.has('NonIndexedPath') && metadata.types.size === 1;
|
const onlyNonIndexed = metadata.types.has('NonIndexedPath') && metadata.types.size === 1;
|
||||||
const filesSize = humanizeSize(metadata.size);
|
const filesSize = humanizeSize(metadata.size);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MetaContainer>
|
<MetaContainer>
|
||||||
|
|
|
@ -13,6 +13,7 @@ export type Procedures = {
|
||||||
{ key: "ephemeralFiles.getMediaData", input: string, result: MediaData | null } |
|
{ key: "ephemeralFiles.getMediaData", input: string, result: MediaData | null } |
|
||||||
{ key: "files.get", input: LibraryArgs<number>, result: ObjectWithFilePaths2 | null } |
|
{ key: "files.get", input: LibraryArgs<number>, result: ObjectWithFilePaths2 | null } |
|
||||||
{ key: "files.getConvertibleImageExtensions", input: never, result: string[] } |
|
{ key: "files.getConvertibleImageExtensions", input: never, result: string[] } |
|
||||||
|
{ key: "files.getDuplicates", input: LibraryArgs<number>, result: [({ id: number; name: string | null; path: string | null })[], FilePathSisters[]] } |
|
||||||
{ key: "files.getMediaData", input: LibraryArgs<number>, result: MediaData } |
|
{ key: "files.getMediaData", input: LibraryArgs<number>, result: MediaData } |
|
||||||
{ key: "files.getPath", input: LibraryArgs<number>, result: string | null } |
|
{ key: "files.getPath", input: LibraryArgs<number>, result: string | null } |
|
||||||
{ key: "invalidation.test-invalidate", input: never, result: number } |
|
{ key: "invalidation.test-invalidate", input: never, result: number } |
|
||||||
|
@ -300,6 +301,8 @@ export type FilePathOrder = { field: "name"; value: SortOrder } | { field: "size
|
||||||
|
|
||||||
export type FilePathSearchArgs = { take?: number | null; orderAndPagination?: OrderAndPagination<number, FilePathOrder, FilePathCursor> | null; filters?: SearchFilterArgs[]; groupDirectories?: boolean }
|
export type FilePathSearchArgs = { take?: number | null; orderAndPagination?: OrderAndPagination<number, FilePathOrder, FilePathCursor> | null; filters?: SearchFilterArgs[]; groupDirectories?: boolean }
|
||||||
|
|
||||||
|
export type FilePathSisters = { id: number; is_dir: boolean | null; cas_id: string | null; integrity_checksum: string | null; location: { id: number; name: string | null; path: string | null } | null; materialized_path: string | null; name: string | null; extension: string | null }
|
||||||
|
|
||||||
export type Flash = {
|
export type Flash = {
|
||||||
/**
|
/**
|
||||||
* Specifies how flash was used (on, auto, off, forced, onvalid)
|
* Specifies how flash was used (on, auto, off, forced, onvalid)
|
||||||
|
|
Loading…
Reference in a new issue