Skip to content
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

[8.8] [Synthetics] Disable/enable status alert for viewer user permissions (#156146) #156167

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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,
Expand All @@ -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>
);
}

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down