Skip to content

Commit ea8285f

Browse files
Adam Erbsvc-squareup-copybara
authored andcommitted
1) Fix run button from UI restructure. 2) Add message when
request editor is disabled. 3) Cobble together first time open help prompt. The initialization code for this should be cleaned up and centralized in the future. Right now it's a bunch of focus requests distributed across components GitOrigin-RevId: c627b1a978351e385f134c7f3d757a028eac62d3
1 parent 8bec997 commit ea8285f

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

misk-admin/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,4 @@ mavenPublishing {
245245
KotlinJvm(javadocJar = Dokka("dokkaGfm"))
246246
)
247247
}
248+

misk-admin/web-actions/src/index.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ function App() {
3636
callables: [],
3737
});
3838
const [loading, setLoading] = useState<boolean>(true);
39-
const [isHelpOpen, setIsHelpOpen] = useState<boolean>(false);
39+
const [isHelpOpen, setIsHelpOpen] = useState<boolean>(() => {
40+
const hasSeenHelp = localStorage.getItem('hasSeenHelp');
41+
return hasSeenHelp !== 'true';
42+
});
4043
const endPointSelectorRef = useRef<EndpointSelector>();
4144
const requestEditorRef = useRef<RequestEditor>();
4245

@@ -135,7 +138,18 @@ function App() {
135138
Help (⌘/)
136139
</Button>
137140
</HStack>
138-
<HelpPanel isOpen={isHelpOpen} onClose={() => setIsHelpOpen(false)} />
141+
<HelpPanel
142+
isOpen={isHelpOpen}
143+
onClose={() => {
144+
setIsHelpOpen(false);
145+
if (!localStorage.getItem('hasSeenHelp')) {
146+
setTimeout(() => {
147+
endPointSelectorRef.current?.focusSelect();
148+
}, 500);
149+
}
150+
localStorage.setItem('hasSeenHelp', 'true');
151+
}}
152+
/>
139153
<HStack spacing={2} flexGrow={1} width="100%">
140154
<VStack height="100%" flexGrow={1} alignItems="start">
141155
<Heading color="white" size="sm" fontWeight="semibold">
@@ -186,7 +200,7 @@ function App() {
186200
<IconButton
187201
aria-label="Run"
188202
colorScheme={'green'}
189-
onClick={() => {}}
203+
onClick={() => requestEditorRef.current?.submitRequest()}
190204
>
191205
<ActionIcon />
192206
</IconButton>

misk-admin/web-actions/src/web-actions/ui/EndpointSelection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class EndpointSelection extends React.Component<Props, State> {
9393
};
9494

9595
setMenuOpen = (menuIsOpen: boolean) => {
96-
this.setState((state) => ({ ...state, menuIsOpen }));
96+
this.setState({ menuIsOpen });
9797
};
9898

9999
focusSelect = () => {

misk-admin/web-actions/src/web-actions/ui/RequestEditor.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,14 @@ export default class RequestEditor extends React.Component<Props, State> {
160160
alignItems="center"
161161
zIndex="100"
162162
>
163-
{this.state.loading && (
163+
{this.state.loading ? (
164164
<Spinner size="xl" color="white" thickness="5px" />
165+
) : (
166+
this.state.isDisabled && (
167+
<Box color="white" fontSize="lg" textAlign="center" padding="4">
168+
Request body not supported for GET requests
169+
</Box>
170+
)
165171
)}
166172
</Box>
167173
)}

0 commit comments

Comments
 (0)