mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.8`: - [[Synthetics] Disable/enable status alert for viewer user permissions (#156146)](https://github.com/elastic/kibana/pull/156146) <!--- 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-04-28T11:18:35Z","message":"[Synthetics] Disable/enable status alert for viewer user permissions (#156146)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/155937\n\nFor viewer user tooltip will be displayed and button is disabled.\n\nAlso fixed loading position for manual test run loader.\n\n<img width=\"1770\" alt=\"image\"\nsrc=\"https://user-images.githubusercontent.com/3505601/235106034-7e758a5d-7291-47a2-8a46-2327b367e4a8.png\">","sha":"dab1409fef83810b12d121ef6c9d2ecda60b4ed3","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":156146,"url":"https://github.com/elastic/kibana/pull/156146","mergeCommit":{"message":"[Synthetics] Disable/enable status alert for viewer user permissions (#156146)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/155937\n\nFor viewer user tooltip will be displayed and button is disabled.\n\nAlso fixed loading position for manual test run loader.\n\n<img width=\"1770\" alt=\"image\"\nsrc=\"https://user-images.githubusercontent.com/3505601/235106034-7e758a5d-7291-47a2-8a46-2327b367e4a8.png\">","sha":"dab1409fef83810b12d121ef6c9d2ecda60b4ed3"}},"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/156146","number":156146,"mergeCommit":{"message":"[Synthetics] Disable/enable status alert for viewer user permissions (#156146)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/155937\n\nFor viewer user tooltip will be displayed and button is disabled.\n\nAlso fixed loading position for manual test run loader.\n\n<img width=\"1770\" alt=\"image\"\nsrc=\"https://user-images.githubusercontent.com/3505601/235106034-7e758a5d-7291-47a2-8a46-2327b367e4a8.png\">","sha":"dab1409fef83810b12d121ef6c9d2ecda60b4ed3"}}]}] BACKPORT--> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
parent
8a0eea0d1e
commit
f21d997505
3 changed files with 20 additions and 6 deletions
|
@ -235,7 +235,12 @@ export function ActionsPopover({
|
|||
},
|
||||
},
|
||||
{
|
||||
name: monitor.isStatusAlertEnabled ? disableAlertLabel : enableMonitorAlertLabel,
|
||||
name: (
|
||||
<NoPermissionsTooltip canEditSynthetics={canEditSynthetics}>
|
||||
{monitor.isStatusAlertEnabled ? disableAlertLabel : enableMonitorAlertLabel}
|
||||
</NoPermissionsTooltip>
|
||||
),
|
||||
disabled: !canEditSynthetics,
|
||||
icon: alertLoading ? (
|
||||
<EuiLoadingSpinner size="s" />
|
||||
) : monitor.isStatusAlertEnabled ? (
|
||||
|
|
|
@ -27,7 +27,7 @@ import { useRef } from 'react';
|
|||
import { selectErrorPopoverState, toggleErrorPopoverOpen } from '../../../../state';
|
||||
import { useErrorDetailsLink } from '../../../common/links/error_details_link';
|
||||
import { MonitorOverviewItem, OverviewPing } from '../../../../../../../common/runtime_types';
|
||||
import { manualTestRunSelector } from '../../../../state/manual_test_runs';
|
||||
import { manualTestRunSelector, isTestRunning } from '../../../../state/manual_test_runs';
|
||||
import { useFormatTestRunAt } from '../../../../utils/monitor_test_result/test_time_formats';
|
||||
|
||||
const Container = styled.div`
|
||||
|
@ -62,7 +62,7 @@ export const MetricItemIcon = ({
|
|||
dispatch(toggleErrorPopoverOpen(configIdByLocation));
|
||||
};
|
||||
|
||||
const inProgress = testNowRun?.status === 'in-progress' || testNowRun?.status === 'loading';
|
||||
const inProgress = isTestRunning(testNowRun);
|
||||
|
||||
const errorLink = useErrorDetailsLink({
|
||||
configId: monitor.configId,
|
||||
|
@ -75,9 +75,11 @@ export const MetricItemIcon = ({
|
|||
|
||||
if (inProgress) {
|
||||
return (
|
||||
<EuiToolTip position="top" content="Test is in progress">
|
||||
<EuiLoadingSpinner />
|
||||
</EuiToolTip>
|
||||
<Container>
|
||||
<EuiToolTip position="top" content={TEST_IN_PROGRESS}>
|
||||
<EuiLoadingSpinner />
|
||||
</EuiToolTip>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -164,6 +166,10 @@ const ERROR_DETAILS = i18n.translate('xpack.synthetics.errorDetails.label', {
|
|||
defaultMessage: 'Error details',
|
||||
});
|
||||
|
||||
const TEST_IN_PROGRESS = i18n.translate('xpack.synthetics.inProgress.label', {
|
||||
defaultMessage: 'Manual test run is in progress.',
|
||||
});
|
||||
|
||||
const StyledIcon = euiStyled.div<{ boxShadow: string }>`
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
|
|
@ -31,6 +31,9 @@ export enum TestRunStatus {
|
|||
COMPLETED = 'completed',
|
||||
}
|
||||
|
||||
export const isTestRunning = (testRun?: ManualTestRun) =>
|
||||
testRun?.status === TestRunStatus.IN_PROGRESS || testRun?.status === TestRunStatus.LOADING;
|
||||
|
||||
export interface ManualTestRun {
|
||||
configId: string;
|
||||
name: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue