Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile View #1803 #1962

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions gcp/appengine/frontend3/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,9 @@ mwc-icon-button.mdc-data-table__sort-icon-button {
width: 100%;

@media (max-width: $osv-mobile-breakpoint) {
.hide-on-mobile {
display: none !important;
.vuln-table-container {
overflow-x: scroll;
overflow-y: hidden;
}
}

Expand Down
30 changes: 12 additions & 18 deletions gcp/appengine/frontend3/src/templates/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
{% set active_section = 'vulnerabilities' %}
{% set disable_turbo_cache = 'true' %}

{% macro table_header_cell(column_id, column_name, is_sortable, is_sorted, is_descending, hide_on_mobile) %}
{% macro table_header_cell(column_id, column_name, is_sortable, is_sorted, is_descending) %}
<span class="vuln-table-cell mdc-data-table__header-cell vuln-table-header
{% if is_sortable %}mdc-data-table__header-cell--with-sort__DISABLED{% endif %}
{% if is_sorted %}mdc-data-table__header-cell--sorted{% endif %}
{% if is_descending %}mdc-data-table__header-cell--sorted-descending{% endif %}
{% if hide_on_mobile%}hide-on-mobile{% endif %}" role="columnheader" scope="col"
{% if is_descending %}mdc-data-table__header-cell--sorted-descending{% endif %}" role="columnheader" scope="col"
aria-sort="{% if is_sorted %}{% if is_descending %}descending{% else %}ascending{% endif %}{% else %}none{% endif %}"
data-column-id="{{ column_id }}">
<div class="mdc-data-table__header-cell-wrapper">
Expand Down Expand Up @@ -74,18 +73,13 @@ <h1 class="title">Vulnerability Library</h1>
<div role="table" class="vuln-table mdc-data-table__table" aria-label="Vulnerability table">
<div role="rowgroup" class="vuln-table-header">
<div role="row" class="vuln-table-row mdc-data-table__header-row">
{{ table_header_cell('id', 'ID', is_sortable=False, is_sorted=False, is_descending=False,
hide_on_mobile=False) }}
{{ table_header_cell('package', 'Packages', is_sortable=False, is_sorted=False, is_descending=False,
hide_on_mobile=False) }}
{{ table_header_cell('summary', 'Summary', is_sortable=False, is_sorted=False, is_descending=False,
hide_on_mobile=True) }}
{{ table_header_cell('id', 'ID', is_sortable=False, is_sorted=False, is_descending=False) }}
{{ table_header_cell('package', 'Packages', is_sortable=False, is_sorted=False, is_descending=False) }}
{{ table_header_cell('summary', 'Summary', is_sortable=False, is_sorted=False, is_descending=False) }}
{{ table_header_cell('affected-versions', 'Affected versions', is_sortable=False, is_sorted=False,
is_descending=False, hide_on_mobile=True) }}
{{ table_header_cell('published', 'Published', is_sortable=True, is_sorted=True, is_descending=True,
hide_on_mobile=True) }}
{{ table_header_cell('fixed', 'Fix', is_sortable=False, is_sorted=False, is_descending=False,
hide_on_mobile=True) }}
is_descending=False) }}
{{ table_header_cell('published', 'Published', is_sortable=True, is_sorted=True, is_descending=True) }}
{{ table_header_cell('fixed', 'Fix', is_sortable=False, is_sorted=False, is_descending=False) }}
</div>
</div>
<div role="rowgroup" class="vuln-table-rows mdc-data-table__content">
Expand All @@ -103,10 +97,10 @@ <h1 class="title">Vulnerability Library</h1>
{% endfor %}
</ul>
</span>
<span role="cell" class="vuln-table-cell vuln-summary mdc-data-table__cell hide-on-mobile">
<span role="cell" class="vuln-table-cell vuln-summary mdc-data-table__cell">
{{ vulnerability.summary or "See record for full details" }}
</span>
<span role="cell" class="vuln-table-cell vuln-versions mdc-data-table__cell hide-on-mobile">
<span role="cell" class="vuln-table-cell vuln-versions mdc-data-table__cell">
<ul class="versions">
{#-
https://stackoverflow.com/questions/31876069/is-it-possible-to-flatten-a-lists-of-lists-with-ansible-jinja2
Expand All @@ -121,12 +115,12 @@ <h1 class="title">Vulnerability Library</h1>
{%- endfor -%}
</ul>
</span>
<span role="cell" class="vuln-table-cell mdc-data-table__cell hide-on-mobile">
<span role="cell" class="vuln-table-cell mdc-data-table__cell">
<relative-time datetime="{{ vulnerability.published }}">
{{ vulnerability.published }}
</relative-time>
</span>
<span role="cell" class="vuln-table-cell vuln-fix-status mdc-data-table__cell hide-on-mobile">
<span role="cell" class="vuln-table-cell vuln-fix-status mdc-data-table__cell">
{%- if vulnerability.isFixed -%}
<span class="tag fix-available">Fix available</span>
{%- else -%}
Expand Down