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

Modularize event Analytics live tail and fix bug #647

Merged
merged 7 commits into from
Apr 18, 2022
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 @@ -394,7 +394,7 @@ describe('Switch on and off livetail', () => {
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(TEST_QUERIES[1].query);

cy.get('[data-test-subj=eventLiveTail]').click();
cy.get('[data-test-subj=eventLiveTail__delay10]').click();
cy.get('[data-test-subj=eventLiveTail__delay10s]').click();
cy.wait(delay * 2);
cy.get('.euiToastHeader__title').contains('On').should('exist');

Expand All @@ -412,7 +412,7 @@ describe('Live tail stop automatically', () => {
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(TEST_QUERIES[1].query);

cy.get('[data-test-subj=eventLiveTail]').click();
cy.get('[data-test-subj=eventLiveTail__delay10]').click();
cy.get('[data-test-subj=eventLiveTail__delay10s]').click();
cy.wait(delay * 2);
cy.get('.euiToastHeader__title').contains('On').should('exist');
});
Expand Down
51 changes: 51 additions & 0 deletions dashboards-observability/common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,54 @@ export const pageStyles: CSS.Properties = {
export const NUMERICAL_FIELDS = ['short', 'integer', 'long', 'float', 'double'];

export const ENABLED_VIS_TYPES = ['bar', 'horizontal_bar', 'line', 'pie', 'heatmap', 'text'];

//Live tail constants
export const LIVE_OPTIONS = [
{
label:'5s',
startTime: 'now-5s',
delayTime: 5000,
},
{
label:'10s',
startTime: 'now-10s',
delayTime: 10000,
},
{
label:'30s',
startTime: 'now-30s',
delayTime: 30000,
},
{
label:'1m',
startTime: 'now-1m',
delayTime: 60000,
},
{
label:'5m',
startTime: 'now-5m',
delayTime: 60000 * 5,
},
{
label:'15m',
startTime: 'now-15m',
delayTime: 60000 * 15,
},
{
label:'30m',
startTime: 'now-30m',
delayTime: 60000 * 30,
},
{
label:'1h',
startTime: 'now-1h',
delayTime: 60000 * 60,
},
{
label:'2h',
startTime: 'now-2h',
delayTime: 60000 * 120,
},
];

export const LIVE_END_TIME ='now';
8 changes: 8 additions & 0 deletions dashboards-observability/common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,11 @@ export interface IDefaultTimestampState {
default_timestamp: string;
message: string;
}

export interface LiveTailProps {
isLiveTailOn: boolean;
setIsLiveTailPopoverOpen: React.Dispatch<React.SetStateAction<boolean>>;
liveTailName: string;
isLiveTailPopoverOpen: boolean;
dataTestSubj: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Live tail button change live tail to 10s interval 1`] = `
<LiveTailButton
dataTestSubj=""
isLiveTailOn={true}
isLiveTailPopoverOpen={false}
liveTailName="10s"
setIsLiveTailPopoverOpen={[MockFunction]}
>
<EuiButton
data-test-subj=""
iconSide="left"
iconType="stop"
onClick={[Function]}
>
<EuiButtonDisplay
baseClassName="euiButton"
data-test-subj=""
disabled={false}
element="button"
iconSide="left"
iconType="stop"
isDisabled={false}
onClick={[Function]}
type="button"
>
<button
className="euiButton euiButton--primary"
data-test-subj=""
disabled={false}
onClick={[Function]}
style={
Object {
"minWidth": undefined,
}
}
type="button"
>
<EuiButtonContent
className="euiButton__content"
iconSide="left"
iconType="stop"
textProps={
Object {
"className": "euiButton__text",
}
}
>
<span
className="euiButtonContent euiButton__content"
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="stop"
>
<EuiIconStop
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiButtonContent__icon"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiButtonContent__icon"
focusable="false"
height={16}
role="img"
style={null}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M4 2h8a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V4a2 2 0 012-2zm0 1a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V4a1 1 0 00-1-1H4z"
fillRule="evenodd"
/>
</svg>
</EuiIconStop>
</EuiIcon>
<span
className="euiButton__text"
>
10s
</span>
</span>
</EuiButtonContent>
</button>
</EuiButtonDisplay>
</EuiButton>
</LiveTailButton>
`;

exports[`Live tail button starts live tail with 5s interval 1`] = `
<LiveTailButton
dataTestSubj=""
isLiveTailOn={true}
isLiveTailPopoverOpen={false}
liveTailName="5s"
setIsLiveTailPopoverOpen={[MockFunction]}
>
<EuiButton
data-test-subj=""
iconSide="left"
iconType="stop"
onClick={[Function]}
>
<EuiButtonDisplay
baseClassName="euiButton"
data-test-subj=""
disabled={false}
element="button"
iconSide="left"
iconType="stop"
isDisabled={false}
onClick={[Function]}
type="button"
>
<button
className="euiButton euiButton--primary"
data-test-subj=""
disabled={false}
onClick={[Function]}
style={
Object {
"minWidth": undefined,
}
}
type="button"
>
<EuiButtonContent
className="euiButton__content"
iconSide="left"
iconType="stop"
textProps={
Object {
"className": "euiButton__text",
}
}
>
<span
className="euiButtonContent euiButton__content"
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="stop"
>
<EuiIconEmpty
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
height={16}
role="img"
style={null}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
</EuiIcon>
<span
className="euiButton__text"
>
5s
</span>
</span>
</EuiButtonContent>
</button>
</EuiButtonDisplay>
</EuiButton>
</LiveTailButton>
`;

exports[`Live tail off button stop live tail 1`] = `
<StopLiveButton
StopLive={[MockFunction]}
dataTestSubj=""
>
<EuiButton
color="danger"
data-test-subj=""
iconType="stop"
onClick={[Function]}
>
<EuiButtonDisplay
baseClassName="euiButton"
color="danger"
data-test-subj=""
disabled={false}
element="button"
iconType="stop"
isDisabled={false}
onClick={[Function]}
type="button"
>
<button
className="euiButton euiButton--danger"
data-test-subj=""
disabled={false}
onClick={[Function]}
style={
Object {
"minWidth": undefined,
}
}
type="button"
>
<EuiButtonContent
className="euiButton__content"
iconSide="left"
iconType="stop"
textProps={
Object {
"className": "euiButton__text",
}
}
>
<span
className="euiButtonContent euiButton__content"
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="stop"
>
<EuiIconStop
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiButtonContent__icon"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiButtonContent__icon"
focusable="false"
height={16}
role="img"
style={null}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M4 2h8a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V4a2 2 0 012-2zm0 1a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V4a1 1 0 00-1-1H4z"
fillRule="evenodd"
/>
</svg>
</EuiIconStop>
</EuiIcon>
<span
className="euiButton__text"
>
Stop
</span>
</span>
</EuiButtonContent>
</button>
</EuiButtonDisplay>
</EuiButton>
</StopLiveButton>
`;
Loading