Adding toggle to disable the tags directory feature.

This commit is contained in:
Roland 2026-01-31 12:54:27 -07:00
parent 74cb5171da
commit 9005c0deff
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
14 changed files with 141 additions and 21 deletions

View file

@ -61,6 +61,7 @@ import {InputForm, useForm} from "../hooks/useForm";
import {CollectionTagModal} from "./collections/CollectionTagModal";
import {CollectionReorganizeModal} from "./collections/CollectionReorganizeModal";
import {BatchReorganizeModal} from "./collections/BatchReorganizeModal";
import {useReorganizationStatus} from "../contexts/FileWorkerStatusContext";
import {Link, Route, Routes, useLocation, useNavigate, useParams} from "react-router";
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
import {
@ -868,8 +869,17 @@ function ArchiveSettingsPage() {
const [browsers, setBrowsers] = useState([]);
const [browsersAvailable, setBrowsersAvailable] = useState(false);
// Check how many domains need reorganization on mount
// Check if batch reorganization is currently active for domains
const {isReorganizing, taskType, collectionKind} = useReorganizationStatus();
const isBatchReorganizingDomains = isReorganizing && taskType === 'batch_reorganize' && collectionKind === 'domain';
// Check how many domains need reorganization on mount (skip if batch is in progress)
React.useEffect(() => {
if (isBatchReorganizingDomains) {
// Skip fetching preview while batch reorganization is in progress
setFetchingReorgCount(false);
return;
}
setFetchingReorgCount(true);
previewBatchReorganization('domain')
.then(data => {
@ -881,7 +891,7 @@ function ArchiveSettingsPage() {
.finally(() => {
setFetchingReorgCount(false);
});
}, []);
}, [isBatchReorganizingDomains]);
// Fetch available browsers on mount (only if not dockerized)
React.useEffect(() => {

View file

@ -845,7 +845,7 @@ export function ThrottleToggle() {
</div>;
}
export function Toggle({label, checked, disabled, onChange, icon, popupContent = null}) {
export function Toggle({label, checked, disabled, onChange, icon, popupContent = null, info = null}) {
// Custom toggle because Semantic UI does not handle inverted labels correctly.
const {t, inverted} = useContext(ThemeContext);
@ -892,6 +892,7 @@ export function Toggle({label, checked, disabled, onChange, icon, popupContent =
<span style={style} data-testid='toggle-label'>
{icon}
{label}
{info && <InfoPopup content={info}/>}
</span>
</span>

View file

@ -458,6 +458,7 @@ export function SettingsPage() {
map_destination: settings.map_destination,
nav_color: settings.nav_color,
media_directory: settings.media_directory,
tags_directory: settings.tags_directory,
throttle_on_startup: settings.throttle_on_startup,
videos_destination: settings.videos_destination,
zims_destination: settings.zims_destination,
@ -542,6 +543,16 @@ export function SettingsPage() {
/>
</div>
<div style={{margin: '0.5em'}}>
<Toggle
label='Tags Directory'
disabled={disabled || state.tags_directory === null}
checked={state.tags_directory === true}
onChange={checked => handleInputChange(null, 'tags_directory', checked)}
info='When enabled, WROLPi creates a "tags" directory with hardlinks to all tagged files, organized by tag name.'
/>
</div>
<Form.Group inline>
<Form.Input
label={<>