Skip to content

Commit 2937b5b

Browse files
ericallamTrigger.dev RepoOps
authored andcommitted
feat(webapp): add a key panel and sort by last updated to the environment variables page
Clicking a row on the Environment variables page opens a side panel showing that key's value in every environment and in each preview branch that sets its own value, where you can edit or set a value in place, add a value for another preview branch, or delete it. When the list shows a single environment, it can also be sorted by when a variable was last updated. The edit dialog now starts in the value field, and archived branch environments are no longer accepted as targets. Adds an index on environment variable values, created concurrently in its own migration. Mono-RevId: bfda0f2830ca910859683ba20d273523732a63f8
1 parent 8424404 commit 2937b5b

22 files changed

Lines changed: 3889 additions & 728 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: feature
4+
---
5+
6+
Click a key on the environment variables page to see its value in every environment and preview branch in a side panel, with edit and delete in place. A list showing a single environment can also be sorted by last updated. The edit dialog now starts in the value field, and archived preview branches are no longer accepted as targets.

‎apps/webapp/app/components/primitives/SearchInput.tsx‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export type SearchInputProps = {
3333
onValueChange?: (value: string) => void;
3434
/** A key that focuses the input. Ignored while a dialog is open. */
3535
shortcut?: ShortcutDefinition;
36+
/**
37+
* Fill the width of the container instead of sizing itself: no minimum width and no growing
38+
* on focus. For a search that sits in a row whose layout decides its width.
39+
*/
40+
fullWidth?: boolean;
3641
};
3742

3843
export function SearchInput({
@@ -45,6 +50,7 @@ export function SearchInput({
4550
value: controlledValue,
4651
onValueChange,
4752
shortcut,
53+
fullWidth = false,
4854
}: SearchInputProps) {
4955
const inputRef = useRef<HTMLInputElement>(null);
5056

@@ -135,16 +141,18 @@ export function SearchInput({
135141
};
136142

137143
return (
138-
<div className="flex items-center gap-1">
144+
<div className={cn("flex items-center gap-1", fullWidth && "w-full min-w-0")}>
139145
<motion.div
140-
initial={{ width: "auto" }}
141-
animate={{ width: isFocused && text.length > 0 ? "24rem" : "auto" }}
146+
initial={{ width: fullWidth ? "100%" : "auto" }}
147+
animate={{
148+
width: fullWidth ? "100%" : isFocused && text.length > 0 ? "24rem" : "auto",
149+
}}
142150
transition={{
143151
type: "spring",
144152
stiffness: 300,
145153
damping: 30,
146154
}}
147-
className="relative h-6 min-w-52"
155+
className={cn("relative h-6", fullWidth ? "min-w-0" : "min-w-52")}
148156
>
149157
<Input
150158
type="text"

‎apps/webapp/app/hooks/useShortcutKeys.tsx‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type Shortcut = {
1111
enabled?: boolean;
1212
/** Set when the browser binds the same keystroke to something of its own. */
1313
preventDefault?: boolean;
14+
/** Ignore the key while a dialog is open, so it can't act on the page under the dialog. */
15+
ignoreWhileDialogOpen?: boolean;
1416
};
1517

1618
export type ShortcutDefinition =
@@ -50,14 +52,18 @@ export function useShortcutKeys({
5052
useHotkeys(
5153
keys,
5254
(event) => {
53-
if (!event.repeat) {
54-
action(event);
55-
}
55+
if (event.repeat) return;
56+
if (relevantShortcut?.ignoreWhileDialogOpen && isDialogOpen()) return;
57+
action(event);
5658
},
5759
hotkeyOptions({ shortcut: relevantShortcut, isEnabled, enabledOnInputElements })
5860
);
5961
}
6062

63+
function isDialogOpen() {
64+
return document.querySelector('[role="dialog"], [role="alertdialog"]') !== null;
65+
}
66+
6167
export type HotkeyOptions = {
6268
enabled: boolean;
6369
enableOnFormTags: boolean;

0 commit comments

Comments
 (0)