Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: add Enable all / Disable all for federated media models and show a loading state while model lists load

Adam Eivy93a91e2c5fe6
diff --git a/client/src/components/settings/SharingTab.jsx b/client/src/components/settings/SharingTab.jsx
index fef7b1bd52..a0895ad866 100644
--- a/client/src/components/settings/SharingTab.jsx
+++ b/client/src/components/settings/SharingTab.jsx
@@ -67,11 +67,11 @@ export function SharingTab() {
const [providerEnabled, setProviderEnabled] = useState(false);
const [providerMaxQueuedJobs, setProviderMaxQueuedJobs] = useState(2);
const [providerModels, setProviderModels] = useState([]);
- // `null` per kind = the candidate list could not be fetched, which is NOT the
+ // `undefined` per kind = still loading; `null` = the candidate list could not be fetched, which is NOT the
// same as a genuinely empty local catalog — reporting "no models installed"
// for a transient API failure would send the user hunting for a model they
// already have.
- const [visualCandidates, setVisualCandidates] = useState({ image: null, video: null });
+ const [visualCandidates, setVisualCandidates] = useState({ image: undefined, video: undefined });
const [providerVisualModels, setProviderVisualModels] = useState({ image: [], video: [] });
const [savedProviderVisualModels, setSavedProviderVisualModels] = useState({ image: [], video: [] });
const [savedProviderEnabled, setSavedProviderEnabled] = useState(false);
@@ -175,6 +175,20 @@ export function SharingTab() {
: current.filter((model) => modelKey(model) !== key));
};
+ // Bulk toggle: "all" selects every ready model (not-ready ones can't be
+ // newly shared), "none" clears every selection including not-ready ones.
+ const setAllModels = (enable) => {
+ setProviderModels(enable
+ ? musicEngines.flatMap((engine) => (engine.models || [])
+ .filter((model) => modelReady(engine, model))
+ .map((model) => ({ engine: engine.id, modelId: model.id })))
+ : []);
+ setProviderVisualModels(Object.fromEntries(VISUAL_KINDS.map(({ kind }) => [kind, enable
+ ? (visualCandidates[kind] || []).filter((candidate) => candidate.ready)
+ .map((candidate) => ({ engine: candidate.engine, modelId: candidate.modelId }))
+ : []])));
+ };
+
const toggleVisualModel = (kind, candidate, checked) => {
const key = modelKey(candidate);
setProviderVisualModels((current) => ({
@@ -367,6 +381,25 @@ export function SharingTab() {
</p>
</div>
+ <div className="flex flex-wrap gap-2">
+ <button
+ type="button"
+ onClick={() => setAllModels(true)}
+ disabled={providerSaving || strictPullSaving}
+ className="inline-flex items-center min-h-[40px] px-3 py-2 bg-port-card hover:bg-port-border text-gray-200 rounded-lg text-sm transition-colors disabled:opacity-40"
+ >
+ Enable all
+ </button>
+ <button
+ type="button"
+ onClick={() => setAllModels(false)}
+ disabled={providerSaving || strictPullSaving}
+ className="inline-flex items-center min-h-[40px] px-3 py-2 bg-port-card hover:bg-port-border text-gray-200 rounded-lg text-sm transition-colors disabled:opacity-40"
+ >
+ Disable all
+ </button>
+ </div>
+
<fieldset>
<legend className="block text-xs uppercase tracking-wider text-gray-500 mb-2">Allowed audio models</legend>
{musicEngines.length === 0 ? (
@@ -406,6 +439,7 @@ export function SharingTab() {
</fieldset>
{VISUAL_KINDS.map(({ kind, label, field }) => {
+ const loadingModels = visualCandidates[kind] === undefined;
const unavailable = visualCandidates[kind] === null;
const rows = candidateRows(visualCandidates[kind] || [], providerVisualModels[kind]);
return (
@@ -413,7 +447,9 @@ export function SharingTab() {
<legend className="block text-xs uppercase tracking-wider text-gray-500 mb-2">Allowed {label} models</legend>
{rows.length === 0 ? (
<p className="text-sm text-gray-500">
- {unavailable
+ {loadingModels
+ ? <span className="inline-flex items-center gap-2"><Loader2 size={14} className="animate-spin" />{`Loading local ${label} models...`}</span>
+ : unavailable
? `Could not load the local ${label} model list. Reload to try again.`
: `No local ${label} models are installed to share.`}
</p>
diff --git a/client/src/components/settings/SharingTab.test.jsx b/client/src/components/settings/SharingTab.test.jsx
index 194046a0da..eaf7af7a61 100644
--- a/client/src/components/settings/SharingTab.test.jsx
+++ b/client/src/components/settings/SharingTab.test.jsx
@@ -254,6 +254,35 @@ describe('SharingTab — patches only the federation sub-keys it owns', () => {
});
});
+describe('SharingTab — bulk enable/disable and loading state', () => {
+ it('shows a loading state, not the failure message, while candidates load', async () => {
+ getMediaShareCandidates.mockReturnValue(new Promise(() => {}));
+ render(<SharingTab />);
+ expect(await screen.findByText(/Loading local image models/i)).toBeInTheDocument();
+ expect(screen.queryByText(/Could not load the local image model list/i)).not.toBeInTheDocument();
+ });
+
+ it('Enable all checks every ready model; Disable all clears them', async () => {
+ getAuthStatus.mockResolvedValue({ enabled: true });
+ getMediaShareCandidates.mockResolvedValue({
+ image: [
+ { engine: 'local', modelId: 'img-a', modelName: 'img-a', ready: true },
+ { engine: 'local', modelId: 'img-b', modelName: 'img-b', ready: false },
+ ],
+ video: [{ engine: 'local', modelId: 'vid-a', modelName: 'vid-a', ready: true }],
+ });
+ render(<SharingTab />);
+ const imgA = await screen.findByLabelText(/img-a/);
+ fireEvent.click(screen.getByRole('button', { name: 'Enable all' }));
+ expect(imgA).toBeChecked();
+ expect(screen.getByLabelText(/vid-a/)).toBeChecked();
+ expect(screen.getByLabelText(/img-b/)).not.toBeChecked();
+ fireEvent.click(screen.getByRole('button', { name: 'Disable all' }));
+ expect(imgA).not.toBeChecked();
+ expect(screen.getByLabelText(/vid-a/)).not.toBeChecked();
+ });
+});
+
describe('SharingTab — a failed candidate fetch is not an empty catalog', () => {
it('says the list could not load rather than "no models installed"', async () => {
getMediaShareCandidates.mockRejectedValue(new Error('offline'));