Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ESAP GUI
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
ESCAPE WP5
ESAP GUI
Commits
c0f0f648
Commit
c0f0f648
authored
4 years ago
by
Hugh Dickinson
Browse files
Options
Downloads
Patches
Plain Diff
Added preliminary support for dynamic config via GlobalContext.
parent
37ca542e
No related branches found
No related tags found
1 merge request
!1
Dev zooniverse
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/archives/ArchiveDetails.js
+9
-1
9 additions, 1 deletion
src/components/archives/ArchiveDetails.js
src/contexts/GlobalContext.js
+11
-3
11 additions, 3 deletions
src/contexts/GlobalContext.js
with
20 additions
and
4 deletions
src/components/archives/ArchiveDetails.js
+
9
−
1
View file @
c0f0f648
...
@@ -7,9 +7,17 @@ import DataProductCategories from "./DataProductCategories";
...
@@ -7,9 +7,17 @@ import DataProductCategories from "./DataProductCategories";
export
default
function
ArchiveDetails
(
props
)
{
export
default
function
ArchiveDetails
(
props
)
{
const
{
uri
}
=
useParams
();
const
{
uri
}
=
useParams
();
console
.
log
(
uri
);
console
.
log
(
uri
);
const
{
archives
}
=
useContext
(
GlobalContext
);
const
{
archives
,
defaultConfigName
,
setConfigName
}
=
useContext
(
GlobalContext
);
if
(
!
archives
)
return
null
;
if
(
!
archives
)
return
null
;
/* This is a nasty hack. There must be a better way! */
if
(
uri
.
search
(
"
zooniverse
"
)
>=
0
){
setConfigName
(
"
zooniverse
"
);
}
else
{
setConfigName
(
defaultConfigName
);
}
const
archive
=
archives
.
find
((
archive
)
=>
archive
.
uri
===
uri
);
const
archive
=
archives
.
find
((
archive
)
=>
archive
.
uri
===
uri
);
if
(
!
archive
)
return
<
Alert
variant
=
"
danger
"
>
No
Archive
found
!<
/Alert>
;
if
(
!
archive
)
return
<
Alert
variant
=
"
danger
"
>
No
Archive
found
!<
/Alert>
;
console
.
log
(
archive
);
console
.
log
(
archive
);
...
...
This diff is collapsed.
Click to expand it.
src/contexts/GlobalContext.js
+
11
−
3
View file @
c0f0f648
...
@@ -8,15 +8,22 @@ export function GlobalContextProvider({ children }) {
...
@@ -8,15 +8,22 @@ export function GlobalContextProvider({ children }) {
console
.
log
(
"
ASTRON ADEX Version 16 july 2020
"
);
console
.
log
(
"
ASTRON ADEX Version 16 july 2020
"
);
const
api_host
=
const
api_host
=
process
.
env
.
NODE_ENV
===
"
development
"
process
.
env
.
NODE_ENV
===
"
development
"
?
"
http://
sdc.astron.nl
:15671/esap-api/
"
?
"
http://
localhost
:15671/esap-api/
"
:
"
/esap-api/
"
;
:
"
/esap-api/
"
;
const
[
config
,
setConfig
]
=
useState
();
const
[
config
,
setConfig
]
=
useState
();
const
[
configName
,
setConfigName
]
=
useState
(
"
esap_config
"
);
const
[
defaultConfigName
,
setDefaultConfigName
]
=
useState
(
"
esap_config
"
);
useEffect
(()
=>
{
useEffect
(()
=>
{
let
configNameString
=
""
if
(
configName
){
configNameString
=
`?name=
${
configName
}
`
}
axios
axios
.
get
(
api_host
+
"
query/configuration
"
)
.
get
(
api_host
+
"
query/configuration
"
+
configNameString
)
.
then
((
response
)
=>
setConfig
(
response
.
data
[
"
configuration
"
]));
.
then
((
response
)
=>
setConfig
(
response
.
data
[
"
configuration
"
]));
},
[
api_host
]);
},
[
api_host
,
configName
]);
console
.
log
(
"
config:
"
,
{
config
});
console
.
log
(
"
config:
"
,
{
config
});
const
[
archives
,
setArchives
]
=
useState
();
const
[
archives
,
setArchives
]
=
useState
();
...
@@ -56,6 +63,7 @@ export function GlobalContextProvider({ children }) {
...
@@ -56,6 +63,7 @@ export function GlobalContextProvider({ children }) {
archives
,
archives
,
handleLogin
,
handleLogin
,
handleLogout
,
handleLogout
,
setConfigName
}}
}}
>
>
{
children
}
{
children
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment