Skip to content

Commit 50f4b09

Browse files
authored
Merge pull request #16 from OpenSourceAGI/claude/add-region-ssh-key-MYdAF
2 parents 661c598 + add6ba6 commit 50f4b09

File tree

3 files changed

+56
-16
lines changed

3 files changed

+56
-16
lines changed

apps/Cloud-Computer-Control-Panel/components/create-manager.tsx

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,37 @@ const INSTANCE_TYPES = [
2525
{ value: "t3.xlarge", label: "t3.xlarge", vcpu: 4, ram: 16, cost: 121.47 },
2626
]
2727

28+
const AWS_REGIONS = [
29+
{ value: "us-east-1", label: "US East (N. Virginia)" },
30+
{ value: "us-east-2", label: "US East (Ohio)" },
31+
{ value: "us-west-1", label: "US West (N. California)" },
32+
{ value: "us-west-2", label: "US West (Oregon)" },
33+
{ value: "ca-central-1", label: "Canada (Central)" },
34+
{ value: "eu-central-1", label: "Europe (Frankfurt)" },
35+
{ value: "eu-west-1", label: "Europe (Ireland)" },
36+
{ value: "eu-west-2", label: "Europe (London)" },
37+
{ value: "eu-west-3", label: "Europe (Paris)" },
38+
{ value: "eu-north-1", label: "Europe (Stockholm)" },
39+
{ value: "eu-south-1", label: "Europe (Milan)" },
40+
{ value: "ap-east-1", label: "Asia Pacific (Hong Kong)" },
41+
{ value: "ap-south-1", label: "Asia Pacific (Mumbai)" },
42+
{ value: "ap-northeast-1", label: "Asia Pacific (Tokyo)" },
43+
{ value: "ap-northeast-2", label: "Asia Pacific (Seoul)" },
44+
{ value: "ap-northeast-3", label: "Asia Pacific (Osaka)" },
45+
{ value: "ap-southeast-1", label: "Asia Pacific (Singapore)" },
46+
{ value: "ap-southeast-2", label: "Asia Pacific (Sydney)" },
47+
{ value: "sa-east-1", label: "South America (São Paulo)" },
48+
{ value: "me-south-1", label: "Middle East (Bahrain)" },
49+
{ value: "af-south-1", label: "Africa (Cape Town)" },
50+
]
51+
2852
const DEV_TOOLS = ["git", "docker", "nodejs", "python3", "nginx"]
2953

3054
export function CreateManager({ credentials, onSuccess }: { credentials: any; onSuccess: () => void }) {
3155
const { toast } = useToast()
3256
const [formData, setFormData] = useState({
3357
instanceName: "",
58+
region: credentials.region || "us-east-1",
3459
instanceType: "t3.small",
3560
storageSize: 40,
3661
keyName: "",
@@ -55,7 +80,6 @@ export function CreateManager({ credentials, onSuccess }: { credentials: any; on
5580
config: {
5681
...formData,
5782
keyName: sanitizedKeyName,
58-
region: credentials.region,
5983
createdAt: new Date().toISOString(),
6084
},
6185
status: {
@@ -181,6 +205,28 @@ export function CreateManager({ credentials, onSuccess }: { credentials: any; on
181205
/>
182206
</div>
183207

208+
<div className="space-y-2">
209+
<Label htmlFor="region">Region</Label>
210+
<Select value={formData.region} onValueChange={(value) => setFormData({ ...formData, region: value })}>
211+
<SelectTrigger>
212+
<SelectValue />
213+
</SelectTrigger>
214+
<SelectContent>
215+
{AWS_REGIONS.map((region) => (
216+
<SelectItem key={region.value} value={region.value}>
217+
{region.label}
218+
</SelectItem>
219+
))}
220+
</SelectContent>
221+
</Select>
222+
<div className="flex items-center gap-1 pt-1">
223+
<Badge variant="outline" className="text-xs">
224+
<MapPin className="h-3 w-3 mr-1" />
225+
{formData.region}
226+
</Badge>
227+
</div>
228+
</div>
229+
184230
<div className="space-y-2">
185231
<Label htmlFor="instanceType">Instance Type</Label>
186232
<Select
@@ -229,18 +275,12 @@ export function CreateManager({ credentials, onSuccess }: { credentials: any; on
229275
/>
230276
</div>
231277

232-
<div className="space-y-2">
233-
<Label htmlFor="keyName">SSH Key Pair Name (Optional)</Label>
234-
<Input
235-
id="keyName"
236-
value={formData.keyName}
237-
onChange={(e) => setFormData({ ...formData, keyName: e.target.value })}
238-
placeholder="Leave empty if you don't have a key pair"
239-
/>
240-
<p className="text-xs text-muted-foreground">
241-
You can connect via AWS Systems Manager Session Manager without a key pair
242-
</p>
243-
</div>
278+
<Alert>
279+
<CheckCircle className="h-4 w-4" />
280+
<AlertDescription className="text-xs">
281+
SSH key pairs will be automatically generated and saved securely when you launch the instance
282+
</AlertDescription>
283+
</Alert>
244284
</CardContent>
245285
</Card>
246286

@@ -450,7 +490,7 @@ export function CreateManager({ credentials, onSuccess }: { credentials: any; on
450490
<div className="flex items-center">
451491
<Badge variant="outline" className="h-fit">
452492
<MapPin className="h-3 w-3 mr-1" />
453-
{credentials.region}
493+
{formData.region}
454494
</Badge>
455495
</div>
456496
</div>

apps/Cloud-Computer-Control-Panel/components/instance-controls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function InstanceControls({ manager, apiUrl, credentials, onUpdate }: Ins
8888
body: JSON.stringify({
8989
accessKeyId: credentials.accessKeyId,
9090
secretAccessKey: credentials.secretAccessKey,
91-
region: credentials.region,
91+
region: sanitizedConfig.region || credentials.region,
9292
config: sanitizedConfig,
9393
}),
9494
})

apps/Cloud-Computer-Control-Panel/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)