Skip to content

Commit

Permalink
Merge branch 'main' into dup-indices
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenesk24 authored Nov 8, 2021
2 parents 903d0c5 + b2428bf commit dd6de20
Show file tree
Hide file tree
Showing 43 changed files with 1,451 additions and 616 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Adding sample data and visualization', () => {

describe('Testing notebooks table', () => {
beforeEach(() => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability#/notebooks`);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
cy.wait(delay * 3);
});

Expand Down Expand Up @@ -134,7 +134,7 @@ describe('Testing notebooks table', () => {

describe('Test reporting integration if plugin installed', () => {
beforeEach(() => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability#/notebooks`);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
cy.get('.euiTableCellContent').contains(TEST_NOTEBOOK).click();
cy.wait(delay * 3);
cy.get('body').then($body => {
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('Test reporting integration if plugin installed', () => {

describe('Testing paragraphs', () => {
beforeEach(() => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability#/notebooks`);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/notebooks`);
cy.get('.euiTableCellContent').contains(TEST_NOTEBOOK).click();
cy.wait(delay * 3);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('Dump test data', () => {

describe('Testing dashboard table empty state', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/home', {
cy.visit('app/observability-dashboards#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -104,7 +104,7 @@ describe('Testing dashboard table empty state', () => {

describe('Testing dashboard table', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/home', {
cy.visit('app/observability-dashboards#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('Testing dashboard table', () => {

describe('Testing plots', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/home', {
cy.visit('app/observability-dashboards#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { delay, SERVICE_NAME, setTimeFilter } from '../utils/constants';

describe('Testing services table empty state', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/services', {
cy.visit('app/observability-dashboards#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -46,7 +46,7 @@ describe('Testing services table empty state', () => {

describe('Testing services table', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/services', {
cy.visit('app/observability-dashboards#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('Testing service view empty state', () => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/observability#/trace_analytics/services/${SERVICE_NAME}`, {
cy.visit(`app/observability-dashboards#/trace_analytics/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -99,7 +99,7 @@ describe('Testing service view', () => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/observability#/trace_analytics/services/${SERVICE_NAME}`, {
cy.visit(`app/observability-dashboards#/trace_analytics/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { delay, setTimeFilter, SPAN_ID, TRACE_ID } from '../utils/constants';

describe('Testing traces table empty state', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/traces', {
cy.visit('app/observability-dashboards#/trace_analytics/traces', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand All @@ -46,7 +46,7 @@ describe('Testing traces table empty state', () => {

describe('Testing traces table', () => {
beforeEach(() => {
cy.visit('app/observability#/trace_analytics/traces', {
cy.visit('app/observability-dashboards#/trace_analytics/traces', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('Testing traces table', () => {

describe('Testing trace view', () => {
beforeEach(() => {
cy.visit(`app/observability#/trace_analytics/traces/${TRACE_ID}`, {
cy.visit(`app/observability-dashboards#/trace_analytics/traces/${TRACE_ID}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
Expand Down
12 changes: 7 additions & 5 deletions dashboards-observability/common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ export const OPENSEARCH_PANELS_API = {
export const SAVED_OBJECT = '/object';

// Color Constants
export const PlotlyColorWay = [
export const PLOTLY_COLOR = [
'#3CA1C7',
'#8C55A3',
'#DB748A',
'#F2BE4B',
'#68CCC2',
'#127871',
'#5F1084',
'#005EB8',
'#BD800F',
'#2A7866',
'#843769',
'#374FB8',
'#BD6F26',
'#4C636F',
];

export const LONG_CHART_COLOR = PLOTLY_COLOR[1];
4 changes: 2 additions & 2 deletions dashboards-observability/common/utils/query_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const insertDateRangeToQuery = ({
const tokens = rawQuery.replaceAll(PPL_NEWLINE_REGEX, '').match(PPL_INDEX_INSERT_POINT_REGEX);

if (isEmpty(tokens)) return finalQuery;
finalQuery = `${tokens![1]}=${tokens![2]} | where ${timeField} >= timestamp('${start}') and ${timeField} <= timestamp('${end}')${tokens![3]}`;
finalQuery = `${tokens![1]}=${tokens![2]} | where ${timeField} >= '${start}' and ${timeField} <= '${end}'${tokens![3]}`;

return finalQuery;
};
};
4 changes: 2 additions & 2 deletions dashboards-observability/public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import React from 'react';
import { Provider } from 'react-redux';
import { HashRouter, Route, Switch } from 'react-router-dom';
import { CoreStart } from '../../../../src/core/public';
import { observabilityTitle } from '../../common/constants/shared';
import { observabilityID, observabilityTitle } from '../../common/constants/shared';
import store from '../framework/redux/store';
import { AppPluginStartDependencies } from '../types';
import { renderPageWithSidebar } from './common/side_nav';
Expand Down Expand Up @@ -43,7 +43,7 @@ export const App = ({
const { chrome, http, notifications } = CoreStart;
const parentBreadcrumb = {
text: observabilityTitle,
href: 'observability#/',
href: `${observabilityID}#/`,
};

const customPanelBreadcrumb = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export function Autocomplete({
},
}
);
}, []);
}, [query]);

return (
<div
Expand All @@ -343,64 +343,65 @@ export function Autocomplete({
<EuiTextArea
{...autocomplete.getInputProps({
'id': 'autocomplete-textarea',
'placeholder': 'Enter PPL query to retrieve log, traces, and metrics'
'placeholder': 'Enter PPL query to retrieve logs'
})}
/>
<div
className={[
'aa-Panel',
'aa-Panel--desktop',
autocompleteState.status === 'stalled' && 'aa-Panel--stalled',
]
.filter(Boolean)
.join(' ')}
{...autocomplete.getPanelProps({})}
>
{autocompleteState.isOpen &&
autocompleteState.collections.map((collection, index) => {
const { source, items } = collection;
items.filter((item, index) => { return items.indexOf(item) === index })
return (
<div key={`scrollable-${index}`} className="aa-PanelLayout aa-Panel--scrollable" style={uiSettingsService.get('theme:darkMode') ? {backgroundColor: '#1D1E24'} : {}}>
<div key={`source-${index}`} className="aa-Source">
{items.length > 0 && (
<ul className="aa-List" {...autocomplete.getListProps()}>
{items.map((item, index) => {
const prefix = item.input.split(' ');
return (
<li
key={item.__autocomplete_id}
className="aa-Item"
{...autocomplete.getItemProps({
item,
source,
})}
style={uiSettingsService.get('theme:darkMode') ? {color: '#DFE5EF'}: {}}
>
<div className="aa-ItemWrapper">
<div className="aa-ItemContent">
<div className="aa-ItemContentBody">
<div
className="aa-ItemContentTitle"
dangerouslySetInnerHTML={{
__html: `<div>
<span><b>${prefix[prefix.length-1]}</b>${item.suggestion}</span>
</div>`
}}
/>
{autocompleteState.isOpen && (
<div
className={[
'aa-Panel',
'aa-Panel--desktop',
autocompleteState.status === 'stalled' && 'aa-Panel--stalled',
]
.filter(Boolean)
.join(' ')}
{...autocomplete.getPanelProps({})}
>
{autocompleteState.collections.map((collection, index) => {
const { source, items } = collection;
items.filter((item, index) => { return items.indexOf(item) === index })
return (
<div key={`scrollable-${index}`} className="aa-PanelLayout aa-Panel--scrollable" style={uiSettingsService.get('theme:darkMode') ? {backgroundColor: '#1D1E24'} : {}}>
<div key={`source-${index}`} className="aa-Source">
{items.length > 0 && (
<ul className="aa-List" {...autocomplete.getListProps()}>
{items.map((item, index) => {
const prefix = item.input.split(' ');
return (
<li
key={item.__autocomplete_id}
className="aa-Item"
{...autocomplete.getItemProps({
item,
source,
})}
style={uiSettingsService.get('theme:darkMode') ? {color: '#DFE5EF'}: {}}
>
<div className="aa-ItemWrapper">
<div className="aa-ItemContent">
<div className="aa-ItemContentBody">
<div
className="aa-ItemContentTitle"
dangerouslySetInnerHTML={{
__html: `<div>
<span><b>${prefix[prefix.length-1]}</b>${item.suggestion}</span>
</div>`
}}
/>
</div>
</div>
</div>
</div>
</li>
);
})}
</ul>
)}
</li>
);
})}
</ul>
)}
</div>
</div>
</div>
);
})}
</div>
);
})}
</div>
)}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export function DatePicker(props: IDatePickerProps) {

return (
<EuiFlexItem
className="euiFlexItem--flexGrowZero"
className="euiFlexItem--flexGrowZero event-date-picker"
style={{maxWidth: '40vw'}}
>
<EuiSuperDatePicker
start={ startTime }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
}

#autocomplete-root {
width: 100%;
#autocomplete-textarea {
width: 100%;
outline: none;
Expand All @@ -37,7 +36,10 @@
font-size: 16px;
}
.aa-Panel {
width: 100%;
z-index: 2500;
}
}
}

.event-date-picker {
max-width: 380px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export const Search = (props: any) => {
savedObjects,
showSavePanelOptionsList,
showSaveButton = true,
setToast
setToast,
runButtonText
} = props;

const [isSavePanelOpen, setIsSavePanelOpen] = useState(false);
Expand Down Expand Up @@ -112,7 +113,7 @@ export const Search = (props: any) => {
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon iconType='iInCircle' iconSize='l' href='https://opensearch.org/docs/latest/search-plugins/ppl/commands/'/>
<EuiButtonIcon iconType="iInCircle" iconSize="l" target="_blank" href="https://opensearch.org/docs/latest/search-plugins/ppl/commands/"/>
</EuiFlexItem>
<EuiFlexItem
className="euiFlexItem--flexGrowZero"
Expand Down Expand Up @@ -140,7 +141,7 @@ export const Search = (props: any) => {
memorizedHandleQuerySearch();
}}
>
{ isEmpty(explorerData) ? 'Run' : 'Refresh' }
{ runButtonText ? runButtonText : isEmpty(explorerData) ? 'Run' : 'Refresh' }
</EuiButton>
</EuiFlexItem>
{ showSaveButton && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Props = {
renameCustomPanel: (newCustomPanelName: string, customPanelId: string) => void;
cloneCustomPanel: (newCustomPanelName: string, customPanelId: string) => void;
deleteCustomPanelList: (customPanelIdList: string[], toastMessage: string) => any;
addSamplePanels: () => void;
};

export const CustomPanelTable = ({
Expand All @@ -89,6 +90,7 @@ export const CustomPanelTable = ({
renameCustomPanel,
cloneCustomPanel,
deleteCustomPanelList,
addSamplePanels
}: Props) => {
const [isModalVisible, setIsModalVisible] = useState(false); // Modal Toggle
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask></EuiOverlayMask>); // Modal Layout
Expand Down Expand Up @@ -235,6 +237,15 @@ export const CustomPanelTable = ({
>
Delete
</EuiContextMenuItem>,
<EuiContextMenuItem
key="addSample"
onClick={() => {
setIsActionsPopoverOpen(false);
addSamplePanels();
}}
>
Add sample panels
</EuiContextMenuItem>,
];

const tableColumns = [
Expand Down
Loading

0 comments on commit dd6de20

Please sign in to comment.