diff --git a/.changeset/calm-flies-punch.md b/.changeset/calm-flies-punch.md new file mode 100644 index 000000000..2e3bf89cc --- /dev/null +++ b/.changeset/calm-flies-punch.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/e2e': minor +--- + +Add getTextInputValueByName method. diff --git a/.changeset/happy-comics-retire.md b/.changeset/happy-comics-retire.md new file mode 100644 index 000000000..ca28f9c4b --- /dev/null +++ b/.changeset/happy-comics-retire.md @@ -0,0 +1,5 @@ +--- +'renterd': minor +--- + +The key management table now supports multiselect and batch deletion. diff --git a/.changeset/selfish-parrots-applaud.md b/.changeset/selfish-parrots-applaud.md new file mode 100644 index 000000000..dac1240e5 --- /dev/null +++ b/.changeset/selfish-parrots-applaud.md @@ -0,0 +1,6 @@ +--- +'hostd': minor +'renterd': minor +--- + +The onboarding wizard is now bottom right aligned. diff --git a/.changeset/strong-cherries-change.md b/.changeset/strong-cherries-change.md new file mode 100644 index 000000000..0785156b5 --- /dev/null +++ b/.changeset/strong-cherries-change.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/e2e': minor +--- + +Add toggleColumnVisibility view preferences method. diff --git a/apps/hostd/components/OnboardingBar.tsx b/apps/hostd/components/OnboardingBar.tsx index 9b839dcad..21b9a54f2 100644 --- a/apps/hostd/components/OnboardingBar.tsx +++ b/apps/hostd/components/OnboardingBar.tsx @@ -67,7 +67,7 @@ export function OnboardingBar() { if (maximized) { return ( -
+
@@ -232,7 +232,7 @@ export function OnboardingBar() { ) } return ( -
+
} @@ -76,12 +81,12 @@ export function KeyContextMenu({ s3Key, contentProps, buttonProps }: Props) { onSelect={() => { openConfirmDialog({ title: `Delete key ${truncate(s3Key, 15)}`, - action: 'Remove', + action: 'Delete', variant: 'red', body: (
- Are you sure you would like to remove the following key? + Are you sure you would like to delete the following key? {truncate(s3Key, 80)} diff --git a/apps/renterd/components/Keys/KeysBatchMenu/KeysBatchDelete.tsx b/apps/renterd/components/Keys/KeysBatchMenu/KeysBatchDelete.tsx new file mode 100644 index 000000000..6d0433cec --- /dev/null +++ b/apps/renterd/components/Keys/KeysBatchMenu/KeysBatchDelete.tsx @@ -0,0 +1,80 @@ +import { + Button, + Paragraph, + triggerSuccessToast, + triggerErrorToast, +} from '@siafoundation/design-system' +import { Delete16 } from '@siafoundation/react-icons' +import { + useSettingsS3, + useSettingsS3Update, +} from '@siafoundation/renterd-react' +import { useCallback, useMemo } from 'react' +import { omit } from '@technically/lodash' +import { useDialog } from '../../../contexts/dialog' +import { useKeys } from '../../../contexts/keys' + +export function KeysBatchDelete() { + const { selectionMap, deselect } = useKeys() + + const ids = useMemo( + () => Object.entries(selectionMap).map(([_, item]) => item.id), + [selectionMap] + ) + const keys = useMemo( + () => Object.entries(selectionMap).map(([_, item]) => item.key), + [selectionMap] + ) + const { openConfirmDialog } = useDialog() + const settingsS3 = useSettingsS3() + const settingsS3Update = useSettingsS3Update() + const deleteKeys = useCallback(async () => { + if (!settingsS3.data) { + triggerErrorToast({ title: 'Error deleting key' }) + return + } + const newKeys = omit(settingsS3.data?.authentication.v4Keypairs, keys) + const response = await settingsS3Update.put({ + payload: { + ...settingsS3.data, + authentication: { + ...settingsS3.data.authentication, + v4Keypairs: newKeys, + }, + }, + }) + deselect(ids) + if (response.error) { + triggerErrorToast({ title: 'Error deleting keys', body: response.error }) + } else { + triggerSuccessToast({ title: `Keys deleted` }) + } + }, [settingsS3.data, settingsS3Update, deselect, keys, ids]) + + return ( + + ) +} diff --git a/apps/renterd/components/Keys/KeysBatchMenu/index.tsx b/apps/renterd/components/Keys/KeysBatchMenu/index.tsx new file mode 100644 index 000000000..973c4369e --- /dev/null +++ b/apps/renterd/components/Keys/KeysBatchMenu/index.tsx @@ -0,0 +1,21 @@ +import { MultiSelectionMenu } from '@siafoundation/design-system' +import { useKeys } from '../../../contexts/keys' +import { KeysBatchDelete } from './KeysBatchDelete' + +export function KeysBatchMenu() { + const { selectionCount, isPageAllSelected, pageCount, deselectAll } = + useKeys() + + return ( + 0} + selectionCount={selectionCount} + isPageAllSelected={isPageAllSelected} + deselectAll={deselectAll} + pageCount={pageCount} + entityWord="key" + > + + + ) +} diff --git a/apps/renterd/components/Keys/KeysCreateDialog.tsx b/apps/renterd/components/Keys/KeysCreateDialog.tsx index 2002bd726..6963ef241 100644 --- a/apps/renterd/components/Keys/KeysCreateDialog.tsx +++ b/apps/renterd/components/Keys/KeysCreateDialog.tsx @@ -157,8 +157,8 @@ export function KeysCreateDialog({ trigger, open, onOpenChange }: Props) { return ( { diff --git a/apps/renterd/components/Keys/index.tsx b/apps/renterd/components/Keys/index.tsx index 392f077f7..7f13752d3 100644 --- a/apps/renterd/components/Keys/index.tsx +++ b/apps/renterd/components/Keys/index.tsx @@ -8,6 +8,7 @@ import { StateNoneYet } from './StateNoneYet' import { KeysActionsMenu } from './KeysActionsMenu' import { StateError } from './StateError' import { useKeys } from '../../contexts/keys' +import { KeysBatchMenu } from './KeysBatchMenu' export function Keys() { const { openDialog } = useDialog() @@ -20,6 +21,7 @@ export function Keys() { toggleSort, limit, dataState, + cellContext, } = useKeys() return ( @@ -31,7 +33,9 @@ export function Keys() { actions={} >
+ +
@@ -239,13 +239,13 @@ export function OnboardingBar() { ) } return ( -
+