Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MD]Address comments from UX signoff meeting-Datasource list and crea…
Browse files Browse the repository at this point in the history
…te page (opensearch-project#2625)

Signed-off-by: Yibo Wang <yibow@amazon.com>
(cherry picked from commit fb4bdfa)
yibow98 authored and zhongnansu committed Oct 21, 2022

Verified

This commit was signed with the committer’s verified signature.
1 parent bf43c77 commit 3e02e54
Showing 10 changed files with 104 additions and 45 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* [Multi DataSource] Add data source config to opensearch-dashboards-docker ([#2557](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2557))
* [Multi DataSource] Make text content dynamically translated & update unit tests ([#2570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2570))
* [Vis Builder] Change classname prefix wiz to vb ([#2581](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2581/files))
* [Multi DataSource] Address UX comments on Data source list and create page ([#2625](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2625))

### 🐛 Bug Fixes
* [Vis Builder] Fixes auto bounds for timeseries bar chart visualization ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
Original file line number Diff line number Diff line change
@@ -13,10 +13,11 @@ const createButtonIdentifier = `[data-test-subj="createDataSourceButton"]`;

describe('CreateButton', () => {
const history = (scopedHistoryMock.create() as unknown) as ScopedHistory;
const dataTestSubj = 'createDataSourceButton';
let component: ShallowWrapper<any, Readonly<{}>, React.Component<{}, {}, any>>;

beforeEach(() => {
component = shallow(<CreateButton history={history} />);
component = shallow(<CreateButton history={history} dataTestSubj={dataTestSubj} />);
});

it('should render normally', () => {
Original file line number Diff line number Diff line change
@@ -11,13 +11,15 @@ import { FormattedMessage } from '@osd/i18n/react';

interface Props {
history: History;
isEmptyState?: boolean;
dataTestSubj: string;
}

export const CreateButton = ({ history }: Props) => {
export const CreateButton = ({ history, isEmptyState, dataTestSubj }: Props) => {
return (
<EuiButton
data-test-subj="createDataSourceButton"
fill={true}
data-test-subj={dataTestSubj}
fill={isEmptyState ? false : true}
onClick={() => history.push('/create')}
>
<FormattedMessage

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

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
@@ -287,6 +287,7 @@ export class CreateDataSourceForm extends React.Component<
return (
<EuiPageContent>
{this.renderHeader()}
<EuiSpacer size="m" />
<EuiForm data-test-subj="data-source-creation">
{/* Endpoint section */}
{this.renderSectionHeader(
@@ -354,7 +355,7 @@ export class CreateDataSourceForm extends React.Component<
placeholder={i18n.translate(
'dataSourcesManagement.createDataSource.endpointPlaceholder',
{
defaultMessage: 'Sample URL: https://connectionurl.com',
defaultMessage: 'https://connectionurl.com',
}
)}
isInvalid={!!this.state.formErrorsByField.endpoint.length}
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ export const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWiz
};

const handleDisplayToastMessage = ({ id, defaultMessage }: ToastMessageItem) => {
toasts.addWarning(i18n.translate(id, { defaultMessage }));
toasts.addDanger(i18n.translate(id, { defaultMessage }));
};

/* Render the creation wizard */

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
@@ -132,7 +132,7 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
const columns = [
{
field: 'title',
name: 'Datasource',
name: 'Title',
render: (
name: string,
index: {
@@ -184,6 +184,7 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
confirmButtonText={i18n.translate('dataSourcesManagement.dataSourcesTable.delete', {
defaultMessage: 'Delete',
})}
buttonColor="danger"
defaultFocusedButton="confirm"
>
<p>
@@ -249,7 +250,7 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
/* Toast Handlers */

const handleDisplayToastMessage = ({ id, defaultMessage }: ToastMessageItem) => {
toasts.addWarning(
toasts.addDanger(
i18n.translate(id, {
defaultMessage,
})
@@ -258,7 +259,14 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {

/* Render Ui elements*/
/* Create Data Source button */
const createButton = <CreateButton history={history} />;
const createButton = <CreateButton history={history} dataTestSubj="createDataSourceButton" />;
const createButtonEmptyState = (
<CreateButton
history={history}
isEmptyState={true}
dataTestSubj="createDataSourceButtonEmptyState"
/>
);

/* Render header*/
const renderHeader = () => {
@@ -332,7 +340,7 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
}
</EuiText>
<EuiSpacer />
{createButton}
{createButtonEmptyState}
</EuiPanel>
<EuiSpacer size="l" />
</>
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ export const ExperimentalCallout = ({ docLinks }: { docLinks: DocLinksStart }) =
{
<FormattedMessage
id="dataSourcesManagement.experimentalFeatureCallout.description"
defaultMessage="The feature is experimental and should not be used in a production environment. Any index patterns, visualization, and observability panels will be impacted if the feature is deactivated. For more information see "
defaultMessage="This feature is experimental and should not be used in a production environment. Any index patterns, visualization, and observability panels will be impacted if the feature is deactivated. For more information see "
/>
}
<EuiLink href={docLinks.links.noDocumentation.indexPatterns.introduction} target="_blank">
@@ -44,7 +44,7 @@ export const ExperimentalCallout = ({ docLinks }: { docLinks: DocLinksStart }) =
{
<FormattedMessage
id="dataSourcesManagement.experimentalFeatureCallout.openForumText"
defaultMessage="OpenSearch Forum"
defaultMessage="forum.opensearch.org"
/>
}
</EuiLink>

0 comments on commit 3e02e54

Please sign in to comment.