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

Update large record report warning #429

Merged
merged 1 commit into from
Sep 10, 2024
Merged
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 @@ -22,9 +22,7 @@
EuiCompressedCheckboxGroup,
EuiCompressedComboBox,
EuiFormRow,
OuiCallOut,
EuiText,
EuiIcon,
EuiCallOut,
} from '@elastic/eui';
import {
REPORT_SOURCE_RADIOS,
Expand All @@ -33,7 +31,7 @@
REPORT_SOURCE_TYPES,
SAVED_SEARCH_FORMAT_OPTIONS,
} from './report_settings_constants';
import ReactMde from 'react-mde';

Check failure on line 34 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

`react-mde` import should occur before import of `./report_settings_constants`
import 'react-mde/lib/styles/css/react-mde-all.css';
import {
reportDefinitionParams,
Expand All @@ -54,14 +52,14 @@
} from './report_settings_helpers';
import { TimeRangeSelect } from './time_range';
import { converter } from '../utils';
import { ReportDefinitionSchemaType } from 'server/model';

Check failure on line 55 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

`server/model` import should occur before import of `./report_settings_constants`
import { ReportTrigger } from '../report_trigger';

type ReportSettingProps = {

Check failure on line 58 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Use an `interface` instead of a `type`
edit: boolean;
editDefinitionId: string;
reportDefinitionRequest: reportDefinitionParams;
httpClientProps: any;

Check warning on line 62 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
timeRange: timeRangeParams;
showSettingsReportNameError: boolean;
settingsReportNameErrorMessage: string;
Expand Down Expand Up @@ -92,22 +90,22 @@
const [reportDescription, setReportDescription] = useState('');
const [reportSourceId, setReportSourceId] = useState('dashboardReportSource');

const [dashboardSourceSelect, setDashboardSourceSelect] = useState([] as any);

Check warning on line 93 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const [dashboards, setDashboards] = useState([] as any);

Check warning on line 94 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const [visualizationSourceSelect, setVisualizationSourceSelect] = useState(
[] as any

Check warning on line 97 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
);
const [visualizations, setVisualizations] = useState([] as any);

Check warning on line 99 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const [savedSearchSourceSelect, setSavedSearchSourceSelect] = useState(
[] as any

Check warning on line 102 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
);
const [savedSearches, setSavedSearches] = useState([] as any);

Check warning on line 104 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const [savedSearchRecordLimit, setSavedSearchRecordLimit] = useState(10000);

const [notebooksSourceSelect, setNotebooksSourceSelect] = useState([] as any);

Check warning on line 107 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const [notebooks, setNotebooks] = useState([] as any);

Check warning on line 108 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const [fileFormat, setFileFormat] = useState('pdf');

Expand Down Expand Up @@ -187,7 +185,7 @@
}
};

const handleDashboardSelect = (e: string | any[]) => {

Check warning on line 188 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
setDashboardSourceSelect(e);

let fromInContext = false;
Expand Down Expand Up @@ -398,7 +396,7 @@
response.report_definition;
const {
report_params: {
core_params: { header, footer },

Check failure on line 399 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

'header' is already declared in the upper scope

Check failure on line 399 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

'footer' is already declared in the upper scope
},
} = reportDefinition;
// set header/footer default
Expand Down Expand Up @@ -499,7 +497,7 @@
}
};

const setDefaultFileFormat = (fileFormat) => {

Check failure on line 500 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

'fileFormat' is already declared in the upper scope
let index = 0;
for (index = 0; index < PDF_PNG_FILE_FORMAT_OPTIONS.length; ++index) {
if (
Expand Down Expand Up @@ -605,7 +603,7 @@
}
});

if (reportSource == REPORT_SOURCE_TYPES.savedSearch) {

Check failure on line 606 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected '===' and instead saw '=='
setSavedSearchRecordLimit(
response.report_definition.report_params.core_params.limit
);
Expand All @@ -621,7 +619,7 @@
);
};

const defaultConfigurationEdit = async (httpClientProps) => {

Check failure on line 622 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

'httpClientProps' is already declared in the upper scope
let editData = {};
await httpClientProps
.get(`../api/reporting/reportDefinitions/${editDefinitionId}`)
Expand All @@ -634,8 +632,8 @@
return editData;
};

const defaultConfigurationCreate = async (httpClientProps) => {

Check failure on line 635 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

'httpClientProps' is already declared in the upper scope
let reportSourceOptions = {

Check failure on line 636 in public/components/report_definitions/report_settings/report_settings.tsx

View workflow job for this annotation

GitHub Actions / Lint

'reportSourceOptions' is never reassigned. Use 'const' instead
dashboard: [],
visualizations: [],
savedSearch: [],
Expand Down Expand Up @@ -801,22 +799,26 @@
/>
</EuiCompressedFormRow>
<EuiSpacer />
{savedSearchRecordLimit > 10000 ? (
<>
<EuiCallOut
color="primary"
title={i18n.translate(
'opensearch.reports.reportSettingProps.form.savedSearchLargeRecordLimitWarning',
{ defaultMessage: 'Generating reports with a large number of records can cause memory issues' }
)}
iconType="iInCircle"
size="s"
/>
<EuiSpacer size="xs" />
</>
) : null}
<EuiFormRow
id="reportSourceSavedSearchRecordLimit"
label={i18n.translate(
'opensearch.reports.reportSettingProps.form.savedSearchRecordLimit',
{ defaultMessage: 'Record limit' }
)}
helpText={
savedSearchRecordLimit > 10000 ? (
<EuiText color="warning" size="xs">
<EuiIcon color="warning" type="alert" size="s" /> Generating
very large reports can cause memory issues.
</EuiText>
) : (
''
)
}
>
<EuiFieldNumber
value={savedSearchRecordLimit}
Expand Down
Loading