mirror of
https://github.com/openziti/zrok.git
synced 2024-11-23 00:23:48 +01:00
elide secrets; tidy messes (#107)
This commit is contained in:
parent
d0cdcd3956
commit
e9c888f41d
@ -47,7 +47,6 @@ func (h *shareDetailHandler) Handle(params metadata.GetShareDetailParams, princi
|
|||||||
sparkData, err = sparkDataForShares([]*store.Share{shr})
|
sparkData, err = sparkDataForShares([]*store.Share{shr})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error querying spark data for share: %v", err)
|
logrus.Errorf("error querying spark data for share: %v", err)
|
||||||
return metadata.NewGetEnvironmentDetailInternalServerError()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
feEndpoint := ""
|
feEndpoint := ""
|
||||||
|
@ -1,15 +1,29 @@
|
|||||||
import {mdiCardAccountDetails} from "@mdi/js";
|
import {mdiCardAccountDetails, mdiEyeOutline, mdiEyeOffOutline} from "@mdi/js";
|
||||||
import Icon from "@mdi/react";
|
import Icon from "@mdi/react";
|
||||||
import PropertyTable from "../PropertyTable";
|
import PropertyTable from "../PropertyTable";
|
||||||
import {Tab, Tabs} from "react-bootstrap";
|
import {Tab, Tabs} from "react-bootstrap";
|
||||||
|
import {useState} from "react";
|
||||||
|
import {secretString} from "./util";
|
||||||
|
|
||||||
const AccountDetail = (props) => {
|
const AccountDetail = (props) => {
|
||||||
|
const [showToken, setShowToken] = useState(false);
|
||||||
|
|
||||||
|
const customProperties = {
|
||||||
|
token: row => {
|
||||||
|
if(showToken) {
|
||||||
|
return <span>{row.value} <Icon path={mdiEyeOffOutline} size={0.7} onClick={() => setShowToken(false)} /></span>
|
||||||
|
} else {
|
||||||
|
return <span>{secretString(row.value)} <Icon path={mdiEyeOutline} size={0.7} onClick={() => setShowToken(true)} /></span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2><Icon path={mdiCardAccountDetails} size={2} />{" "}{props.user.email}</h2>
|
<h2><Icon path={mdiCardAccountDetails} size={2} />{" "}{props.user.email}</h2>
|
||||||
<Tabs defaultActiveKey={"detail"}>
|
<Tabs defaultActiveKey={"detail"}>
|
||||||
<Tab eventKey={"detail"} title={"Detail"}>
|
<Tab eventKey={"detail"} title={"Detail"}>
|
||||||
<PropertyTable object={props.user} />
|
<PropertyTable object={props.user} custom={customProperties}/>
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
import * as metadata from "../../api/metadata";
|
import * as metadata from "../../api/metadata";
|
||||||
import {Sparklines, SparklinesLine, SparklinesSpots} from "react-sparklines";
|
import {Sparklines, SparklinesLine, SparklinesSpots} from "react-sparklines";
|
||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {mdiShareVariant} from "@mdi/js";
|
import {mdiEyeOffOutline, mdiEyeOutline, mdiShareVariant} from "@mdi/js";
|
||||||
import Icon from "@mdi/react";
|
import Icon from "@mdi/react";
|
||||||
import PropertyTable from "../PropertyTable";
|
import PropertyTable from "../PropertyTable";
|
||||||
import {Tab, Tabs} from "react-bootstrap";
|
import {Tab, Tabs} from "react-bootstrap";
|
||||||
|
import {secretString} from "./util";
|
||||||
|
|
||||||
const ShareDetail = (props) => {
|
const ShareDetail = (props) => {
|
||||||
const [detail, setDetail] = useState({});
|
const [detail, setDetail] = useState({});
|
||||||
|
const [showZId, setShowZId] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
metadata.getShareDetail(props.selection.id)
|
metadata.getShareDetail(props.selection.id)
|
||||||
@ -41,6 +43,13 @@ const ShareDetail = (props) => {
|
|||||||
return <a href={row.value} target="_">{row.value}</a>;
|
return <a href={row.value} target="_">{row.value}</a>;
|
||||||
}
|
}
|
||||||
return row.value;
|
return row.value;
|
||||||
|
},
|
||||||
|
zId: row => {
|
||||||
|
if(showZId) {
|
||||||
|
return <span>{row.value} <Icon path={mdiEyeOffOutline} size={0.7} onClick={() => setShowZId(false)} /></span>
|
||||||
|
} else {
|
||||||
|
return <span>{secretString(row.value)} <Icon path={mdiEyeOutline} size={0.7} onClick={() => setShowZId(true)} /></span>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,24 @@
|
|||||||
import PropertyTable from "../../PropertyTable";
|
import PropertyTable from "../../PropertyTable";
|
||||||
|
import Icon from "@mdi/react";
|
||||||
|
import {mdiEyeOffOutline, mdiEyeOutline} from "@mdi/js";
|
||||||
|
import {secretString} from "../util";
|
||||||
|
import {useState} from "react";
|
||||||
|
|
||||||
const Detail = (props) => {
|
const Detail = (props) => {
|
||||||
|
const [showZId, setShowZId] = useState(false);
|
||||||
|
|
||||||
|
const customProperties = {
|
||||||
|
zId: row => {
|
||||||
|
if(showZId) {
|
||||||
|
return <span>{row.value} <Icon path={mdiEyeOffOutline} size={0.7} onClick={() => setShowZId(false)} /></span>
|
||||||
|
} else {
|
||||||
|
return <span>{secretString(row.value)} <Icon path={mdiEyeOutline} size={0.7} onClick={() => setShowZId(true)} /></span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PropertyTable object={props.environment} />
|
<PropertyTable object={props.environment} custom={customProperties} />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
7
ui/src/console/detail/util.js
Normal file
7
ui/src/console/detail/util.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export const secretString = (s) => {
|
||||||
|
let out = "";
|
||||||
|
for(let i = 0; i < s.length; i++) {
|
||||||
|
out += "*";
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user