Skip to content

Commit efb5fd2

Browse files
mscolnickdmadisetti
authored andcommitted
feat: release .env secrets out of experimental (#4556)
Release dotenv secrets out of experimental.
1 parent 06a2a9e commit efb5fd2

File tree

5 files changed

+81
-50
lines changed

5 files changed

+81
-50
lines changed

frontend/src/components/app-config/user-config-form.tsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,35 +1294,37 @@ export const UserConfigForm: React.FC = () => {
12941294
)}
12951295
/>
12961296

1297-
<FormField
1298-
control={form.control}
1299-
name="experimental.lsp"
1300-
render={({ field }) => (
1301-
<div className="flex flex-col gap-y-1">
1302-
<FormItem className={formItemClasses}>
1303-
<FormLabel className="font-normal">
1304-
LSP (Language Server Protocol)
1305-
</FormLabel>
1306-
<FormControl>
1307-
<Checkbox
1308-
data-testid="inline-ai-checkbox"
1309-
checked={field.value === true}
1310-
onCheckedChange={field.onChange}
1311-
/>
1312-
</FormControl>
1313-
</FormItem>
1314-
<FormDescription>
1315-
Enable experimental LSP support. You will need to have
1316-
<Kbd className="inline">marimo[lsp]</Kbd> installed in your
1317-
environment to use this. See{" "}
1318-
<ExternalLink href="https://docs.marimo.io/guides/editor_features/language_server/">
1319-
docs
1320-
</ExternalLink>{" "}
1321-
for more info.
1322-
</FormDescription>
1323-
</div>
1324-
)}
1325-
/>
1297+
{!isWasm() && (
1298+
<FormField
1299+
control={form.control}
1300+
name="experimental.lsp"
1301+
render={({ field }) => (
1302+
<div className="flex flex-col gap-y-1">
1303+
<FormItem className={formItemClasses}>
1304+
<FormLabel className="font-normal">
1305+
LSP (Language Server Protocol)
1306+
</FormLabel>
1307+
<FormControl>
1308+
<Checkbox
1309+
data-testid="inline-ai-checkbox"
1310+
checked={field.value === true}
1311+
onCheckedChange={field.onChange}
1312+
/>
1313+
</FormControl>
1314+
</FormItem>
1315+
<FormDescription>
1316+
Enable experimental LSP support. You will need to have
1317+
<Kbd className="inline">marimo[lsp]</Kbd> installed in
1318+
your environment to use this. See{" "}
1319+
<ExternalLink href="https://docs.marimo.io/guides/editor_features/language_server/">
1320+
docs
1321+
</ExternalLink>{" "}
1322+
for more info.
1323+
</FormDescription>
1324+
</div>
1325+
)}
1326+
/>
1327+
)}
13261328
<FormField
13271329
control={form.control}
13281330
name="experimental.inline_ai_tooltip"

frontend/src/components/editor/chrome/panels/write-secret-modal.tsx

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,32 @@ export const WriteSecretModal: React.FC<{
4646
}> = ({ providerNames, onClose, onSuccess }) => {
4747
const [key, setKey] = React.useState("");
4848
const [value, setValue] = React.useState("");
49-
const [location, setLocation] = React.useState(providerNames[0] || ".env");
49+
const [location, setLocation] = React.useState<string | undefined>(
50+
providerNames[0],
51+
);
5052
// Only dotenv is supported for now
5153
const provider = "dotenv";
5254

5355
const handleSubmit = async (e: React.FormEvent) => {
5456
e.preventDefault();
57+
if (!location) {
58+
toast({
59+
title: "Error",
60+
description: "No location selected for the secret.",
61+
variant: "danger",
62+
});
63+
return;
64+
}
65+
66+
if (!key || !value || !location) {
67+
toast({
68+
title: "Error",
69+
description: "Please fill in all fields.",
70+
variant: "danger",
71+
});
72+
return;
73+
}
74+
5575
try {
5676
await writeSecret({
5777
key,
@@ -109,21 +129,28 @@ export const WriteSecretModal: React.FC<{
109129
</div>
110130
<div className="grid gap-2">
111131
<Label htmlFor="location">Location</Label>
112-
<Select
113-
value={location}
114-
onValueChange={(value) => setLocation(value)}
115-
>
116-
<SelectTrigger>
117-
<SelectValue placeholder="Select a provider" />
118-
</SelectTrigger>
119-
<SelectContent>
120-
{providerNames.map((name) => (
121-
<SelectItem key={name} value={name}>
122-
{name}
123-
</SelectItem>
124-
))}
125-
</SelectContent>
126-
</Select>
132+
{providerNames.length === 0 && (
133+
<p className="text-sm text-muted-foreground">
134+
No dotenv locations configured.
135+
</p>
136+
)}
137+
{providerNames.length > 0 && (
138+
<Select
139+
value={location}
140+
onValueChange={(value) => setLocation(value)}
141+
>
142+
<SelectTrigger>
143+
<SelectValue placeholder="Select a provider" />
144+
</SelectTrigger>
145+
<SelectContent>
146+
{providerNames.map((name) => (
147+
<SelectItem key={name} value={name}>
148+
{name}
149+
</SelectItem>
150+
))}
151+
</SelectContent>
152+
</Select>
153+
)}
127154
<FormDescription>
128155
You can configure the location by setting the{" "}
129156
<ExternalLink href="https://links.marimo.app/dotenv">
@@ -137,7 +164,9 @@ export const WriteSecretModal: React.FC<{
137164
<Button type="button" variant="outline" onClick={onClose}>
138165
Cancel
139166
</Button>
140-
<Button type="submit">Add Secret</Button>
167+
<Button type="submit" disabled={!key || !value || !location}>
168+
Add Secret
169+
</Button>
141170
</DialogFooter>
142171
</form>
143172
</DialogContent>

frontend/src/components/editor/chrome/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright 2024 Marimo. All rights reserved. */
2-
import { getFeatureFlag } from "@/core/config/feature-flag";
2+
import { isWasm } from "@/core/wasm/utils";
33
import {
44
XCircleIcon,
55
FolderTreeIcon,
@@ -110,10 +110,11 @@ export const PANELS: PanelDescriptor[] = [
110110
position: "sidebar",
111111
},
112112
{
113+
// Not supported in WebAssembly yet
113114
type: "secrets",
114115
Icon: KeyIcon,
115116
tooltip: "Secrets",
116-
hidden: !getFeatureFlag("secrets"),
117+
hidden: isWasm(),
117118
position: "sidebar",
118119
},
119120
{

frontend/src/core/config/feature-flag.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export interface ExperimentalFeatures {
1414
rtc_v2: boolean;
1515
reactive_tests: boolean;
1616
toplevel_defs: boolean;
17-
secrets: boolean;
1817
table_charts: boolean;
1918
// Add new feature flags here
2019
}
@@ -27,7 +26,6 @@ const defaultValues: ExperimentalFeatures = {
2726
rtc_v2: false,
2827
reactive_tests: false,
2928
toplevel_defs: false,
30-
secrets: false,
3129
table_charts: false,
3230
};
3331

marimo/_server/print.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def print_experimental_features(config: MarimoConfig) -> None:
118118
"tracing",
119119
"markdown",
120120
"sql_engines",
121+
"secrets",
121122
"reactive_tests",
122123
}
123124
keys = keys - finished_experiments

0 commit comments

Comments
 (0)