Skip to content

Commit

Permalink
Added last update datetime displa, Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
rajbos committed Jun 26, 2021
1 parent 5f40d64 commit 7c3df4f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ <h2 class="project-tagline">Host a GitHub Actions Marketplace in your own organi
<div id="main">

</div>

<div id=lastUpdatePanel><span>Dataset last updated:</span><span id="lastUpdated" class="name"></span></div>

<footer class="site-footer">

<span class="site-footer-owner"><a href="https://github.com/rajbos/actions-marketplace">actions-marketplace</a> is maintained by <a href="https://github.com/rajbos">rajbos</a>.</span>
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
</footer>
Expand Down
18 changes: 16 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,27 @@ function addActionPanel(mainElement, action) {
var panel = document.createElement('div');
panel.className = "panel";
panel.id = action.repoName
panel.innerHTML = '<div class="line"><span class="name">Repository:</span><span class="value">'+action.repoName+'</span></div>';
panel.innerHTML = '<div class="line"><span class="name">Repository:</span><span class="value"><a href="https://github.com/'+action.repoName+'">'+action.repoName+'</a></span></div>';
panel.innerHTML += '<div class="line"><span class="name">Action:</span><span class="value">'+action.action.name+'</span></div>';
panel.innerHTML += '<div class="line"><span class="name">Author:</span><span class="value">'+(action.action.author || "Not set") +'</span></div>';
panel.innerHTML += '<div class="line"><span class="name">Description:</span><div class="value description">'+action.action.description+'</div></div>';

mainElement.appendChild(panel);
}

function setLastUpdated(lastUpdated) {
var splitted = lastUpdated.split("_");
var date = splitted[0];
var time = splitted[1];

var splittedDate = date.split(/(?=(?:..)*$)/);
var splittedTime = time.split(/(?=(?:..)*$)/);

var date = new Date(splittedDate[0]+splittedDate[1],splittedDate[2],splittedDate[3], splittedTime[0], splittedTime[1]);

document.getElementById('lastUpdated').innerHTML = date.toLocaleString();
}

function init() {
loadFile(jsonFileToUrl, false, function(response) {
console.log('found file with content' + response);
Expand All @@ -40,7 +53,8 @@ function init() {
var actionCountElement = document.getElementById('actionCount');

actionCountElement.innerHTML = json.actions.length;

setLastUpdated(json.lastUpdated);

for(var index in json.actions) {
var action = json.actions[index];

Expand Down
9 changes: 9 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,13 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu,

.top {
clear: both;
}

#lastUpdatePanel {
margin-bottom: 5px;
clear: both;
}

#lastUpdated {
margin-left: 5px;
}

0 comments on commit 7c3df4f

Please # to comment.