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
b3d9c9c5
Commit
b3d9c9c5
authored
Sep 10, 2017
by
Andreas Åkre Solberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding preselect items
parent
be32cc95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
19 deletions
+50
-19
src/components/HTTPFetchView.jsx
src/components/HTTPFetchView.jsx
+50
-19
No files found.
src/components/HTTPFetchView.jsx
View file @
b3d9c9c5
...
@@ -53,35 +53,66 @@ class Component extends PureComponent {
...
@@ -53,35 +53,66 @@ class Component extends PureComponent {
renderDropdownButton
()
{
renderDropdownButton
()
{
const
i
=
"
drpdwn
"
const
i
=
"
drpdwn
"
const
title
=
"
Load preset URL
"
const
title
=
"
Load preset URL
"
return
(
console
.
log
(
"
PROPOS
"
,
this
.
props
)
<
DropdownButton
bsStyle
=
"default"
title
=
{
title
}
key
=
{
i
}
id
=
{
`
dropdown-basic-
${
i
}
`
}
onSelect
=
{
this
.
preselect
.
bind
(
this
)
}
>
if
(
this
.
props
.
serverConfig
&&
this
.
props
.
serverConfig
.
authorization_endpoint
&&
this
.
props
.
serverConfig
.
authorization_endpoint
===
'
https://auth.dataporten.no/oauth/authorization
'
)
{
<
MenuItem
eventKey
=
"https://groups-api.dataporten.no/groups/me/groups"
>
groups-api.dataporten.no/groups/me/groups
</
MenuItem
>
let
links
=
[]
<
MenuItem
eventKey
=
"https://4f2.httpjs.net/"
>
https://4f2.httpjs.net/
</
MenuItem
>
if
(
this
.
props
.
serverConfig
.
userinfo_endpoint
)
{
</
DropdownButton
>
links
.
push
({
);
url
:
this
.
props
.
serverConfig
.
userinfo_endpoint
,
title
:
"
Userinfo endpoint
"
})
}
const
cntrl
=
/^gk_
([^
_
]
+
)
$/i
this
.
props
.
token
.
scopes
.
forEach
((
scope
)
=>
{
if
(
scope
===
'
groups
'
)
{
links
.
push
({
url
:
"
https://groups-api.dataporten.no/groups/me/groups
"
,
title
:
"
Dataporten groups API: My groups
"
})
}
let
res
=
cntrl
.
exec
(
scope
)
if
(
res
)
{
links
.
push
({
url
:
"
https://
"
+
res
[
1
]
+
"
.dataporten-api.no/
"
,
title
:
"
Dataporten APIGK
"
+
res
[
1
]
})
console
.
log
(
res
)
}
})
let
menuitems
=
links
.
map
((
link
)
=>
{
return
(
<
MenuItem
key
=
{
link
.
url
}
eventKey
=
{
link
.
url
}
>
{
link
.
title
}
</
MenuItem
>
)
})
return
(
<
DropdownButton
bsStyle
=
"default"
title
=
{
title
}
key
=
{
i
}
id
=
{
`
dropdown-basic-
${
i
}
`
}
onSelect
=
{
this
.
preselect
.
bind
(
this
)
}
>
{
menuitems
}
</
DropdownButton
>
);
}
return
null
}
}
render
()
{
render
()
{
console
.
error
(
"
Component
"
,
this
.
props
)
console
.
error
(
"
Component
"
,
this
.
props
)
if
(
!
this
.
props
.
token
)
{
if
(
!
this
.
props
.
token
)
{
return
(
return
null
<
p
>
Not ready. No token found.
</
p
>
)
}
}
let
userinfo
=
null
let
userinfo
=
null
if
(
this
.
props
.
serverConfig
.
userinfo_endpoint
)
{
//
if (this.props.serverConfig.userinfo_endpoint) {
userinfo
=
(
//
userinfo = (
<
div
>
//
<div>
<
p
>
Fetch userinfo from
<
code
>
{
this
.
props
.
serverConfig
.
userinfo_endpoint
}
</
code
></
p
>
//
<p>Fetch userinfo from <code>{this.props.serverConfig.userinfo_endpoint}</code></p>
<
Button
onClick
=
{
this
.
fetchUserinfo
.
bind
(
this
)
}
bsStyle
=
"default"
>
//
<Button onClick={this.fetchUserinfo.bind(this)} bsStyle="default">
<
FontAwesome
name
=
'arrow-circle-o-right'
/>
Get userinfo
//
<FontAwesome name='arrow-circle-o-right' /> Get userinfo
</
Button
>
//
</Button>
</
div
>
//
</div>
)
//
)
}
//
}
...
...
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