Skip to content

Commit

Permalink
Remove ability to update brokers from website, only 1 way function
Browse files Browse the repository at this point in the history
  • Loading branch information
dakota002 committed Nov 19, 2024
1 parent b6f5ee8 commit b48b2d3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
8 changes: 0 additions & 8 deletions app/lib/kafka.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,6 @@ export async function deleteKafkaACL(user: User, aclIds: string[]) {
)
}

export async function updateBrokersFromDb(user: User) {
const dbDefinedAcls = await getKafkaACLsFromDynamoDB(user)
const adminClient = adminKafka.admin()
await adminClient.connect()
await adminClient.createAcls({ acl: dbDefinedAcls })
await adminClient.disconnect()
}

export async function updateDbFromBrokers(user: User) {
const kafkaDefinedAcls = await getAclsFromBrokers()
const db = await tables()
Expand Down
48 changes: 0 additions & 48 deletions app/routes/admin.kafka._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
deleteKafkaACL,
getKafkaACLsFromDynamoDB,
getLastSyncDate,
updateBrokersFromDb,
updateDbFromBrokers,
} from '~/lib/kafka.server'
import { getFormDataString } from '~/lib/utils'
Expand Down Expand Up @@ -67,11 +66,6 @@ export async function action({ request }: ActionFunctionArgs) {
return null
}

if (intent === 'migrateFromDB') {
await updateBrokersFromDb(user)
return null
}

const promises = []

switch (intent) {
Expand Down Expand Up @@ -130,7 +124,6 @@ export default function Index() {
const updateFetcher = useFetcher<typeof action>()
const aclFetcher = useFetcher<typeof loader>()
const brokerFromDbFetcher = useFetcher()
const ref = useRef<ModalRef>(null)

useEffect(() => {
setAclData(aclFetcher.data?.dynamoDbAclData ?? aclData)
Expand Down Expand Up @@ -175,16 +168,6 @@ export default function Index() {
) : (
<br />
)}
<ModalToggleButton
opener
disabled={
updateFetcher.state !== 'idle' || brokerFromDbFetcher.state !== 'idle'
}
modalRef={ref}
type="button"
>
Update Broker from DB
</ModalToggleButton>
{brokerFromDbFetcher.state !== 'idle' && (
<span className="text-middle">
<Spinner /> Updating...
Expand Down Expand Up @@ -224,37 +207,6 @@ export default function Index() {
</SegmentedCards>
</>
)}
<Modal
id="modal-update"
ref={ref}
aria-labelledby="modal-update-heading"
aria-describedby="modal-update-description"
renderToPortal={false} // FIXME: https://github.com/trussworks/react-uswds/pull/1890#issuecomment-1023730448
>
<brokerFromDbFetcher.Form method="POST" action="/admin/kafka">
<ModalHeading id="modal-update-heading">Confirm Update</ModalHeading>
<p id="modal-update-description">
This will affect some_number of ACLs currently defined on the
broker. If you want to maintain the ACLs defined on the brokers,
click cancel to close this window then click the Pull ACLs from
Broker button.
</p>
<p>This action cannot be undone.</p>
<ModalFooter>
<ModalToggleButton modalRef={ref} closer outline>
Cancel
</ModalToggleButton>
<Button
data-close-modal
type="submit"
name="intent"
value="migrateFromDB"
>
Confirm
</Button>
</ModalFooter>
</brokerFromDbFetcher.Form>
</Modal>
</>
)
}
Expand Down

0 comments on commit b48b2d3

Please sign in to comment.