Skip to content

Commit

Permalink
Update URL of create datasources, fix spacing (opensearch-project#1149)…
Browse files Browse the repository at this point in the history
… (opensearch-project#1153)

(cherry picked from commit 54d125d)
  • Loading branch information
opensearch-trigger-bot[bot] authored and A9 Swift Project User committed Jan 8, 2024
1 parent ef5481d commit fb1940c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions auto_sync_commit_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"last_github_commit": "d5e7636b434c4d5624956c4fbbd9631160be7ea4",
"last_gitfarm_commit": "6ff47cadf0441916ed89d2006df4e2530d82240a"
"last_github_commit": "54d125d0b8e5fb5eb3c6ea664aff7c731f277f2f",
"last_gitfarm_commit": "854d937f281b75b90173cdf4cbad5aebf5758b84"
}
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 fb1940c

Please sign in to comment.