Commit 700b2af9 authored by Glenn Aarøen's avatar Glenn Aarøen

remove warnings and make code closer to Panel documentation

parent 3feef9ec
Pipeline #16694 passed with stages
in 3 minutes and 38 seconds
......@@ -120,7 +120,7 @@ class Component extends PureComponent {
return (
<Panel eventKey="1" collapsible={true} defaultExpanded={true}>
<Panel eventKey="1" defaultExpanded={true}>
<Panel.Heading className={'panel-title'}>
HTTP Client using OAuth Access Token
</Panel.Heading>
......
......@@ -84,7 +84,7 @@ class Component extends PureComponent {
return (
<Panel eventKey="1" collapsible={true} defaultExpanded={true}>
<Panel eventKey="1" defaultExpanded={true}>
<Panel.Heading className={"panel-title"}>
HTTP Reponse
</Panel.Heading>
......
......@@ -72,12 +72,13 @@ class Component extends PureComponent {
console.log("Expanded discovery", expanded, this.state.overrideToggle, this.props.expanded)
console.log("STATE", this.state)
return (
<Panel eventKey="1" collapsible={true} expanded={expanded}>
<Panel.Heading onClick={this.actTogglePanel} className={"panel-title"}>
OpenID Connect Discovery
<Panel eventKey="1" expanded={expanded}>
<Panel.Heading onClick={this.actTogglePanel}>
<Panel.Title className={"panel-title"}>
OpenID Connect Discovery
</Panel.Title>
</Panel.Heading>
<Panel.Collapse>
<Panel.Body>
<Panel.Body collapsible>
<FormGroup
className="gutter"
controlId="formBasicText"
......@@ -100,7 +101,6 @@ class Component extends PureComponent {
</Button>
</div>
</Panel.Body>
</Panel.Collapse>
</Panel>
)
}
......
......@@ -104,12 +104,13 @@ class Component extends PureComponent {
let expanded = (this.state.overrideToggle === true) || this.props.expanded
return (
<Panel eventKey="2" collapsible={true} expanded={expanded}>
<Panel.Heading onClick={this.actTogglePanel} className={"panel-title"}>
Configuration
<Panel eventKey="2" expanded={expanded}>
<Panel.Heading onClick={this.actTogglePanel}>
<Panel.Title className={"panel-title"}>
Configuration
</Panel.Title>
</Panel.Heading>
<Panel.Collapse>
<Panel.Body>
<Panel.Body collapsible>
<form>
<h3>Server configuration</h3>
......@@ -175,7 +176,6 @@ class Component extends PureComponent {
</div>
</form>
</Panel.Body>
</Panel.Collapse>
</Panel>
)
}
......
......@@ -21,6 +21,13 @@ export function expiresText(expires) {
class Component extends PureComponent {
constructor(props) {
super(props)
this.state = {
overrideToggle: null,
}
}
getIDTokenView(idtoken) {
let str = JSON.stringify(jwtDecode(idtoken), undefined, 4)
return (
......@@ -31,6 +38,14 @@ class Component extends PureComponent {
)
}
actTogglePanel = () => {
if (this.state.overrideToggle === null) {
this.setState({overrideToggle: !(this.props.expanded)})
} else {
this.setState({overrideToggle: !(this.state.overrideToggle === true)})
}
}
render() {
// console.error("Component", this.props)
......@@ -41,18 +56,18 @@ class Component extends PureComponent {
)
}
let idtokenView = null
let extxt = expiresText(this.props.token.expires)
if (this.props.token.id_token) {
idtokenView = this.getIDTokenView(this.props.token.id_token)
}
return (
<Panel eventKey="1" collapsible={true} defaultExpanded={true}>
<Panel.Heading className={"panel-title"}>
Access Token
<Panel.Heading onClick={this.actTogglePanel}>
<Panel.Title className={"panel-title"}>
Access Token
</Panel.Title>
</Panel.Heading>
<Panel.Body>
<p>This access token expires {extxt}</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment