Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand Down
49 changes: 37 additions & 12 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import {
Stack,
FormControl,
TextField,
OutlinedInput,
InputLabel,
InputAdornment,
IconButton,
Button,
MenuItem,
Typography,
Expand All @@ -10,7 +14,9 @@ import {
debounce,
Box,
LinearProgress,
FormHelperText,
} from "@mui/material";
import { Visibility, VisibilityOff } from "@mui/icons-material";
import React, { useEffect, useState } from "react";
import { createDockerDesktopClient } from "@docker/extension-api-client";
import { Header } from "./Header";
Expand All @@ -28,6 +34,12 @@ function App() {
useApiContext();
const [apikeyError, setApikeyError] = useState(null);

const [showPassword, setShowPassword] = React.useState(false);
const handleClickShowPassword = () => setShowPassword((show) => !show);
const handleMouseDownPassword = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
};

// sample API key: PMAK-6245dae283d9d36ec467cb18-d5a238ce70ed8161d502b30f1db056847b

async function runCommand(collectionID, environmentID, apiKey) {
Expand Down Expand Up @@ -199,18 +211,31 @@ function App() {
) : null}
{!apiKeyInContext || !postmanInfo ? (
<>
<TextField
id="apikey-input"
label={["Postman API key"]}
placeholder="e.g. PMAK-xxx-xxxx-xxxx-xxxx"
error={!!apikeyError}
helperText={apikeyError ? apikeyError : ""}
onChange={(e) => {
validateApikeyError(e.target.value);
}}
focused
fullWidth
/>
<FormControl fullWidth focused sx={{ marginY: 2 }}>
<InputLabel htmlFor="apikey-input">Postman API key</InputLabel>
<OutlinedInput
id="apikey-input"
type={showPassword ? 'text' : 'password'}
placeholder="e.g. PMAK-xxx-xxxx-xxxx-xxxx"
error={!!apikeyError}
onChange={(e) => {
validateApikeyError(e.target.value);
}}
label="Postman API key"
endAdornment={
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={handleClickShowPassword}
onMouseDown={handleMouseDownPassword}
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
}
/>
<FormHelperText>{apikeyError ? apikeyError : ""}</FormHelperText>
</FormControl>
<Alert severity="info" sx={{ marginY: 2 }}>
Find your Postman API key in{" "}
<Link
Expand Down