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

[Workspace] Address UI issues of index patterns #8287

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions changelogs/fragments/8287.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Address UI issues of index patterns ([#8287](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8287))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { mount } from 'enzyme';
import { EuiBadge, EuiLink } from '@elastic/eui';
import { EuiBadge, EuiButtonEmpty } from '@elastic/eui';
import { DataSourceColumn } from './data_source_column';
import { DataSourceTableItem } from '../../types';
import * as utils from '../utils';
Expand Down Expand Up @@ -42,8 +42,8 @@ describe('DataSourceColumn', () => {
const navigateToAppMock = jest.fn();
spyOn(utils, 'getApplication').and.returnValue({ navigateToApp: navigateToAppMock });
const wrapper = mount(<>{dataSourceColumn.euiColumn.render('1')}</>);
expect(wrapper.find(EuiLink).text()).toBe('DataSource 1');
wrapper.find(EuiLink).simulate('click');
expect(wrapper.find(EuiButtonEmpty).text()).toBe('DataSource 1');
wrapper.find(EuiButtonEmpty).simulate('click');

expect(navigateToAppMock).toHaveBeenCalledWith('management', {
path: `opensearch-dashboards/${DSM_APP_ID}/1`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { i18n } from '@osd/i18n';
import { SavedObjectsStart } from 'opensearch-dashboards/public';
import { EuiBadge, EuiLink } from '@elastic/eui';
import { EuiBadge, EuiButtonEmpty, EuiLink } from '@elastic/eui';
import React from 'react';
import { IndexPatternTableColumn } from '../../../../index_pattern_management/public';
import { getApplication, getDataSources } from '../utils';
Expand Down Expand Up @@ -38,15 +38,17 @@ export class DataSourceColumn implements IndexPatternTableColumn<DataSourceMap>
const { title, id } = dataSource;

return (
<EuiLink
<EuiButtonEmpty
flush="left"
size="xs"
onClick={() =>
getApplication().navigateToApp('management', {
path: `opensearch-dashboards/${DSM_APP_ID}/${encodeURIComponent(id)}`,
})
}
>
{title}
</EuiLink>
</EuiButtonEmpty>
);
},
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const Header = withRouter(({ indexPatternId, history }: HeaderProps) => (

<EuiFlexItem grow={false}>
<EuiSmallButton
iconType="plusInCircle"
data-test-subj="addScriptedFieldLink"
{...reactRouterNavigate(history, `patterns/${indexPatternId}/create-field/`)}
>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const AddFilter = ({ onAddFilter }: AddFilterProps) => {
}, [filter, onAddFilter]);

return (
<EuiFlexGroup>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={10}>
<EuiCompressedFieldText
fullWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function Tabs({ indexPattern, saveIndexPattern, fields, history, location
return (
<>
{useUpdatedUX && <EuiSpacer size="m" />}
<Wrapper>
<Wrapper paddingSize="m">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to take useUpdatedUX into consideration? Here we will have 2x paddingM vertically if useUpdatedUX is true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm not quite clear on how useUpdatedUX leads to 2x paddingM, but I see it work as expected when useUpdatedUX is true
Screenshot 2024-11-04 at 10 35 37

<EuiSpacer size="m" />
{getFilterSection(type)}
<EuiSpacer size="m" />
Expand All @@ -207,7 +207,7 @@ export function Tabs({ indexPattern, saveIndexPattern, fields, history, location
return (
<>
{useUpdatedUX && <EuiSpacer size="m" />}
<Wrapper>
<Wrapper paddingSize="m">
<EuiSpacer size="m" />
{getFilterSection(type)}
<EuiSpacer size="m" />
Expand All @@ -231,7 +231,7 @@ export function Tabs({ indexPattern, saveIndexPattern, fields, history, location
return (
<>
{useUpdatedUX && <EuiSpacer size="m" />}
<Wrapper>
<Wrapper paddingSize="m">
<EuiSpacer size="m" />
{getFilterSection(type)}
<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@

import {
EuiBadge,
EuiButtonEmpty,
EuiFlexGroup,
EuiFlexItem,
EuiInMemoryTable,
EuiSpacer,
EuiText,
EuiBadgeGroup,
EuiPageContent,
EuiLink,
} from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';
import { withRouter, RouteComponentProps } from 'react-router-dom';
Expand Down Expand Up @@ -199,9 +199,7 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {
}
) => (
<>
<EuiButtonEmpty size="xs" {...reactRouterNavigate(history, `patterns/${index.id}`)}>
{name}
</EuiButtonEmpty>
<EuiLink {...reactRouterNavigate(history, `patterns/${index.id}`)}>{name}</EuiLink>
&emsp;
<EuiBadgeGroup gutterSize="s">
{index.tags &&
Expand Down Expand Up @@ -309,7 +307,12 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {

return (
<>
<EuiPageContent data-test-subj="indexPatternTable" role="region" aria-label={ariaRegion}>
<EuiPageContent
data-test-subj="indexPatternTable"
role="region"
aria-label={ariaRegion}
paddingSize="m"
>
<EuiFlexGroup justifyContent="spaceBetween">
{pageTitleAndDescription}
{createButton}
Expand Down