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

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 { ...@@ -120,7 +120,7 @@ class Component extends PureComponent {
return ( return (
<Panel eventKey="1" collapsible={true} defaultExpanded={true}> <Panel eventKey="1" defaultExpanded={true}>
<Panel.Heading className={'panel-title'}> <Panel.Heading className={'panel-title'}>
HTTP Client using OAuth Access Token HTTP Client using OAuth Access Token
</Panel.Heading> </Panel.Heading>
......
...@@ -84,7 +84,7 @@ class Component extends PureComponent { ...@@ -84,7 +84,7 @@ class Component extends PureComponent {
return ( return (
<Panel eventKey="1" collapsible={true} defaultExpanded={true}> <Panel eventKey="1" defaultExpanded={true}>
<Panel.Heading className={"panel-title"}> <Panel.Heading className={"panel-title"}>
HTTP Reponse HTTP Reponse
</Panel.Heading> </Panel.Heading>
......
...@@ -72,12 +72,13 @@ class Component extends PureComponent { ...@@ -72,12 +72,13 @@ class Component extends PureComponent {
console.log("Expanded discovery", expanded, this.state.overrideToggle, this.props.expanded) console.log("Expanded discovery", expanded, this.state.overrideToggle, this.props.expanded)
console.log("STATE", this.state) console.log("STATE", this.state)
return ( return (
<Panel eventKey="1" collapsible={true} expanded={expanded}> <Panel eventKey="1" expanded={expanded}>
<Panel.Heading onClick={this.actTogglePanel} className={"panel-title"}> <Panel.Heading onClick={this.actTogglePanel}>
OpenID Connect Discovery <Panel.Title className={"panel-title"}>
OpenID Connect Discovery
</Panel.Title>
</Panel.Heading> </Panel.Heading>
<Panel.Collapse> <Panel.Body collapsible>
<Panel.Body>
<FormGroup <FormGroup
className="gutter" className="gutter"
controlId="formBasicText" controlId="formBasicText"
...@@ -100,7 +101,6 @@ class Component extends PureComponent { ...@@ -100,7 +101,6 @@ class Component extends PureComponent {
</Button> </Button>
</div> </div>
</Panel.Body> </Panel.Body>
</Panel.Collapse>
</Panel> </Panel>
) )
} }
......
...@@ -104,12 +104,13 @@ class Component extends PureComponent { ...@@ -104,12 +104,13 @@ class Component extends PureComponent {
let expanded = (this.state.overrideToggle === true) || this.props.expanded let expanded = (this.state.overrideToggle === true) || this.props.expanded
return ( return (
<Panel eventKey="2" collapsible={true} expanded={expanded}> <Panel eventKey="2" expanded={expanded}>
<Panel.Heading onClick={this.actTogglePanel} className={"panel-title"}> <Panel.Heading onClick={this.actTogglePanel}>
Configuration <Panel.Title className={"panel-title"}>
Configuration
</Panel.Title>
</Panel.Heading> </Panel.Heading>
<Panel.Collapse> <Panel.Body collapsible>
<Panel.Body>
<form> <form>
<h3>Server configuration</h3> <h3>Server configuration</h3>
...@@ -175,7 +176,6 @@ class Component extends PureComponent { ...@@ -175,7 +176,6 @@ class Component extends PureComponent {
</div> </div>
</form> </form>
</Panel.Body> </Panel.Body>
</Panel.Collapse>
</Panel> </Panel>
) )
} }
......
...@@ -21,6 +21,13 @@ export function expiresText(expires) { ...@@ -21,6 +21,13 @@ export function expiresText(expires) {
class Component extends PureComponent { class Component extends PureComponent {
constructor(props) {
super(props)
this.state = {
overrideToggle: null,
}
}
getIDTokenView(idtoken) { getIDTokenView(idtoken) {
let str = JSON.stringify(jwtDecode(idtoken), undefined, 4) let str = JSON.stringify(jwtDecode(idtoken), undefined, 4)
return ( return (
...@@ -31,6 +38,14 @@ class Component extends PureComponent { ...@@ -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() { render() {
// console.error("Component", this.props) // console.error("Component", this.props)
...@@ -41,18 +56,18 @@ class Component extends PureComponent { ...@@ -41,18 +56,18 @@ class Component extends PureComponent {
) )
} }
let idtokenView = null let idtokenView = null
let extxt = expiresText(this.props.token.expires) let extxt = expiresText(this.props.token.expires)
if (this.props.token.id_token) { if (this.props.token.id_token) {
idtokenView = this.getIDTokenView(this.props.token.id_token) idtokenView = this.getIDTokenView(this.props.token.id_token)
} }
return ( return (
<Panel eventKey="1" collapsible={true} defaultExpanded={true}> <Panel eventKey="1" collapsible={true} defaultExpanded={true}>
<Panel.Heading className={"panel-title"}> <Panel.Heading onClick={this.actTogglePanel}>
Access Token <Panel.Title className={"panel-title"}>
Access Token
</Panel.Title>
</Panel.Heading> </Panel.Heading>
<Panel.Body> <Panel.Body>
<p>This access token expires {extxt}</p> <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