diff --git a/app/assets/javascripts/about/index.js b/app/assets/javascripts/about/index.js new file mode 100644 index 000000000..7980f45dc --- /dev/null +++ b/app/assets/javascripts/about/index.js @@ -0,0 +1,24 @@ +function loadProgressStats(){ + stats = window.progressData[window.activeProjectID] + $('#num_vulns').html(stats["num_vulns"]) + $('#perc_curated').html(stats["perc_curated"]) +} + +$( document ).ready( function() { + + $.ajax({ + url: "/api/about/progress", + dataType: 'json' + }).done(function(jsonData){ + window.progressData = jsonData; + window.activeProjectID = 0; // all projects + loadProgressStats(); + }); + + $('.project-select-pane button').click((e) => { + $('button.project-select-button').html(e.target.innerHTML); + $('#progress-project-select').foundation('close'); + window.activeProjectID = e.target.dataset.project; + loadProgressStats(); + }) +}); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 2fcbde1ec..92ca0dad5 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,6 +15,12 @@ //= require d3 //= require modernizr //= require_tree ./global +//= require plugins/foundation.core +//= require plugins/foundation.dropdown +//= require plugins/foundation.util.keyboard +//= require plugins/foundation.util.box +//= require plugins/foundation.util.touch +//= require plugins/foundation.util.triggers //= require foundation //= require moment/moment //= require datatables.net/js/jquery.dataTables diff --git a/app/assets/javascripts/curate.js b/app/assets/javascripts/curate.js new file mode 100644 index 000000000..67aedd88e --- /dev/null +++ b/app/assets/javascripts/curate.js @@ -0,0 +1,13 @@ +function loadProgressStats(projectID){ + +} + +$( document ).ready( function() { + + + + $('.project-select-pane button').click((e) => { + let projectID = e.target.dataset.project; + + }) +}); diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index ed6ce4abb..a9492cc49 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -396,7 +396,7 @@ $dropdownmenu-arrows: true; $dropdownmenu-arrow-color: $anchor-color; $dropdownmenu-arrow-size: 6px; $dropdownmenu-arrow-padding: 1.5rem; -$dropdownmenu-min-width: 200px; +$dropdownmenu-min-width: 150px; $dropdownmenu-background: $white; $dropdownmenu-submenu-background: $dropdownmenu-background; $dropdownmenu-padding: $global-menu-padding; diff --git a/app/assets/stylesheets/about.scss b/app/assets/stylesheets/about.scss new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/stylesheets/common/icons.scss b/app/assets/stylesheets/common/icons.scss index 08078d42e..f13e3a397 100644 --- a/app/assets/stylesheets/common/icons.scss +++ b/app/assets/stylesheets/common/icons.scss @@ -96,6 +96,7 @@ $fa-font-path: "@fortawesome/fontawesome-free/webfonts"; .vhp-icon-cloud { @extend .fi-cloud; } .vhp-icon-cogs { @extend .fas; @extend .fa-cogs; } .vhp-icon-contest { @extend .fas; @extend .fa-trophy; } +.vhp-icon-curate { @extend .fas; @extend .fa-comment-medical; } .vhp-icon-default { @extend .fas; @extend .fa-clipboard-check; } .vhp-icon-dependency { @include vhp-material-icon('device_hub') } .vhp-icon-distrust-input{ @extend .fas; @extend .fa-door-closed; } diff --git a/app/assets/stylesheets/common/vhp.scss b/app/assets/stylesheets/common/vhp.scss index aa67a1190..74870a7f6 100644 --- a/app/assets/stylesheets/common/vhp.scss +++ b/app/assets/stylesheets/common/vhp.scss @@ -90,11 +90,11 @@ hr { } .dropdown.menu > li.is-dropdown-submenu-parent > a::after{ - border-top-color: white; + border-top-color: white; // down arrow } .dropdown.menu > li.is-dropdown-submenu-parent > a:hover:after{ - border-top-color: $vhp-color; + border-top-color: $vhp-color; // down arrow } .top-bar-title { @@ -111,6 +111,38 @@ hr { top: 120%; } +.project-select-button { + background-color: $light-gray; + color: $body-font-color; + font-weight: $global-weight-bold; + +} + +.project-select-pane { + cursor: pointer; + user-select: none; + display: flex; + flex-flow: row; + border: 1pt solid $medium-gray; + justify-content: center; + width: 12em; + + + button { + flex-grow: 1; + flex-shrink: 1; + flex-basis: 0; + padding: 1em; + margin: 0.25em; + width: 100%; + text-align: center; + border: 1pt solid $medium-gray; + background-color: $light-gray; + color: $body-font-color; + font-weight: $global-weight-bold; + } +} + .subheader { font-size: 2vh; } diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index 94380da5c..c4ebc809c 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -19,7 +19,7 @@ // @include foundation-flex-classes; @include foundation-typography; @include foundation-forms; -// @include foundation-button; +@include foundation-button; // @include foundation-accordion; // @include foundation-accordion-menu; // @include foundation-badge; @@ -31,7 +31,7 @@ @include foundation-menu; @include foundation-menu-icon; // @include foundation-drilldown-menu; -// @include foundation-dropdown; +@include foundation-dropdown; @include foundation-dropdown-menu; @include foundation-responsive-embed; // @include foundation-label; diff --git a/app/assets/stylesheets/progress.scss b/app/assets/stylesheets/progress.scss new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/stylesheets/projects.scss b/app/assets/stylesheets/projects.scss new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb new file mode 100644 index 000000000..0475cc266 --- /dev/null +++ b/app/controllers/about_controller.rb @@ -0,0 +1,8 @@ +class AboutController < ApplicationController + + # GET /about + def index + end + + +end diff --git a/app/controllers/curate_controller.rb b/app/controllers/curate_controller.rb index 6709f301d..8eaebdcf6 100644 --- a/app/controllers/curate_controller.rb +++ b/app/controllers/curate_controller.rb @@ -1,6 +1,7 @@ class CurateController < ApplicationController def index + @projects = Project.all num_vulns = Vulnerability.count @num_vulns_report = ActiveSupport::NumberHelper. number_to_delimited(num_vulns, :delimiter => ',') diff --git a/app/controllers/progress_controller.rb b/app/controllers/progress_controller.rb new file mode 100644 index 000000000..554709899 --- /dev/null +++ b/app/controllers/progress_controller.rb @@ -0,0 +1,42 @@ +class ProgressController < ApplicationController + + # GET /about + def index + @projects = Project.all + end + + # GET /api/about/progress + def progress + stats = {} + Project.all.each do |p| + p_stats = {} + num_vulns = Vulnerability.where(project: p).count + p_stats[:num_vulns] = num_vulns + p_stats[:num_vulns_report] = ActiveSupport::NumberHelper.number_to_delimited(num_vulns, :delimiter => ',') + num_curated = Vulnerability.curated.where(project: p).count + p_stats[:num_curated] = num_curated + p_stats[:perc_curated] = 100.0 * num_curated / num_vulns.to_f + p_stats[:perc_report] = "%.1f%%" % p_stats[:perc_curated] + num_w_fixes = Fix.select(:vulnerability_id).distinct.count + p_stats[:perc_fixes] = (100.0 * num_w_fixes / num_vulns.to_f) + # @fix_report = "%.1f%%" % @perc_fixes + # @num_vccs = Vcc.count + # @num_w_vccs = Vcc.select(:vulnerability_id).distinct.count + # @perc_vccs = (100.0 * @num_w_vccs / num_vulns.to_f) + # @vcc_report = "%.1f%%" % @perc_vccs + stats[p.id] = p_stats + end + stats[0] = all_project_stats() + render_json_for_api stats + end + + private + + def all_project_stats + { + num_vulns: Vulnerability.count + } + end + + +end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f5600febb..69c2faa7d 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -19,7 +19,7 @@ def releases private # Use callbacks to share common setup or constraints between actions. def set_project - @project = Project.find(params[:project_id]) + @project = Project.find(params[:project_id]) end # Never trust parameters from the scary internet, only allow the white list through. diff --git a/app/views/about/index.html.erb b/app/views/about/index.html.erb new file mode 100644 index 000000000..a85ca06f0 --- /dev/null +++ b/app/views/about/index.html.erb @@ -0,0 +1,3 @@ +
Stuff about us.
diff --git a/app/views/curate/_howto.html.erb b/app/views/curate/_howto.html.erb new file mode 100644 index 000000000..ebf9250dd --- /dev/null +++ b/app/views/curate/_howto.html.erb @@ -0,0 +1,15 @@ +<%= render('shared/grid', size: 8) do %> + +Most of our curators are undergraduate software engineering students at Rochester Institute of Technology. Students are required to complete a vulnerability history study, and are allowed to volunteer their submissions to this project.
+ +<% end %> + + +<%= render('shared/grid', size: 8) do %> +To be written.
+ +<% end %> diff --git a/app/views/curate/_progress.html.erb b/app/views/curate/_progress.html.erb index 28f1a9e0f..f4adc7936 100644 --- a/app/views/curate/_progress.html.erb +++ b/app/views/curate/_progress.html.erb @@ -1,6 +1,24 @@ + <%= render('shared/grid', size: 8) do %> -The data set for this project is usable at any time, and has been used in academic literature. diff --git a/app/views/curate/index.html.erb b/app/views/curate/index.html.erb index a9ca32215..919987620 100644 --- a/app/views/curate/index.html.erb +++ b/app/views/curate/index.html.erb @@ -3,21 +3,39 @@ <% end %> <%= render('shared/grid', size: 8) do %> -
- This project relies upon a massive effort to collect, correct, and annotate vulnerability history data. We call this process curating. -
- -Most of our curators are undergraduate software engineering students at Rochester Institute of Technology. Students are required to complete a vulnerability history study, and are allowed to volunteer their submissions to this project.
- ++ This project relies upon a massive effort to collect, correct, and annotate vulnerability history data. We call this process curating. +
+ +To be written.
- -<% end %> +<%= javascript_include_tag "curate" %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 378261143..4ff1a334f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -44,19 +44,27 @@+ The data set for this project is usable at any time, and has been used in academic literature. +
+<% end %> + ++ This the current number of historical vulnerabilities that this project knows about. +
+<% end %> + ++ These are the vulnerabilities that have received a curator's attention. Curation is assigned at random so that this population is representative of the whole. +
+<% end %> diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb new file mode 100644 index 000000000..a4d637f41 --- /dev/null +++ b/app/views/projects/index.html.erb @@ -0,0 +1,19 @@ +TODO: make this better.
+ + <% Project.all.each do |p| %> +