2022-08-06 05:22:07 +00:00
|
|
|
import React, {useContext, useState} from "react";
|
2026-02-23 17:29:09 -07:00
|
|
|
import {useHotkeys} from "react-hotkeys-hook";
|
2022-02-02 08:24:34 -07:00
|
|
|
import {
|
2022-11-30 20:13:54 -07:00
|
|
|
CardContent,
|
|
|
|
|
CardDescription,
|
|
|
|
|
CardHeader,
|
|
|
|
|
CardMeta,
|
2022-08-06 05:22:07 +00:00
|
|
|
Container,
|
2025-12-05 18:26:36 -07:00
|
|
|
Form,
|
2023-10-20 18:53:26 -06:00
|
|
|
GridColumn,
|
|
|
|
|
GridRow,
|
2023-04-09 14:34:33 -06:00
|
|
|
Image,
|
|
|
|
|
Input,
|
2025-12-17 17:27:17 -07:00
|
|
|
PlaceholderHeader,
|
|
|
|
|
PlaceholderLine,
|
|
|
|
|
StatisticLabel,
|
|
|
|
|
StatisticValue,
|
2022-08-06 05:22:07 +00:00
|
|
|
TableCell,
|
2025-12-05 18:26:36 -07:00
|
|
|
TextArea,
|
2022-08-06 05:22:07 +00:00
|
|
|
} from "semantic-ui-react";
|
2025-12-17 17:27:17 -07:00
|
|
|
import Icon from "semantic-ui-react/dist/commonjs/elements/Icon";
|
2022-08-06 05:22:07 +00:00
|
|
|
import {
|
2023-07-21 15:14:09 -06:00
|
|
|
APIButton,
|
2022-11-30 19:31:18 -07:00
|
|
|
BackButton,
|
2023-01-04 09:14:33 -07:00
|
|
|
CardLink,
|
2026-03-28 14:19:09 -06:00
|
|
|
DirectoryLink,
|
2023-10-20 18:53:26 -06:00
|
|
|
encodeMediaPath,
|
|
|
|
|
ErrorMessage,
|
2022-08-06 05:22:07 +00:00
|
|
|
ExternalCardLink,
|
|
|
|
|
FileIcon,
|
2023-03-29 13:46:39 -06:00
|
|
|
findPosterPath,
|
2023-04-09 14:52:44 -06:00
|
|
|
humanFileSize,
|
2025-12-17 17:27:17 -07:00
|
|
|
humanNumber,
|
2025-01-26 12:44:16 -07:00
|
|
|
InfoHeader,
|
2024-08-20 13:13:21 -06:00
|
|
|
isoDatetimeToAgoPopup,
|
2022-08-06 05:22:07 +00:00
|
|
|
mimetypeColor,
|
2023-02-15 21:05:34 -07:00
|
|
|
PageContainer,
|
2023-08-26 20:28:34 -06:00
|
|
|
PreviewPath,
|
2025-12-24 12:30:04 -07:00
|
|
|
resolveDataPath,
|
2023-04-09 14:34:33 -06:00
|
|
|
SearchInput,
|
2022-01-29 22:25:35 -07:00
|
|
|
TabLinks,
|
2022-01-29 21:24:39 -07:00
|
|
|
textEllipsis,
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle
|
2022-01-29 21:24:39 -07:00
|
|
|
} from "./Common";
|
2025-12-06 14:49:46 -07:00
|
|
|
import {
|
|
|
|
|
deleteDomain,
|
2026-05-03 18:50:22 -06:00
|
|
|
deleteFileGroups,
|
2026-01-23 19:51:02 -07:00
|
|
|
fetchArchiveBrowsers,
|
2025-12-22 17:56:35 -07:00
|
|
|
fetchArchiveDownloaderConfig,
|
2025-12-06 14:49:46 -07:00
|
|
|
generateArchiveScreenshot,
|
|
|
|
|
getCollectionTagInfo,
|
2025-12-22 17:56:35 -07:00
|
|
|
postArchiveFileFormat,
|
2025-12-06 14:49:46 -07:00
|
|
|
postDownload,
|
2026-01-23 19:51:02 -07:00
|
|
|
previewBatchReorganization,
|
2025-12-06 14:49:46 -07:00
|
|
|
refreshDomain,
|
|
|
|
|
tagDomain,
|
|
|
|
|
tagFileGroup,
|
2025-12-22 17:56:35 -07:00
|
|
|
untagFileGroup,
|
|
|
|
|
updateArchiveDownloaderConfig,
|
2025-12-06 14:49:46 -07:00
|
|
|
} from "../api";
|
2025-12-22 17:56:35 -07:00
|
|
|
import {InputForm, useForm} from "../hooks/useForm";
|
2026-05-03 17:28:06 -06:00
|
|
|
import {TaggedDeleteConfirmModal} from "./TaggedDeleteConfirmModal";
|
2025-10-29 22:16:33 -06:00
|
|
|
import {CollectionTagModal} from "./collections/CollectionTagModal";
|
2026-01-23 19:51:02 -07:00
|
|
|
import {CollectionReorganizeModal} from "./collections/CollectionReorganizeModal";
|
|
|
|
|
import {BatchReorganizeModal} from "./collections/BatchReorganizeModal";
|
2026-01-31 12:54:27 -07:00
|
|
|
import {useReorganizationStatus} from "../contexts/FileWorkerStatusContext";
|
2025-12-07 11:54:20 -07:00
|
|
|
import {Link, Route, Routes, useLocation, useNavigate, useParams} from "react-router";
|
2022-01-15 18:05:51 -07:00
|
|
|
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
|
2025-12-25 09:14:00 -07:00
|
|
|
import {
|
|
|
|
|
useArchive,
|
2026-02-02 15:15:28 -07:00
|
|
|
useArchiveStatistics,
|
2026-01-23 19:51:02 -07:00
|
|
|
useDockerized,
|
2025-12-25 09:14:00 -07:00
|
|
|
useDomain,
|
|
|
|
|
useDomains,
|
|
|
|
|
useOneQuery,
|
|
|
|
|
useSearchArchives,
|
|
|
|
|
useSearchDomain,
|
|
|
|
|
useSearchOrder
|
|
|
|
|
} from "../hooks/customHooks";
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
import {DeepSearchHint, FileCards, FileRowTagIcon, FilesView, SearchControlBar} from "./Files";
|
2022-08-06 05:22:07 +00:00
|
|
|
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
|
|
|
|
import _ from "lodash";
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
import {ThemeContext} from "../contexts/contexts";
|
2025-12-17 17:27:17 -07:00
|
|
|
import {Button, Card, darkTheme, Header, Loader, Placeholder, Popup, Segment, Statistic, Tab} from "./Theme";
|
2026-04-09 16:18:26 -06:00
|
|
|
import {BulkTagModal} from "./BulkTagModal";
|
2025-12-06 14:49:46 -07:00
|
|
|
import {taggedImageLabel, TagsSelector} from "../Tags";
|
Add ordered collections (playlists): polymorphic items + item API (#475)
* Add Playlists: ordered, mixed-type collections
A playlist (Collection kind='playlist') is a manually-curated, ordered list that
mixes item types. Squash of the playlists feature branch (24 commits).
Data model & API:
- CollectionItem is polymorphic via item_kind: 'file' (FileGroup), 'zim'
(zim_id + zim_entry), or 'url' (link to anything the WROLPi browser opens,
e.g. /map?lat=&lon=&z=). CHECK constraint enforces exactly one kind; per-kind
unique constraints; migration a7b1c2d3e4f5.
- Endpoints: create playlist; add/remove/reorder items (idempotent adds: 201 new,
200 existing); GET returns the ordered items. All mutations wrol_mode_check'd.
Config (source of truth):
- playlists.yaml (PlaylistsConfig) stores each playlist's metadata AND ordered
items (file by relative path, zim by path+entry, url inline); round-trips a
DB wipe. Supports backup import (DB_CONFIG_FILE_NAMES).
- The redundant generic CollectionsConfig (collections.yaml) is deleted:
channels/domains own their configs, authors/subjects are re-derived.
On-disk sync (sync_playlists_directory switch):
- Each playlist materializes into the configurable Playlists Directory
(playlists_destination, Settings UI input, excluded from indexing) with
position-prefixed entries: NNNN_<file> hard links (copy fallback across
filesystems) and NNNN_<title>.html stubs for zim/url items.
- Tagged playlists are namespaced like channels: <playlists>/<tag>/<name>;
a tag change moves the directory and prunes the empty old tag dir.
- Deletion safety: managed files are only removed when they are our marked
stubs or still have another hard link (st_nlink > 1) -- never a last copy.
Stray loose files at the playlists root are removed; stub URLs are
scheme-allowlisted (no javascript:/data:).
Frontend:
- /playlists list page (CollectionTable, name filter, New Playlist modal, Tag
column) between Files and Zim in the nav.
- View-only detail page (Name link) and edit page (Edit button): themed table
with model icons/colors + poster thumbnails, items link to their model page
(video/archive/doc) or preview, up/down reorder, remove, add-URL form,
single-tag selector; all editing disabled in WROL Mode.
- Reusable green "Add to Playlist" button on Video/Archive/Doc detail pages,
the FilePreview toolbar, Zim search results, and Map pins (added as a /map
URL item with a map-marker icon).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Playlist edit page parity: rename, custom directory, tag modal move suggestion
Match the ChannelEditPage/DomainEditPage UX on the playlist edit page:
Back/View buttons, an edit form (name, description, directory), and the
shared CollectionTagModal with the violet "Tag" button. The tag modal now
suggests moving the playlist to its managed tag location
(playlists/<tag>/<name>); accepting the suggestion stores directory=None so
the sync keeps auto-managing the location. Tag buttons on the Channel and
Domain edit pages are now violet to match.
Backend: update_collection learns rename (with per-kind validation and
duplicate checks) and playlist custom directories (cleanup of the abandoned
directory, config round-trip, commit-before-switch to avoid the background
sync racing pre-commit state). tag_collection's duplicated untag/tag
branches are merged, and the per-kind config-save dispatch is consolidated
into _activate_config_save().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Deduplicate Collection error handling and Tag creation
Delete the duplicate UnknownCollection in wrolpi/collections/errors.py and
re-export the canonical one from wrolpi/errors.py, which carries
status_code=NOT_FOUND (the local copy inherited 500). Replace the repeated
query/raise pattern in reorganize.py with Collection.find_by_id.
Add Tag.get_or_create_tag and use it for collection tagging; flush the new
Tag before returning so callers can read .id immediately -- previously
tagging a collection with a brand-new tag name set tag_id=None. Regression
test included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:37:34 -06:00
|
|
|
import {AddToPlaylistButton} from "./AddToPlaylist";
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
import {toast} from "./ui";
|
2025-01-26 12:44:16 -07:00
|
|
|
import {API_ARCHIVE_UPLOAD_URI, Downloaders} from "./Vars";
|
2025-10-29 22:16:33 -06:00
|
|
|
import {CollectionTable} from "./collections/CollectionTable";
|
|
|
|
|
import {CollectionEditForm} from "./collections/CollectionEditForm";
|
|
|
|
|
import {RecurringDownloadsTable} from "./admin/Downloads";
|
2025-12-05 18:26:36 -07:00
|
|
|
import {DestinationForm} from "./Download";
|
2022-08-06 05:22:07 +00:00
|
|
|
|
|
|
|
|
function ArchivePage() {
|
|
|
|
|
const navigate = useNavigate();
|
2026-03-20 15:38:32 -06:00
|
|
|
const {fileGroupId} = useParams();
|
|
|
|
|
const {archiveFile, history, fetchArchive} = useArchive(fileGroupId);
|
2023-08-26 20:28:34 -06:00
|
|
|
const {theme} = useContext(ThemeContext);
|
2026-05-03 17:28:06 -06:00
|
|
|
const [taggedFileGroups, setTaggedFileGroups] = useState(null);
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2023-10-24 10:20:06 -06:00
|
|
|
let title = archiveFile ? archiveFile.title ? archiveFile.title : archiveFile.name : null;
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle(title);
|
|
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
if (archiveFile === null) {
|
2022-05-16 17:56:55 -06:00
|
|
|
return <Segment><Loader active/></Segment>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
2022-08-06 05:22:07 +00:00
|
|
|
if (archiveFile === undefined) {
|
2022-05-16 17:56:55 -06:00
|
|
|
return <>
|
|
|
|
|
<Header as='h2'>Unknown archive</Header>
|
2022-09-28 09:38:05 -06:00
|
|
|
<Header as='h4'>This archive does not exist</Header>
|
2022-05-16 17:56:55 -06:00
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
const {data, size, directory} = archiveFile;
|
2022-08-06 05:22:07 +00:00
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
// Resolve data paths (filename-only) to full relative paths using directory
|
|
|
|
|
const singlefilePath = resolveDataPath(data.singlefile_path, directory);
|
|
|
|
|
const readabilityPath = resolveDataPath(data.readability_path, directory);
|
|
|
|
|
const screenshotPath = resolveDataPath(data.screenshot_path, directory);
|
|
|
|
|
|
|
|
|
|
const singlefileUrl = singlefilePath ? `/media/${encodeMediaPath(singlefilePath)}` : null;
|
|
|
|
|
const readabilityUrl = readabilityPath ? `/media/${encodeMediaPath(readabilityPath)}` : null;
|
|
|
|
|
const screenshotUrl = screenshotPath ? `/media/${encodeMediaPath(screenshotPath)}` : null;
|
2022-05-16 17:56:55 -06:00
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
const singlefileButton = <ExternalCardLink to={singlefileUrl}>
|
2023-04-05 10:18:52 -06:00
|
|
|
<Button content='View' color='violet'/>
|
2022-08-06 05:22:07 +00:00
|
|
|
</ExternalCardLink>;
|
2024-05-25 09:40:13 -06:00
|
|
|
const readButton = <ExternalCardLink to={readabilityUrl}>
|
|
|
|
|
<Button content='Read' color='blue' disabled={!!!readabilityUrl}/>
|
|
|
|
|
</ExternalCardLink>
|
2022-05-16 17:56:55 -06:00
|
|
|
|
|
|
|
|
const screenshot = screenshotUrl ?
|
|
|
|
|
<Image src={screenshotUrl} size='large' style={{marginTop: '1em', marginBottom: '1em'}}/> :
|
|
|
|
|
null;
|
|
|
|
|
|
2026-05-03 17:28:06 -06:00
|
|
|
const localDeleteArchive = async (force = false) => {
|
2026-05-03 18:50:22 -06:00
|
|
|
const result = await deleteFileGroups([archiveFile.id], force);
|
2026-05-03 17:28:06 -06:00
|
|
|
if (result && result.tagged) {
|
|
|
|
|
setTaggedFileGroups(result.file_groups);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-21 15:14:09 -06:00
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Archive Deleted',
|
|
|
|
|
description: 'Archive was successfully deleted.',
|
|
|
|
|
time: 2000,
|
|
|
|
|
})
|
2022-09-23 16:22:57 -06:00
|
|
|
navigate(-1);
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
2024-04-14 14:05:22 -06:00
|
|
|
|
2022-11-14 15:42:57 -07:00
|
|
|
const localUpdateArchive = async () => {
|
2024-11-02 15:14:02 -06:00
|
|
|
const downloadData = {urls: [archiveFile.url], downloader: Downloaders.Archive};
|
|
|
|
|
const response = await postDownload(downloadData);
|
2024-04-14 14:02:02 -06:00
|
|
|
if (response.ok) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Archive Downloading',
|
|
|
|
|
description: 'Archive update has been scheduled.',
|
|
|
|
|
time: 2000,
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-05-16 17:56:55 -06:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-10-19 11:40:02 -06:00
|
|
|
const localGenerateScreenshot = async () => {
|
2026-03-20 15:38:32 -06:00
|
|
|
const success = await generateArchiveScreenshot(archiveFile.id);
|
2025-10-19 11:40:02 -06:00
|
|
|
if (success) {
|
|
|
|
|
// Refresh the archive data after a short delay to show the new screenshot
|
|
|
|
|
setTimeout(() => fetchArchive(), 2000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 15:14:09 -06:00
|
|
|
const updateButton = <APIButton
|
|
|
|
|
text='Update'
|
|
|
|
|
color='green'
|
|
|
|
|
confirmContent='Download the latest version of this URL?'
|
|
|
|
|
confirmButton='Update'
|
|
|
|
|
onClick={localUpdateArchive}
|
|
|
|
|
obeyWROLMode={true}
|
2023-08-26 20:28:34 -06:00
|
|
|
style={{marginTop: '0.5em'}}
|
|
|
|
|
>
|
|
|
|
|
Update
|
|
|
|
|
</APIButton>;
|
2023-07-21 15:14:09 -06:00
|
|
|
const deleteButton = <APIButton
|
|
|
|
|
text='Delete'
|
|
|
|
|
color='red'
|
|
|
|
|
confirmContent='Are you sure you want to delete this archive? All files will be deleted'
|
|
|
|
|
confirmButton='Delete'
|
2026-05-03 17:28:06 -06:00
|
|
|
onClick={() => localDeleteArchive(false)}
|
2023-07-21 15:14:09 -06:00
|
|
|
obeyWROLMode={true}
|
2023-08-26 20:28:34 -06:00
|
|
|
>
|
|
|
|
|
Delete
|
|
|
|
|
</APIButton>;
|
2025-10-19 11:40:02 -06:00
|
|
|
const generateScreenshotButton = !screenshotUrl ? <APIButton
|
|
|
|
|
text='Generate Screenshot'
|
|
|
|
|
color='yellow'
|
|
|
|
|
confirmContent='Generate a screenshot for this archive?'
|
|
|
|
|
confirmButton='Generate'
|
|
|
|
|
onClick={localGenerateScreenshot}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
style={{marginTop: '0.5em'}}
|
|
|
|
|
>
|
|
|
|
|
Generate Screenshot
|
|
|
|
|
</APIButton> : null;
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2022-11-14 15:42:57 -07:00
|
|
|
let historyList = <Loader active/>;
|
2023-01-04 09:14:33 -07:00
|
|
|
if (history && history.length === 0) {
|
2022-11-14 15:42:57 -07:00
|
|
|
historyList = <p>No history available</p>;
|
2023-01-04 09:14:33 -07:00
|
|
|
} else if (history) {
|
|
|
|
|
historyList = <FileCards files={history}/>;
|
2022-01-03 15:13:02 -07:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2023-07-27 15:53:47 -06:00
|
|
|
const domain = data.domain ? data.domain : null;
|
2023-08-26 20:28:34 -06:00
|
|
|
let domainHeader = <p>Unknown</p>;
|
2022-10-27 11:30:53 -06:00
|
|
|
if (domain) {
|
2026-03-20 15:38:32 -06:00
|
|
|
const domainUrl = `/archives?domain=${domain}`;
|
2023-07-27 15:53:47 -06:00
|
|
|
domainHeader = <Header as='h4'>
|
2023-10-31 10:20:45 -06:00
|
|
|
<a href={domainUrl}>{domain}</a>
|
2022-10-27 11:30:53 -06:00
|
|
|
</Header>;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-02 16:30:01 -06:00
|
|
|
const localAddTag = async (name) => {
|
2023-05-29 18:04:03 -06:00
|
|
|
await tagFileGroup(archiveFile, name);
|
2023-04-02 16:30:01 -06:00
|
|
|
await fetchArchive();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const localRemoveTag = async (name) => {
|
2023-05-29 18:04:03 -06:00
|
|
|
await untagFileGroup(archiveFile, name);
|
2023-04-02 16:30:01 -06:00
|
|
|
await fetchArchive();
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-25 09:14:00 -07:00
|
|
|
const downloadDatetimeString = archiveFile.download_datetime ?
|
|
|
|
|
isoDatetimeToAgoPopup(archiveFile.download_datetime, true) : 'unknown';
|
|
|
|
|
const publishedDatetimeString = archiveFile.published_datetime ?
|
|
|
|
|
isoDatetimeToAgoPopup(archiveFile.published_datetime, true) : 'unknown';
|
2023-10-20 18:53:26 -06:00
|
|
|
const modifiedDatetimeString = archiveFile.published_modified_datetime
|
2024-11-02 15:14:02 -06:00
|
|
|
? isoDatetimeToAgoPopup(archiveFile.published_modified_datetime, true)
|
2023-10-20 18:53:26 -06:00
|
|
|
: 'unknown';
|
|
|
|
|
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
const aboutPane = {
|
|
|
|
|
menuItem: 'About', render: () => <Tab.Pane>
|
|
|
|
|
<Header as={'h3'}>Domain</Header>
|
|
|
|
|
{domainHeader}
|
|
|
|
|
|
|
|
|
|
<Header as='h3'>Size</Header>
|
|
|
|
|
{humanFileSize(size)}
|
|
|
|
|
|
|
|
|
|
<Header as={'h3'}>URL</Header>
|
|
|
|
|
<p>{archiveFile.url ? <a href={archiveFile.url}>{archiveFile.url}</a> : 'N/A'}</p>
|
|
|
|
|
|
|
|
|
|
<Header as={'h3'}>Modified Date</Header>
|
|
|
|
|
<p>{modifiedDatetimeString}</p>
|
|
|
|
|
</Tab.Pane>
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-28 14:19:09 -06:00
|
|
|
// Helper to find file size from the files array by resolved path
|
|
|
|
|
const findFileSize = (resolvedPath) => {
|
|
|
|
|
if (!resolvedPath || !archiveFile.files) return null;
|
|
|
|
|
const file = archiveFile.files.find(i => String(i.path) === String(resolvedPath));
|
|
|
|
|
return file && file.size
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
? <span style={{marginLeft: '1em', color: 'grey'}}>({humanFileSize(file.size)})</span>
|
2026-03-28 14:19:09 -06:00
|
|
|
: null;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
// Helper to resolve and preview a data path
|
|
|
|
|
const localPreviewPath = (dataPath, mimetype) => {
|
|
|
|
|
const resolvedPath = resolveDataPath(dataPath, directory);
|
|
|
|
|
if (resolvedPath) {
|
2026-03-28 14:19:09 -06:00
|
|
|
return <><PreviewPath path={resolvedPath} mimetype={mimetype}
|
|
|
|
|
taggable={false}>{resolvedPath}</PreviewPath>{findFileSize(resolvedPath)}</>
|
2023-08-26 20:28:34 -06:00
|
|
|
} else {
|
|
|
|
|
return 'Unknown'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-28 14:19:09 -06:00
|
|
|
const tableStyle = {width: '100%', borderCollapse: 'separate', borderSpacing: '0 0.7em'};
|
|
|
|
|
const labelStyle = {whiteSpace: 'nowrap', paddingRight: '1.5em', verticalAlign: 'top'};
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
const filesPane = {
|
|
|
|
|
menuItem: 'Files', render: () => <Tab.Pane>
|
|
|
|
|
<table style={tableStyle}>
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Singlefile File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.singlefile_path, 'text/html')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Readability File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.readability_path, 'text/html')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Readability Text File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.readability_txt_path, 'text/plain')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Readability JSON File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.readability_json_path, 'application/json')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Screenshot File</strong></td>
|
|
|
|
|
<td>
|
|
|
|
|
{screenshotPath
|
|
|
|
|
? <><PreviewPath path={screenshotPath} mimetype='image/*'
|
|
|
|
|
taggable={false}>{screenshotPath}</PreviewPath>{findFileSize(screenshotPath)}</>
|
|
|
|
|
: 'Unknown'}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Directory</strong></td>
|
|
|
|
|
<td><DirectoryLink path={archiveFile.directory}/></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</Tab.Pane>
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const tabPanes = [aboutPane, filesPane];
|
|
|
|
|
const tabMenu = theme === darkTheme ? {inverted: true, attached: true} : {attached: true};
|
2023-08-26 20:28:34 -06:00
|
|
|
|
2023-02-17 16:09:24 -07:00
|
|
|
return <>
|
|
|
|
|
<BackButton/>
|
2022-05-16 17:56:55 -06:00
|
|
|
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
<Segment>
|
2023-02-17 16:09:24 -07:00
|
|
|
{screenshot}
|
|
|
|
|
<ExternalCardLink to={singlefileUrl}>
|
2023-04-06 11:05:14 -06:00
|
|
|
<Header as='h2'>{textEllipsis(archiveFile.title || data.url)}</Header>
|
2023-02-17 16:09:24 -07:00
|
|
|
</ExternalCardLink>
|
2023-10-20 18:53:26 -06:00
|
|
|
|
|
|
|
|
<Header as='h3'>Author: {archiveFile.author ? archiveFile.author : 'unknown'}</Header>
|
|
|
|
|
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
<Grid columns={2} stackable>
|
|
|
|
|
<GridRow>
|
|
|
|
|
<GridColumn>
|
|
|
|
|
<Header as='h4'>Published: {publishedDatetimeString}</Header>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn>
|
|
|
|
|
<Header as='h4'>Downloaded: {downloadDatetimeString}</Header>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
</GridRow>
|
2023-10-20 18:53:26 -06:00
|
|
|
</Grid>
|
2023-02-17 16:09:24 -07:00
|
|
|
|
2023-08-28 09:47:51 -06:00
|
|
|
{singlefileButton}
|
2024-05-25 09:40:13 -06:00
|
|
|
{readButton}
|
2023-02-17 16:09:24 -07:00
|
|
|
{updateButton}
|
|
|
|
|
{deleteButton}
|
2025-10-19 11:40:02 -06:00
|
|
|
{generateScreenshotButton}
|
Add ordered collections (playlists): polymorphic items + item API (#475)
* Add Playlists: ordered, mixed-type collections
A playlist (Collection kind='playlist') is a manually-curated, ordered list that
mixes item types. Squash of the playlists feature branch (24 commits).
Data model & API:
- CollectionItem is polymorphic via item_kind: 'file' (FileGroup), 'zim'
(zim_id + zim_entry), or 'url' (link to anything the WROLPi browser opens,
e.g. /map?lat=&lon=&z=). CHECK constraint enforces exactly one kind; per-kind
unique constraints; migration a7b1c2d3e4f5.
- Endpoints: create playlist; add/remove/reorder items (idempotent adds: 201 new,
200 existing); GET returns the ordered items. All mutations wrol_mode_check'd.
Config (source of truth):
- playlists.yaml (PlaylistsConfig) stores each playlist's metadata AND ordered
items (file by relative path, zim by path+entry, url inline); round-trips a
DB wipe. Supports backup import (DB_CONFIG_FILE_NAMES).
- The redundant generic CollectionsConfig (collections.yaml) is deleted:
channels/domains own their configs, authors/subjects are re-derived.
On-disk sync (sync_playlists_directory switch):
- Each playlist materializes into the configurable Playlists Directory
(playlists_destination, Settings UI input, excluded from indexing) with
position-prefixed entries: NNNN_<file> hard links (copy fallback across
filesystems) and NNNN_<title>.html stubs for zim/url items.
- Tagged playlists are namespaced like channels: <playlists>/<tag>/<name>;
a tag change moves the directory and prunes the empty old tag dir.
- Deletion safety: managed files are only removed when they are our marked
stubs or still have another hard link (st_nlink > 1) -- never a last copy.
Stray loose files at the playlists root are removed; stub URLs are
scheme-allowlisted (no javascript:/data:).
Frontend:
- /playlists list page (CollectionTable, name filter, New Playlist modal, Tag
column) between Files and Zim in the nav.
- View-only detail page (Name link) and edit page (Edit button): themed table
with model icons/colors + poster thumbnails, items link to their model page
(video/archive/doc) or preview, up/down reorder, remove, add-URL form,
single-tag selector; all editing disabled in WROL Mode.
- Reusable green "Add to Playlist" button on Video/Archive/Doc detail pages,
the FilePreview toolbar, Zim search results, and Map pins (added as a /map
URL item with a map-marker icon).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Playlist edit page parity: rename, custom directory, tag modal move suggestion
Match the ChannelEditPage/DomainEditPage UX on the playlist edit page:
Back/View buttons, an edit form (name, description, directory), and the
shared CollectionTagModal with the violet "Tag" button. The tag modal now
suggests moving the playlist to its managed tag location
(playlists/<tag>/<name>); accepting the suggestion stores directory=None so
the sync keeps auto-managing the location. Tag buttons on the Channel and
Domain edit pages are now violet to match.
Backend: update_collection learns rename (with per-kind validation and
duplicate checks) and playlist custom directories (cleanup of the abandoned
directory, config round-trip, commit-before-switch to avoid the background
sync racing pre-commit state). tag_collection's duplicated untag/tag
branches are merged, and the per-kind config-save dispatch is consolidated
into _activate_config_save().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Deduplicate Collection error handling and Tag creation
Delete the duplicate UnknownCollection in wrolpi/collections/errors.py and
re-export the canonical one from wrolpi/errors.py, which carries
status_code=NOT_FOUND (the local copy inherited 500). Replace the repeated
query/raise pattern in reorganize.py with Collection.find_by_id.
Add Tag.get_or_create_tag and use it for collection tagging; flush the new
Tag before returning so callers can read .id immediately -- previously
tagging a collection with a brand-new tag name set tag_id=None. Regression
test included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:37:34 -06:00
|
|
|
<AddToPlaylistButton fileGroupId={archiveFile.id}/>
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
</Segment>
|
2023-02-17 16:09:24 -07:00
|
|
|
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
<Segment>
|
2024-07-22 16:36:57 -06:00
|
|
|
<TagsSelector
|
|
|
|
|
selectedTagNames={archiveFile['tags']}
|
|
|
|
|
onAdd={localAddTag}
|
|
|
|
|
onRemove={localRemoveTag}
|
|
|
|
|
/>
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
</Segment>
|
|
|
|
|
|
|
|
|
|
<Tab menu={tabMenu} panes={tabPanes}/>
|
|
|
|
|
|
|
|
|
|
<Segment>
|
2025-01-24 14:28:04 -07:00
|
|
|
<InfoHeader
|
2023-02-17 16:09:24 -07:00
|
|
|
headerContent='History'
|
|
|
|
|
popupContent='Other archives of this URL created at different times.'
|
|
|
|
|
/>
|
|
|
|
|
{historyList}
|
ui: keep the unmigrated pages' notifications working
Greptile P1, and a real one: App.js migrated and took `<SemanticToastContainer/>`
with it, but seven pages -- Archive, Channels, Docs, FilePreview, Playlists,
Zim, ControllerPage -- still raised their toasts through the Semantic library.
With no container mounted those notifications went nowhere. No error, no
warning; a user deletes a document and is simply never told whether it worked.
Fixed by pointing those seven at the library's `toast`, which takes the same
options, rather than by mounting a second toast system. Nothing calls the
Semantic toast library now, so a test asserts that at zero: a file that goes
back to it would raise notifications that silently never appear, and that is
not something a reviewer would spot.
Also reverted Archive.js to its last good state. An interrupted agent had
migrated part of it -- Panel, Tabs, and Mantine's Grid.Col -- while the rest of
the file still used Semantic's Segment, Tab and Grid.Row, so a single `Grid`
identifier had to be two different components at once. A half-migrated
1400-line file is worse than an unmigrated one; it goes back on the list and
gets done in one piece.
That break was masked: react-scripts caches ESLint results per file, so the
earlier build passed while Archive.js sat on a stale pass. Editing its import
invalidated the entry and the errors appeared. Verified with the cache cleared
this time, which is the only way that check means anything after a wide change.
2026-07-30 12:31:40 -06:00
|
|
|
</Segment>
|
2026-05-03 17:28:06 -06:00
|
|
|
|
|
|
|
|
<TaggedDeleteConfirmModal
|
|
|
|
|
open={taggedFileGroups !== null}
|
|
|
|
|
taggedFileGroups={taggedFileGroups}
|
|
|
|
|
onCancel={() => setTaggedFileGroups(null)}
|
|
|
|
|
onConfirm={async () => {
|
|
|
|
|
setTaggedFileGroups(null);
|
|
|
|
|
await localDeleteArchive(true);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-02-17 16:09:24 -07:00
|
|
|
</>
|
2022-05-16 17:56:55 -06:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
export function ArchiveCard({file}) {
|
|
|
|
|
const {s} = useContext(ThemeContext);
|
2026-03-17 18:35:57 -06:00
|
|
|
const {sort} = useSearchOrder();
|
|
|
|
|
const sortField = sort ? sort.replace(/^-/, '') : null;
|
2025-12-24 12:30:04 -07:00
|
|
|
const {data, directory} = file;
|
|
|
|
|
|
|
|
|
|
// Resolve data paths (filename-only) to full relative paths using directory
|
|
|
|
|
const screenshotPath = resolveDataPath(data.screenshot_path, directory);
|
|
|
|
|
const singlefilePath = resolveDataPath(data.singlefile_path, directory);
|
2022-05-16 17:56:55 -06:00
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
const imageSrc = screenshotPath ? `/media/${encodeMediaPath(screenshotPath)}` : null;
|
|
|
|
|
const singlefileUrl = singlefilePath ? `/media/${encodeMediaPath(singlefilePath)}` : null;
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-12-07 11:32:07 -07:00
|
|
|
let screenshot = <Card.Icon><FileIcon file={file}/></Card.Icon>;
|
2023-03-24 08:58:18 -06:00
|
|
|
const imageLabel = file.tags && file.tags.length ? taggedImageLabel : null;
|
2022-08-06 05:22:07 +00:00
|
|
|
if (imageSrc) {
|
2023-03-24 08:58:18 -06:00
|
|
|
screenshot = <Image src={imageSrc} wrapped style={{position: 'relative', width: '100%'}} label={imageLabel}/>;
|
2022-08-06 05:22:07 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-24 08:58:18 -06:00
|
|
|
const domain = data ? data.domain : null;
|
2026-03-20 15:38:32 -06:00
|
|
|
const domainUrl = `/archives?domain=${domain}`;
|
2022-01-30 16:27:06 -07:00
|
|
|
|
2024-08-20 13:13:21 -06:00
|
|
|
const title = file.title || data.url;
|
|
|
|
|
const header = <ExternalCardLink to={singlefileUrl} className='card-title-ellipsis'>{title}</ExternalCardLink>;
|
|
|
|
|
const dt = file.published_datetime || file.published_modified_datetime || file.modified;
|
2023-02-17 16:09:24 -07:00
|
|
|
return <Card color={mimetypeColor(file.mimetype)}>
|
|
|
|
|
<div>
|
|
|
|
|
<ExternalCardLink to={singlefileUrl}>
|
|
|
|
|
{screenshot}
|
|
|
|
|
</ExternalCardLink>
|
|
|
|
|
</div>
|
|
|
|
|
<CardContent {...s}>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<Container textAlign='left'>
|
2024-08-20 13:13:21 -06:00
|
|
|
<Popup on='hover'
|
|
|
|
|
trigger={header}
|
|
|
|
|
content={title}/>
|
2023-02-17 16:09:24 -07:00
|
|
|
</Container>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
{domain &&
|
|
|
|
|
<CardLink to={domainUrl}>
|
2023-11-02 10:07:49 -06:00
|
|
|
<span {...s}>{domain}</span>
|
2023-02-17 16:09:24 -07:00
|
|
|
</CardLink>}
|
|
|
|
|
<CardMeta {...s}>
|
2026-03-17 18:35:57 -06:00
|
|
|
{sortField === 'published_modified_datetime'
|
|
|
|
|
? isoDatetimeToAgoPopup(file.published_modified_datetime, false)
|
|
|
|
|
: sortField === 'download_datetime'
|
|
|
|
|
? isoDatetimeToAgoPopup(file.download_datetime, false)
|
|
|
|
|
: sortField === 'size'
|
|
|
|
|
? humanFileSize(file.size)
|
|
|
|
|
: sortField === 'viewed'
|
|
|
|
|
? isoDatetimeToAgoPopup(file.viewed, false)
|
|
|
|
|
: isoDatetimeToAgoPopup(dt, false)
|
|
|
|
|
}
|
2023-02-17 16:09:24 -07:00
|
|
|
</CardMeta>
|
|
|
|
|
<CardDescription>
|
2026-03-20 15:38:32 -06:00
|
|
|
<Link to={`/archives/${file.id}`}>
|
2023-02-17 16:09:24 -07:00
|
|
|
<Button icon='file alternate' content='Details'
|
|
|
|
|
labelPosition='left'/>
|
|
|
|
|
</Link>
|
2023-10-31 10:20:45 -06:00
|
|
|
<Button icon='external' href={file.url} target='_blank' rel='noopener noreferrer'/>
|
2023-02-17 16:09:24 -07:00
|
|
|
</CardDescription>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
2022-01-03 15:13:02 -07:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-12-05 17:12:21 -07:00
|
|
|
// Domain table column configuration
|
|
|
|
|
const DOMAIN_COLUMNS = [
|
|
|
|
|
{key: 'domain', label: 'Domain', sortable: true, width: 7},
|
|
|
|
|
{key: 'tag_name', label: 'Tag', sortable: true, width: 2},
|
|
|
|
|
{key: 'archive_count', label: 'Archives', sortable: true, align: 'right', width: 2},
|
2025-12-06 14:49:46 -07:00
|
|
|
{
|
|
|
|
|
key: 'min_download_frequency',
|
|
|
|
|
label: 'Download Frequency',
|
|
|
|
|
sortable: true,
|
|
|
|
|
format: 'frequency',
|
|
|
|
|
width: 2,
|
|
|
|
|
hideOnMobile: true
|
|
|
|
|
},
|
2025-12-05 17:12:21 -07:00
|
|
|
{key: 'size', label: 'Size', sortable: true, align: 'right', format: 'bytes', width: 2, hideOnMobile: true},
|
|
|
|
|
{key: 'actions', label: 'Manage', sortable: false, type: 'actions', width: 1}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const DOMAIN_ROUTES = {
|
2026-03-20 15:38:32 -06:00
|
|
|
list: '/archives/domains',
|
|
|
|
|
edit: '/archives/domain/:id/edit',
|
|
|
|
|
search: '/archives',
|
2025-12-05 17:12:21 -07:00
|
|
|
searchParam: 'domain'
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-17 17:27:17 -07:00
|
|
|
function DomainStatistics({statistics}) {
|
|
|
|
|
if (!statistics) {
|
|
|
|
|
return <></>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <Segment>
|
|
|
|
|
<Header as='h1'>Statistics</Header>
|
|
|
|
|
<Statistic>
|
|
|
|
|
<StatisticValue>{statistics.archive_count}</StatisticValue>
|
|
|
|
|
<StatisticLabel>Archives</StatisticLabel>
|
|
|
|
|
</Statistic>
|
|
|
|
|
<Statistic>
|
|
|
|
|
<StatisticValue>{humanFileSize(statistics.size, true)}</StatisticValue>
|
|
|
|
|
<StatisticLabel>Total Size</StatisticLabel>
|
|
|
|
|
</Statistic>
|
|
|
|
|
<Statistic>
|
|
|
|
|
<StatisticValue>{humanFileSize(statistics.largest_archive, true)}</StatisticValue>
|
|
|
|
|
<StatisticLabel>Largest Archive</StatisticLabel>
|
|
|
|
|
</Statistic>
|
|
|
|
|
<Statistic>
|
|
|
|
|
<StatisticValue>{humanNumber(statistics.archive_tags)}</StatisticValue>
|
|
|
|
|
<StatisticLabel>Archive Tags</StatisticLabel>
|
|
|
|
|
</Statistic>
|
|
|
|
|
</Segment>
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-09 14:13:36 -06:00
|
|
|
export function DomainsPage() {
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle('Archive Domains');
|
|
|
|
|
|
2025-12-05 17:12:21 -07:00
|
|
|
const [domains] = useDomains();
|
2025-10-29 22:16:33 -06:00
|
|
|
const [searchStr, setSearchStr] = useOneQuery('domain');
|
2026-02-23 17:29:09 -07:00
|
|
|
const searchInputRef = React.useRef();
|
|
|
|
|
|
|
|
|
|
useHotkeys('f', (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (searchInputRef.current) {
|
|
|
|
|
searchInputRef.current.focus();
|
|
|
|
|
}
|
|
|
|
|
}, {enableOnFormTags: false});
|
2025-10-29 22:16:33 -06:00
|
|
|
|
|
|
|
|
// Header section matching ChannelsPage pattern
|
|
|
|
|
const header = <div style={{marginBottom: '1em'}}>
|
|
|
|
|
<Grid stackable columns={2}>
|
|
|
|
|
<Grid.Row>
|
|
|
|
|
<Grid.Column>
|
|
|
|
|
<SearchInput
|
|
|
|
|
placeholder='Domain filter...'
|
|
|
|
|
size='large'
|
|
|
|
|
searchStr={searchStr}
|
|
|
|
|
disabled={!Array.isArray(domains) || domains.length === 0}
|
|
|
|
|
onClear={() => setSearchStr('')}
|
|
|
|
|
onChange={setSearchStr}
|
|
|
|
|
onSubmit={null}
|
2026-02-23 17:29:09 -07:00
|
|
|
inputRef={searchInputRef}
|
2025-10-29 22:16:33 -06:00
|
|
|
/>
|
|
|
|
|
</Grid.Column>
|
|
|
|
|
<Grid.Column textAlign='right'>
|
|
|
|
|
{/* No "New Domain" button - domains are auto-created */}
|
|
|
|
|
</Grid.Column>
|
|
|
|
|
</Grid.Row>
|
|
|
|
|
</Grid>
|
|
|
|
|
</div>;
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
// Empty state
|
|
|
|
|
if (domains && domains.length === 0) {
|
2023-01-04 09:14:33 -07:00
|
|
|
return <>
|
2025-10-29 22:16:33 -06:00
|
|
|
{header}
|
|
|
|
|
<Message>
|
|
|
|
|
<Message.Header>No domains yet. Archive some webpages!</Message.Header>
|
|
|
|
|
</Message>
|
2023-01-04 09:14:33 -07:00
|
|
|
</>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
// Error state
|
|
|
|
|
if (domains === undefined) {
|
|
|
|
|
return <>
|
|
|
|
|
{header}
|
|
|
|
|
<ErrorMessage>Could not fetch Domains</ErrorMessage>
|
|
|
|
|
</>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
return <>
|
|
|
|
|
{header}
|
|
|
|
|
<CollectionTable
|
|
|
|
|
collections={domains}
|
2025-12-05 17:12:21 -07:00
|
|
|
columns={DOMAIN_COLUMNS}
|
|
|
|
|
routes={DOMAIN_ROUTES}
|
2025-10-29 22:16:33 -06:00
|
|
|
searchStr={searchStr}
|
|
|
|
|
/>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function DomainEditPage() {
|
|
|
|
|
const {domainId} = useParams();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const {domain, form, fetchDomain} = useDomain(parseInt(domainId));
|
|
|
|
|
|
|
|
|
|
// Modal state for tagging
|
|
|
|
|
const [tagEditModalOpen, setTagEditModalOpen] = useState(false);
|
2026-01-23 19:51:02 -07:00
|
|
|
// Modal state for reorganization
|
|
|
|
|
const [reorganizeModalOpen, setReorganizeModalOpen] = useState(false);
|
2025-10-29 22:16:33 -06:00
|
|
|
|
|
|
|
|
useTitle(`Edit Domain: ${domain?.domain || '...'}`);
|
|
|
|
|
|
|
|
|
|
// Wrap form.onSubmit to add toast and refresh domain data
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (form && form.onSubmit) {
|
|
|
|
|
const originalOnSubmit = form.onSubmit;
|
|
|
|
|
form.onSubmit = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await originalOnSubmit();
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Domain Updated',
|
|
|
|
|
description: 'Domain was successfully updated',
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
// Refresh domain data to show updated values
|
|
|
|
|
await fetchDomain();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to update domain:', e);
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}, [form, fetchDomain]);
|
|
|
|
|
|
|
|
|
|
// Handler for tag modal save
|
|
|
|
|
const handleTagSave = async (tagName, directory) => {
|
|
|
|
|
try {
|
|
|
|
|
await tagDomain(parseInt(domainId), tagName, directory);
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Domain Tagged',
|
|
|
|
|
description: `Domain "${domain?.domain}" has been tagged with "${tagName}"`,
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to tag domain', e);
|
|
|
|
|
} finally {
|
|
|
|
|
setTimeout(async () => {
|
|
|
|
|
await fetchDomain();
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Handler for fetching tag info
|
|
|
|
|
const handleGetTagInfo = async (tagName) => {
|
|
|
|
|
if (domain?.id) {
|
|
|
|
|
return await getCollectionTagInfo(domain.id, tagName);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleRefreshDomain = async (e) => {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
await refreshDomain(parseInt(domainId));
|
|
|
|
|
// Refresh domain data after completion
|
|
|
|
|
await fetchDomain();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!form.ready) {
|
2026-07-16 19:40:28 -06:00
|
|
|
if (form.error) {
|
|
|
|
|
return <>
|
|
|
|
|
<BackButton/>
|
|
|
|
|
<Message error>
|
|
|
|
|
<Message.Header>Domain not found</Message.Header>
|
|
|
|
|
<p>{form.error}</p>
|
|
|
|
|
</Message>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
2025-10-29 22:16:33 -06:00
|
|
|
return <Loader active>Loading domain...</Loader>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
// Handler for domain deletion
|
|
|
|
|
const handleDelete = async () => {
|
|
|
|
|
try {
|
|
|
|
|
let response = await deleteDomain(parseInt(domainId));
|
|
|
|
|
if (response.status === 204) {
|
2026-03-20 15:38:32 -06:00
|
|
|
navigate('/archives/domains');
|
2025-10-29 22:16:33 -06:00
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to delete domain', e);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const deleteButton = <APIButton
|
|
|
|
|
color='red'
|
|
|
|
|
size='small'
|
|
|
|
|
confirmContent='Are you sure you want to delete this domain? No archive files will be deleted, but archives will be orphaned.'
|
|
|
|
|
confirmButton='Delete'
|
|
|
|
|
confirmHeader='Delete Domain?'
|
|
|
|
|
onClick={handleDelete}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
style={{marginTop: '1em'}}
|
|
|
|
|
>Delete</APIButton>;
|
|
|
|
|
|
|
|
|
|
const refreshButton = domain?.directory ? (
|
|
|
|
|
<APIButton
|
|
|
|
|
color='blue'
|
|
|
|
|
size='small'
|
|
|
|
|
onClick={handleRefreshDomain}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
style={{marginTop: '1em'}}
|
|
|
|
|
>Refresh</APIButton>
|
|
|
|
|
) : null;
|
|
|
|
|
|
|
|
|
|
const tagButton = <Button
|
|
|
|
|
type="button"
|
|
|
|
|
size='small'
|
|
|
|
|
onClick={() => setTagEditModalOpen(true)}
|
Add ordered collections (playlists): polymorphic items + item API (#475)
* Add Playlists: ordered, mixed-type collections
A playlist (Collection kind='playlist') is a manually-curated, ordered list that
mixes item types. Squash of the playlists feature branch (24 commits).
Data model & API:
- CollectionItem is polymorphic via item_kind: 'file' (FileGroup), 'zim'
(zim_id + zim_entry), or 'url' (link to anything the WROLPi browser opens,
e.g. /map?lat=&lon=&z=). CHECK constraint enforces exactly one kind; per-kind
unique constraints; migration a7b1c2d3e4f5.
- Endpoints: create playlist; add/remove/reorder items (idempotent adds: 201 new,
200 existing); GET returns the ordered items. All mutations wrol_mode_check'd.
Config (source of truth):
- playlists.yaml (PlaylistsConfig) stores each playlist's metadata AND ordered
items (file by relative path, zim by path+entry, url inline); round-trips a
DB wipe. Supports backup import (DB_CONFIG_FILE_NAMES).
- The redundant generic CollectionsConfig (collections.yaml) is deleted:
channels/domains own their configs, authors/subjects are re-derived.
On-disk sync (sync_playlists_directory switch):
- Each playlist materializes into the configurable Playlists Directory
(playlists_destination, Settings UI input, excluded from indexing) with
position-prefixed entries: NNNN_<file> hard links (copy fallback across
filesystems) and NNNN_<title>.html stubs for zim/url items.
- Tagged playlists are namespaced like channels: <playlists>/<tag>/<name>;
a tag change moves the directory and prunes the empty old tag dir.
- Deletion safety: managed files are only removed when they are our marked
stubs or still have another hard link (st_nlink > 1) -- never a last copy.
Stray loose files at the playlists root are removed; stub URLs are
scheme-allowlisted (no javascript:/data:).
Frontend:
- /playlists list page (CollectionTable, name filter, New Playlist modal, Tag
column) between Files and Zim in the nav.
- View-only detail page (Name link) and edit page (Edit button): themed table
with model icons/colors + poster thumbnails, items link to their model page
(video/archive/doc) or preview, up/down reorder, remove, add-URL form,
single-tag selector; all editing disabled in WROL Mode.
- Reusable green "Add to Playlist" button on Video/Archive/Doc detail pages,
the FilePreview toolbar, Zim search results, and Map pins (added as a /map
URL item with a map-marker icon).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Playlist edit page parity: rename, custom directory, tag modal move suggestion
Match the ChannelEditPage/DomainEditPage UX on the playlist edit page:
Back/View buttons, an edit form (name, description, directory), and the
shared CollectionTagModal with the violet "Tag" button. The tag modal now
suggests moving the playlist to its managed tag location
(playlists/<tag>/<name>); accepting the suggestion stores directory=None so
the sync keeps auto-managing the location. Tag buttons on the Channel and
Domain edit pages are now violet to match.
Backend: update_collection learns rename (with per-kind validation and
duplicate checks) and playlist custom directories (cleanup of the abandoned
directory, config round-trip, commit-before-switch to avoid the background
sync racing pre-commit state). tag_collection's duplicated untag/tag
branches are merged, and the per-kind config-save dispatch is consolidated
into _activate_config_save().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Deduplicate Collection error handling and Tag creation
Delete the duplicate UnknownCollection in wrolpi/collections/errors.py and
re-export the canonical one from wrolpi/errors.py, which carries
status_code=NOT_FOUND (the local copy inherited 500). Replace the repeated
query/raise pattern in reorganize.py with Collection.find_by_id.
Add Tag.get_or_create_tag and use it for collection tagging; flush the new
Tag before returning so callers can read .id immediately -- previously
tagging a collection with a brand-new tag name set tag_id=None. Regression
test included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:37:34 -06:00
|
|
|
color='violet'
|
2025-10-29 22:16:33 -06:00
|
|
|
style={{marginTop: '1em'}}
|
|
|
|
|
>Tag</Button>;
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
const reorganizeButton = (
|
|
|
|
|
<APIButton
|
|
|
|
|
color='orange'
|
|
|
|
|
size='small'
|
|
|
|
|
onClick={() => setReorganizeModalOpen(true)}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
style={{marginTop: '1em'}}
|
|
|
|
|
>Reorganize Files</APIButton>
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
const actionButtons = <>
|
|
|
|
|
{deleteButton}
|
|
|
|
|
{refreshButton}
|
|
|
|
|
{tagButton}
|
2026-01-23 19:51:02 -07:00
|
|
|
{reorganizeButton}
|
2025-10-29 22:16:33 -06:00
|
|
|
</>;
|
2023-01-31 18:08:07 -07:00
|
|
|
|
2025-12-05 18:26:36 -07:00
|
|
|
const [descriptionProps] = form.getCustomProps({name: 'description', path: 'description'});
|
|
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
return <>
|
2025-10-29 22:16:33 -06:00
|
|
|
<BackButton/>
|
2026-03-20 15:38:32 -06:00
|
|
|
<Link to={`/archives?domain=${domain?.domain}`}>
|
2025-12-17 17:27:17 -07:00
|
|
|
<Button>Archives</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
{domain?.needs_reorganization && (
|
|
|
|
|
<Message warning>
|
|
|
|
|
<Message.Header>File Format Changed</Message.Header>
|
|
|
|
|
<p>
|
|
|
|
|
The file name format has changed. Click "Reorganize Files" to move existing files
|
|
|
|
|
to match the new format.
|
|
|
|
|
</p>
|
|
|
|
|
</Message>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
<CollectionEditForm
|
|
|
|
|
form={form}
|
|
|
|
|
title={`Edit Domain: ${domain?.domain || '...'}`}
|
|
|
|
|
wrolModeContent='Domain editing is disabled while in WROL Mode.'
|
|
|
|
|
actionButtons={actionButtons}
|
|
|
|
|
appliedTagName={domain?.tag_name}
|
2025-12-05 18:26:36 -07:00
|
|
|
>
|
|
|
|
|
<GridRow>
|
|
|
|
|
<GridColumn>
|
|
|
|
|
<DestinationForm
|
|
|
|
|
form={form}
|
|
|
|
|
label='Directory'
|
|
|
|
|
name='directory'
|
|
|
|
|
path='directory'
|
|
|
|
|
/>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
</GridRow>
|
|
|
|
|
<GridRow>
|
|
|
|
|
<GridColumn>
|
|
|
|
|
<Form.Field>
|
|
|
|
|
<label>Description</label>
|
|
|
|
|
<TextArea
|
|
|
|
|
placeholder='Optional description'
|
|
|
|
|
{...descriptionProps}
|
|
|
|
|
onChange={(e, {value}) => descriptionProps.onChange(value)}
|
|
|
|
|
rows={3}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Field>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
</GridRow>
|
|
|
|
|
</CollectionEditForm>
|
2025-10-29 22:16:33 -06:00
|
|
|
|
|
|
|
|
{/* Tag Modal */}
|
|
|
|
|
<CollectionTagModal
|
|
|
|
|
open={tagEditModalOpen}
|
|
|
|
|
onClose={() => setTagEditModalOpen(false)}
|
|
|
|
|
currentTagName={domain?.tag_name}
|
|
|
|
|
originalDirectory={domain?.directory}
|
|
|
|
|
getTagInfo={handleGetTagInfo}
|
|
|
|
|
onSave={handleTagSave}
|
|
|
|
|
collectionName="Domain"
|
2025-12-06 09:27:40 -07:00
|
|
|
hasDirectory={!!domain?.directory}
|
2023-01-31 18:08:07 -07:00
|
|
|
/>
|
2025-10-29 22:16:33 -06:00
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
{/* Reorganize Modal */}
|
|
|
|
|
<CollectionReorganizeModal
|
|
|
|
|
open={reorganizeModalOpen}
|
|
|
|
|
onClose={() => setReorganizeModalOpen(false)}
|
|
|
|
|
collectionId={domain?.id}
|
|
|
|
|
collectionName={domain?.domain}
|
|
|
|
|
onComplete={fetchDomain}
|
|
|
|
|
needsReorganization={domain?.needs_reorganization}
|
|
|
|
|
/>
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
{/* Downloads Segment */}
|
|
|
|
|
<Segment>
|
|
|
|
|
<Header as='h1'>Downloads</Header>
|
|
|
|
|
<RecurringDownloadsTable
|
|
|
|
|
downloads={domain?.downloads}
|
|
|
|
|
fetchDownloads={fetchDomain}
|
|
|
|
|
/>
|
|
|
|
|
</Segment>
|
2025-12-17 17:27:17 -07:00
|
|
|
|
|
|
|
|
{domain && domain.statistics && <DomainStatistics statistics={domain.statistics}/>}
|
2022-08-06 05:22:07 +00:00
|
|
|
</>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-12-22 17:56:35 -07:00
|
|
|
function ArchiveFileNameForm({form}) {
|
|
|
|
|
const [message, setMessage] = React.useState(null);
|
|
|
|
|
|
|
|
|
|
const onChange = async (value) => {
|
|
|
|
|
const response = await postArchiveFileFormat(value);
|
|
|
|
|
const {error, preview} = await response.json();
|
|
|
|
|
if (error) {
|
|
|
|
|
setMessage({content: error, header: 'Invalid File Name', negative: true});
|
|
|
|
|
} else {
|
|
|
|
|
setMessage({content: preview, header: 'File Name Preview', positive: true});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const label = <InfoHeader
|
|
|
|
|
headerSize='h5'
|
|
|
|
|
headerContent='Archive File Format'
|
|
|
|
|
popupProps={{wide: 'very', position: 'top left'}}
|
|
|
|
|
popupContent={<>
|
|
|
|
|
<p>Variables:</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>%(title)s</code> - Page title</li>
|
|
|
|
|
<li><code>%(download_datetime)s</code> - Full datetime (YYYY-MM-DD-HH-MM-SS)</li>
|
|
|
|
|
<li><code>%(download_date)s</code> - Date only (YYYY-MM-DD)</li>
|
|
|
|
|
<li><code>%(download_year)s</code> - Year</li>
|
|
|
|
|
<li><code>%(download_month)s</code> - Month (zero-padded)</li>
|
|
|
|
|
<li><code>%(download_day)s</code> - Day (zero-padded)</li>
|
|
|
|
|
<li><code>%(domain)s</code> - Domain name</li>
|
2025-12-23 19:11:07 -07:00
|
|
|
<li><code>%(ext)s</code> - File extension (required, must be at end)</li>
|
2025-12-22 17:56:35 -07:00
|
|
|
</ul>
|
2025-12-23 19:11:07 -07:00
|
|
|
<p>Subdirectories supported: <code>%(download_year)s/%(title)s.%(ext)s</code></p>
|
2025-12-22 17:56:35 -07:00
|
|
|
</>}
|
|
|
|
|
/>;
|
|
|
|
|
|
|
|
|
|
return <InputForm
|
|
|
|
|
form={form}
|
|
|
|
|
name='file_name_format'
|
|
|
|
|
path='file_name_format'
|
|
|
|
|
label={label}
|
|
|
|
|
onChange={onChange}
|
|
|
|
|
message={message}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
function BrowserConfigForm({form, browsers, browsersAvailable}) {
|
|
|
|
|
const {t} = React.useContext(ThemeContext);
|
|
|
|
|
const [useCustomPath, setUseCustomPath] = useState(false);
|
|
|
|
|
|
|
|
|
|
// Determine if custom path is being used based on current value
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
const currentBrowser = form.formData?.browser_executable;
|
|
|
|
|
if (currentBrowser) {
|
|
|
|
|
// Check if current value matches any known browser
|
|
|
|
|
const isKnownBrowser = browsers.some(b => b.path === currentBrowser || b.key === currentBrowser);
|
|
|
|
|
setUseCustomPath(!isKnownBrowser);
|
|
|
|
|
}
|
|
|
|
|
}, [form.formData?.browser_executable, browsers]);
|
|
|
|
|
|
|
|
|
|
if (!browsersAvailable) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Build dropdown options: auto-detect + installed browsers + custom
|
|
|
|
|
const browserOptions = [
|
|
|
|
|
{key: 'auto', value: '', text: 'Auto-detect (recommended)'},
|
|
|
|
|
...browsers.map(b => ({key: b.key, value: b.path, text: `${b.name} (${b.path})`})),
|
|
|
|
|
{key: 'custom', value: '__custom__', text: 'Custom path...'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const handleBrowserChange = (e, {value}) => {
|
|
|
|
|
if (value === '__custom__') {
|
|
|
|
|
setUseCustomPath(true);
|
|
|
|
|
form.setValue('browser_executable', '');
|
|
|
|
|
} else {
|
|
|
|
|
setUseCustomPath(false);
|
|
|
|
|
form.setValue('browser_executable', value || null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const currentValue = form.formData?.browser_executable || '';
|
|
|
|
|
const dropdownValue = useCustomPath ? '__custom__' : currentValue;
|
|
|
|
|
|
|
|
|
|
return <>
|
|
|
|
|
<Header as='h4'>Browser Settings</Header>
|
|
|
|
|
<p {...t}>
|
|
|
|
|
Configure which browser SingleFile uses to create archives.
|
|
|
|
|
These settings only apply to native deployments (Raspberry Pi/Debian).
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<Form.Field>
|
|
|
|
|
<label {...t}>Browser</label>
|
|
|
|
|
<Form.Dropdown
|
|
|
|
|
selection
|
|
|
|
|
options={browserOptions}
|
|
|
|
|
value={dropdownValue}
|
|
|
|
|
onChange={handleBrowserChange}
|
|
|
|
|
placeholder='Select browser...'
|
|
|
|
|
/>
|
|
|
|
|
</Form.Field>
|
|
|
|
|
|
|
|
|
|
{useCustomPath && (
|
|
|
|
|
<Form.Field>
|
|
|
|
|
<label {...t}>Custom Browser Path</label>
|
|
|
|
|
<Input
|
|
|
|
|
fluid
|
|
|
|
|
placeholder='/usr/bin/chromium'
|
|
|
|
|
value={form.formData?.browser_executable || ''}
|
|
|
|
|
onChange={(e) => form.setValue('browser_executable', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
<small {...t}>Enter the absolute path to the browser executable.</small>
|
|
|
|
|
</Form.Field>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<Form.Field>
|
|
|
|
|
<label {...t}>Browser Arguments</label>
|
|
|
|
|
<Input
|
|
|
|
|
fluid
|
|
|
|
|
placeholder='["--no-sandbox"]'
|
|
|
|
|
value={form.formData?.browser_args || '["--no-sandbox"]'}
|
|
|
|
|
onChange={(e) => form.setValue('browser_args', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
<small {...t}>JSON array of arguments passed to the browser. Default: ["--no-sandbox"]</small>
|
|
|
|
|
</Form.Field>
|
|
|
|
|
|
|
|
|
|
<Form.Field>
|
|
|
|
|
<label {...t}>User Agent</label>
|
|
|
|
|
<Input
|
|
|
|
|
fluid
|
|
|
|
|
placeholder='Leave empty to use system default'
|
|
|
|
|
value={form.formData?.user_agent || ''}
|
|
|
|
|
onChange={(e) => form.setValue('user_agent', e.target.value || null)}
|
|
|
|
|
/>
|
|
|
|
|
<small {...t}>Custom user agent string. Leave empty to use the system default.</small>
|
|
|
|
|
</Form.Field>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
function ArchiveSettingsPage() {
|
2025-12-22 17:56:35 -07:00
|
|
|
useTitle('Archive Settings');
|
|
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
const {t} = React.useContext(ThemeContext);
|
2026-01-23 19:51:02 -07:00
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
const [batchModalOpen, setBatchModalOpen] = useState(false);
|
|
|
|
|
const [domainsNeedingReorg, setDomainsNeedingReorg] = useState(0);
|
|
|
|
|
const [fetchingReorgCount, setFetchingReorgCount] = useState(true);
|
|
|
|
|
const [browsers, setBrowsers] = useState([]);
|
|
|
|
|
const [browsersAvailable, setBrowsersAvailable] = useState(false);
|
|
|
|
|
|
2026-01-31 12:54:27 -07:00
|
|
|
// 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)
|
2026-01-23 19:51:02 -07:00
|
|
|
React.useEffect(() => {
|
2026-01-31 12:54:27 -07:00
|
|
|
if (isBatchReorganizingDomains) {
|
|
|
|
|
// Skip fetching preview while batch reorganization is in progress
|
|
|
|
|
setFetchingReorgCount(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-01-23 19:51:02 -07:00
|
|
|
setFetchingReorgCount(true);
|
|
|
|
|
previewBatchReorganization('domain')
|
|
|
|
|
.then(data => {
|
|
|
|
|
setDomainsNeedingReorg(data.total_collections || 0);
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
setDomainsNeedingReorg(0);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
setFetchingReorgCount(false);
|
|
|
|
|
});
|
2026-01-31 12:54:27 -07:00
|
|
|
}, [isBatchReorganizingDomains]);
|
2026-01-23 19:51:02 -07:00
|
|
|
|
|
|
|
|
// Fetch available browsers on mount (only if not dockerized)
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (dockerized === false) {
|
|
|
|
|
fetchArchiveBrowsers()
|
|
|
|
|
.then(data => {
|
|
|
|
|
setBrowsers(data.browsers || []);
|
|
|
|
|
setBrowsersAvailable(data.available === true);
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
setBrowsers([]);
|
|
|
|
|
setBrowsersAvailable(false);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, [dockerized]);
|
2023-04-09 14:13:36 -06:00
|
|
|
|
2025-12-22 17:56:35 -07:00
|
|
|
const emptyFormData = {
|
2025-12-23 19:11:07 -07:00
|
|
|
file_name_format: '%(download_datetime)s_%(title)s.%(ext)s',
|
2026-01-23 19:51:02 -07:00
|
|
|
browser_executable: null,
|
|
|
|
|
browser_args: '["--no-sandbox"]',
|
|
|
|
|
user_agent: null,
|
2025-12-22 17:56:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const configSubmitter = async () => {
|
|
|
|
|
return await updateArchiveDownloaderConfig(configForm.formData);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const configForm = useForm({
|
|
|
|
|
fetcher: fetchArchiveDownloaderConfig,
|
|
|
|
|
submitter: configSubmitter,
|
|
|
|
|
emptyFormData,
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
const urlClipboardButton = <APIButton
|
|
|
|
|
icon='copy'
|
|
|
|
|
onClick={() => navigator.clipboard.writeText(API_ARCHIVE_UPLOAD_URI)}
|
|
|
|
|
/>;
|
|
|
|
|
const dataFieldNameClipboardButton = <APIButton
|
|
|
|
|
icon='copy'
|
|
|
|
|
onClick={() => navigator.clipboard.writeText('singlefile_contents')}
|
|
|
|
|
/>;
|
|
|
|
|
const urlFieldNameClipboardButton = <APIButton
|
|
|
|
|
icon='copy'
|
|
|
|
|
onClick={() => navigator.clipboard.writeText('url')}
|
|
|
|
|
/>;
|
2023-09-07 20:13:36 -06:00
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
return <PageContainer>
|
2025-12-22 17:56:35 -07:00
|
|
|
<Segment>
|
|
|
|
|
<Header as='h3'>Archive Downloader Config</Header>
|
|
|
|
|
|
|
|
|
|
<Form>
|
|
|
|
|
<Grid>
|
|
|
|
|
<GridRow columns={1}>
|
|
|
|
|
<GridColumn mobile={16} computer={8}>
|
|
|
|
|
<ArchiveFileNameForm form={configForm}/>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
</GridRow>
|
2026-01-23 19:51:02 -07:00
|
|
|
|
|
|
|
|
{/* Browser settings - only shown on native deployments */}
|
|
|
|
|
{!dockerized && browsersAvailable && (
|
|
|
|
|
<GridRow columns={1}>
|
|
|
|
|
<GridColumn mobile={16} computer={8}>
|
|
|
|
|
<BrowserConfigForm
|
|
|
|
|
form={configForm}
|
|
|
|
|
browsers={browsers}
|
|
|
|
|
browsersAvailable={browsersAvailable}
|
|
|
|
|
/>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
</GridRow>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-12-22 17:56:35 -07:00
|
|
|
<GridRow columns={1}>
|
|
|
|
|
<GridColumn textAlign='right'>
|
|
|
|
|
<APIButton
|
|
|
|
|
disabled={configForm.disabled || !configForm.ready}
|
|
|
|
|
type='submit'
|
|
|
|
|
style={{marginTop: '0.5em'}}
|
|
|
|
|
onClick={configForm.onSubmit}
|
|
|
|
|
id='archive_settings_save_button'
|
|
|
|
|
>Save</APIButton>
|
|
|
|
|
</GridColumn>
|
|
|
|
|
</GridRow>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Form>
|
|
|
|
|
</Segment>
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
<Segment>
|
|
|
|
|
<Header as='h4'>File Organization</Header>
|
|
|
|
|
<p>
|
|
|
|
|
{fetchingReorgCount
|
|
|
|
|
? 'Checking for domains that need reorganization...'
|
|
|
|
|
: <>
|
|
|
|
|
<strong>{domainsNeedingReorg}</strong> domain{domainsNeedingReorg !== 1 ? 's' : ''}
|
|
|
|
|
{domainsNeedingReorg > 0
|
|
|
|
|
? ' have files that do not match the current file name format.'
|
|
|
|
|
: '. All domains are organized correctly.'}
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
</p>
|
|
|
|
|
<Button
|
|
|
|
|
color='orange'
|
|
|
|
|
onClick={() => setBatchModalOpen(true)}
|
|
|
|
|
id='reorganize_all_domains_button'
|
|
|
|
|
disabled={fetchingReorgCount || domainsNeedingReorg === 0}
|
|
|
|
|
loading={fetchingReorgCount}
|
|
|
|
|
>
|
|
|
|
|
<Icon name='folder open outline'/> Reorganize All Domains
|
|
|
|
|
</Button>
|
|
|
|
|
</Segment>
|
|
|
|
|
|
|
|
|
|
<BatchReorganizeModal
|
|
|
|
|
open={batchModalOpen}
|
|
|
|
|
onClose={() => setBatchModalOpen(false)}
|
|
|
|
|
kind='domain'
|
|
|
|
|
onComplete={() => {
|
|
|
|
|
setBatchModalOpen(false);
|
|
|
|
|
setDomainsNeedingReorg(0);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
2025-12-22 17:56:35 -07:00
|
|
|
<Segment>
|
|
|
|
|
<Header as='h3'>SingleFile Browser Extension</Header>
|
|
|
|
|
|
|
|
|
|
<p {...t}>
|
|
|
|
|
These are the settings necessary to configure the <a
|
2026-02-15 17:26:36 -07:00
|
|
|
href="https://github.com/gildas-lormeau/SingleFile?tab=readme-ov-file#install"
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
target='_blank'>SingleFile Browser
|
2025-12-22 17:56:35 -07:00
|
|
|
Extension</a> to automatically upload to your WROLPi.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<label {...t}>Upload URL</label>
|
|
|
|
|
<Input fluid
|
|
|
|
|
value={API_ARCHIVE_UPLOAD_URI}
|
|
|
|
|
label={urlClipboardButton}
|
|
|
|
|
/>
|
|
|
|
|
<label {...t}>Data Field Name</label>
|
|
|
|
|
<Input fluid
|
|
|
|
|
value='singlefile_contents'
|
|
|
|
|
label={dataFieldNameClipboardButton}
|
|
|
|
|
/>
|
|
|
|
|
<label {...t}>URL Field Name</label>
|
|
|
|
|
<Input fluid
|
|
|
|
|
value='url'
|
|
|
|
|
label={urlFieldNameClipboardButton}
|
|
|
|
|
/>
|
|
|
|
|
</Segment>
|
2025-01-26 12:44:16 -07:00
|
|
|
</PageContainer>
|
2023-04-09 14:13:36 -06:00
|
|
|
}
|
|
|
|
|
|
2023-07-21 15:14:09 -06:00
|
|
|
function ArchivesPage() {
|
2022-09-23 16:22:57 -06:00
|
|
|
const [selectedArchives, setSelectedArchives] = useState([]);
|
2026-04-09 16:18:26 -06:00
|
|
|
const [bulkTagOpen, setBulkTagOpen] = useState(false);
|
2026-05-03 17:28:06 -06:00
|
|
|
const [taggedFileGroups, setTaggedFileGroups] = useState(null);
|
2026-02-23 17:29:09 -07:00
|
|
|
const searchInputRef = React.useRef();
|
|
|
|
|
|
|
|
|
|
useHotkeys('f', (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (searchInputRef.current) {
|
|
|
|
|
searchInputRef.current.focus();
|
|
|
|
|
}
|
|
|
|
|
}, {enableOnFormTags: false});
|
2022-09-23 16:22:57 -06:00
|
|
|
|
2025-12-17 17:27:17 -07:00
|
|
|
const {domain, domains} = useSearchDomain();
|
|
|
|
|
|
|
|
|
|
// Find the domain object from the domains list to get the ID for the edit link
|
|
|
|
|
const domainObj = domain && domains ? domains.find(d => d.domain === domain) : null;
|
|
|
|
|
|
|
|
|
|
let title = 'Archives';
|
|
|
|
|
if (domainObj && domainObj.domain) {
|
|
|
|
|
title = `${domainObj.domain} Archives`;
|
|
|
|
|
}
|
|
|
|
|
useTitle(title);
|
2022-01-15 18:05:51 -07:00
|
|
|
|
2022-09-23 16:22:57 -06:00
|
|
|
const {
|
|
|
|
|
archives,
|
|
|
|
|
totalPages,
|
|
|
|
|
activePage,
|
|
|
|
|
setPage,
|
|
|
|
|
searchStr,
|
|
|
|
|
setSearchStr,
|
2022-10-24 15:08:53 -06:00
|
|
|
fetchArchives,
|
2023-04-09 14:13:36 -06:00
|
|
|
} = useSearchArchives();
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2022-10-24 15:17:48 -06:00
|
|
|
let archiveOrders = [
|
2023-10-24 10:20:06 -06:00
|
|
|
{value: 'published_datetime', text: 'Published Date', short: 'P.Date'},
|
|
|
|
|
{value: 'published_modified_datetime', text: 'Modified Date', short: 'M.Date'},
|
|
|
|
|
{value: 'download_datetime', text: 'Download Date', short: 'D.Date'},
|
2023-04-09 14:13:36 -06:00
|
|
|
{value: 'size', text: 'Size'},
|
2023-10-24 10:20:06 -06:00
|
|
|
{value: 'viewed', text: 'Recently Viewed', short: 'R.Viewed'},
|
2022-08-06 05:22:07 +00:00
|
|
|
];
|
|
|
|
|
|
2022-10-24 15:17:48 -06:00
|
|
|
if (searchStr) {
|
2023-04-09 14:13:36 -06:00
|
|
|
archiveOrders = [{value: 'rank', text: 'Rank'}, ...archiveOrders];
|
2022-10-24 15:17:48 -06:00
|
|
|
}
|
|
|
|
|
|
2022-09-23 16:22:57 -06:00
|
|
|
const onSelect = (path, checked) => {
|
2022-10-24 17:15:15 -06:00
|
|
|
if (checked && path) {
|
|
|
|
|
setSelectedArchives([...selectedArchives, path]);
|
|
|
|
|
} else if (path) {
|
|
|
|
|
setSelectedArchives(selectedArchives.filter(i => i !== path));
|
2022-09-23 16:22:57 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-03 18:50:22 -06:00
|
|
|
const fileGroupIdsForSelection = () => archives
|
2026-05-03 17:28:06 -06:00
|
|
|
.filter(i => selectedArchives.indexOf(i['primary_path']) >= 0)
|
|
|
|
|
.map(i => i['id']);
|
|
|
|
|
|
|
|
|
|
const onDelete = async (force = false) => {
|
2026-05-03 18:50:22 -06:00
|
|
|
const fileGroupIds = fileGroupIdsForSelection();
|
|
|
|
|
const result = await deleteFileGroups(fileGroupIds, force);
|
2026-05-03 17:28:06 -06:00
|
|
|
if (result && result.tagged) {
|
|
|
|
|
setTaggedFileGroups(result.file_groups);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-09-23 16:22:57 -06:00
|
|
|
await fetchArchives();
|
|
|
|
|
setSelectedArchives([]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-24 17:15:15 -06:00
|
|
|
const invertSelection = async () => {
|
|
|
|
|
const newSelectedArchives = archives.map(archive => archive['key']).filter(i => selectedArchives.indexOf(i) < 0);
|
|
|
|
|
setSelectedArchives(newSelectedArchives);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const clearSelection = async (e) => {
|
|
|
|
|
if (e) e.preventDefault();
|
|
|
|
|
setSelectedArchives([]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 16:18:26 -06:00
|
|
|
const onBulkTagComplete = async () => {
|
|
|
|
|
await fetchArchives();
|
|
|
|
|
setSelectedArchives([]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-23 16:22:57 -06:00
|
|
|
const selectElm = <div style={{marginTop: '0.5em'}}>
|
2026-04-09 16:18:26 -06:00
|
|
|
<Button
|
|
|
|
|
color='violet'
|
|
|
|
|
disabled={_.isEmpty(selectedArchives)}
|
|
|
|
|
onClick={() => setBulkTagOpen(true)}
|
|
|
|
|
>Tag</Button>
|
2023-07-27 15:53:47 -06:00
|
|
|
<APIButton
|
2022-09-23 16:22:57 -06:00
|
|
|
color='red'
|
2023-01-04 09:14:33 -07:00
|
|
|
disabled={_.isEmpty(selectedArchives)}
|
2022-09-23 16:22:57 -06:00
|
|
|
confirmButton='Delete'
|
2023-07-27 15:53:47 -06:00
|
|
|
confirmContent='Are you sure you want to delete these archives files? This cannot be undone.'
|
2026-05-03 17:28:06 -06:00
|
|
|
onClick={() => onDelete(false)}
|
2023-07-27 15:53:47 -06:00
|
|
|
>Delete</APIButton>
|
2022-10-24 17:15:15 -06:00
|
|
|
<Button
|
|
|
|
|
color='grey'
|
2023-01-04 11:16:40 -07:00
|
|
|
onClick={invertSelection}
|
2023-01-04 09:14:33 -07:00
|
|
|
disabled={_.isEmpty(archives)}
|
2022-10-24 17:15:15 -06:00
|
|
|
>
|
|
|
|
|
Invert
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
color='yellow'
|
2023-01-04 11:16:40 -07:00
|
|
|
onClick={clearSelection}
|
2023-01-04 09:14:33 -07:00
|
|
|
disabled={_.isEmpty(archives) || _.isEmpty(selectedArchives)}
|
2022-10-24 17:15:15 -06:00
|
|
|
>
|
|
|
|
|
Clear
|
|
|
|
|
</Button>
|
2026-04-09 16:18:26 -06:00
|
|
|
<BulkTagModal
|
|
|
|
|
open={bulkTagOpen}
|
|
|
|
|
onClose={() => setBulkTagOpen(false)}
|
|
|
|
|
paths={selectedArchives}
|
|
|
|
|
onComplete={onBulkTagComplete}
|
|
|
|
|
/>
|
2022-09-23 16:22:57 -06:00
|
|
|
</div>;
|
|
|
|
|
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
const {body, paginator, viewButton} = FilesView(
|
2024-07-22 16:36:57 -06:00
|
|
|
{
|
|
|
|
|
files: archives,
|
|
|
|
|
activePage: activePage,
|
|
|
|
|
totalPages: totalPages,
|
|
|
|
|
selectElem: selectElm,
|
|
|
|
|
selectedKeys: selectedArchives,
|
|
|
|
|
onSelect: onSelect,
|
|
|
|
|
setPage: setPage,
|
|
|
|
|
headlines: !!searchStr
|
|
|
|
|
},
|
2023-04-09 14:13:36 -06:00
|
|
|
);
|
|
|
|
|
|
2024-02-19 15:08:04 -07:00
|
|
|
|
2025-12-17 17:27:17 -07:00
|
|
|
// Domain header with edit link when filtering by domain
|
|
|
|
|
let header;
|
|
|
|
|
if (domainObj && domainObj.domain) {
|
2026-03-20 15:38:32 -06:00
|
|
|
const editLink = `/archives/domain/${domainObj.id}/edit`;
|
2025-12-17 17:27:17 -07:00
|
|
|
header = <>
|
|
|
|
|
<Header as='h1'>
|
|
|
|
|
{domainObj.domain}
|
|
|
|
|
<Link to={editLink}>
|
|
|
|
|
<Icon name='edit' style={{marginLeft: '0.5em'}}/>
|
|
|
|
|
</Link>
|
|
|
|
|
</Header>
|
|
|
|
|
</>;
|
|
|
|
|
} else if (domain) {
|
|
|
|
|
// Domain filter is set but domain object not loaded yet
|
|
|
|
|
header = <Placeholder style={{marginBottom: '1em'}}>
|
|
|
|
|
<PlaceholderHeader>
|
|
|
|
|
<PlaceholderLine/>
|
|
|
|
|
</PlaceholderHeader>
|
|
|
|
|
</Placeholder>;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-09 14:13:36 -06:00
|
|
|
return <>
|
2025-12-17 17:27:17 -07:00
|
|
|
{header}
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
<SearchControlBar
|
|
|
|
|
searchStr={searchStr}
|
|
|
|
|
setSearchStr={setSearchStr}
|
|
|
|
|
placeholder='Search Archives...'
|
|
|
|
|
inputRef={searchInputRef}
|
|
|
|
|
viewButton={viewButton}
|
|
|
|
|
sorts={archiveOrders}
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
showDeep={true}
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
/>
|
2023-04-09 14:13:36 -06:00
|
|
|
{body}
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
<DeepSearchHint searchStr={searchStr} files={archives}/>
|
2023-04-09 14:13:36 -06:00
|
|
|
{paginator}
|
2026-05-03 17:28:06 -06:00
|
|
|
<TaggedDeleteConfirmModal
|
|
|
|
|
open={taggedFileGroups !== null}
|
|
|
|
|
taggedFileGroups={taggedFileGroups}
|
|
|
|
|
onCancel={() => setTaggedFileGroups(null)}
|
|
|
|
|
onConfirm={async () => {
|
|
|
|
|
setTaggedFileGroups(null);
|
|
|
|
|
await onDelete(true);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-04-09 14:13:36 -06:00
|
|
|
</>
|
2022-08-06 05:22:07 +00:00
|
|
|
}
|
2022-01-03 15:13:02 -07:00
|
|
|
|
2022-11-04 09:58:38 -06:00
|
|
|
export function ArchiveRowCells({file}) {
|
2023-03-24 08:58:18 -06:00
|
|
|
const {data} = file;
|
2023-11-02 16:56:05 -06:00
|
|
|
let {sort} = useSearchOrder();
|
|
|
|
|
sort = sort ? sort.replace(/^-+/, '') : null;
|
2022-11-04 09:58:38 -06:00
|
|
|
|
2026-03-20 15:38:32 -06:00
|
|
|
const archiveUrl = `/archives/${file.id}`;
|
2023-03-29 13:46:39 -06:00
|
|
|
const posterPath = findPosterPath(file);
|
|
|
|
|
const posterUrl = posterPath ? `/media/${encodeMediaPath(posterPath)}` : null;
|
2022-11-04 09:58:38 -06:00
|
|
|
|
|
|
|
|
let poster;
|
|
|
|
|
if (posterUrl) {
|
|
|
|
|
poster = <CardLink to={archiveUrl}>
|
|
|
|
|
<Image wrapped src={posterUrl} width='50px'/>
|
|
|
|
|
</CardLink>;
|
|
|
|
|
} else {
|
|
|
|
|
poster = <FileIcon file={file} size='large'/>;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
let dataCell = file.published_datetime ? isoDatetimeToAgoPopup(file.published_datetime) : '';
|
2023-11-02 16:56:05 -06:00
|
|
|
if (sort === 'published_modified_datetime') {
|
2024-11-02 15:14:02 -06:00
|
|
|
dataCell = file.published_modified_datetime ? isoDatetimeToAgoPopup(file.published_modified_datetime) : '';
|
2023-11-02 16:56:05 -06:00
|
|
|
} else if (sort === 'download_datetime') {
|
2024-11-02 15:14:02 -06:00
|
|
|
dataCell = file.download_datetime ? isoDatetimeToAgoPopup(file.download_datetime) : '';
|
2023-11-02 16:56:05 -06:00
|
|
|
} else if (sort === 'size') {
|
|
|
|
|
dataCell = humanFileSize(file.size);
|
|
|
|
|
} else if (sort === 'viewed') {
|
2024-11-02 15:14:02 -06:00
|
|
|
dataCell = isoDatetimeToAgoPopup(file.viewed);
|
2023-11-02 16:56:05 -06:00
|
|
|
}
|
|
|
|
|
|
2022-11-04 09:58:38 -06:00
|
|
|
// Fragment for SelectableRow
|
2023-02-17 16:09:24 -07:00
|
|
|
return <React.Fragment>
|
2022-11-04 09:58:38 -06:00
|
|
|
<TableCell>
|
|
|
|
|
<center>{poster}</center>
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<CardLink to={archiveUrl}>
|
2023-03-24 08:58:18 -06:00
|
|
|
<FileRowTagIcon file={file}/>
|
|
|
|
|
{textEllipsis(file.title || file.stem)}
|
2022-11-04 09:58:38 -06:00
|
|
|
</CardLink>
|
|
|
|
|
</TableCell>
|
2023-11-02 16:56:05 -06:00
|
|
|
<TableCell>{dataCell}</TableCell>
|
2023-02-17 16:09:24 -07:00
|
|
|
</React.Fragment>
|
2022-11-04 09:58:38 -06:00
|
|
|
}
|
|
|
|
|
|
2026-02-02 15:15:28 -07:00
|
|
|
function ArchiveStatistics() {
|
|
|
|
|
useTitle('Archive Statistics');
|
|
|
|
|
|
|
|
|
|
const {statistics} = useArchiveStatistics();
|
|
|
|
|
|
|
|
|
|
if (statistics === null) {
|
|
|
|
|
// Request is pending.
|
|
|
|
|
return <Loader active inline='centered'/>
|
|
|
|
|
} else if (statistics === undefined) {
|
|
|
|
|
return <ErrorMessage>Unable to fetch Archive Statistics</ErrorMessage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {archives, historical, domains} = statistics;
|
|
|
|
|
|
|
|
|
|
const archiveNames = [
|
|
|
|
|
{key: 'archives', label: 'Archives'},
|
|
|
|
|
{key: 'sum_size', label: 'Total Size'},
|
|
|
|
|
{key: 'max_size', label: 'Largest Archive'},
|
|
|
|
|
{key: 'week', label: 'Downloads Past Week'},
|
|
|
|
|
{key: 'month', label: 'Downloads Past Month'},
|
|
|
|
|
{key: 'year', label: 'Downloads Past Year'},
|
|
|
|
|
];
|
|
|
|
|
const historicalNames = [
|
|
|
|
|
{key: 'average_count', label: 'Average Monthly Downloads'},
|
|
|
|
|
{key: 'average_size', label: 'Average Monthly Usage'},
|
|
|
|
|
];
|
|
|
|
|
const domainNames = [
|
|
|
|
|
{key: 'domains', label: 'Domains'},
|
|
|
|
|
{key: 'tagged_domains', label: 'Tagged Domains'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const buildSegment = (title, names, stats) => {
|
|
|
|
|
return <Segment>
|
|
|
|
|
<Header textAlign='center' as='h1'>{title}</Header>
|
|
|
|
|
<Statistic.Group>
|
|
|
|
|
{names.map(
|
|
|
|
|
({key, label}) =>
|
|
|
|
|
<Statistic key={key} style={{margin: '2em'}}>
|
|
|
|
|
<StatisticValue>{stats[key]}</StatisticValue>
|
|
|
|
|
<StatisticLabel>{label}</StatisticLabel>
|
|
|
|
|
</Statistic>
|
|
|
|
|
)}
|
|
|
|
|
</Statistic.Group>
|
|
|
|
|
</Segment>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <>
|
|
|
|
|
{buildSegment('Archives', archiveNames, archives)}
|
|
|
|
|
{buildSegment('Historical Archives', historicalNames, historical)}
|
|
|
|
|
{buildSegment('Domains', domainNames, domains)}
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
export function ArchiveRoute() {
|
2025-10-29 22:16:33 -06:00
|
|
|
const location = useLocation();
|
|
|
|
|
const path = location.pathname;
|
|
|
|
|
|
2022-01-29 22:25:35 -07:00
|
|
|
const links = [
|
2025-10-29 22:16:33 -06:00
|
|
|
{
|
|
|
|
|
text: 'Archives',
|
2026-03-20 15:38:32 -06:00
|
|
|
to: '/archives',
|
2025-10-29 22:16:33 -06:00
|
|
|
end: true,
|
2026-03-20 15:38:32 -06:00
|
|
|
isActive: () => path === '/archives' || /^\/archives\/\d+$/.test(path)
|
2025-10-29 22:16:33 -06:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'Domains',
|
2026-03-20 15:38:32 -06:00
|
|
|
to: '/archives/domains',
|
|
|
|
|
isActive: () => path.startsWith('/archives/domain')
|
2025-10-29 22:16:33 -06:00
|
|
|
},
|
2026-03-20 15:38:32 -06:00
|
|
|
{text: 'Settings', to: '/archives/settings'},
|
|
|
|
|
{text: 'Statistics', to: '/archives/statistics'},
|
2022-01-29 21:24:39 -07:00
|
|
|
];
|
2022-01-31 09:32:06 -07:00
|
|
|
return <PageContainer>
|
2022-01-29 22:25:35 -07:00
|
|
|
<TabLinks links={links}/>
|
2022-08-06 05:22:07 +00:00
|
|
|
<Routes>
|
2023-07-21 15:14:09 -06:00
|
|
|
<Route path='/' element={<ArchivesPage/>}/>
|
2023-04-09 14:13:36 -06:00
|
|
|
<Route path='domains' element={<DomainsPage/>}/>
|
2025-10-29 22:16:33 -06:00
|
|
|
<Route path='domain/:domainId/edit' element={<DomainEditPage/>}/>
|
2025-01-26 12:44:16 -07:00
|
|
|
<Route path='settings' element={<ArchiveSettingsPage/>}/>
|
2026-02-02 15:15:28 -07:00
|
|
|
<Route path='statistics' element={<ArchiveStatistics/>}/>
|
2026-03-20 15:38:32 -06:00
|
|
|
<Route path=':fileGroupId' element={<ArchivePage/>}/>
|
2022-08-06 05:22:07 +00:00
|
|
|
</Routes>
|
2022-01-31 09:32:06 -07:00
|
|
|
</PageContainer>
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|