Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
409d6d9
Update comment for json adaptor construction
Swiddis Jan 16, 2024
bdbf5e7
Stub index data adaptor class
Swiddis Jan 16, 2024
da380fb
Add initial impl for findIntegrationVersions
Swiddis Jan 17, 2024
676b1c7
Fill in simple getDirectoryType implementation
Swiddis Jan 17, 2024
01a2705
Merge branch 'main' into feature/index-adaptor
Swiddis Jan 23, 2024
f860fae
Implement index adaptor as wrapper for json adaptor
Swiddis Jan 24, 2024
3cbe96f
Add integration template type for index
Swiddis Jan 26, 2024
0a472b2
Fix lints for server/routes
Swiddis Jan 26, 2024
e837ef6
Merge branch 'main' into feature/index-adaptor
Swiddis Jan 26, 2024
7626f87
Fix integrations_manager lints
Swiddis Jan 26, 2024
f441021
Refactor template manager to support multiple readers at once
Swiddis Jan 26, 2024
f17fbbb
Rename FileSystemCatalogDataAdaptor -> FileSystemDataAdaptor
Swiddis Jan 26, 2024
2bb12a3
Add IndexReader to existing Manager logic
Swiddis Jan 26, 2024
1e84fd7
Fix plugin label type
Swiddis Jan 26, 2024
549120f
Add tests for index adaptor
Swiddis Jan 26, 2024
8bb2dc5
Merge remote-tracking branch 'upstream/main' into feature/index-adaptor
Swiddis Jan 29, 2024
b500a4f
Add object management to integration objects
Swiddis Jan 29, 2024
71cd590
Fix bug with version parsing for numeric integration names
Swiddis Jan 30, 2024
cb5a915
Remove FileSystemDataAdaptor usage in manager
Swiddis Jan 30, 2024
1b84773
Add empty integration state page
Swiddis Jan 31, 2024
198cabc
Remove all integrations that aren't used by tests
Swiddis Jan 31, 2024
cf3c038
Move repository to test files
Swiddis Jan 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,54 @@ exports[`Available Integration Card View Test Renders nginx integration card vie
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
<RenderRows
integrations={Array []}
>
<NoIntegrationsAvailable>
<EuiSpacer
size="xxl"
>
<div
className="euiSpacer euiSpacer--xxl"
/>
</EuiSpacer>
<EuiText
textAlign="center"
>
<div
className="euiText euiText--medium"
>
<EuiTextAlign
textAlign="center"
>
<div
className="euiTextAlign euiTextAlign--center"
>
<h2>
No Integrations Available
</h2>
<p>
You can get bundles from

<a
href="https://github.com/opensearch-project/opensearch-catalog"
>
the OpenSearch Catalog.
</a>
</p>
</div>
</EuiTextAlign>
</div>
</EuiText>
<EuiSpacer
size="m"
>
<div
className="euiSpacer euiSpacer--m"
/>
</EuiSpacer>
</NoIntegrationsAvailable>
</RenderRows>
</div>
</EuiPanel>
</AvailableIntegrationsCardView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
EuiSpacer,
EuiFieldSearch,
EuiButtonGroup,
EuiText,
EuiLoadingDashboards,
} from '@elastic/eui';
import _ from 'lodash';
import React, { useState } from 'react';
Expand All @@ -20,11 +22,47 @@ import {
} from './available_integration_overview_page';
import { INTEGRATIONS_BASE } from '../../../../common/constants/shared';
import { badges } from './integration_category_badge_group';
import { HttpSetup } from '../../../../../../src/core/public';

export function AvailableIntegrationsCardView(props: AvailableIntegrationsCardViewProps) {
const http = props.http;
const [toggleIconIdSelected, setToggleIconIdSelected] = useState('1');
function NoIntegrationsAvailable() {
return (
<>
<EuiSpacer size="xxl" />
<EuiText textAlign="center">
<h2>No Integrations Available</h2>
<p>
You can get bundles from{' '}
<a href="https://github.com/opensearch-project/opensearch-catalog">
the OpenSearch Catalog.
</a>
</p>
</EuiText>
<EuiSpacer size="m" />
</>
);
}

function LoadingIntegrations() {
return (
<>
<EuiSpacer size="xxl" />
<EuiText textAlign="center">
<EuiLoadingDashboards size="xxl" />
<p>Loading Integrations...</p>
</EuiText>
</>
);
}

function RenderRows({
loading,
integrations,
http,
}: {
loading: boolean;
integrations: AvailableIntegrationType[];
http: HttpSetup;
}) {
const getImage = (url?: string) => {
let optionalImg;
if (url) {
Expand All @@ -35,6 +73,39 @@ export function AvailableIntegrationsCardView(props: AvailableIntegrationsCardVi
return optionalImg;
};

if (loading) return <LoadingIntegrations />;
if (!integrations.length) return <NoIntegrationsAvailable />;
return (
<>
<EuiFlexGroup gutterSize="l" style={{ flexWrap: 'wrap' }}>
{integrations.map((i, v) => {
return (
<EuiFlexItem key={v} style={{ minWidth: '14rem', maxWidth: '14rem' }}>
<EuiCard
icon={getImage(
http.basePath.prepend(
`${INTEGRATIONS_BASE}/repository/${i.name}/static/${i.statics.logo.path}`
)
)}
title={i.displayName ? i.displayName : i.name}
description={i.description}
data-test-subj={`integration_card_${i.name.toLowerCase()}`}
titleElement="span"
onClick={() => (window.location.hash = `#/available/${i.name}`)}
footer={badges(i.labels ?? [])}
/>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
<EuiSpacer />
</>
);
}

export function AvailableIntegrationsCardView(props: AvailableIntegrationsCardViewProps) {
const [toggleIconIdSelected, setToggleIconIdSelected] = useState('1');

const toggleButtonsIcons = [
{
id: '0',
Expand All @@ -57,36 +128,6 @@ export function AvailableIntegrationsCardView(props: AvailableIntegrationsCardVi
}
};

const renderRows = (integrations: AvailableIntegrationType[]) => {
if (!integrations || !integrations.length) return null;
return (
<>
<EuiFlexGroup gutterSize="l" style={{ flexWrap: 'wrap' }}>
{integrations.map((i, v) => {
return (
<EuiFlexItem key={v} style={{ minWidth: '14rem', maxWidth: '14rem' }}>
<EuiCard
icon={getImage(
http.basePath.prepend(
`${INTEGRATIONS_BASE}/repository/${i.name}/static/${i.statics.logo.path}`
)
)}
title={i.displayName ? i.displayName : i.name}
description={i.description}
data-test-subj={`integration_card_${i.name.toLowerCase()}`}
titleElement="span"
onClick={() => (window.location.hash = `#/available/${i.name}`)}
footer={badges(i.labels ?? [])}
/>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
<EuiSpacer />
</>
);
};

return (
<EuiPanel>
<EuiFlexGroup gutterSize="s">
Expand All @@ -113,7 +154,11 @@ export function AvailableIntegrationsCardView(props: AvailableIntegrationsCardVi
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer />
{renderRows(props.data.hits.filter((x) => x.name.includes(props.query)))}
<RenderRows
loading={props.loading}
integrations={props.data.hits.filter((x) => x.name.includes(props.query))}
http={props.http}
/>
</EuiPanel>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { AvailableIntegrationsTable } from './available_integration_table';
import { AvailableIntegrationsCardView } from './available_integration_card_view';
import { INTEGRATIONS_BASE } from '../../../../common/constants/shared';
import { AvailableIntegrationOverviewPageProps } from './integration_types';
import { useToast } from '../../../../public/components/common/toast';
import { HttpStart } from '../../../../../../src/core/public';

export interface AvailableIntegrationType {
Expand Down Expand Up @@ -57,15 +56,16 @@ export interface AvailableIntegrationsCardViewProps {
setQuery: (input: string) => void;
renderCateogryFilters: () => React.JSX.Element;
http: HttpStart;
loading: boolean;
}

export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOverviewPageProps) {
const { chrome, http } = props;

const [query, setQuery] = useState('');
const [isCardView, setCardView] = useState(true);
const { setToast } = useToast();
const [data, setData] = useState<AvailableIntegrationsList>({ hits: [] });
const [loading, setLoading] = useState<boolean>(true);

const [isPopoverOpen, setIsPopoverOpen] = useState(false);

Expand Down Expand Up @@ -116,6 +116,7 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
async function handleDataRequest() {
http.get(`${INTEGRATIONS_BASE}/repository`).then((exists) => {
setData(exists.data);
setLoading(false);

let newItems = exists.data.hits.flatMap(
(hit: { labels?: string[] }) => hit.labels?.sort() ?? []
Expand All @@ -130,24 +131,6 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
});
}

async function addIntegrationRequest(name: string) {
http
.post(`${INTEGRATIONS_BASE}/store`)
.then((res) => {
setToast(
`${name} integration successfully added!`,
'success',
`View the added assets from ${name} in the Added Integrations list`
);
})
.catch((err) =>
setToast(
'Failed to load integration. Check Added Integrations table for more details',
'danger'
)
);
}

const renderCateogryFilters = () => {
return (
<EuiFilterGroup>
Expand Down Expand Up @@ -180,7 +163,7 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
return (
<EuiPage>
<EuiPageBody>
{IntegrationHeader()}
<IntegrationHeader />
{isCardView
? AvailableIntegrationsCardView({
data: {
Expand All @@ -192,6 +175,7 @@ export function AvailableIntegrationOverviewPage(props: AvailableIntegrationOver
setQuery,
renderCateogryFilters,
http,
loading,
})
: AvailableIntegrationsTable({
loading: false,
Expand Down

This file was deleted.

This file was deleted.

Loading