Skip to content

Commit efb4892

Browse files
authored
Setup page polishes (#2288)
* minor fixes * f
1 parent 9eec604 commit efb4892

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

web/src/components/common/Select.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
2-
import { useConfig } from '../../contexts/ConfigContext';
1+
import React from "react";
2+
import { useConfig } from "../../contexts/ConfigContext";
33

44
interface SelectOption {
55
value: string;
@@ -18,6 +18,7 @@ interface SelectProps {
1818
helpText?: string;
1919
className?: string;
2020
labelClassName?: string;
21+
placeholder?: string;
2122
}
2223

2324
const Select: React.FC<SelectProps> = ({
@@ -30,8 +31,9 @@ const Select: React.FC<SelectProps> = ({
3031
disabled = false,
3132
error,
3233
helpText,
33-
className = '',
34-
labelClassName = '',
34+
className = "",
35+
labelClassName = "",
36+
placeholder,
3537
}) => {
3638
const { prototypeSettings } = useConfig();
3739
const themeColor = prototypeSettings.themeColor;
@@ -49,15 +51,20 @@ const Select: React.FC<SelectProps> = ({
4951
disabled={disabled}
5052
required={required}
5153
className={`w-full px-3 py-2 border ${
52-
error ? 'border-red-500' : 'border-gray-300'
53-
} rounded-md shadow-sm focus:outline-none ${
54-
disabled ? 'bg-gray-100 text-gray-500' : 'bg-white'
55-
} ${className}`}
56-
style={{
57-
'--tw-ring-color': themeColor,
58-
'--tw-ring-offset-color': themeColor,
59-
} as React.CSSProperties}
54+
error ? "border-red-500" : "border-gray-300"
55+
} rounded-md shadow-sm focus:outline-none ${disabled ? "bg-gray-100 text-gray-500" : "bg-white"} ${className}`}
56+
style={
57+
{
58+
"--tw-ring-color": themeColor,
59+
"--tw-ring-offset-color": themeColor,
60+
} as React.CSSProperties
61+
}
6062
>
63+
{placeholder && (
64+
<option value="" disabled>
65+
{placeholder}
66+
</option>
67+
)}
6168
{options.map((option) => (
6269
<option key={option.value} value={option.value}>
6370
{option.label}
@@ -70,4 +77,4 @@ const Select: React.FC<SelectProps> = ({
7077
);
7178
};
7279

73-
export default Select;
80+
export default Select;

web/src/components/wizard/setup/LinuxSetup.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ const LinuxSetup: React.FC<LinuxSetupProps> = ({
4949
return (
5050
<div className="space-y-6" data-testid="linux-setup">
5151
<div className="space-y-4">
52-
<h2 className="text-lg font-medium text-gray-900">
53-
System Configuration
54-
</h2>
52+
<h2 className="text-lg font-medium text-gray-900">System Configuration</h2>
5553
<Input
5654
id="dataDirectory"
5755
label="Data Directory"
@@ -87,9 +85,7 @@ const LinuxSetup: React.FC<LinuxSetupProps> = ({
8785
</div>
8886

8987
<div className="space-y-4">
90-
<h2 className="text-lg font-medium text-gray-900">
91-
Proxy Configuration
92-
</h2>
88+
<h2 className="text-lg font-medium text-gray-900">Proxy Configuration</h2>
9389
<div className="space-y-4">
9490
<Input
9591
id="httpProxy"
@@ -129,11 +125,7 @@ const LinuxSetup: React.FC<LinuxSetupProps> = ({
129125
className="flex items-center text-lg font-medium text-gray-900 mb-4"
130126
onClick={() => onShowAdvancedChange(!showAdvanced)}
131127
>
132-
{showAdvanced ? (
133-
<ChevronDown className="w-4 h-4 mr-1" />
134-
) : (
135-
<ChevronUp className="w-4 h-4 mr-1" />
136-
)}
128+
{showAdvanced ? <ChevronDown className="w-4 h-4 mr-1" /> : <ChevronUp className="w-4 h-4 mr-1" />}
137129
Advanced Settings
138130
</button>
139131

@@ -145,21 +137,20 @@ const LinuxSetup: React.FC<LinuxSetupProps> = ({
145137
value={config.networkInterface || ""}
146138
onChange={onSelectChange}
147139
options={[
148-
{ value: "", label: "Select a network interface" },
149140
...(availableNetworkInterfaces.length > 0
150141
? availableNetworkInterfaces.map((iface) => ({
151142
value: iface,
152143
label: iface,
153144
}))
154-
: (prototypeSettings.availableNetworkInterfaces || []).map(
155-
(iface) => ({
156-
value: iface.name,
157-
label: iface.name,
158-
})
159-
)),
145+
: (prototypeSettings.availableNetworkInterfaces || []).map((iface) => ({
146+
value: iface.name,
147+
label: iface.name,
148+
}))),
160149
]}
161150
helpText={`Network interface to use for ${title}`}
162151
error={getFieldError("networkInterface")}
152+
required
153+
placeholder="Select a network interface"
163154
/>
164155

165156
<Input
@@ -168,8 +159,9 @@ const LinuxSetup: React.FC<LinuxSetupProps> = ({
168159
value={config.globalCidr || ""}
169160
onChange={onInputChange}
170161
placeholder="10.244.0.0/16"
171-
helpText="CIDR notation for the reserved network range (defaults to 10.244.0.0/16; must be /16 or larger)"
162+
helpText="CIDR notation for the reserved network range (must be /16 or larger)"
172163
error={getFieldError("globalCidr")}
164+
required
173165
/>
174166
</div>
175167
)}

0 commit comments

Comments
 (0)