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

[Backport 2.11] Update URL of create datasources, fix spacing #1154

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading