Skip to content

Commit

Permalink
Update URL of create datasources, fix spacing (#1149) (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
opensearch-trigger-bot[bot] authored Oct 23, 2023
1 parent 0acc0f3 commit 0b66d83
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
8 changes: 8 additions & 0 deletions common/constants/data_connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@ export const DatasourceTypeToDisplayName: { [key in DatasourceType]: string } =
S3GLUE: 'Amazon S3',
};

export const PrometheusURL = 'Prometheus';
export const AmazonS3URL = 'AmazonS3AWSGlue';

export const UrlToDatasourceType: { [key: string]: DatasourceType } = {
[PrometheusURL]: 'PROMETHEUS',
[AmazonS3URL]: 'S3GLUE',
};

export type AuthMethod = 'noauth' | 'basicauth' | 'awssigv4';
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ exports[`Data Connection Page test Renders Prometheus data connection page with
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary"
data-test-subj="createButton"
type="button"
>
Expand Down Expand Up @@ -786,7 +786,7 @@ exports[`Data Connection Page test Renders S3 data connection page with data 1`]
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary"
data-test-subj="createButton"
type="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export const AccessControlTab = (props: AccessControlTabProps) => {
<EuiButton
data-test-subj="createButton"
onClick={() => setMode(mode === 'view' ? 'edit' : 'view')}
fill={mode === 'view' ? true : false}
>
{mode === 'view' ? 'Edit' : 'Cancel'}
</EuiButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ import { ReviewPrometheusDatasource } from './review_prometheus_datasource_confi
import {
AuthMethod,
DatasourceTypeToDisplayName,
UrlToDatasourceType,
} from '../../../../../common/constants/data_connections';
import { formatError } from '../../../../../public/components/event_analytics/utils';
import { NotificationsStart } from '../../../../../../../src/core/public';

interface ConfigureDatasourceProps {
type: DatasourceType;
urlType: string;
notifications: NotificationsStart;
}

export function Configure(props: ConfigureDatasourceProps) {
const { type, notifications } = props;
const { urlType, notifications } = props;
const { http, chrome } = coreRefs;
const { setToast } = useToast();
const [error, setError] = useState<string>('');
Expand All @@ -55,6 +56,7 @@ export function Configure(props: ConfigureDatasourceProps) {
const [hasSecurityAccess, setHasSecurityAccess] = useState(true);
const [selectedQueryPermissionRoles, setSelectedQueryPermissionRoles] = useState<Role[]>([]);
const [page, setPage] = useState<'configure' | 'review'>('configure');
const type = UrlToDatasourceType[urlType];
const ConfigureDatasourceSteps = [
{
title: 'Configure data source',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const ConfigurePrometheusDatasource = (props: ConfigurePrometheusDatasour
<EuiText>
<h3>Data source details</h3>
</EuiText>
<EuiSpacer />
<EuiSpacer size="m" />
<NameRow
currentName={currentName}
setNameForRequest={setNameForRequest}
Expand All @@ -131,7 +131,7 @@ export const ConfigurePrometheusDatasource = (props: ConfigurePrometheusDatasour
<EuiText>
<h3>Prometheus data location</h3>
</EuiText>
<EuiSpacer />
<EuiSpacer size="m" />

<EuiFormRow label="Prometheus URI">
<>
Expand All @@ -156,7 +156,7 @@ export const ConfigurePrometheusDatasource = (props: ConfigurePrometheusDatasour
<EuiText>
<h3>Authentication details</h3>
</EuiText>
<EuiSpacer />
<EuiSpacer size="m" />

<EuiFormRow label="Authentication method">
<EuiSelect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const ConfigureS3Datasource = (props: ConfigureS3DatasourceProps) => {
<EuiText>
<h3>Data source details</h3>
</EuiText>
<EuiSpacer />
<EuiSpacer size="m" />
<NameRow
key={error}
currentName={currentName}
Expand All @@ -131,7 +131,7 @@ export const ConfigureS3Datasource = (props: ConfigureS3DatasourceProps) => {
<EuiText>
<h3>AWS Glue Data Catalog authentication details</h3>
</EuiText>
<EuiSpacer />
<EuiSpacer size="m" />

<EuiFormRow label="Authentication Method">
<>
Expand Down Expand Up @@ -169,7 +169,7 @@ export const ConfigureS3Datasource = (props: ConfigureS3DatasourceProps) => {
<EuiText>
<h3>AWS Glue Data Catalog index store details</h3>
</EuiText>
<EuiSpacer />
<EuiSpacer size="m" />

<EuiFormRow label="AWS Glue Data Catalog index store URI">
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { NewDatasourceDescription } from './new_datasource_description';
import s3Svg from '../../icons/s3-logo.svg';
import prometheusSvg from '../../icons/prometheus-logo.svg';
import { DatasourceType } from '../../../../../common/types/data_connections';
import { AmazonS3URL, PrometheusURL } from '../../../../../common/constants/data_connections';

export interface DatasourceCard {
name: DatasourceType;
Expand All @@ -22,17 +23,17 @@ export function NewDatasourceCardView() {
const Datasources: DatasourceCard[] = [
{
name: 'S3GLUE',
displayName: 'S3',
displayName: 'Amazon S3',
description: 'Connect to Amazon S3 via AWS Glue Data Catalog',
displayIcon: <EuiIcon type={s3Svg} size="xl" />,
onClick: () => (window.location.hash = `#/configure/S3GLUE`),
onClick: () => (window.location.hash = `#/configure/${AmazonS3URL}`),
},
{
name: 'PROMETHEUS',
displayName: 'Prometheus',
description: 'Connect to Prometheus',
displayIcon: <EuiIcon type={prometheusSvg} size="xl" />,
onClick: () => (window.location.hash = `#/configure/PROMETHEUS`),
onClick: () => (window.location.hash = `#/configure/${PrometheusURL}`),
},
];

Expand Down
2 changes: 1 addition & 1 deletion public/components/datasources/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const Home = (props: HomeProps) => {
exact
path={['/configure/:id+']}
render={(routerProps) => (
<Configure {...commonProps} type={decodeURIComponent(routerProps.match.params.id)} />
<Configure {...commonProps} urlType={decodeURIComponent(routerProps.match.params.id)} />
)}
/>
</Switch>
Expand Down

0 comments on commit 0b66d83

Please sign in to comment.