Skip to content

Commit f1ab805

Browse files
committed
mozilla/remote-settings#923: add tooltip when local/server timestamp
1 parent fc7e500 commit f1ab805

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

extension/content/script.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,16 @@ async function refreshUI(state) {
9191
document.getElementById("polling-url").setAttribute("href", pollingEndpoint);
9292
document.getElementById("local-timestamp").textContent = localTimestamp;
9393
document.getElementById("server-timestamp").textContent = serverTimestamp;
94-
document.getElementById("human-local-timestamp").className =
94+
95+
const tsElt = document.getElementById("human-local-timestamp");
96+
tsElt.className =
9597
localTimestamp == serverTimestamp ? " up-to-date" : " unsync";
96-
document.getElementById("human-local-timestamp").textContent =
97-
humanDate(localTimestamp);
98+
tsElt.textContent = humanDate(localTimestamp);
99+
tsElt.setAttribute(
100+
"title",
101+
localTimestamp == serverTimestamp ? "Synced" : "Local data is out of sync",
102+
);
103+
98104
document.getElementById("human-server-timestamp").textContent =
99105
humanDate(serverTimestamp);
100106
document.getElementById("last-check").textContent = humanDate(
@@ -144,13 +150,19 @@ async function refreshUI(state) {
144150
);
145151
tableRow.querySelector(".server-timestamp").textContent =
146152
serverTimestampCollection;
147-
tableRow.querySelector(".human-local-timestamp").className +=
153+
const tsRowElt = tableRow.querySelector(".human-local-timestamp");
154+
tsRowElt.className =
148155
localTimestampCollection == serverTimestampCollection
149156
? " up-to-date"
150157
: " unsync";
151-
tableRow.querySelector(".human-local-timestamp").textContent = humanDate(
152-
localTimestampCollection,
158+
tsRowElt.textContent = humanDate(localTimestampCollection);
159+
tsRowElt.setAttribute(
160+
"title",
161+
localTimestampCollection == serverTimestampCollection
162+
? "Synced"
163+
: "Local data is out of sync",
153164
);
165+
154166
tableRow.querySelector(".local-timestamp").textContent = localTimestamp;
155167
tableRow.querySelector(".last-check").textContent = humanDate(
156168
lastCheckCollection * 1000,

0 commit comments

Comments
 (0)