feat: the library's folders are set in Admin › Library, and changing a folder moves its tracks with it, keeping their plays, likes and playlists (#6129)
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m20s
release / go (push) Failing after 1m37s
release / integration (push) Failing after 4m56s
release / android (push) Successful in 5m1s
release / Build signed APK (releases and dev) (push) Successful in 5m13s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m20s
release / go (push) Failing after 1m37s
release / integration (push) Failing after 4m56s
release / android (push) Successful in 5m1s
release / Build signed APK (releases and dev) (push) Successful in 5m13s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import StageBadge from '#lib/components/StageBadge.svelte';
|
||||
import LoudnessSettingsCard from '#lib/components/LoudnessSettingsCard.svelte';
|
||||
import FingerprintSettingsCard from '#lib/components/FingerprintSettingsCard.svelte';
|
||||
import LibraryFoldersSetting from '#lib/components/LibraryFoldersSetting.svelte';
|
||||
import SettingsColumns from '#lib/components/settings/SettingsColumns.svelte';
|
||||
import SettingsGroup from '#lib/components/settings/SettingsGroup.svelte';
|
||||
import SettingRow from '#lib/components/settings/SettingRow.svelte';
|
||||
@@ -15,7 +16,6 @@
|
||||
triggerScan,
|
||||
researchMissingArt
|
||||
} from '#lib/api/admin.js';
|
||||
import { createSearchSettingsQuery } from '#lib/api/wanted.js';
|
||||
import { qk } from '#lib/api/queries.js';
|
||||
import { errMessage } from '#lib/api/errors.js';
|
||||
import { pushToast } from '#lib/stores/toast.svelte.js';
|
||||
@@ -31,9 +31,6 @@
|
||||
const button =
|
||||
'rounded-md border border-border px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-hover hover:text-text-primary disabled:opacity-50';
|
||||
|
||||
const searchStore = createSearchSettingsQuery();
|
||||
const folders = $derived($searchStore.data?.scan_paths ?? []);
|
||||
|
||||
const scanStore = createScanStatusQuery();
|
||||
const scan = $derived($scanStore.data);
|
||||
const scanInFlight = $derived(scan?.in_flight === true);
|
||||
@@ -150,11 +147,13 @@
|
||||
<SettingsColumns>
|
||||
{#snippet main()}
|
||||
<SettingsGroup title="Library" id="scan" hint="The folders Minstrel reads, and the scan that reads them.">
|
||||
<SettingRow label="Folders" hint="Set where Minstrel is installed.">
|
||||
<span class="flex flex-col items-end font-mono text-xs text-text-secondary" data-testid="library-folders">
|
||||
{#each folders as f (f)}<span>{f}</span>{:else}<span>—</span>{/each}
|
||||
</span>
|
||||
</SettingRow>
|
||||
<!-- The import's folder picker reads the folders through search settings. -->
|
||||
<LibraryFoldersSetting
|
||||
onSaved={() => {
|
||||
client.invalidateQueries({ queryKey: qk.scanStatus() });
|
||||
client.invalidateQueries({ queryKey: qk.searchSettings() });
|
||||
}}
|
||||
/>
|
||||
<SettingRow label="Scan" hint={scanLine}>
|
||||
<button type="button" onclick={onRunScan} disabled={triggering || scanInFlight} class={button}>
|
||||
{scanInFlight ? 'Scanning…' : triggering ? 'Starting…' : 'Run scan'}
|
||||
|
||||
@@ -21,14 +21,17 @@ vi.mock('#lib/api/admin.js', () => ({
|
||||
updateLoudnessSettings: vi.fn(),
|
||||
getLoudnessCoverage: vi.fn(() => new Promise(() => {})),
|
||||
getFingerprintSettings: vi.fn(() => new Promise(() => {})),
|
||||
updateFingerprintSettings: vi.fn()
|
||||
updateFingerprintSettings: vi.fn(),
|
||||
getLibraryFolders: vi.fn().mockResolvedValue({
|
||||
saved: false,
|
||||
folders: [
|
||||
{ path: '/music', present: true, tracks: 1200 },
|
||||
{ path: '/more-music', present: true, tracks: 3 }
|
||||
]
|
||||
}),
|
||||
updateLibraryFolders: vi.fn()
|
||||
}));
|
||||
|
||||
vi.mock('#lib/api/wanted.js', async () => {
|
||||
const { mockQuery } = await import('../../../test-utils/query');
|
||||
return { createSearchSettingsQuery: vi.fn(() => mockQuery({ data: { scan_paths: ['/music', '/more-music'] } })) };
|
||||
});
|
||||
|
||||
import LibraryPage from './+page.svelte';
|
||||
import {
|
||||
createScanStatusQuery,
|
||||
@@ -57,9 +60,9 @@ function setup(scan: Partial<ScanStatus> = { id: '', started_at: '', finished_at
|
||||
const squash = (el: Element) => el.textContent?.replace(/\s+/g, ' ').trim();
|
||||
|
||||
describe('Admin › Library', () => {
|
||||
test('lists the folders Minstrel reads', () => {
|
||||
test('lists the folders Minstrel reads', async () => {
|
||||
setup();
|
||||
const folders = [...screen.getByTestId('library-folders').children].map((el) => el.textContent);
|
||||
const folders = [...(await screen.findByTestId('library-folders')).children].map((el) => el.textContent);
|
||||
expect(folders).toEqual(['/music', '/more-music']);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user