Skip to content

Commit 1d93a16

Browse files
committed
feat: move restapi component into generic type
1 parent 9271802 commit 1d93a16

File tree

11 files changed

+91
-3
lines changed

11 files changed

+91
-3
lines changed

apps/console/public/icons/audio.svg

+3
Loading
+5
Loading

apps/console/public/icons/hubspot.svg

+3
Loading

apps/console/public/icons/jira.svg

+15
Loading

apps/console/public/icons/ollama.svg

+7
Loading

apps/console/public/icons/sql.svg

+6
Loading

apps/console/public/icons/video.svg

+3
Loading

packages/sdk/src/vdp/component/types.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ export type ConnectorType =
77
| "CONNECTOR_TYPE_OPERATOR"
88
| "CONNECTOR_TYPE_DATA"
99
| "CONNECTOR_TYPE_AI"
10-
| "CONNECTOR_TYPE_APPLICATION";
10+
| "CONNECTOR_TYPE_APPLICATION"
11+
| "CONNECTOR_TYPE_GENERIC";
1112

1213
export const ConnectorTypeSchema = z.enum([
1314
"CONNECTOR_TYPE_UNSPECIFIED",
1415
"CONNECTOR_TYPE_OPERATOR",
1516
"CONNECTOR_TYPE_DATA",
1617
"CONNECTOR_TYPE_AI",
1718
"CONNECTOR_TYPE_APPLICATION",
19+
"CONNECTOR_TYPE_GENERIC",
1820
]);
1921

2022
export type ConnectorDefinition = {

packages/sdk/src/vdp/pipeline/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export type PipelineComponentType =
3333
| "COMPONENT_TYPE_CONNECTOR_AI"
3434
| "COMPONENT_TYPE_CONNECTOR_DATA"
3535
| "COMPONENT_TYPE_CONNECTOR_APPLICATION"
36-
| "COMPONENT_TYPE_OPERATOR";
36+
| "COMPONENT_TYPE_OPERATOR"
37+
| "COMPONENT_TYPE_GENERIC";
3738

3839
export type PipelineReleasesWatchState = Record<
3940
string,

packages/toolkit/src/lib/vdp-sdk/connector/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export type ConnectorType =
66
| "CONNECTOR_TYPE_OPERATOR"
77
| "CONNECTOR_TYPE_DATA"
88
| "CONNECTOR_TYPE_AI"
9-
| "CONNECTOR_TYPE_APPLICATION";
9+
| "CONNECTOR_TYPE_APPLICATION"
10+
| "CONNECTOR_TYPE_GENERIC";
1011

1112
export type ConnectorDefinition = {
1213
name: string;

packages/toolkit/src/view/pipeline-builder/components/dialogs/select-component-dialog/GenericSection.tsx

+42
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
import { Icons } from "@instill-ai/design-system";
22

33
import { ImageWithFallback } from "../../../../../components";
4+
import {
5+
InstillStore,
6+
useConnectorDefinitions,
7+
useInstillStore,
8+
useShallow,
9+
} from "../../../../../lib";
410
import { Section } from "./Section";
511
import { OnSelectComponent } from "./SelectComponentDialog";
612

13+
const selector = (store: InstillStore) => ({
14+
accessToken: store.accessToken,
15+
enabledQuery: store.enabledQuery,
16+
});
17+
718
export const GenericSection = ({
819
onSelect,
920
}: {
1021
onSelect: OnSelectComponent;
1122
}) => {
23+
const { accessToken, enabledQuery } = useInstillStore(useShallow(selector));
24+
25+
const genericDefinitions = useConnectorDefinitions({
26+
connectorType: "CONNECTOR_TYPE_GENERIC",
27+
enabled: enabledQuery,
28+
accessToken,
29+
});
30+
1231
return (
1332
<Section.Root title="Generic">
1433
<Section.Item
@@ -35,6 +54,29 @@ export const GenericSection = ({
3554
Iterator
3655
</p>
3756
</Section.Item>
57+
{genericDefinitions.isSuccess
58+
? genericDefinitions.data.map((definition) => (
59+
<Section.Item
60+
key={definition.id}
61+
onClick={() => {
62+
onSelect(definition);
63+
}}
64+
>
65+
<ImageWithFallback
66+
src={`/icons/${definition.id}.svg`}
67+
width={32}
68+
height={32}
69+
alt={`${definition.title}-icon`}
70+
fallbackImg={
71+
<Icons.Box className="h-8 w-8 stroke-semantic-fg-primary" />
72+
}
73+
/>
74+
<p className="my-auto text-left text-semantic-fg-primary product-headings-heading-5">
75+
{definition.title}
76+
</p>
77+
</Section.Item>
78+
))
79+
: null}
3880
</Section.Root>
3981
);
4082
};

0 commit comments

Comments
 (0)