cpack_repository/commit
Added package status
author | Jan Wielemaker |
---|---|
Mon Nov 15 17:14:49 2010 +0100 | |
committer | Jan Wielemaker |
Mon Nov 15 17:14:49 2010 +0100 | |
commit | c83ed85cf03280f967d1a64e22836b585e93893e |
tree | 97aa14d1c7427b59fe764aed762585d712fc26b8 |
parent | 2567a7ef3aea8ca60b824bb282c4f0fdbb213ebc |
Diff style: patch stat
diff --git a/applications/cpack_submit.pl b/applications/cpack_submit.pl index 8e25517..8ef756c 100644 --- a/applications/cpack_submit.pl +++ b/applications/cpack_submit.pl @@ -39,6 +39,7 @@ :- use_module(user(user_db)). :- use_module(library(http/http_path)). :- use_module(library(cpack/repository)). +:- use_module(library(cpack/dependency)). :- use_module(components(messages)). :- use_module(components(label)). :- use_module(components(cpack)). @@ -126,9 +127,11 @@ list_packages(Options) :- findall(Package, current_package(Package, Options), Packages), reply_html_page(cliopatria(cpack), title('CPACK packages'), - [ h1('CPACK packages'), - \package_table(Packages, []), - \update_all_link(Options) + [ div(class(cpack), + [ h1('CPACK packages'), + \package_table(Packages, []), + \update_all_link(Options) + ]) ]). current_package(Package, Options) :- @@ -140,11 +143,13 @@ current_package(Package, Options) :- package_table(Packages, Options) --> + html_requires(css('cpack.css')), html(table(class(block), [ tr([ th('Name'), th('Title'), th('Type'), - th('Submitter') + th('Submitter'), + th('Status') ]) | \package_rows(Packages, 1, Options) ])). @@ -158,9 +163,21 @@ package_row(Package, _Options) --> html([ td(\cpack_link(Package)), td(\cpack_prop(Package, dcterms:title)), td(\cpack_prop(Package, rdf:type)), - td(\cpack_prop(Package, cpack:submittedBy)) + td(\cpack_prop(Package, cpack:submittedBy)), + td(class(status), \cpack_satisfied(Package)) ]). +cpack_satisfied(Package) --> + { cpack_not_satisfied(Package, _Reason), + http_absolute_location(icons('webdev-alert-icon.png'), IMG, []) + }, !, + html(img([class(status), alt('Not satisfied'), src(IMG)])). +cpack_satisfied(_) --> + { http_absolute_location(icons('webdev-ok-icon.png'), IMG, []) + }, !, + html(img([class(status), alt('OK'), src(IMG)])). + + update_all_link(Options) --> { option(update_all_link(true), Options), http_link_to_id(cpack_update_my_packages, [], HREF) diff --git a/lib/cpack/dependency.pl b/lib/cpack/dependency.pl index d021b34..8b1eefa 100644 --- a/lib/cpack/dependency.pl +++ b/lib/cpack/dependency.pl @@ -32,7 +32,8 @@ [ file_used_by_file_in_package/3, % +File, -UsedBy, -Package cpack_requires/3, % +Package, -Package, -Why cpack_conflicts/3, % +Package, -Package, -Why - file_not_satisfied/2, % +File, -WhyNot + cpack_not_satisfied/2, % +Package, -Reasons + file_not_satisfied/2, % +File, -Reasons file_imports_from/3 % +File, -Imports, -From ]). :- use_module(library(semweb/rdf_db)). @@ -128,8 +129,20 @@ cpack_conflicts_by(Package, Conflict, same_file(Path,File1,File2)) :- % % True when WhyNot describes why Package is not satisfied. -cpack_not_satisfied(_Package, _WhyNot) :- - true. +cpack_not_satisfied(Pack, AllReasons) :- + setof(Due, cpack_not_satisfied_due(Pack, Due), AllReasons). + +cpack_not_satisfied_due(Package, no_token(Token)) :- + rdf_has(Package, cpack:requires, Req), + ( rdf_is_literal(Req) + -> Token = Req + ; rdf_has(Req, cpack:name, Token) + ), + \+ rdf_has(_, cpack:provides, Token). +cpack_not_satisfied_due(Package, file(File, Problems)) :- + rdf_has(File, cpack:inPack, Package), + file_not_satisfied(File, Problems). + %% file_not_satisfied(+File, -Reasons) is semidet. % @@ -164,7 +177,21 @@ file_not_satisfied_due(File, file_not_found(FileRef)) :- file_not_satisfied_due(File, predicate_not_found(PI)) :- LPI = literal(PI), rdf_has(File, cpack:requiresPredicate, LPI), - \+ file_imports_pi_from(File, _, LPI). + \+ file_imports_pi_from(File, _, PI), + \+ other_source(PI). + +other_source(API) :- + atom_to_term(API, PI, []), + pi_head(PI, Head), + ( predicate_property(Head, multifile) + ; predicate_property(Head, autoload(_)) + ). + +pi_head(M:PI, M:Head) :- !, + pi_head(PI, Head). +pi_head(Name/Arity, Head) :- + functor(Head, Name, Arity). + %% file_imports_from(+File, -Predicates, -From) is nondet. % diff --git a/web/css/cpack.css b/web/css/cpack.css index ea0e8b3..239161d 100644 --- a/web/css/cpack.css +++ b/web/css/cpack.css @@ -1,3 +1,12 @@ +div.cpack td.status +{ text-align: center; +} + +div.cpack td.status img +{ height: 1.3em; +} + + div.cpack table.infobox { font-size: 80%; float: right; diff --git a/web/icons/webdev-alert-icon.png b/web/icons/webdev-alert-icon.png new file mode 100644 index 0000000..0249257 Binary files /dev/null and b/web/icons/webdev-alert-icon.png differ diff --git a/web/icons/webdev-ok-icon.png b/web/icons/webdev-ok-icon.png new file mode 100644 index 0000000..d279940 Binary files /dev/null and b/web/icons/webdev-ok-icon.png differ