Compare commits

...

6 commits

Author SHA1 Message Date
Jamie Pine 73b8a58ae6
Merge 2554cfab3c into e2253bc5ba 2024-06-27 15:25:53 +02:00
ameer2468 e2253bc5ba
[ENG-1789] Plausible ping every 10 minutes (#2572)
Update index.tsx
2024-06-27 12:58:26 +00:00
Matthew Yung 4735adcb66
fixed issue with tag assign mode (#2570) 2024-06-26 20:35:53 +00:00
Arnab Chakraborty aaf1f237cd
[MOB-72] Tracing logs not working on Android (#2569)
* Logging to logcat instead of logfile

Hopefully works now?

* Lock dep for Android builds only

* Don't want only debug logs lol

* Update lib.rs
2024-06-26 20:20:16 +00:00
Jamie Pine 2554cfab3c
Merge branch 'main' into eng-386-inspector-sister-file-paths 2024-05-29 17:19:53 -07:00
James Pine 6cd3d76def wip 2024-05-24 01:31:40 -07:00
9 changed files with 97 additions and 22 deletions

18
Cargo.lock generated
View file

@ -132,6 +132,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_log-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e"
[[package]]
name = "android_system_properties"
version = "0.1.5"
@ -9024,6 +9030,7 @@ dependencies = [
"tokio-util",
"tower-service",
"tracing",
"tracing-android",
"tracing-appender",
"tracing-subscriber",
"tracing-test",
@ -11239,6 +11246,17 @@ dependencies = [
"tracing-core",
]
[[package]]
name = "tracing-android"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12612be8f868a09c0ceae7113ff26afe79d81a24473a393cb9120ece162e86c0"
dependencies = [
"android_log-sys",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "tracing-appender"
version = "0.2.3"

View file

@ -159,6 +159,9 @@ icrate = { version = "0.1.2", features = [
"Foundation_NSNumber",
] }
[target.'cfg(target_os = "android")'.dependencies]
tracing-android = "0.2.0"
[dev-dependencies]
# Workspace dependencies
globset = { workspace = true }

View file

@ -98,6 +98,20 @@ file_path::select!(file_path_to_isolate_with_id {
name
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 {
pub_id
location_id

View file

@ -17,7 +17,7 @@ use crate::{
use sd_core_file_path_helper::{FilePathError, IsolatedFilePathData};
use sd_core_heavy_lifting::media_processor::{exif_media_data, ffmpeg_media_data};
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,
};
@ -32,6 +32,7 @@ use sd_sync::OperationFactory;
use sd_utils::{db::maybe_missing, error::FileIOError, msgpack};
use std::{
collections::HashSet,
ffi::OsString,
path::{Path, PathBuf},
sync::Arc,
@ -171,6 +172,32 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
.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", {
#[derive(Type, Deserialize)]
pub struct SetNoteArgs {

View file

@ -31,7 +31,7 @@ use tracing_appender::{
non_blocking::{NonBlocking, WorkerGuard},
rolling::{RollingFileAppender, Rotation},
};
use tracing_subscriber::{filter::FromEnvError, prelude::*, EnvFilter};
use tracing_subscriber::{filter::FromEnvError, prelude::*, registry, EnvFilter};
pub mod api;
mod cloud;
@ -254,12 +254,15 @@ impl Node {
);
}
tracing_subscriber::registry()
let registry = registry();
let registry = registry
.with(
tracing_subscriber::fmt::layer()
.with_file(true)
.with_line_number(true)
.with_ansi(false)
.with_target(true)
.with_writer(logfile)
.with_filter(EnvFilter::from_default_env()),
)
@ -269,8 +272,12 @@ impl Node {
.with_line_number(true)
.with_writer(std::io::stdout)
.with_filter(EnvFilter::from_default_env()),
)
.init();
);
#[cfg(target_os = "android")]
let registry = registry.with(tracing_android::layer("com.spacedrive.app").unwrap());
registry.init();
std::panic::set_hook(Box::new(move |panic| {
use std::backtrace::{Backtrace, BacktraceStatus};

View file

@ -154,7 +154,7 @@ export const ExplorerTagBar = () => {
// extract the list of tags from each object in the selected items
const targetsTagList = Array.from(explorer.selectedItems.entries()).map(
// issues with type here. unsure as to why, and not causing any noticeable errors, so ignoring for now with as any
(item) => (item[0] as any).object.item.tags
(item) => (item[0] as any).item.object.tags
);
// iterate through each tag in the selected items and check if the tag we want to assign is already assigned

View file

@ -12,6 +12,20 @@ import {
Icon as PhosphorIcon,
Snowflake
} 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 {
FilePath,
FilePathForFrontend,
@ -28,20 +42,6 @@ import {
type ExplorerItem
} from '@sd/client';
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 { Folder, Icon } from '~/components';
import { useLocale, useZodRouteParams } from '~/hooks';
@ -233,6 +233,10 @@ export const SingleItemMetadata = ({ item }: { item: ExplorerItem }) => {
enabled: filePathData != null && readyToFetch
});
const duplicateFilePaths = useLibraryQuery(['files.getDuplicates', objectData?.id ?? -1], {
enabled: objectData != null && readyToFetch
});
const filesMediaData = useLibraryQuery(['files.getMediaData', objectData?.id ?? -1], {
enabled: objectData != null && readyToFetch
});
@ -526,7 +530,6 @@ const MultiItemMetadata = ({ items }: { items: ExplorerItem[] }) => {
const onlyNonIndexed = metadata.types.has('NonIndexedPath') && metadata.types.size === 1;
const filesSize = humanizeSize(metadata.size);
return (
<>
<MetaContainer>

View file

@ -153,7 +153,7 @@ function usePlausible() {
useEffect(() => {
const interval = setInterval(() => {
plausibleEvent({ event: { type: 'ping' } });
}, 270 * 1000);
}, 600 * 1000); // 10 minutes
return () => clearInterval(interval);
}, [plausibleEvent]);

View file

@ -13,6 +13,7 @@ export type Procedures = {
{ key: "ephemeralFiles.getMediaData", input: string, result: MediaData | null } |
{ key: "files.get", input: LibraryArgs<number>, result: ObjectWithFilePaths2 | null } |
{ 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.getPath", input: LibraryArgs<number>, result: string | null } |
{ 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 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 = {
/**
* Specifies how flash was used (on, auto, off, forced, onvalid)