Skip to content
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 @@ -249,6 +249,15 @@ describe('UnifiedHistoryTable', () => {
expect(screen.getByText('Rule')).toBeInTheDocument();
});

it('run by column shows Elastic for rule row', () => {
const row = createMockRuleRow();
mockHistory({ data: [row] });

renderWithProviders(<UnifiedHistoryTable />);

expect(screen.getByText('Elastic')).toBeInTheDocument();
});

it('details button has correct href for navigation', () => {
const row = createMockLiveRow({ actionId: 'action-42' });
mockHistory({ data: [row] });
Expand Down Expand Up @@ -374,14 +383,13 @@ describe('UnifiedHistoryTable', () => {
expect(screen.getByText('20')).toBeInTheDocument();
});

it('run by column shows em dash for scheduled row', () => {
it('run by column shows Elastic for scheduled row', () => {
const row = createMockScheduledRow();
mockHistory({ data: [row] });

renderWithProviders(<UnifiedHistoryTable />);

const dashes = screen.getAllByText('\u2014');
expect(dashes.length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('Elastic')).toBeInTheDocument();
});

it('play button is not available for scheduled rows', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ const UnifiedHistoryTableComponent = () => {

const renderRunByColumn = useCallback(
(_: unknown, row: UnifiedHistoryRow) => {
if (!isLiveRow(row)) {
return <>{'\u2014'}</>;
if (!isLiveRow(row) || !row.userId) {
return <>{'Elastic'}</>;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { QUERIES_DROPDOWN_LABEL, QUERIES_DROPDOWN_SEARCH_FIELD_LABEL } from './c
import { OsquerySchemaLink } from '../components/osquery_schema_link';
import { useOsquerySchema } from '../common/hooks/use_osquery_schema';
import { useSavedQueries } from './use_saved_queries';
import { useIsExperimentalFeatureEnabled } from '../common/experimental_features_context';
import type { SavedQuerySO } from '../routes/saved_queries/list';

const euiCodeBlockCss = {
Expand Down Expand Up @@ -44,6 +45,7 @@ const SavedQueriesDropdownComponent: React.FC<SavedQueriesDropdownProps> = ({
onChange,
}) => {
const { osqueryVersion } = useOsquerySchema();
const isHistoryReworkEnabled = useIsExperimentalFeatureEnabled('queryHistoryRework');
const savedQueryId = useWatch({ name: 'savedQueryId' });
const context = useFormContext();
const { errors } = context.formState;
Expand Down Expand Up @@ -94,12 +96,14 @@ const SavedQueriesDropdownComponent: React.FC<SavedQueriesDropdownProps> = ({
<div className="eui-textTruncate">
<EuiTextColor color="subdued">{value.description}</EuiTextColor>
</div>
<EuiCodeBlock css={euiCodeBlockCss} language="sql" fontSize="m" paddingSize="s">
{value.query.split('\n').join(' ')}
</EuiCodeBlock>
{!isHistoryReworkEnabled && (
<EuiCodeBlock css={euiCodeBlockCss} language="sql" fontSize="m" paddingSize="s">
{value.query.split('\n').join(' ')}
</EuiCodeBlock>
)}
</>
),
[]
[isHistoryReworkEnabled]
);

useEffect(() => {
Expand Down Expand Up @@ -138,7 +142,7 @@ const SavedQueriesDropdownComponent: React.FC<SavedQueriesDropdownProps> = ({
selectedOptions={selectedOptions}
onChange={handleSavedQueryChange}
renderOption={renderOption}
rowHeight={110}
rowHeight={isHistoryReworkEnabled ? 55 : 110}
/>
</EuiFormRow>
);
Expand Down
Loading