Skip to content

Commit

Permalink
Merge branch '2.x' into backport/backport-1736-to-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstn authored Apr 25, 2024
2 parents b5b1af2 + d4900b0 commit b223457
Show file tree
Hide file tree
Showing 94 changed files with 3,727 additions and 669 deletions.
6 changes: 6 additions & 0 deletions common/constants/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export const ACCELERATION_TIME_INTERVAL = [
{ text: 'day(s)', value: 'day' },
{ text: 'week(s)', value: 'week' },
];
export const ACCELERATION_REFRESH_TIME_INTERVAL = [
{ text: 'minutes(s)', value: 'minute' },
{ text: 'hour(s)', value: 'hour' },
{ text: 'day(s)', value: 'day' },
{ text: 'week(s)', value: 'week' },
];

export const ACCELERATION_ADD_FIELDS_TEXT = '(add fields here)';
export const ACCELERATION_INDEX_NAME_REGEX = /^[a-z0-9_]+$/;
Expand Down
8 changes: 7 additions & 1 deletion common/constants/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
*/

export const OPENSEARCH_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest/integrations/index';
export const ASSET_FILTER_OPTIONS = ['index-pattern', 'search', 'visualization', 'dashboard'];
export const ASSET_FILTER_OPTIONS = [
'index-pattern',
'search',
'visualization',
'dashboard',
'observability-search',
];
export const VALID_INDEX_NAME = /^[a-z\d\.][a-z\d\._\-\*]*$/;

// Upstream doesn't export this, so we need to redeclare it for our use.
Expand Down
2 changes: 1 addition & 1 deletion common/types/data_connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export interface FormErrorsType {
watermarkDelayError: string[];
}

export type AccelerationRefreshType = 'auto' | 'autoInterval' | 'manual' | 'manualIncrement';
export type AccelerationRefreshType = 'autoInterval' | 'manual' | 'manualIncrement';

export interface CreateAccelerationForm {
dataSource: string;
Expand Down
2 changes: 2 additions & 0 deletions docs/integrations/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ the author in hindsight.
If working on S3-based integrations, it's worth noting that queries have some values
[substituted](https://github.com/opensearch-project/dashboards-observability/blob/4e1e0e585/public/components/integrations/components/setup_integration.tsx#L438) when installing. They are:

- `{table_name}` is the fully qualified name of the Flint table, typically `datasource.database.object_name`.
This is also substituted in any linked Saved Queries when using S3-based integrations.
- `{s3_bucket_location}` to locate data.
- `{s3_checkpoint_location}` to store intermediate results, which is required by Spark.
- `{object_name}` used for giving tables a unique name per-integration to avoid collisions.
Expand Down
7 changes: 4 additions & 3 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "observabilityDashboards",
"version": "2.13.0.0",
"opensearchDashboardsVersion": "2.13.0",
"version": "2.14.0.0",
"opensearchDashboardsVersion": "2.14.0",
"server": true,
"ui": true,
"requiredPlugins": [
Expand All @@ -20,7 +20,8 @@
],
"optionalPlugins": [
"managementOverview",
"assistantDashboards"
"assistantDashboards",
"securityDashboards"
],
"configPath": [
"observability"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "observability-dashboards",
"version": "2.13.0.0",
"version": "2.14.0.0",
"main": "index.ts",
"license": "Apache-2.0",
"scripts": {
Expand Down

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions public/components/common/search/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface AutocompleteProps extends IQueryBarProps {
possibleCommands?: Array<{ label: string }>;
append?: any;
isSuggestionDisabled?: boolean;
ignoreShiftEnter?: boolean;
}

export const Autocomplete = (props: AutocompleteProps) => {
Expand All @@ -47,6 +48,7 @@ export const Autocomplete = (props: AutocompleteProps) => {
possibleCommands,
append,
isSuggestionDisabled = false,
ignoreShiftEnter = false,
} = props;

const [autocompleteState, setAutocompleteState] = useState<AutocompleteState<AutocompleteItem>>({
Expand All @@ -63,6 +65,7 @@ export const Autocomplete = (props: AutocompleteProps) => {
const panelsFilter = tabId === 'panels-filter';

useEffect(() => {
if (ignoreShiftEnter) return;
const searchBar = document.getElementById('autocomplete-textarea');

searchBar?.addEventListener('keydown', (e) => {
Expand Down
60 changes: 11 additions & 49 deletions public/components/common/search/date_picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiSuperDatePicker, EuiToolTip } from '@elastic/eui';
import { EuiSuperDatePicker } from '@elastic/eui';
import React from 'react';
import { i18n } from '@osd/i18n';
import { uiSettingsService } from '../../../../common/utils';
import { coreRefs } from '../../../framework/core_refs';
import { IDatePickerProps } from './search';
import {
QUERY_ASSIST_END_TIME,
QUERY_ASSIST_START_TIME,
} from '../../../../common/constants/shared';

export function DatePicker(props: IDatePickerProps) {
const {
startTime,
endTime,
handleTimePickerChange,
handleTimeRangePickerRefresh,
isAppAnalytics,
} = props;
const { startTime, endTime, handleTimePickerChange, handleTimeRangePickerRefresh } = props;

const handleTimeChange = (e: any) => handleTimePickerChange([e.start, e.end]);

let finalizedStartTime;
let finalizedEndTime;
let setDisabled;
let toolTipMessage;

if (coreRefs.queryAssistEnabled && !isAppAnalytics) {
// is query assistant inside log explorer
finalizedStartTime = QUERY_ASSIST_START_TIME;
finalizedEndTime = QUERY_ASSIST_END_TIME;
setDisabled = true;
toolTipMessage = i18n.translate('discover.queryAssistant.timePickerDisabledMessage', {
defaultMessage: 'Date range has been disabled to accomodate timerange of all datasets',
});
} else {
finalizedStartTime = startTime;
finalizedEndTime = endTime;
setDisabled = false;
toolTipMessage = false;
}

return (
<>
<EuiToolTip position="bottom" content={toolTipMessage}>
<EuiSuperDatePicker
data-test-subj="pplSearchDatePicker"
start={finalizedStartTime}
end={finalizedEndTime}
dateFormat={uiSettingsService.get('dateFormat')}
onTimeChange={handleTimeChange}
onRefresh={handleTimeRangePickerRefresh}
className="osdQueryBar__datePicker"
showUpdateButton={false}
isDisabled={setDisabled}
/>
</EuiToolTip>
</>
<EuiSuperDatePicker
data-test-subj="pplSearchDatePicker"
start={startTime}
end={endTime}
dateFormat={uiSettingsService.get('dateFormat')}
onTimeChange={handleTimeChange}
onRefresh={handleTimeRangePickerRefresh}
className="osdQueryBar__datePicker"
/>
);
}
1 change: 1 addition & 0 deletions public/components/common/search/direct_search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export const DirectSearch = (props: any) => {
tabId={tabId}
isSuggestionDisabled={true}
isDisabled={explorerSearchMetadata.isPolling}
ignoreShiftEnter={true}
/>
{queryLang === QUERY_LANGUAGE.PPL && (
<EuiBadge
Expand Down
8 changes: 7 additions & 1 deletion public/components/common/search/query_area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { QueryAssistInput } from '../../event_analytics/explorer/query_assist/in
import { useFetchEvents } from '../../event_analytics/hooks/use_fetch_events';
import './query_area.scss';

/**
* QueryArea is currently used for query assist only.
*/
export function QueryArea({
tabId,
handleQueryChange,
Expand Down Expand Up @@ -39,6 +42,7 @@ export function QueryArea({
memoizedGetAvailableFields(indexQuery);
}, [selectedIndex, memoizedGetAvailableFields, memoizedHandleQueryChange]);
const [lastFocusedInput, setLastFocusedInput] = useState<'query_area' | 'nlq_input'>('nlq_input');
const [callOut, setCallOut] = useState<React.ReactNode>(null);

const queryEditor = (
<EuiCodeEditor
Expand All @@ -52,8 +56,8 @@ export function QueryArea({
aria-label="Code Editor"
onChange={(query) => {
handleQueryChange(query);
setCallOut(null);
// query is considered updated when the last run query is not the same as whats in the editor
// setUpdatedQuery(runQuery !== query);
setNeedsUpdate(runQuery !== query);
}}
onFocus={() => setLastFocusedInput('query_area')}
Expand Down Expand Up @@ -90,6 +94,8 @@ export function QueryArea({
lastFocusedInput={lastFocusedInput}
setLastFocusedInput={setLastFocusedInput}
runChanges={runChanges}
callOut={callOut}
setCallOut={setCallOut}
>
{queryEditor}
</QueryAssistInput>
Expand Down
8 changes: 3 additions & 5 deletions public/components/common/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export const Search = (props: any) => {
placeholder="Select an index"
isClearable={true}
prepend={<EuiText>Index</EuiText>}
singleSelection={true}
singleSelection={{ asPlainText: true }}
isLoading={loading}
options={indicesAndIndexPatterns}
selectedOptions={selectedIndex}
Expand Down Expand Up @@ -389,9 +389,7 @@ export const Search = (props: any) => {
tempQuery={tempQuery}
baseQuery={baseQuery}
handleQueryChange={handleQueryChange}
handleQuerySearch={() => {
onQuerySearch(queryLang);
}}
handleQuerySearch={runChanges}
dslService={dslService}
getSuggestions={getSuggestions}
onItemSelect={onItemSelect}
Expand All @@ -412,7 +410,7 @@ export const Search = (props: any) => {
<EuiFlexItem grow={false} />
{!(queryRedux.selectedTimestamp === '' && queryResults?.datarows) && ( // index with no timestamp, dont show timepicker
<EuiFlexItem className="euiFlexItem--flexGrowZero event-date-picker" grow={false}>
{!isLiveTailOn && (
{!isLiveTailOn && !coreRefs.queryAssistEnabled && (
<DatePicker
startTime={startTime}
endTime={endTime}
Expand Down
Loading

0 comments on commit b223457

Please sign in to comment.