Skip to content

Commit f951af7

Browse files
authored
StarRocks Form (#8772)
* feat(sources): Add StarRocks OLAP connector with form schema Add StarRocks connector support to the data sources modal: - Create JSON schema for StarRocks connection configuration - Support both DSN and parameter-based connection modes - Configure OLAP catalog, database, and SSL settings - Fix StarRocks icon text to use proper dark mode coloring The schema includes conditional validation to require either: - DSN string (MySQL format), or - Individual parameters (host, port, username, catalog) * fix(forms): Hide checkbox indicator when unchecked, remove redundant boolean default - Add `data-[state=unchecked]:hidden` to CheckboxPrimitive.Indicator to properly hide the check icon in unchecked state - The background color change indicates checked state; the icon should only appear when checked - Remove redundant `default: false` from StarRocks SSL field (boolean fields default to false implicitly) Fixes checkbox display issue where unchecked checkboxes showed visible check icons.
1 parent 13daf1c commit f951af7

File tree

5 files changed

+107
-2
lines changed

5 files changed

+107
-2
lines changed

web-common/src/components/forms/Checkbox.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
)}
4242
>
4343
<CheckboxPrimitive.Indicator
44-
class={cn("flex items-center justify-center text-white")}
44+
class={cn(
45+
"flex items-center justify-center text-white",
46+
"data-[state=unchecked]:hidden",
47+
)}
4548
>
4649
<Check class="h-3.5 w-3.5" />
4750
</CheckboxPrimitive.Indicator>

web-common/src/components/icons/connectors/StarRocks.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/>
2525
<!-- StarRocks text -->
2626
<path
27+
class="fill-fg-primary"
2728
d="M104.591 12.5L106.417 12.5L106.417 19.622A16.152 16.152 0 0 1 106.385 20.576A711.473 711.473 0 0 1 106.326 21.558L106.39 21.558A80.585 80.585 0 0 1 106.951 20.836A17.564 17.564 0 0 1 107.577 20.078L110.791 16.645L112.909 16.645L108.873 20.965L113.193 26.708L111.019 26.708L107.631 22.115L106.417 23.192L106.417 26.708L104.591 26.708L104.591 12.5ZM36 26.224L36 24.452A14.978 14.978 0 0 0 37.753 25.032A7.829 7.829 0 0 0 39.808 25.301Q40.73 25.301 41.355 25.05Q41.981 24.799 42.3 24.343A1.862 1.862 0 0 0 42.62 23.247A1.796 1.796 0 0 0 42.31 22.174A2.863 2.863 0 0 0 41.328 21.375Q40.657 21.01 39.57 20.599Q38.812 20.325 38.191 19.973A4.882 4.882 0 0 1 37.119 19.165A3.192 3.192 0 0 1 36.42 18.092Q36.173 17.476 36.173 16.673Q36.173 15.568 36.717 14.783A3.424 3.424 0 0 1 38.237 13.582A5.748 5.748 0 0 1 40.502 13.167A8.85 8.85 0 0 1 42.478 13.377Q43.396 13.587 44.227 13.952L43.633 15.504Q42.857 15.185 42.072 14.984Q41.287 14.783 40.447 14.783A3.335 3.335 0 0 0 39.137 15.011A1.783 1.783 0 0 0 38.324 15.659A1.759 1.759 0 0 0 38.045 16.655Q38.045 17.303 38.338 17.732Q38.63 18.161 39.26 18.508Q39.89 18.855 40.903 19.248Q42.045 19.686 42.844 20.179A3.591 3.591 0 0 1 44.062 21.366A3.338 3.338 0 0 1 44.483 23.119Q44.483 24.306 43.894 25.151A3.704 3.704 0 0 1 42.236 26.443A6.463 6.463 0 0 1 39.801 26.89A9.524 9.524 0 0 1 39.698 26.89A12.287 12.287 0 0 1 38.287 26.813A9.506 9.506 0 0 1 37.041 26.589A5.789 5.789 0 0 1 36 26.224ZM72.624 13.359L76.303 13.359A9.244 9.244 0 0 1 78.467 13.582A5.336 5.336 0 0 1 79.093 13.774Q80.194 14.189 80.732 15.034A3.861 3.861 0 0 1 81.271 17.094A6.141 6.141 0 0 1 81.271 17.175A3.635 3.635 0 0 1 80.897 18.901Q80.522 19.604 79.915 20.051A5.235 5.235 0 0 1 78.613 20.754L82.349 26.708L80.202 26.708L76.952 21.247L74.496 21.247L74.496 26.708L72.624 26.708L72.624 13.359ZM76.185 14.947L74.496 14.947L74.496 19.686L76.313 19.686A4.814 4.814 0 0 0 77.956 19.445A2.199 2.199 0 0 0 78.623 19.07A2.25 2.25 0 0 0 79.353 17.248A2.17 2.17 0 0 0 78.846 15.7A1.608 1.608 0 0 0 78.577 15.472A3.275 3.275 0 0 0 77.155 15.004A7.647 7.647 0 0 0 76.185 14.947ZM114.224 26.269L114.224 24.644A9.578 9.578 0 0 0 115.767 25.21A6.323 6.323 0 0 0 117.484 25.457A3.97 3.97 0 0 0 118.815 25.273A1.555 1.555 0 0 0 119.187 25.082Q119.712 24.708 119.712 24.069Q119.712 23.695 119.502 23.407Q119.291 23.119 118.767 22.832A10.473 10.473 0 0 0 117.725 22.352A22.938 22.938 0 0 0 117.265 22.17A13.974 13.974 0 0 1 115.626 21.421A2.899 2.899 0 0 1 114.59 20.517Q114.233 19.987 114.233 19.147A2.244 2.244 0 0 1 115.279 17.152A4.497 4.497 0 0 1 117.421 16.487A7.661 7.661 0 0 1 118.041 16.463Q118.954 16.463 119.762 16.645A8.312 8.312 0 0 1 121.309 17.157L120.716 18.572A9.995 9.995 0 0 0 119.365 18.102A5.411 5.411 0 0 0 117.949 17.915A3.078 3.078 0 0 0 116.644 18.145A1.499 1.499 0 0 0 116.511 18.216A0.929 0.929 0 0 0 116.013 19.047A1.021 1.021 0 0 0 116.247 19.731Q116.479 20.005 117.027 20.266A17.855 17.855 0 0 0 118.065 20.71A36.03 36.03 0 0 0 118.507 20.882Q119.428 21.229 120.1 21.604A2.966 2.966 0 0 1 121.136 22.517A2.407 2.407 0 0 1 121.501 23.895A2.762 2.762 0 0 1 121.022 25.543Q120.543 26.215 119.63 26.553A6.246 6.246 0 0 1 117.518 26.89A9.549 9.549 0 0 1 117.438 26.89Q116.379 26.89 115.612 26.731A5.946 5.946 0 0 1 114.224 26.269ZM61.484 19.905L61.484 26.708L60.169 26.708L59.813 25.247L59.74 25.247A5.252 5.252 0 0 1 58.864 26.16A3.134 3.134 0 0 1 57.809 26.708A5.038 5.038 0 0 1 56.353 26.89Q55.44 26.89 54.728 26.561A2.525 2.525 0 0 1 53.609 25.571Q53.202 24.909 53.202 23.886A2.63 2.63 0 0 1 54.38 21.558A4.857 4.857 0 0 1 56.148 20.88A10.909 10.909 0 0 1 57.951 20.691L59.685 20.617L59.685 20.051A2.78 2.78 0 0 0 59.42 18.727A1.302 1.302 0 0 0 59.161 18.389A2.081 2.081 0 0 0 57.695 17.905A4.937 4.937 0 0 0 56.206 18.129Q55.494 18.353 54.837 18.663L54.253 17.33Q54.965 16.965 55.873 16.719A7.239 7.239 0 0 1 57.777 16.472A5.314 5.314 0 0 1 59.688 16.775A2.818 2.818 0 0 1 60.562 17.298A2.91 2.91 0 0 1 61.44 19.172A5.768 5.768 0 0 1 61.484 19.905ZM59.667 22.727L59.667 21.822L58.261 21.886Q56.517 21.951 55.809 22.467Q55.102 22.982 55.102 23.904A1.396 1.396 0 0 0 55.585 25.082Q56.07 25.457 56.864 25.457A2.951 2.951 0 0 0 58.877 24.767Q59.667 24.078 59.667 22.727ZM51.888 25.156L51.888 26.561A3.835 3.835 0 0 1 51.061 26.795A5.76 5.76 0 0 1 50.007 26.89A3.772 3.772 0 0 1 48.519 26.607A2.22 2.22 0 0 1 47.455 25.64A3.417 3.417 0 0 1 47.068 24.115A6.681 6.681 0 0 1 47.057 23.74L47.057 18.061L45.66 18.061L45.66 17.211L47.122 16.536L47.769 14.363L48.902 14.363L48.902 16.645L51.815 16.645L51.815 18.061L48.902 18.061L48.902 23.713A1.762 1.762 0 0 0 49.308 24.982A1.448 1.448 0 0 0 50.4 25.402A4.721 4.721 0 0 0 51.194 25.333Q51.595 25.265 51.888 25.156ZM102.427 17.038L101.879 18.526A9.933 9.933 0 0 0 100.779 18.171A4.392 4.392 0 0 0 99.66 18.015Q98.692 18.015 98.058 18.439A2.564 2.564 0 0 0 97.104 19.686A5.454 5.454 0 0 0 96.785 21.564A8.823 8.823 0 0 0 96.784 21.713A5.539 5.539 0 0 0 97.08 23.639A3.586 3.586 0 0 0 97.099 23.69A2.558 2.558 0 0 0 98.031 24.918A2.671 2.671 0 0 0 99.569 25.338A5.389 5.389 0 0 0 101.03 25.156A6.349 6.349 0 0 0 102.226 24.69L102.226 26.306Q101.696 26.598 101.057 26.744Q100.418 26.89 99.514 26.89A5.073 5.073 0 0 1 97.085 26.333Q96.045 25.776 95.474 24.63Q94.903 23.485 94.903 21.731A7.41 7.41 0 0 1 95.216 19.459A4.545 4.545 0 0 1 95.515 18.741A3.924 3.924 0 0 1 97.209 17.02A5.34 5.34 0 0 1 99.688 16.463A6.873 6.873 0 0 1 101.226 16.627A5.247 5.247 0 0 1 102.427 17.038ZM70.524 16.572L70.332 18.28Q70.113 18.225 69.825 18.189Q69.538 18.152 69.291 18.152A2.885 2.885 0 0 0 68.177 18.371A2.741 2.741 0 0 0 67.246 19.006A2.95 2.95 0 0 0 66.616 20.019A3.809 3.809 0 0 0 66.388 21.384L66.388 26.708L64.543 26.708L64.543 16.645L66.022 16.645L66.241 18.463L66.324 18.463A4.924 4.924 0 0 1 67.077 17.458A3.42 3.42 0 0 1 68.1 16.732A3.008 3.008 0 0 1 69.382 16.463A5.991 5.991 0 0 1 69.976 16.495A5.772 5.772 0 0 1 70.524 16.572ZM92.607 23.872Q92.283 24.845 91.666 25.516A4.054 4.054 0 0 1 90.183 26.539A5.189 5.189 0 0 1 88.219 26.89A4.882 4.882 0 0 1 86.343 26.539A4.123 4.123 0 0 1 84.869 25.516Q84.248 24.845 83.909 23.872Q83.572 22.9 83.572 21.658A6.704 6.704 0 0 1 84.001 19.15A4.782 4.782 0 0 1 84.138 18.842Q84.704 17.677 85.759 17.07A4.958 4.958 0 0 1 88.274 16.463A4.754 4.754 0 0 1 90.712 17.074A4.157 4.157 0 0 1 92.346 18.846A5.975 5.975 0 0 1 92.926 21.353A8.965 8.965 0 0 1 92.931 21.658A6.989 6.989 0 0 1 92.607 23.872ZM85.453 21.658A5.977 5.977 0 0 0 85.75 23.653A2.611 2.611 0 0 0 86.663 24.936Q87.279 25.384 88.256 25.384Q89.215 25.384 89.836 24.936A2.573 2.573 0 0 0 90.749 23.653A6.063 6.063 0 0 0 91.041 21.658A5.908 5.908 0 0 0 90.749 19.686Q90.457 18.864 89.84 18.426A2.704 2.704 0 0 0 88.238 17.988A2.467 2.467 0 0 0 86.274 18.758A2.232 2.232 0 0 0 86.124 18.951A4 4 0 0 0 85.496 20.823A7.635 7.635 0 0 0 85.453 21.658Z"
28-
fill="#1a1a1a"
2929
/>
3030
</svg>

web-common/src/features/sources/modal/connector-schemas.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { motherduckSchema } from "../../templates/schemas/motherduck";
2121
import { druidSchema } from "../../templates/schemas/druid";
2222
import { pinotSchema } from "../../templates/schemas/pinot";
2323
import { s3Schema } from "../../templates/schemas/s3";
24+
import { starrocksSchema } from "../../templates/schemas/starrocks";
2425
import { SOURCES, OLAP_ENGINES } from "./constants";
2526

2627
export const multiStepFormSchemas: Record<string, MultiStepFormSchema> = {
@@ -38,6 +39,7 @@ export const multiStepFormSchemas: Record<string, MultiStepFormSchema> = {
3839
duckdb: duckdbSchema,
3940
druid: druidSchema,
4041
pinot: pinotSchema,
42+
starrocks: starrocksSchema,
4143
local_file: localFileSchema,
4244
https: httpsSchema,
4345
s3: s3Schema,

web-common/src/features/sources/modal/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export const OLAP_ENGINES = [
103103
"duckdb",
104104
"druid",
105105
"pinot",
106+
"starrocks",
106107
];
107108

108109
export const ALL_CONNECTORS = [...SOURCES, ...OLAP_ENGINES];
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import type { MultiStepFormSchema } from "./types";
2+
3+
export const starrocksSchema: MultiStepFormSchema = {
4+
$schema: "http://json-schema.org/draft-07/schema#",
5+
type: "object",
6+
title: "StarRocks",
7+
"x-category": "olap",
8+
"x-form-height": "tall",
9+
properties: {
10+
connection_mode: {
11+
type: "string",
12+
title: "Connection method",
13+
enum: ["parameters", "dsn"],
14+
default: "parameters",
15+
"x-display": "tabs",
16+
"x-enum-labels": ["Enter parameters", "Enter connection string"],
17+
"x-ui-only": true,
18+
"x-tab-group": {
19+
parameters: [
20+
"host",
21+
"port",
22+
"username",
23+
"password",
24+
"catalog",
25+
"database",
26+
"ssl",
27+
],
28+
dsn: ["dsn"],
29+
},
30+
},
31+
dsn: {
32+
type: "string",
33+
title: "Connection string",
34+
description:
35+
"MySQL DSN format. If provided, do not set host/port/username/password. Catalog and database should be set separately for external catalogs.",
36+
"x-placeholder":
37+
"user:password@tcp(host:9030)/?timeout=30s&readTimeout=300s&parseTime=true",
38+
"x-secret": true,
39+
},
40+
host: {
41+
type: "string",
42+
title: "Host",
43+
description: "Hostname or IP address of the StarRocks FE node",
44+
"x-placeholder": "localhost",
45+
},
46+
port: {
47+
type: "string",
48+
title: "Port",
49+
description: "MySQL protocol port of the StarRocks FE node",
50+
pattern: "^\\d+$",
51+
errorMessage: { pattern: "Port must be a number" },
52+
default: "9030",
53+
"x-placeholder": "9030",
54+
},
55+
username: {
56+
type: "string",
57+
title: "Username",
58+
description: "Username to connect to StarRocks",
59+
default: "root",
60+
"x-placeholder": "root",
61+
},
62+
password: {
63+
type: "string",
64+
title: "Password",
65+
description: "Password to connect to StarRocks",
66+
"x-placeholder": "password",
67+
"x-secret": true,
68+
},
69+
catalog: {
70+
type: "string",
71+
title: "Catalog",
72+
description:
73+
"StarRocks catalog name. Use default_catalog for internal tables, or specify an external catalog (e.g. Iceberg, Hive).",
74+
default: "default_catalog",
75+
"x-placeholder": "default_catalog",
76+
},
77+
database: {
78+
type: "string",
79+
title: "Database",
80+
description: "Name of the StarRocks database to connect to",
81+
"x-placeholder": "default",
82+
},
83+
ssl: {
84+
type: "boolean",
85+
title: "SSL",
86+
description: "Enable SSL/TLS encryption for the connection",
87+
},
88+
},
89+
required: [],
90+
allOf: [
91+
{
92+
if: {
93+
properties: { connection_mode: { const: "dsn" } },
94+
},
95+
then: { required: ["dsn"] },
96+
else: { required: ["host"] },
97+
},
98+
],
99+
};

0 commit comments

Comments
 (0)