A permission-aware button component for creating resources in the Kafka UI. It automatically checks user authorization before rendering the action.
// Source: https://github.com/provectus/kafka-ui | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import React from 'react';
import { Props as ButtonProps } from 'components/common/Button/Button';
import { ActionComponentProps } from 'components/common/ActionComponent/ActionComponent';
import { useCreatePermission } from 'lib/hooks/useCreatePermisson';
import ActionCanButton from 'components/common/ActionComponent/ActionButton/ActionCanButton/ActionCanButton';
interface Props extends ActionComponentProps, ButtonProps {}
const ActionCreateButton: React.FC<Props> = ({ permission, ...props }) => {
const canDoAction = useCreatePermission(permission.resource);
return <ActionCanBu
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key