mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 00:47:09 +00:00
refactor(control): rename get_current_folder_elements to get_folder_elements
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { db } from './database';
|
import { db } from './database';
|
||||||
import { get_display_by_id } from './stores/displays';
|
import { get_display_by_id } from './stores/displays';
|
||||||
import {
|
import {
|
||||||
get_current_folder_elements,
|
|
||||||
create_path_on_all_selected_displays,
|
create_path_on_all_selected_displays,
|
||||||
|
get_folder_elements,
|
||||||
get_file_by_id,
|
get_file_by_id,
|
||||||
remove_all_files_without_display,
|
remove_all_files_without_display,
|
||||||
remove_file_from_display_recusively
|
remove_file_from_display_recusively
|
||||||
@@ -32,7 +32,7 @@ export async function add_upload(
|
|||||||
await create_path_on_all_selected_displays(current_file_path, selected_display_ids);
|
await create_path_on_all_selected_displays(current_file_path, selected_display_ids);
|
||||||
|
|
||||||
const used_file_names: string[] = await (
|
const used_file_names: string[] = await (
|
||||||
await get_current_folder_elements(current_file_path, selected_display_ids)
|
await get_folder_elements(current_file_path, selected_display_ids)
|
||||||
).map((e) => e.name);
|
).map((e) => e.name);
|
||||||
|
|
||||||
for (const file of file_list) {
|
for (const file of file_list) {
|
||||||
|
|||||||
@@ -310,8 +310,8 @@ function get_folder_elements_difference(
|
|||||||
return { deleted: only_in_old, new: only_in_new };
|
return { deleted: only_in_old, new: only_in_new };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function get_current_folder_elements(
|
export async function get_folder_elements(
|
||||||
current_file_path: string,
|
file_path: string,
|
||||||
selected_display_ids: string[]
|
selected_display_ids: string[]
|
||||||
): Promise<Inode[]> {
|
): Promise<Inode[]> {
|
||||||
const existing_file_keys_on_selected_displays: [string, string, number, string][] = (
|
const existing_file_keys_on_selected_displays: [string, string, number, string][] = (
|
||||||
@@ -320,7 +320,7 @@ export async function get_current_folder_elements(
|
|||||||
const existing_files_on_selected_displays_in_path: Inode[] = await db.files
|
const existing_files_on_selected_displays_in_path: Inode[] = await db.files
|
||||||
.where('[path+name+size+type]')
|
.where('[path+name+size+type]')
|
||||||
.anyOf(existing_file_keys_on_selected_displays)
|
.anyOf(existing_file_keys_on_selected_displays)
|
||||||
.filter((e) => e.path === current_file_path)
|
.filter((e) => e.path === file_path)
|
||||||
.toArray();
|
.toArray();
|
||||||
|
|
||||||
return sort_files(existing_files_on_selected_displays_in_path);
|
return sort_files(existing_files_on_selected_displays_in_path);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import { selected_display_ids, selected_file_ids } from '$lib/ts/stores/select';
|
import { selected_display_ids, selected_file_ids } from '$lib/ts/stores/select';
|
||||||
import {
|
import {
|
||||||
current_file_path,
|
current_file_path,
|
||||||
get_current_folder_elements,
|
get_folder_elements,
|
||||||
get_file_by_id,
|
get_file_by_id,
|
||||||
run_for_selected_files_on_selected_displays,
|
run_for_selected_files_on_selected_displays,
|
||||||
update_current_folder_on_selected_displays,
|
update_current_folder_on_selected_displays,
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
$effect(() => {
|
$effect(() => {
|
||||||
const path = $current_file_path,
|
const path = $current_file_path,
|
||||||
display_ids = $selected_display_ids;
|
display_ids = $selected_display_ids;
|
||||||
current_folder_elements = liveQuery(() => get_current_folder_elements(path, display_ids));
|
current_folder_elements = liveQuery(() => get_folder_elements(path, display_ids));
|
||||||
});
|
});
|
||||||
let one_file_selected: Observable<boolean> | undefined = $state();
|
let one_file_selected: Observable<boolean> | undefined = $state();
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user