File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const depctrl = require ( "./depctrl.js" ) ;
2+
3+ // exports an array of all updates
4+ module . exports = ( ) => {
5+ return depctrl . getData ( )
6+ . then ( feedData => feedData . flatMap ( feed => {
7+ let automations = Object . entries ( feed [ "macros" ] || { } ) ;
8+ //automations.push(...Object.entries(feed["modules"] || {}));
9+ return automations . map ( ( [ namespace , singleAutomation ] ) => {
10+ let defaultChannel = Object . values ( singleAutomation . channels ) . filter ( ( c ) => c . default ) [ 0 ] ;
11+ if ( defaultChannel === undefined ) {
12+ defaultChannel = Object . values ( singleAutomation . channels ) [ 0 ] ;
13+ }
14+ let updateData = { }
15+ updateData [ "namespace" ] = namespace ;
16+ updateData [ "feed" ] = feed . name ;
17+ updateData [ "name" ] = singleAutomation . name ;
18+ updateData [ "version" ] = defaultChannel . version ;
19+ updateData [ "releaseDate" ] = defaultChannel . released ;
20+ updateData [ "changelog" ] = ( ( singleAutomation . changelog || { } ) [ defaultChannel . version ] || [ ] ) . join ( "\n" ) ;
21+ return updateData ;
22+ } ) ;
23+ } )
24+ ) ;
25+ }
Original file line number Diff line number Diff line change 3333 <li class =" nav-item" >
3434 <a class =" nav-link{% if '/modules/' === page.url %} active{% endif %}" href =" {{ " /modules /" | url }}" >Modules</a >
3535 </li >
36+ <li class =" nav-item" >
37+ <a class =" nav-link{% if '/updates/' === page.url %} active{% endif %}" href =" {{ " /updates /" | url }}" >Updates</a >
38+ </li >
3639 <li class =" nav-item" >
3740 <a class =" nav-link" href =" https://github.com/TypesettingTools/depctrl-browser" >GitHub</a >
3841 </li >
Original file line number Diff line number Diff line change 1+ ---
2+ layout: base.njk
3+ title: Recent Updates
4+ permalink: "updates/"
5+ ---
6+ <h1 >Recent Updates</h1 >
7+ {% if (updates | length ) != = 0 %}
8+ <div class =" table-responsive" >
9+ <table class =" table table-hover" >
10+ <thead >
11+ <tr >
12+ <th scope =" col" >Macro</th >
13+ <th scope =" col" >Version</th >
14+ <th scope =" col" >Date</th >
15+ <th scope =" col" >Changelog</th >
16+ </tr >
17+ </thead >
18+ <tbody >
19+ {% for update in updates | updateListSort %}
20+ <tr >
21+ <th ><a href =" {{ [" /macros /" , update.namespace, " /" ] | join | url }}" >{{ update .name }} </a ></th >
22+ <td >{{ update .version }} </td >
23+ <td >{{ update .releaseDate }} </td >
24+ <td >{{ update .changelog }} </td >
25+ </tr >
26+ {% endfor %}
27+ </tbody >
28+ </table >
29+ </div >
30+ {% else %}
31+ <div class =" alert alert-danger" role =" alert" >
32+ No Macros found!
33+ </div >
34+ {% endif %}
Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ module.exports = {
2323
2424 automationListSort : ( obj ) => obj . sort ( ( a , b ) => a [ 0 ] [ 'name' ] . localeCompare ( b [ 0 ] [ 'name' ] ) ) ,
2525
26+ updateListSort : ( obj ) => obj . sort ( ( a , b ) => {
27+ if ( a [ 'releaseDate' ] === undefined ) {
28+ return 1 ;
29+ } else if ( b [ 'releaseDate' ] === undefined ) {
30+ return - 1 ;
31+ }
32+ let dateA = Date . parse ( a [ 'releaseDate' ] ) || 0 ;
33+ let dateB = Date . parse ( b [ 'releaseDate' ] ) || 0 ;
34+ return dateB - dateA ;
35+ } ) ,
36+
2637 singleValue : ( list , key ) => {
2738 var lastValue = null ;
2839 for ( let elm of list ) {
You can’t perform that action at this time.
0 commit comments