Adding source url and dropping sorting by frequency
This commit is contained in:
parent
d697a86255
commit
45b4378df2
|
@ -3,3 +3,4 @@
|
|||
/static/pkg
|
||||
/static/pkgs-all
|
||||
*json
|
||||
/static/atom.xml
|
||||
|
|
|
@ -119,32 +119,67 @@
|
|||
(packages-conflict?/cache pkg other-pkg)))
|
||||
ring-01))
|
||||
|
||||
(define (package-url->useful-url pkg-url-str)
|
||||
(define pkg-url
|
||||
(string->url pkg-url-str))
|
||||
(match (url-scheme pkg-url)
|
||||
["github"
|
||||
(match (url-path pkg-url)
|
||||
[(list* user repo branch path)
|
||||
(url->string
|
||||
(struct-copy
|
||||
url pkg-url
|
||||
[scheme "http"]
|
||||
[path (list* user repo (path/param "tree" empty) branch path)]))]
|
||||
[_
|
||||
pkg-url-str])]
|
||||
["git"
|
||||
(match (url-path pkg-url)
|
||||
;; xxx make this more robust
|
||||
[(list user repo)
|
||||
(url->string
|
||||
(struct-copy
|
||||
url pkg-url
|
||||
[scheme "http"]
|
||||
[path (list user repo (path/param "tree" empty)
|
||||
(path/param "master" empty))]))]
|
||||
[_
|
||||
pkg-url-str])]
|
||||
[_
|
||||
pkg-url-str]))
|
||||
|
||||
(for ([pkg (in-hash-keys pkg-ht)])
|
||||
(hash-update!
|
||||
pkg-ht pkg
|
||||
(λ (ht)
|
||||
(define conflicts (package-conflicts? pkg))
|
||||
(hash-set* ht
|
||||
'conflicts conflicts
|
||||
'search-terms
|
||||
(let* ([st (hasheq)]
|
||||
[st (for/fold ([st st])
|
||||
([t (in-list (hash-ref ht 'tags))])
|
||||
(hash-set st (string->symbol t) #t))]
|
||||
[st (hash-set st (string->symbol (format "ring:~a" (hash-ref ht 'ring))) #t)]
|
||||
[st (for/fold ([st st])
|
||||
([a (in-list (author->list (hash-ref ht 'author)))])
|
||||
(hash-set st (string->symbol (format "author:~a" a)) #t))]
|
||||
[st (if (empty? (hash-ref ht 'tags))
|
||||
(hash-set st ':no-tag: #t)
|
||||
st)]
|
||||
[st (if (hash-ref ht 'checksum-error)
|
||||
(hash-set st ':error: #t)
|
||||
st)]
|
||||
[st (if (empty? conflicts)
|
||||
st
|
||||
(hash-set st ':conflicts: #t))])
|
||||
st)))))
|
||||
(hash-set*
|
||||
ht
|
||||
'conflicts conflicts
|
||||
'source_url (package-url->useful-url (hash-ref ht 'source))
|
||||
'search-terms
|
||||
(let* ([st (hasheq)]
|
||||
[st (for/fold ([st st])
|
||||
([t (in-list (hash-ref ht 'tags))])
|
||||
(hash-set st (string->symbol t) #t))]
|
||||
[st (hash-set
|
||||
st
|
||||
(string->symbol
|
||||
(format "ring:~a" (hash-ref ht 'ring))) #t)]
|
||||
[st (for/fold ([st st])
|
||||
([a (in-list (author->list (hash-ref ht 'author)))])
|
||||
(hash-set
|
||||
st (string->symbol (format "author:~a" a)) #t))]
|
||||
[st (if (empty? (hash-ref ht 'tags))
|
||||
(hash-set st ':no-tag: #t)
|
||||
st)]
|
||||
[st (if (hash-ref ht 'checksum-error)
|
||||
(hash-set st ':error: #t)
|
||||
st)]
|
||||
[st (if (empty? conflicts)
|
||||
st
|
||||
(hash-set st ':conflicts: #t))])
|
||||
st)))))
|
||||
|
||||
|
||||
(define basic-dispatch
|
||||
|
|
|
@ -17,21 +17,23 @@
|
|||
</div>
|
||||
<p id="search_menu"></p>
|
||||
|
||||
<div id="package_info">
|
||||
<span class="field">Package Name: <span id="pi_name">XXX</span></span>
|
||||
<span class="field">Ring: <span id="pi_ring">XXX</span></span>
|
||||
<span class="field">Authors: <span id="pi_authors">XXX</span></span>
|
||||
<span class="field">Source: <span id="pi_source">XXX</span></span>
|
||||
<span class="field">Checksum: <span id="pi_checksum">XXX</span></span>
|
||||
<span class="field">Last Update: <span id="pi_last_update">XXX</span></span>
|
||||
<span class="field">Last Checked: <span id="pi_last_checked">XXX</span></span>
|
||||
<span class="field">Last Edit: <span id="pi_last_edit">XXX</span></span>
|
||||
<span class="field">Description: <span id="pi_description">XXX</span></span>
|
||||
<span class="field">Tags: <span id="pi_tags">XXX</span></span>
|
||||
XXX Add a tag
|
||||
XXX Version exceptions
|
||||
<div id="package_info" class="package">
|
||||
<table>
|
||||
<tr><td>Package Name:</td><td><span id="pi_name"></span></td></tr>
|
||||
<tr><td>Ring:</td><td><span id="pi_ring"></span></td></tr>
|
||||
<tr><td>Authors:</td><td><span id="pi_authors"></span></td></tr>
|
||||
<tr><td>Source:</td><td><span id="pi_source"></span></td></tr>
|
||||
<tr><td>Checksum:</td><td><span id="pi_checksum"></span></td></tr>
|
||||
<tr><td>Last Updated:</td><td><span id="pi_last_updated"></span></td></tr>
|
||||
<tr><td>Last Checked:</td><td><span id="pi_last_checked"></span></td></tr>
|
||||
<tr><td>Last Edit:</td><td><span id="pi_last_edit"></span></td></tr>
|
||||
<tr><td>Description:</td><td><span id="pi_description"></span></td></tr>
|
||||
<tr><td>Tags:</td><td><span id="pi_tags"></span></td></tr>
|
||||
<tr><td>XXX</td><td>Add a tag</td></tr>
|
||||
<tr><td>XXX</td><td>Version exceptions</td></tr>
|
||||
</table>
|
||||
|
||||
<div class="install">Install this package with:<br><br><tt>raco pkg install <span id="pi_name_inst">XXX</span></tt><br><br>or, with the 'File|Install Package...' menu option in DrRacket.</div>
|
||||
<div class="install">Install this package with:<br><br><tt>raco pkg install <span id="pi_name_inst"></span></tt><br><br>or, with the 'File|Install Package...' menu option in DrRacket.</div>
|
||||
</div>
|
||||
|
||||
<table class="packages sortable">
|
||||
|
|
|
@ -3,19 +3,43 @@
|
|||
// xxx what user am i
|
||||
// xxx upload
|
||||
// xxx update
|
||||
// xxx show info about a package (make sure url is same as in atom feed)
|
||||
// xxx show info about a package
|
||||
|
||||
$( document ).ready(function() {
|
||||
$("#package_info").dialog({
|
||||
autoOpen: false,
|
||||
minWidth: 600,
|
||||
minHeight: 600,
|
||||
position: { my: "center", at: "center", of: "#search_menu" },
|
||||
modal: true });
|
||||
|
||||
function format_time( t ) {
|
||||
var d = new Date( t * 1000 );
|
||||
return d.toLocaleString(); }
|
||||
|
||||
var active_info = false;
|
||||
var target_pkg = false;
|
||||
function update_info( pkgi ) {
|
||||
console.log( pkgi );
|
||||
change_hash( "[" + pkgi['name'] + "]" );
|
||||
$( "#pi_name" ).text( pkgi['name'] );
|
||||
$( "#pi_name_inst" ).text( pkgi['name'] );
|
||||
$( "#pi_ring" ).text( pkgi['ring'] );
|
||||
$( "#pi_authors" ).html("")
|
||||
.append( $.map( pkgi['authors'],
|
||||
function ( author, i ) {
|
||||
return [author, " "]; } ) )
|
||||
|
||||
$( "#pi_source" ).html( $('<a>', { text: pkgi['source'],
|
||||
href: pkgi['source_url'] } ));
|
||||
|
||||
$( "#pi_checksum" ).text( pkgi['checksum'] );
|
||||
$( "#pi_last_updated" ).text( format_time(pkgi['last-updated']) );
|
||||
$( "#pi_last_checked" ).text( format_time(pkgi['last-checked']) );
|
||||
$( "#pi_last_edit" ).text( format_time(pkgi['last-edit']) );
|
||||
$( "#pi_description" ).text( pkgi['description'] );
|
||||
$( "#pi_tags" ).html("").append( $.map( pkgi['tags'], function ( tag, i ) {
|
||||
return [tag, " "]; } ) )
|
||||
active_info = pkgi; };
|
||||
|
||||
var search_terms = { };
|
||||
|
@ -112,12 +136,7 @@ $( document ).ready(function() {
|
|||
|
||||
var shown_terms_keys = object_keys(shown_terms);
|
||||
var shown_terms_skeys = shown_terms_keys.sort(function(a,b) {
|
||||
var va = shown_terms[a];
|
||||
var vb = shown_terms[b];
|
||||
if ( va < 0 && vb < 0 ) { return ((a < b) ? -1 : ((a > b) ? 1 : 0)); }
|
||||
else if ( va >= 0 && vb >= 0 ) { return ((va < vb) ? -1 : ((va > vb) ? 1 : 0)); }
|
||||
else if ( va < 0 ) { return -1; }
|
||||
else if ( vb < 0 ) { return 1; } });
|
||||
return ((a < b) ? -1 : ((a > b) ? 1 : 0)); });
|
||||
|
||||
change_hash( "" );
|
||||
$("#search_menu").html("").append( $.map( shown_terms_skeys, function ( term, i ) {
|
||||
|
|
|
@ -72,20 +72,12 @@ table.packages tbody tr.even {
|
|||
}
|
||||
|
||||
.package {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.package table {
|
||||
width: 70%;
|
||||
margin-left: 15%;
|
||||
margin-right: 15%;
|
||||
border: 1px dotted;
|
||||
}
|
||||
.package table tr {
|
||||
width: 100%;
|
||||
}
|
||||
.package table td {
|
||||
vertical-align: top;
|
||||
|
@ -100,7 +92,7 @@ table.packages tbody tr.even {
|
|||
.package table td:nth-child(1) {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
width: 15%;
|
||||
width: 20%;
|
||||
}
|
||||
.package table td:nth-child(2) {
|
||||
text-align: left;
|
||||
|
|
Loading…
Reference in New Issue
Block a user