[8.8] [Synthetics] Show tooltips in settings where applicable (#157240) (#157261)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] Show tooltips in settings where applicable
(#157240)](https://github.com/elastic/kibana/pull/157240)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-05-10T12:14:27Z","message":"[Synthetics]
Show tooltips in settings where applicable
(#157240)","sha":"45d8971b1d17ce88da34ce0ab41ceaed9477153b","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.8.0","v8.9.0"],"number":157240,"url":"https://github.com/elastic/kibana/pull/157240","mergeCommit":{"message":"[Synthetics]
Show tooltips in settings where applicable
(#157240)","sha":"45d8971b1d17ce88da34ce0ab41ceaed9477153b"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/157240","number":157240,"mergeCommit":{"message":"[Synthetics]
Show tooltips in settings where applicable
(#157240)","sha":"45d8971b1d17ce88da34ce0ab41ceaed9477153b"}}]}]
BACKPORT-->

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
Kibana Machine 2023-05-10 09:20:32 -04:00 committed by GitHub
parent 7ae7eecbcc
commit 1136054a26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 26 deletions

View file

@ -22,6 +22,7 @@ import { FormProvider } from 'react-hook-form';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { i18n } from '@kbn/i18n';
import { useDispatch, useSelector } from 'react-redux';
import { NoPermissionsTooltip } from '../../common/components/permissions';
import {
addNewGlobalParamAction,
editGlobalParamAction,
@ -162,16 +163,18 @@ export const AddParamFlyout = ({
return (
<div>
<EuiButton
data-test-subj="syntheticsAddParamFlyoutButton"
fill
iconType="plusInCircleFilled"
iconSide="left"
onClick={() => setIsFlyoutVisible(true)}
isDisabled={!canSave}
>
{CREATE_PARAM}
</EuiButton>
<NoPermissionsTooltip canEditSynthetics={canSave}>
<EuiButton
data-test-subj="syntheticsAddParamFlyoutButton"
fill
iconType="plusInCircleFilled"
iconSide="left"
onClick={() => setIsFlyoutVisible(true)}
isDisabled={!canSave}
>
{CREATE_PARAM}
</EuiButton>
</NoPermissionsTooltip>
{flyout}
</div>
);

View file

@ -170,7 +170,10 @@ export const ParamsList = () => {
setIsDeleteModalVisible(true);
}}
>
Delete {selectedItems.length} params
{i18n.translate('xpack.synthetics.settingsRoute.params.deleteCount', {
defaultMessage: 'Delete {count} params',
values: { count: selectedItems.length },
})}
</EuiButton>
);
};
@ -237,7 +240,7 @@ export const ParamsList = () => {
items={filteredItems}
columns={columns}
tableLayout="auto"
isSelectable={true}
isSelectable={canSave}
pagination={true}
sorting={{
sort: { field: 'key', direction: 'asc' },
@ -255,7 +258,7 @@ export const ParamsList = () => {
setPageSize(page?.size ?? 10);
}}
selection={{
selectable: () => true,
selectable: () => canSave,
onSelectionChange: (sItems) => {
setSelectedItems(sItems);
},

View file

@ -26,7 +26,10 @@ import { useCanManagePrivateLocation } from '../../../hooks';
import { setAddingNewPrivateLocation } from '../../../state/private_locations';
import { PrivateLocationDocsLink, START_ADDING_LOCATIONS_DESCRIPTION } from './empty_locations';
import { PrivateLocation } from '../../../../../../common/runtime_types';
import { CANNOT_SAVE_INTEGRATION_LABEL } from '../../common/components/permissions';
import {
CANNOT_SAVE_INTEGRATION_LABEL,
NoPermissionsTooltip,
} from '../../common/components/permissions';
import { DeleteLocation } from './delete_location';
import { useLocationMonitors } from './hooks/use_location_monitors';
import { PolicyName } from './policy_name';
@ -128,18 +131,20 @@ export const PrivateLocationsTable = ({
const renderToolRight = () => {
return [
<EuiButton
key="addPrivateLocationButton"
fill
data-test-subj={'addPrivateLocationButton'}
isLoading={loading}
disabled={!canManagePrivateLocations || !canSave}
onClick={() => setIsAddingNew(true)}
iconType="plusInCircle"
title={!canManagePrivateLocations ? CANNOT_SAVE_INTEGRATION_LABEL : undefined}
>
{ADD_LABEL}
</EuiButton>,
<NoPermissionsTooltip canEditSynthetics={canSave}>
<EuiButton
key="addPrivateLocationButton"
fill
data-test-subj={'addPrivateLocationButton'}
isLoading={loading}
disabled={!canManagePrivateLocations || !canSave}
onClick={() => setIsAddingNew(true)}
iconType="plusInCircle"
title={!canManagePrivateLocations ? CANNOT_SAVE_INTEGRATION_LABEL : undefined}
>
{ADD_LABEL}
</EuiButton>
</NoPermissionsTooltip>,
];
};