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

Add ability to sort columns #253

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading