-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ingest] Address #59376 feedback #59961
Changes from 5 commits
518ae4e
53d0ce3
45717e2
ce9abdf
0184341
42a7604
a2c655e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ import { | |
} from '../../../constants'; | ||
import { WithHeaderLayout } from '../../../layouts'; | ||
import { | ||
useCore, | ||
useGetAgentConfigs, | ||
usePagination, | ||
useLink, | ||
|
@@ -87,6 +88,7 @@ const DangerEuiContextMenuItem = styled(EuiContextMenuItem)` | |
|
||
const RowActions = React.memo<{ config: AgentConfig; onDelete: () => void }>( | ||
({ config, onDelete }) => { | ||
const core = useCore(); | ||
const DETAILS_URI = useLink(`${AGENT_CONFIG_DETAILS_PATH}${config.id}`); | ||
const ADD_DATASOURCE_URI = `${DETAILS_URI}/add-datasource`; | ||
|
||
|
@@ -120,6 +122,7 @@ const RowActions = React.memo<{ config: AgentConfig; onDelete: () => void }>( | |
</EuiContextMenuItem>, | ||
|
||
<EuiContextMenuItem | ||
disabled={!core.application.capabilities.ingestManager.write} | ||
icon="plusInCircle" | ||
href={ADD_DATASOURCE_URI} | ||
key="createDataSource" | ||
|
@@ -130,7 +133,7 @@ const RowActions = React.memo<{ config: AgentConfig; onDelete: () => void }>( | |
/> | ||
</EuiContextMenuItem>, | ||
|
||
<EuiContextMenuItem icon="copy" disabled={true} key="copyConfig"> | ||
<EuiContextMenuItem icon="copy" key="copyConfig"> | ||
jfsiii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<FormattedMessage | ||
id="xpack.ingestManager.agentConfigList.copyConfigActionText" | ||
defaultMessage="Copy configuration" | ||
|
@@ -162,6 +165,7 @@ const RowActions = React.memo<{ config: AgentConfig; onDelete: () => void }>( | |
|
||
export const AgentConfigListPage: React.FunctionComponent<{}> = () => { | ||
// Config information | ||
const core = useCore(); | ||
const { | ||
fleet: { enabled: isFleetEnabled }, | ||
} = useConfig(); | ||
|
@@ -309,6 +313,7 @@ export const AgentConfigListPage: React.FunctionComponent<{}> = () => { | |
<EuiButton | ||
fill | ||
iconType="plusInCircle" | ||
isDisabled={!core.application.capabilities.ingestManager.write} | ||
onClick={() => setIsCreateAgentConfigFlyoutOpen(true)} | ||
> | ||
<FormattedMessage | ||
|
@@ -317,7 +322,7 @@ export const AgentConfigListPage: React.FunctionComponent<{}> = () => { | |
/> | ||
</EuiButton> | ||
), | ||
[setIsCreateAgentConfigFlyoutOpen] | ||
[core.application.capabilities.ingestManager.write, setIsCreateAgentConfigFlyoutOpen] | ||
); | ||
|
||
const emptyPrompt = useMemo( | ||
|
@@ -331,7 +336,7 @@ export const AgentConfigListPage: React.FunctionComponent<{}> = () => { | |
/> | ||
</h2> | ||
} | ||
actions={createAgentConfigButton} | ||
actions={false ?? createAgentConfigButton} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update this with the correct There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure to understand this expression it's not always going to return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't mean to add that. Will fix |
||
/> | ||
), | ||
[createAgentConfigButton] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal opinion: I found this verbose, should we have a hook that hide some of this complexity.
Maybe something like
const hasWriteCapabilites = useWriteCapabilites()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's wordy, but would like to hold off generalizing it until we have a better idea of our permissions model and workflows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I wrote made sense to me at the time, but I now agree we should just pack this up into a hook. I'll send a commit soon.