Skip to content

Commit

Permalink
use existing status badge (provisional)
Browse files Browse the repository at this point in the history
jsstevenson committed Apr 2, 2024
1 parent 9847458 commit ff952e8
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
@@ -109,7 +109,9 @@ jQuery(document).ready(function() {
<span>Social</span>
</th>
<th scope="col">
<span>Dashboard Status</span>
<span class="sort-button" title="Sort by Status" data-sort="status" >
Dashboard Status <i class="bi-chevron-up" aria-hidden="true"></i>
</span>
</th>
</tr>
</thead>
@@ -120,6 +122,7 @@ jQuery(document).ready(function() {
`;
}

// constrain status values, make them sortable
const DashboardStatus = {
PASS: 5, // all checks pass
INFO: 4, // info parameters returned
@@ -129,12 +132,6 @@ jQuery(document).ready(function() {
UNKNOWN: 0, // not found in dashboard results
}

const generateDashboardBadge = (dashboardResults) => {
const success = [DashboardStatus.PASS, DashboardStatus.INFO, DashboardStatus.WARN].includes(dashboardResults.status);
const color = success ? "green" : "red";
return `<img alt="Static Badge" src="https://img.shields.io/badge/%E2%9A%99_OBO_Dashboard_QC-ERROR_1%252C_WARN_2-${color}">`;
}

/**
* Construct and render HTML ontology table(s)
* @param {object} data Ontology json data.
@@ -170,7 +167,6 @@ jQuery(document).ready(function() {
};
return acc;
}, dashboard_success_data);
console.log(dashboard_success_data);
}).then(() => {
// by default, sort ontology records first by dashboard success status, then alphabetically
data.sort((a, b) => {
@@ -280,14 +276,13 @@ jQuery(document).ready(function() {
} else {
description_box = ``;
}
dash_success_indicator = generateDashboardBadge(dashboard_success_data[id]);
// if (dash_success) {
// dash_success_indicator = "<span>&#10003;</span>";
// } else {
// dash_success_indicator = "<span>&#88;</span>";
// }
// table row template
let tr_class = is_inactive
dash_success_indicator = `
<a href="http://dashboard.obofoundry.org/dashboard/${id}/dashboard.html">
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FOBOFoundry%2Fobo-dash.github.io%2Fgh-pages%2Fdashboard%2F${id}%2Fdashboard-qc-badge.json" alt="OBO Dashboard badge for ${id}"/>
</a>
<span style="display: none">${dash_success}</a>
`;
let tr_class = is_inactive;
if (!dash_success) {
tr_class += " failing";
}

0 comments on commit ff952e8

Please sign in to comment.