Skip to content

Commit

Permalink
Fix SBOLExplorerConfig to return all SBH config variables
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmyers committed May 27, 2024
1 parent bfb1d0a commit 168434e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/views/admin/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,36 @@ function form (req, res) {
adminSection: 'explorer',
user: req.user
}

var explorerConfig
getExplorerConfig().then((body) => {
locals.explorerConfig = body
if (!req.accepts('text/html')) {
body = { SBOLExplorerEndpoint: config.get('SBOLExplorerEndpoint'),
useSBOLExplorer: config.get('useSBOLExplorer'),
SBOLExplorerConfig: body
}
return res.status(200).header('content-type', 'application/json').send(JSON.stringify(body))
} else {
res.send(pug.renderFile('templates/views/admin/explorer.jade', locals))
}
}).catch(() => {
if (config.get('useSBOLExplorer')) {
if (!req.accepts('text/html')) {
return res.status(503).header('content-type', 'text/plain').send('SBOLExplorer is down')
// return res.status(503).header('content-type', 'text/plain').send('SBOLExplorer is down')
explorerConfig = { SBOLExplorerEndpoint: config.get('SBOLExplorerEndpoint'),
useSBOLExplorer: config.get('useSBOLExplorer')
}
return res.status(200).header('content-type', 'application/json').send(JSON.stringify(explorerConfig))
} else {
res.send(pug.renderFile('templates/views/admin/explorerDown.jade', locals))
}
} else {
if (!req.accepts('text/html')) {
return res.status(404).header('content-type', 'text/plain').send('SBOLExplorer is not in use')
// return res.status(404).header('content-type', 'text/plain').send('SBOLExplorer is not in use')
explorerConfig = { SBOLExplorerEndpoint: config.get('SBOLExplorerEndpoint'),
useSBOLExplorer: config.get('useSBOLExplorer')
}
return res.status(200).header('content-type', 'application/json').send(JSON.stringify(explorerConfig))
} else {
res.send(pug.renderFile('templates/views/admin/explorerOff.jade', locals))
}
Expand Down

0 comments on commit 168434e

Please sign in to comment.