release: publish v2.0.32 account controls
Prevent account enable checkboxes from opening the account editor during rapid interactions. Remove the redundant global account toggle and keep every configured account independently controlled.
This commit is contained in:
+1
-31
@@ -45,7 +45,7 @@ import {
|
||||
sortPackageOrderByName
|
||||
} from "./package-order";
|
||||
import { pruneSelection, shouldClearDownloadSelection, shouldClearDownloadSelectionOnEscape } from "./selection";
|
||||
import { buildBulkAccountEnabledState, buildConfiguredProviderOrder, getAccountDialogSelectableOptions, matchesAccountModeFilter, pruneAccountRowSelection, resolveAccountUsername, resolveVisibleAccountKind } from "./account-ui";
|
||||
import { buildConfiguredProviderOrder, getAccountDialogSelectableOptions, matchesAccountModeFilter, pruneAccountRowSelection, resolveAccountUsername, resolveVisibleAccountKind } from "./account-ui";
|
||||
import type { AccountModeFilter } from "./account-ui";
|
||||
import { buildAccountDeleteCommand, buildAccountReplaceCommand, createAccountEditState, validateAccountEdit } from "./account-edit";
|
||||
import type { AccountEditState, AccountEditTarget, AccountKind, AccountService, SingleAccountKind } from "./account-edit";
|
||||
@@ -3038,34 +3038,6 @@ export function App(): ReactElement {
|
||||
}
|
||||
};
|
||||
|
||||
const setAllAccountsEnabled = (enabled: boolean): void => {
|
||||
const configuredProviderIds = [...new Set(configuredAccounts.map((entry) => entry.service as DebridProvider))];
|
||||
const nextEnabledState = buildBulkAccountEnabledState(
|
||||
settingsDraftRef.current.disabledProviders || [],
|
||||
configuredProviderIds,
|
||||
accountRows.filter((row) => row.toggleKind === "mega" && row.accountId).map((row) => row.accountId as string),
|
||||
accountRows.filter((row) => row.toggleKind === "dl" && row.accountId).map((row) => row.accountId as string),
|
||||
enabled
|
||||
);
|
||||
const nextDraft: RendererSettingsDraft = {
|
||||
...settingsDraftRef.current,
|
||||
...nextEnabledState,
|
||||
megaDebridApiDisabledAccountIds: enabled ? [] : accountRows.filter((row) => row.entry.kind === "megadebrid-api" && row.accountId).map((row) => row.accountId as string),
|
||||
megaDebridWebDisabledAccountIds: enabled ? [] : accountRows.filter((row) => row.entry.kind === "megadebrid-web" && row.accountId).map((row) => row.accountId as string)
|
||||
};
|
||||
nextDraft.megaDebridDisabledAccountIds = [...new Set([
|
||||
...nextDraft.megaDebridApiDisabledAccountIds,
|
||||
...nextDraft.megaDebridWebDisabledAccountIds
|
||||
])];
|
||||
const nextOverrides = Object.fromEntries(accountRows.map((row) => [row.rowKey, enabled]));
|
||||
enqueueAccountSettingsChange(
|
||||
nextDraft,
|
||||
nextOverrides,
|
||||
enabled ? "Accounts aktiviert" : "Accounts deaktiviert",
|
||||
"Accounts konnten nicht umgeschaltet werden"
|
||||
);
|
||||
};
|
||||
|
||||
const removeAccountTableRow = (row: AccountTableRow): void => {
|
||||
setAccountContextMenu(null);
|
||||
void (async () => {
|
||||
@@ -5068,7 +5040,6 @@ export function App(): ReactElement {
|
||||
rows: visibleAccountRows,
|
||||
selectedIds: selectedAccountViewId ? [selectedAccountViewId] : [],
|
||||
busy: actionBusy || accountCheckBusy,
|
||||
allEnabled: accountRows.length > 0 && accountRows.some((row) => !row.disabled),
|
||||
statusSort: accountStatusSort,
|
||||
rules: {
|
||||
providerOrder: activeProviderOrder.map((provider) => providerLabelWithMode(provider, settingsDraft)),
|
||||
@@ -5121,7 +5092,6 @@ export function App(): ReactElement {
|
||||
if (row) removeAccountTableRow(row);
|
||||
},
|
||||
onCheckAll: () => { void checkAllAccounts(); },
|
||||
onSetAllEnabled: (enabled) => { void setAllAccountsEnabled(enabled); },
|
||||
onStatusSort: cycleAccountStatusSort,
|
||||
onMoveProvider: (index, direction) => {
|
||||
const target = index + direction;
|
||||
|
||||
@@ -58,24 +58,3 @@ export function isAccountRowSelectionKey(key: string, originatedOnRow: boolean):
|
||||
export function resolveAccountUsername(storedUsername: string, checkedEmail?: string): string {
|
||||
return checkedEmail?.trim() || storedUsername.trim() || "—";
|
||||
}
|
||||
|
||||
export function buildBulkAccountEnabledState(
|
||||
currentDisabledProviders: DebridProvider[],
|
||||
configuredProviders: DebridProvider[],
|
||||
megaAccountIds: string[],
|
||||
debridLinkKeyIds: string[],
|
||||
enabled: boolean
|
||||
): {
|
||||
disabledProviders: DebridProvider[];
|
||||
megaDebridDisabledAccountIds: string[];
|
||||
debridLinkDisabledKeyIds: string[];
|
||||
} {
|
||||
const configured = new Set(configuredProviders);
|
||||
return {
|
||||
disabledProviders: enabled
|
||||
? currentDisabledProviders.filter((provider) => !configured.has(provider))
|
||||
: [...new Set([...currentDisabledProviders, ...configuredProviders])],
|
||||
megaDebridDisabledAccountIds: enabled ? [] : [...new Set(megaAccountIds)],
|
||||
debridLinkDisabledKeyIds: enabled ? [] : [...new Set(debridLinkKeyIds)]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ const pairs = [
|
||||
["Hoch", "High"], ["Normal", "Normal"], ["Niedrig", "Low"], ["In Warteschlange", "Queued"], ["Abgeschlossen", "Completed"], ["Entpackt", "Extracted"], ["Automatisch entpacken", "Extract automatically"],
|
||||
["Liste leeren", "Clear list"], ["Sitzung", "Session"], ["Gesamt", "Total"], ["Bereit", "Ready"], ["Download läuft", "Download running"], ["Wartet", "Waiting"], ["Offline", "Offline"],
|
||||
["Übersicht", "Overview"], ["Verwendungsregeln", "Usage rules"], ["Accountverwaltung", "Account management"], ["Accounts hinzufügen, prüfen und verwalten.", "Add, check and manage accounts."],
|
||||
["Accounts zum Herunterladen verwenden", "Use accounts for downloads"], ["Download-Traffic übrig", "Download traffic remaining"], ["Benutzername", "Username"], ["E-Mail", "Email"], ["Verfallsdatum", "Expiration date"], ["Passwort/Zugang", "Password/access"],
|
||||
["Download-Traffic übrig", "Download traffic remaining"], ["Benutzername", "Username"], ["E-Mail", "Email"], ["Verfallsdatum", "Expiration date"], ["Passwort/Zugang", "Password/access"],
|
||||
["Account hinzufügen", "Add account"], ["Ausgewählte prüfen", "Check selected"], ["Ausgewählte entfernen", "Remove selected"], ["Aktivieren", "Enable"], ["Deaktivieren", "Disable"], ["Noch nicht geprüft", "Not checked yet"],
|
||||
["Aktiviert", "Enabled"], ["Aktionen", "Actions"], ["Deaktiviert", "Disabled"], ["Premium aktiv", "Premium active"], ["API-Key aktiv", "API key active"], ["API-Account", "API account"], ["API-Key", "API key"],
|
||||
["Ungültiger API-Key (nicht autorisiert)", "Invalid API key (not authorized)"], ["Free Account", "Free account"], ["Unbeschränkt", "Unlimited"], ["Keine Accounts eingerichtet", "No accounts configured"],
|
||||
|
||||
@@ -63,10 +63,9 @@ export interface AccountWorkspaceViewModel {
|
||||
selectedIds: readonly string[];
|
||||
busy: boolean;
|
||||
error?: string;
|
||||
allEnabled?: boolean;
|
||||
statusSort?: "none" | "desc" | "asc";
|
||||
rules: AccountRulesViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AccountWorkspaceActions {
|
||||
onPanelChange: (panel: AccountWorkspacePanel) => void;
|
||||
@@ -77,8 +76,7 @@ export interface AccountWorkspaceActions {
|
||||
onAdd: () => void;
|
||||
onRemoveSelected: () => void;
|
||||
onCheckAll: () => void;
|
||||
onSetAllEnabled?: (enabled: boolean) => void;
|
||||
onStatusSort?: () => void;
|
||||
onStatusSort?: () => void;
|
||||
onMoveProvider?: (index: number, direction: -1 | 1) => void;
|
||||
onProviderDragStart?: (event: DragEvent<HTMLElement>, index: number) => void;
|
||||
onProviderDragOver?: (event: DragEvent<HTMLElement>, index: number) => void;
|
||||
@@ -226,8 +224,9 @@ function AccountRow({
|
||||
disabled={busy}
|
||||
onChange={() => actions.onToggleEnabled(row.id)}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
onDoubleClick={(event) => event.stopPropagation()}
|
||||
type="checkbox"
|
||||
/>
|
||||
/>
|
||||
</span>
|
||||
<span className="settings-account-hoster" role="cell" title={`${row.hoster} · ${row.mode}`}>
|
||||
<img alt="" aria-hidden="true" draggable={false} height="20" src={row.icon} width="20" />
|
||||
@@ -440,18 +439,7 @@ export function AccountWorkspace({ model, actions }: AccountWorkspaceProps): Rea
|
||||
<h2>Accountverwaltung</h2>
|
||||
<p>Accounts hinzufügen, prüfen und verwalten.</p>
|
||||
</div>
|
||||
{typeof model.allEnabled === "boolean" && actions.onSetAllEnabled ? (
|
||||
<label className="settings-rule-toggle settings-account-all-enabled">
|
||||
<input
|
||||
checked={model.allEnabled}
|
||||
disabled={model.busy || model.rows.length === 0}
|
||||
onChange={(event) => actions.onSetAllEnabled?.(event.target.checked)}
|
||||
type="checkbox"
|
||||
/>
|
||||
<span>Accounts zum Herunterladen verwenden</span>
|
||||
</label>
|
||||
) : null}
|
||||
</header>
|
||||
</header>
|
||||
<SlidingSelection activeKey={model.activePanel} aria-label="Accountverwaltung" aria-orientation="horizontal" axis="horizontal" className="settings-account-tabs" role="tablist">
|
||||
{ACCOUNT_WORKSPACE_PANELS.map((panel, index) => (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user