Skip to content

Commit

Permalink
renaming files + writing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
milachae committed Aug 21, 2023
1 parent 9996cbb commit 102846a
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 133 deletions.
4 changes: 2 additions & 2 deletions config/templates/hpc.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ docs_dir: docs/HPC

nav:
- Welcome: index.md
- datatables: datatables.md
- datatables: module_overview.md
- Introduction to HPC: introduction.md
- Getting an HPC Account: account.md
- Connecting to the HPC infrastructure: connecting.md
Expand Down Expand Up @@ -144,7 +144,7 @@ theme:
extra_javascript:
- https://code.jquery.com/jquery-3.7.0.min.js
- https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js
- javascripts/test_populate.js
- javascripts/populate_overview.js
extra_css:
- https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css

Expand Down
94 changes: 0 additions & 94 deletions mkdocs/docs/HPC/data/test.json

This file was deleted.

69 changes: 69 additions & 0 deletions mkdocs/docs/HPC/javascripts/populate_overview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Copyright 2023-2023 Ghent University
*
* This file is part of vsc_user_docs,
* originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
* with support of Ghent University (http://ugent.be/hpc),
* the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
* the Flemish Research Foundation (FWO) (http://www.fwo.be/en)
* and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
*
* https://github.com/hpcugent/vsc_user_docs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @author: Michiel Lachaert
*/


/**
* A function that populates the table on the module overview page with information about all the available modules.
*/
function populate_overview(json_data) {
fetch(json_data)
.then((response) => response.json())
.then((json) => {
// CONSTRUCT TABLE

// list with all the names of the clusters
const all_clusters = json.clusters.map(x => {
return ({"title": x.split("/")[1]})
})
const table = new DataTable('#overview_table', {
columns: [...[{"title": "name"}], ...all_clusters],
paging: false,
});


// ADD DATA
let new_rows = [];

// list_avaible contains a list with booleans.
// These booleans indicates if the software is available on the corresponding cluster.
for (const [software, list_available] of Object.entries(json.modules)) {
let new_row = [software];
list_available.forEach(bool => new_row.push(bool ? "x" : "-"));
new_rows.push(new_row);
}

table.rows.add(new_rows).draw();
})
}

// Only start populating the table if the correct page has been loaded.
document$.subscribe(function() {
if (document.getElementById("overview_table")) {
populate_overview("../data/json_data.json")
}
})
32 changes: 0 additions & 32 deletions mkdocs/docs/HPC/javascripts/test_populate.js

This file was deleted.

File renamed without changes.
12 changes: 7 additions & 5 deletions scripts/module_overview/module_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,16 @@ def generate_overview_json_data(modules: dict) -> dict:
@return: Dictionary with the required JSON structure.
"""
json_data = {"clusters": list(modules.keys()), "modules": {}}
avail_mods = get_unique_software_names(modules)
all_packages = get_unique_software_names(np.concatenate(list(avail_mods.values())))
avail_software = get_unique_software_names(modules)
all_software = get_unique_software_names(np.concatenate(list(avail_software.values())))

for package in all_packages:
# creates a list of booleans for each software that indicates
# if the software is available for the corresponding cluster.
for soft in all_software:
available = []
for cluster in json_data["clusters"]:
available.append(package in avail_mods[cluster])
json_data["modules"][package] = available
available.append(soft in avail_software[cluster])
json_data["modules"][soft] = available
return json_data


Expand Down

0 comments on commit 102846a

Please sign in to comment.