Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions docroot/statistics/bokeh/coverages/index.html

This file was deleted.

151 changes: 151 additions & 0 deletions docroot/statistics/coverage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php
require_once '../../src/Config.php';
$config = new Config('../../settings/Config.ini');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Helioviewer.org - Data Coverage Statistics</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
background-color: #1a1a1a;
color: #e0e0e0;
}
#main {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #1a1a1a;
}
#header {
flex-shrink: 0;
background-color: #2a2a2a;
padding: 5px 10px;
display: flex;
align-items: center;
gap: 10px;
}
#header img {
height: 30px;
width: auto;
}
#headerText {
color: #e0e0e0;
font-size: 14px;
margin: 0;
}
#dashboard-container {
flex: 1;
width: 100vw;
min-height: 0;
margin: 0;
padding: 0;
}
#dashboard-container iframe {
width: 100%;
height: 100%;
border: none;
display: block;
}
#error-message {
display: none;
padding: 10px;
margin: 10px;
background-color: #5c1c1c;
color: #ff8a80;
border-radius: 4px;
}
#loading-message {
padding: 10px;
margin: 10px;
text-align: center;
font-size: 14px;
color: #e0e0e0;
}
</style>
</head>

<body>
<div id="main">
<div id="header">
<img src="../resources/images/logos/hvlogo1s_transparent_logo.png" alt="Helioviewer logo" />
<div id='headerText'>The Helioviewer Project - Data Coverage</div>
</div>

<div id="loading-message">Loading dashboard...</div>
<div id="error-message"></div>
<div id="dashboard-container"></div>
</div>

<script src="https://unpkg.com/@superset-ui/embedded-sdk"></script>
<script type="text/javascript">
const DASHBOARD_ID = '<?= HV_SUPERSET_COVERAGE_DASHBOARD_ID ?>';
const GUEST_TOKEN_URL = '<?= HV_SUPERSET_SIDECAR_URL ?>/guest_token.php';
const SUPERSET_URL = '<?= HV_SUPERSET_URL ?>';

async function fetchGuestToken() {
try {
const response = await fetch(GUEST_TOKEN_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
dashboard_id: DASHBOARD_ID
})
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.json();

if (!data.success || !data.token) {
throw new Error('Failed to retrieve guest token from response');
}

return data.token;
} catch (error) {
console.error('Error fetching guest token:', error);
throw error;
}
}

async function embedDashboard() {
try {
const guestToken = await fetchGuestToken();

// Hide loading message
document.getElementById('loading-message').style.display = 'none';

// Embed the dashboard
supersetEmbeddedSdk.embedDashboard({
id: DASHBOARD_ID,
supersetDomain: SUPERSET_URL,
mountPoint: document.getElementById('dashboard-container'),
fetchGuestToken: () => guestToken,
dashboardUiConfig: {
hideTitle: true,
hideChartControls: false,
hideTab: false,
},
});
} catch (error) {
console.error('Error embedding dashboard:', error);
document.getElementById('loading-message').style.display = 'none';
const errorDiv = document.getElementById('error-message');
errorDiv.style.display = 'block';
errorDiv.textContent = 'Failed to load dashboard: ' + error.message;
}
}

// Initialize dashboard when page loads
window.addEventListener('load', embedDashboard);
</script>
</body>
</html>
27 changes: 1 addition & 26 deletions docroot/status/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,6 @@
"RHESSI" => $PROVIDERS['RHESSI']
);

const COVERAGE = array (
"AIA" => "SDO_coverage.html",
"HMI" => "SDO_coverage.html",
"EIT" => "SOHO_coverage.html",
"LASCO" => "SOHO_coverage.html",
"COSMO" => "MLSO_coverage.html",
"EUI" => "SOLO_coverage.html",
"COR1-A" => "STEREO_A_coverage.html",
"COR2-A" => "STEREO_A_coverage.html",
"EUVI-A" => "STEREO_A_coverage.html",
"COR1-B" => "STEREO_B_coverage.html",
"COR2-B" => "STEREO_B_coverage.html",
"EUVI-B" => "STEREO_B_coverage.html",
"IRIS" => "IRIS_coverage.html",
"SWAP" => "PROBA2_coverage.html",
"SXT" => "Yohkoh_coverage.html",
"XRT" => "Hinode_coverage.html",
"RHESSI" => "RHESSI_coverage.html"
);

const TABLE_ROW_TEMPLATE = "<tr class='%s'><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td align='center'>%s</td></tr>";

function formatDate(?DateTime $date) {
Expand Down Expand Up @@ -102,12 +82,7 @@ function genRobLink($name, $url) {
}

function genCoverageLink($source) {
$instrument = explode(" ", $source)[0];
if (array_key_exists($instrument, COVERAGE)) {
$coverage_page = "/statistics/bokeh/coverages/" . COVERAGE[$instrument];
} else {
$coverage_page = "#";
}
$coverage_page = "/statistics/coverage.php";
return "<a href=".$coverage_page.">$source</a>";
}

Expand Down
5 changes: 5 additions & 0 deletions settings/Config.Example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,8 @@ http_export = ''
# If running the coordinator locally, then change this to
# http://localhost:port
coordinator_url = 'http://coordinator'

[superset]
superset_url = 'http://localhost:8088'
superset_sidecar_url = 'http://localhost:8087'
superset_coverage_dashboard_id = 'your-dashboard-id-here'