feat(replication): add bucket replication rule editing - #195
Merged
Conversation
The replication tab only supported adding and deleting rules, so target settings — most importantly the sync/async replication mode — could never be changed after creation. Add an edit dialog with full field parity with the add form (priority, mode, endpoint, target bucket, credentials, region, storage class, prefix, tags, TLS, existing-object/delete-marker/delete toggles, health check, bandwidth), prefilled from the rule and its remote target. Saving updates the target via set-remote-target?update=true using the server's MinIO-style field-group ops (creds/sync/bandwidth) computed by change detection, then rewrites the rule in place. The secret key can stay blank: untouched groups keep their stored values server-side, so flipping the replication mode no longer requires re-entering credentials; the secret is only required when connection settings actually change. The rules table gains a replication-mode column joined from the bucket's remote targets. The region field is read-only in the edit dialog because the MinIO update contract defines no region group.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The bucket replication tab only supported adding and deleting rules, so target-level settings — most importantly the sync/async replication mode — could never be changed after creation (customer-reported).
This PR adds rule editing with full field parity with the add form:
components/replication/edit-form.tsx: edit dialog prefilled from the rule and its remote target (priority, mode, endpoint, target bucket, credentials, region, storage class, prefix, tags, TLS, existing-object/delete-marker/delete toggles, health check interval, bandwidth), with the same capability gating as the add form.components/buckets/replication-tab.tsx: per-row Edit action (desktop table + mobile cards) and a Mode column (sync/async) joined from the bucket's remote targets; a targets listing failure only disables editing, never the rules table.hooks/use-bucket.ts:setRemoteReplicationTargetgainsupdate+ field-groupops(MinIOTargetUpdateTypecontract:creds/sync/bandwidth).Saving is a two-step write: the remote target is updated via
set-remote-target?update=true&<ops>with only the field groups that actually changed (change detection), then the rule is rewritten in place by ID. The secret key may stay blank — untouched groups keep their stored values server-side, so flipping the replication mode no longer requires re-entering credentials; the secret is required only when connection settings (endpoint, target bucket, TLS, access key) change. The region field is read-only in the edit dialog because the MinIO update contract defines no region group.Requires the companion server PR rustfs/rustfs#5715. Against older servers the edit dialog degrades: a zero-ops save is a server-side no-op and creds-bearing saves behave like the old full update.
i18n: three new strings translated for all 14 locales (locale-consistency test enforced).
Verification
pnpm install --frozen-lockfile— passpnpm tsc --noEmit— passpnpm lint— passpnpm prettier --checkon changed files — passpnpm test:run— 387/387 pass (includes the locale key-parity suite covering the new strings)list-remote-targetsconfirmed credentials untouched; rule-level edits (priority, delete replication toggle, storage class) persisted correctly; server-side credential mismatch surfaces the backend error in the dialog; bidirectional replication smoke passed after each edit.