Skip to content

Commit

Permalink
Add ability to sort columns (#253)
Browse files Browse the repository at this point in the history
* Add ability to sort columns

Run prettier

* Disable undef List

* Ignore lint of vendored minified lib

* Adding cursor:pointer to sort column headers

---------

Co-authored-by: Alex Cottner <acottner@mozilla.com>
  • Loading branch information
leplatrem and alexcottner authored Jan 14, 2025
1 parent e3ea83e commit 3e2ade6
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension/content/list-2.3.1.min.js
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: npm run lint

- name: Ext Lint
run: npx web-ext lint --warnings-as-errors --privileged --self-hosted --source-dir=extension/
run: npx web-ext lint --ignore-files="**/*.min.js" --warnings-as-errors --privileged --self-hosted --source-dir=extension/

test:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension/content/list-2.3.1.min.js
15 changes: 8 additions & 7 deletions extension/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ <h2>Sync History</h2>
</section>
</section>
<section id="status">
<table>
<table id="status-table">
<thead>
<tr>
<th>Collection</th>
<th>Last Check</th>
<th>Server Timestamp</th>
<th>Local Timestamp</th>
<th><span class="sort" data-sort="collection">Collection</span></th>
<th><span class="sort" data-sort="last-check">Last Check</span></th>
<th><span class="sort desc" data-sort="server-timestamp">Server Timestamp</span></th>
<th><span class="sort" data-sort="local-timestamp">Local Timestamp</span></th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tbody class="list">
</tbody>
</table>
</section>
Expand All @@ -66,7 +66,7 @@ <h2>Sync History</h2>
<template id="collection-status-tpl">
<tr class="collection-status">
<td>
<a class="url"></a>
<a class="collection url"></a>
<div class="error"></div>
</td>
<td class="last-check"></td>
Expand All @@ -92,6 +92,7 @@ <h2>Sync History</h2>
</li>
</template>

<script type="text/javascript" src="list-2.3.1.min.js"></script>
<script type="text/javascript" src="script.js"></script>

</html>
2 changes: 2 additions & 0 deletions extension/content/list-2.3.1.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions extension/content/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ async function refreshUI(state) {
};
statusTable.appendChild(tableRow);
});
const options = {
valueNames: [
"collection",
"last-check",
"server-timestamp",
"local-timestamp",
],
};
// eslint-disable-next-line no-undef
new List("status-table", options);
}

async function main() {
Expand Down
18 changes: 18 additions & 0 deletions extension/content/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,21 @@ button.clear-data {
#sync-history .status:not(.success) {
background-color: var(--error-text-color);
}

.sort {
cursor: pointer;
}

.sort:after {
content: "▼▲";
padding-left: 10px;
opacity: 0.5;
}
.sort.desc:after {
content: "▼";
opacity: 1;
}
.sort.asc:after {
content: "▲";
opacity: 1;
}

0 comments on commit 3e2ade6

Please sign in to comment.