diff --git a/lib/views/admin/explorer.js b/lib/views/admin/explorer.js index 0afeff03..8c2462cc 100644 --- a/lib/views/admin/explorer.js +++ b/lib/views/admin/explorer.js @@ -51,10 +51,14 @@ 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)) @@ -62,13 +66,21 @@ function form (req, res) { }).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)) }