Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
oauth-play
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ASM
oauth-play
Commits
0f8e062f
Commit
0f8e062f
authored
Sep 07, 2017
by
Andreas Åkre Solberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix http response view
parent
53094133
Pipeline
#3703
passed with stages
in 5 minutes and 53 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
9 deletions
+126
-9
src/components/HTTPFetchView.jsx
src/components/HTTPFetchView.jsx
+5
-6
src/components/HTTPResponseView.jsx
src/components/HTTPResponseView.jsx
+107
-0
src/components/MainContent.jsx
src/components/MainContent.jsx
+2
-0
src/components/ServerConfigInput.jsx
src/components/ServerConfigInput.jsx
+0
-2
src/containers/HTTPResponseContainer.js
src/containers/HTTPResponseContainer.js
+8
-0
src/reducers/index.js
src/reducers/index.js
+4
-1
No files found.
src/components/HTTPFetchView.jsx
View file @
0f8e062f
...
@@ -22,11 +22,8 @@ export function expiresText(expires) {
...
@@ -22,11 +22,8 @@ export function expiresText(expires) {
class
Component
extends
PureComponent
{
class
Component
extends
PureComponent
{
updateAPIendpoint
()
{
updateAPIendpoint
(
e
)
{
this
.
setState
({
customEndpoint
:
e
.
target
.
value
})
}
}
fetchUserinfo
()
{
fetchUserinfo
()
{
...
@@ -36,7 +33,9 @@ class Component extends PureComponent {
...
@@ -36,7 +33,9 @@ class Component extends PureComponent {
}
}
fetchCustom
()
{
fetchCustom
()
{
let
endpoint
=
this
.
state
.
customEndpoint
console
.
error
(
"
Get data from
"
,
endpoint
)
this
.
props
.
httpRequestStart
(
endpoint
)
}
}
render
()
{
render
()
{
...
...
src/components/HTTPResponseView.jsx
0 → 100644
View file @
0f8e062f
import
React
,
{
PureComponent
}
from
'
react
'
import
{
Table
,
Navbar
,
Nav
,
NavItem
,
NavDropdown
,
MenuItem
,
Glyphicon
,
Jumbotron
,
Button
}
from
'
react-bootstrap
'
import
{
Alert
,
Row
,
Col
,
Collapse
,
FormControl
,
FormGroup
,
ControlLabel
,
HelpBlock
,
PanelGroup
,
Panel
}
from
'
react-bootstrap
'
import
FontAwesome
from
'
react-fontawesome
'
import
HostnameController
from
'
../containers/HostnameController
'
import
ServerConfigController
from
'
../containers/ServerConfigController
'
import
WhiteBox
from
'
./WhiteBox
'
import
LoadingIndicator
from
'
../components/LoadingIndicator
'
import
moment
from
'
moment
'
import
'
moment/locale/nb
'
;
// import 'moment/locale/en';
moment
.
locale
(
"
en
"
);
export
function
expiresText
(
expires
)
{
var
expiresM
=
moment
.
unix
(
expires
)
return
expiresM
.
fromNow
()
}
class
Component
extends
PureComponent
{
updateAPIendpoint
()
{
}
fetchUserinfo
()
{
let
endpoint
=
this
.
props
.
serverConfig
.
userinfo_endpoint
;
console
.
error
(
"
Get userinfo from
"
,
endpoint
)
this
.
props
.
httpRequestStart
(
endpoint
)
}
fetchCustom
()
{
}
handleAlertDismiss
()
{
}
getErrorMessage
()
{
if
(
this
.
props
.
http
.
error
)
{
return
(
<
Alert
bsStyle
=
"danger"
onDismiss
=
{
this
.
handleAlertDismiss
}
>
<
h4
>
Error performing HTTP request
</
h4
>
<
p
>
{
this
.
props
.
http
.
error
}
</
p
>
</
Alert
>
)
}
return
null
}
render
()
{
console
.
error
(
"
Component
"
,
this
.
props
)
if
(
!
this
.
props
.
http
)
{
return
(
<
p
></
p
>
)
}
let
headers
=
[]
if
(
this
.
props
.
http
.
response
&&
this
.
props
.
http
.
response
.
headers
)
{
this
.
props
.
http
.
response
.
headers
.
forEach
((
item
)
=>
{
headers
.
push
((
<
tr
key
=
{
item
.
key
}
>
<
td
>
{
item
.
key
}
</
td
>
<
td
>
{
item
.
value
}
</
td
>
</
tr
>
))
})
}
let
bodystr
=
this
.
props
.
http
.
response
?
JSON
.
stringify
(
this
.
props
.
http
.
response
.
body
,
undefined
,
2
)
:
''
let
loading
=
null
if
(
this
.
props
.
http
.
isLoading
)
{
loading
=
(
<
LoadingIndicator
/>
)
}
return
(
<
Panel
header
=
"HTTP Response"
eventKey
=
"1"
collapsible
=
{
true
}
expanded
=
{
true
}
>
<
div
>
<
p
><
code
>
GET
</
code
>
request to
<
code
>
{
this
.
props
.
http
.
url
}
</
code
></
p
>
{
loading
}
{
this
.
getErrorMessage
()
}
<
Table
striped
bordered
condensed
hover
>
<
tbody
>
{
headers
}
</
tbody
>
</
Table
>
<
pre
>
{
bodystr
}
</
pre
>
</
div
>
</
Panel
>
)
}
}
export
default
Component
src/components/MainContent.jsx
View file @
0f8e062f
...
@@ -6,6 +6,7 @@ import HostnameController from '../containers/HostnameController'
...
@@ -6,6 +6,7 @@ import HostnameController from '../containers/HostnameController'
import
ServerConfigController
from
'
../containers/ServerConfigController
'
import
ServerConfigController
from
'
../containers/ServerConfigController
'
import
TokenViewContainer
from
'
../containers/TokenViewContainer
'
import
TokenViewContainer
from
'
../containers/TokenViewContainer
'
import
HTTPFetchContainer
from
'
../containers/HTTPFetchContainer
'
import
HTTPFetchContainer
from
'
../containers/HTTPFetchContainer
'
import
HTTPResponseContainer
from
'
../containers/HTTPResponseContainer
'
import
WhiteBox
from
'
./WhiteBox
'
import
WhiteBox
from
'
./WhiteBox
'
...
@@ -29,6 +30,7 @@ const MainContent = () => (
...
@@ -29,6 +30,7 @@ const MainContent = () => (
<
ServerConfigController
/>
<
ServerConfigController
/>
<
TokenViewContainer
/>
<
TokenViewContainer
/>
<
HTTPFetchContainer
/>
<
HTTPFetchContainer
/>
<
HTTPResponseContainer
/>
</
WhiteBox
>
</
WhiteBox
>
...
...
src/components/ServerConfigInput.jsx
View file @
0f8e062f
...
@@ -77,13 +77,11 @@ class Component extends PureComponent {
...
@@ -77,13 +77,11 @@ class Component extends PureComponent {
<
FormControl
type
=
"text"
value
=
{
tokenEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
tokenEndpoint
"
)
}
/>
<
FormControl
type
=
"text"
value
=
{
tokenEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
tokenEndpoint
"
)
}
/>
</
FormGroup
>
</
FormGroup
>
<
h4
>
Userinfo Endpoint
</
h4
>
<
h4
>
Userinfo Endpoint
</
h4
>
<
FormGroup
>
<
FormGroup
>
<
FormControl
type
=
"text"
value
=
{
userinfoEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
userinfo_endpoint
"
)
}
/>
<
FormControl
type
=
"text"
value
=
{
userinfoEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
userinfo_endpoint
"
)
}
/>
</
FormGroup
>
</
FormGroup
>
<
h4
>
Client ID
</
h4
>
<
h4
>
Client ID
</
h4
>
<
FormGroup
>
<
FormGroup
>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
this
.
state
.
clientId
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
clientId
"
)
}
/>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
this
.
state
.
clientId
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
clientId
"
)
}
/>
...
...
src/containers/HTTPResponseContainer.js
0 → 100644
View file @
0f8e062f
import
{
connect
}
from
'
react-redux
'
import
Component
from
'
../components/HTTPResponseView
'
const
mapStateToProps
=
(
state
)
=>
({
http
:
state
.
http
})
export
default
connect
(
mapStateToProps
)(
Component
)
src/reducers/index.js
View file @
0f8e062f
...
@@ -36,7 +36,8 @@ const reducer = handleActions({
...
@@ -36,7 +36,8 @@ const reducer = handleActions({
start
:
(
state
,
action
)
=>
({
start
:
(
state
,
action
)
=>
({
...
state
,
...
state
,
http
:
{
http
:
{
url
:
action
.
payload
url
:
action
.
payload
,
isLoading
:
true
}
}
}),
}),
completed
:
(
state
,
action
)
=>
{
completed
:
(
state
,
action
)
=>
{
...
@@ -46,6 +47,7 @@ const reducer = handleActions({
...
@@ -46,6 +47,7 @@ const reducer = handleActions({
...
state
,
...
state
,
http
:
{
http
:
{
url
:
state
.
http
.
url
,
url
:
state
.
http
.
url
,
isLoading
:
false
,
error
:
action
.
payload
.
toString
()
error
:
action
.
payload
.
toString
()
}
}
}
}
...
@@ -54,6 +56,7 @@ const reducer = handleActions({
...
@@ -54,6 +56,7 @@ const reducer = handleActions({
...
state
,
...
state
,
http
:
{
http
:
{
url
:
state
.
http
.
url
,
url
:
state
.
http
.
url
,
isLoading
:
false
,
response
:
action
.
payload
response
:
action
.
payload
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment