More settings/admin fixes

This commit is contained in:
Frikky
2024-02-15 18:53:54 +01:00
parent 858d18c7dc
commit d2b9552dad
3 changed files with 78 additions and 18 deletions
+16 -13
View File
@@ -3415,24 +3415,26 @@ If you're interested, please let me know a time that works for you, or set up a
// using request id or trace id // using request id or trace id
<ListItem key={index} style={{ backgroundColor: index % 2 === 0 ? "#1f2023" : "#27292d" }}> <ListItem key={index} style={{ backgroundColor: index % 2 === 0 ? "#1f2023" : "#27292d" }}>
<ListItemText <ListItemText
primary={new Date(data.start_time.seconds * 1000).toISOString().slice(0, 10)} primary={new Date(data.start_time.seconds * 1000).toLocaleString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
})}
style={{ style={{
minWidth: 150, minWidth: 200,
maxWidth: 150, maxWidth: 200,
}} }}
/> />
<ListItemText <ListItemText
primary={data.status} primary={data.referrer}
style={{ style={{
minWidth: 70, minWidth: 300,
maxWidth: 70, maxWidth: 300,
}} overflow: "hidden",
/>
<ListItemText
primary={data.method}
style={{
minWidth: 150,
maxWidth: 150,
}} }}
/> />
<ListItemText <ListItemText
@@ -3441,6 +3443,7 @@ If you're interested, please let me know a time that works for you, or set up a
minWidth: 700, minWidth: 700,
maxWidth: 700, maxWidth: 700,
overflow: "hidden", overflow: "hidden",
marginLeft: 10,
}} }}
/> />
</ListItem> </ListItem>
+61 -4
View File
@@ -13,6 +13,11 @@ import {
//import { useAlert //import { useAlert
import { ToastContainer, toast } from "react-toastify" import { ToastContainer, toast } from "react-toastify"
import { FileCopy, Visibility, VisibilityOff } from "@mui/icons-material";
import IconButton from "@mui/material/IconButton";
import { Tooltip } from "@mui/material";
const Settings = (props) => { const Settings = (props) => {
const { globalUrl, isLoaded, userdata, setUserData } = props; const { globalUrl, isLoaded, userdata, setUserData } = props;
//const alert = useAlert(); //const alert = useAlert();
@@ -44,6 +49,17 @@ const Settings = (props) => {
const [userSettings, setUserSettings] = useState({}); const [userSettings, setUserSettings] = useState({});
const [showApiKey, setShowApiKey] = useState(false);
const [apiKeyCopied, setApiKeyCopied] = useState(false);
const handleCopyApiKey = () => {
navigator.clipboard.writeText(userSettings.apikey);
setApiKeyCopied(true);
setTimeout(() => {
setApiKeyCopied(false);
}, 2000);
}
/* /*
const [userdata.eth_info, setEthInfo] = useState(userdata.eth_info !== undefined && userdata.eth_info.account !== undefined && userdata.eth_info.account.length > 0 ? userdata.eth_info : { const [userdata.eth_info, setEthInfo] = useState(userdata.eth_info !== undefined && userdata.eth_info.account !== undefined && userdata.eth_info.account.length > 0 ? userdata.eth_info : {
"account": "", "account": "",
@@ -467,7 +483,7 @@ const Settings = (props) => {
> >
What is the API key used for? What is the API key used for?
</a> </a>
<TextField {/* <TextField
style={{ backgroundColor: theme.palette.inputColor, flex: "1" }} style={{ backgroundColor: theme.palette.inputColor, flex: "1" }}
InputProps={{ InputProps={{
style: { style: {
@@ -484,7 +500,43 @@ const Settings = (props) => {
id="standard-required" id="standard-required"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
/> /> */}
<TextField
style={{ backgroundColor: theme.palette.inputColor, flex: "1" }}
InputProps={{
style: {
height: "50px",
color: "white",
},
endAdornment: (
<>
<Tooltip title={showApiKey ? "Hide API Key" : "Show API Key"}>
<IconButton
onClick={() => setShowApiKey(!showApiKey)}
>
{showApiKey ? <VisibilityOff /> : <Visibility />}
</IconButton>
</Tooltip>
<Tooltip title={apiKeyCopied ? "API Key copied!" : "Copy API Key"}>
<IconButton
onClick={handleCopyApiKey}
>
<FileCopy />
</IconButton>
</Tooltip>
</>
),
}}
color="primary"
value={showApiKey ? userSettings.apikey : '*'.repeat(36)} // Show API key if showApiKey is true, else show asterisks
required
disabled
fullWidth
placeholder="APIKEY"
id="standard-required"
margin="normal"
variant="outlined"
/>
<Button <Button
style={{ width: "100%", height: "40px", marginTop: "10px" }} style={{ width: "100%", height: "40px", marginTop: "10px" }}
variant="outlined" variant="outlined"
@@ -676,8 +728,13 @@ const Settings = (props) => {
Submit password change Submit password change
</Button> </Button>
<h3>{passwordFormMessage}</h3> <h3>{passwordFormMessage}</h3>
<Divider style={{ marginTop: "40px" }} /> {isCloud && (
<h2>Creator Incentive Program</h2> <>
<Divider style={{ marginTop: "40px" }} />
<h2>Creator Incentive Program</h2>
</>
)}
<div style={{ display: runFlex ? "flex" : "", width: "100%" }}> <div style={{ display: runFlex ? "flex" : "", width: "100%" }}>
<div> <div>
{isCloud ? {isCloud ?
+1 -1
View File
@@ -924,7 +924,7 @@ const Workflows = (props) => {
> >
<DialogTitle> <DialogTitle>
<div style={{ textAlign: "center", color: "rgba(255,255,255,0.9)" }}> <div style={{ textAlign: "center", color: "rgba(255,255,255,0.9)" }}>
Are you sure you want to delete {selectedWorkflowId.length > 0 ? filteredWorkflows.find((w) => w.id === selectedWorkflowId).name : `${selectedWorkflowIndexes.length} workflow${selectedWorkflowIndexes.length === 1 ? '' : 's'}`}? <div /> Are you sure you want to delete {selectedWorkflowId.length > 0 ? filteredWorkflows.find((w) => w.id === selectedWorkflowId)?.name : `${selectedWorkflowIndexes.length} workflow${selectedWorkflowIndexes.length === 1 ? '' : 's'}`}? <div />
Other workflows relying on {selectedWorkflowIndexes.length > 0 ? "them" : "it"} one will stop working Other workflows relying on {selectedWorkflowIndexes.length > 0 ? "them" : "it"} one will stop working
</div> </div>