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

Dev -> Stage Sync (July 2024 Release) #731

Merged
merged 36 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
71fc61b
add modal to restrict research check in when clinical samples collected
Gbarra9 Jun 28, 2024
df258f1
Remove logs, uncomment await handleCheckInModal, remove extra logic …
Gbarra9 Jul 3, 2024
e355e32
remove extra logs
Gbarra9 Jul 3, 2024
40b9a1c
move showConfirmationModal function to share.js file
Gbarra9 Jul 5, 2024
e08abe0
Merge pull request #723 from episphere/issue#1004-restrict-research-c…
Gbarra9 Jul 5, 2024
11d281f
Kit validation now prevents duplicate tracking numbers
amber-emmes Jul 8, 2024
0eccdc1
clear out fields date collection card and time collection card when c…
Gbarra9 Jul 9, 2024
849ff19
Remove early code clearing of element with collectionId's value
Gbarra9 Jul 9, 2024
f6e8d2d
Merge pull request #725 from episphere/issue#1043-clear-collection-da…
Gbarra9 Jul 9, 2024
720aa79
add BCC-Fort Worth as placeholder waiting for cid assignment
Gbarra9 Jul 15, 2024
bad245b
update research check-in block logic to include anoy of the 4 site EM…
Gbarra9 Jul 15, 2024
c902b8d
add modal icon
Gbarra9 Jul 16, 2024
55aadfb
edit jsdocs typos
Gbarra9 Jul 16, 2024
5a8d38d
rename data to participantData
Gbarra9 Jul 16, 2024
ee36eb0
Merge pull request #726 from episphere/update-block-research-check-in
Gbarra9 Jul 16, 2024
c7127f6
create dismissBiospecimenModal function
Gbarra9 Jul 17, 2024
cad851d
remove spaces
Gbarra9 Jul 17, 2024
1e233d9
remove already called dismiss function and unused variable
Gbarra9 Jul 17, 2024
7682ef9
Merge pull request #727 from episphere/issue#1004-fix-create-dismiss-…
Gbarra9 Jul 18, 2024
2c2e5fb
Merge pull request #724 from episphere/1038-fix
amber-emmes Jul 18, 2024
ea2c1a9
add BCC- Forth Worth collection/shipping location
Gbarra9 Jul 18, 2024
515c1ad
Merge pull request #728 from episphere/issue#1032-add-BCC-Fort-Worth
Gbarra9 Jul 18, 2024
4aedcbe
change disabled timing of check-in button
Gbarra9 Jul 18, 2024
27a628b
move disable check-in btn in the else block
Gbarra9 Jul 18, 2024
4b75193
Merge pull request #729 from episphere/adjust-disabled-timing-of-chec…
Gbarra9 Jul 19, 2024
60e2252
display app version to footer
Gbarra9 Jul 20, 2024
5c879b8
cache app version via storage cache
Gbarra9 Jul 25, 2024
5dfb526
change match and move function
Gbarra9 Jul 25, 2024
fc4d0a5
add log to check if service worker is registered
Gbarra9 Jul 25, 2024
f074653
remove comments
Gbarra9 Jul 25, 2024
4b1fd2e
add appVersion p element to template literal
Gbarra9 Jul 26, 2024
5ef27c3
move version to service worker; cleanups
we-ai Jul 26, 2024
f85f8e0
remove async
Gbarra9 Jul 26, 2024
d351455
remove unused route
Gbarra9 Jul 26, 2024
aded1ae
Merge pull request #730 from episphere/issue#621-display-app-version
Gbarra9 Jul 29, 2024
6891c56
Merge branch 'stage' into dev
we-ai Jul 29, 2024
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
13 changes: 1 addition & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,11 @@ <h4 class="modal-title">Barcode Scanner</h4>
<li class="menu-item"><a class="footer-links" href="http://www.usa.gov/">USA.gov</a></li>
</ul>
<p class="menu footer-tagline">NIH…Turning Discovery Into Health<sup>®</sup></p>
<p id="appVersion"></p>
</div>
</div>
</div>
</footer>
<script>
if(location.host !== 'biospecimen-myconnect.cancer.gov') {
(function () {
const sentryScript = document.createElement('script');
sentryScript.src = 'https://browser.sentry-cdn.com/6.13.3/bundle.tracing.min.js';
document.head.appendChild(sentryScript);
sentryScript.addEventListener('load', () => {
Sentry.init({ dsn: 'https://[email protected]/6139072' });
})
})();
}
</script>
<script src="index.js" type="module"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
Expand Down
28 changes: 19 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ import { bptlShipReportsScreen } from "./src/pages/reports/shippingReport.js";
import { checkOutReportTemplate } from "./src/pages/checkOutReport.js";
import { dailyReportTemplate } from "./src/pages/dailyReport.js";

if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("./serviceWorker.js").catch((error) => {
console.error("Service worker registration failed.", error);
return;
});

navigator.serviceWorker.ready.then(() => {
if (navigator.serviceWorker.controller) {
navigator.serviceWorker.controller.postMessage({ action: "getAppVersion" });
}
});

navigator.serviceWorker.addEventListener("message", (event) => {
if (event.data.action === "sendAppVersion") {
document.getElementById("appVersion").textContent = event.data.payload;
}
});
}

let auth = '';

const datadogConfig = {
Expand All @@ -48,14 +67,6 @@ const datadogConfig = {
const isLocalDev = location.hostname === 'localhost' || location.hostname === '127.0.0.1';

window.onload = () => {
if ("serviceWorker" in navigator) {
try {
navigator.serviceWorker.register("./serviceWorker.js");
} catch (error) {
console.log(error);
}
}

if(location.host === urls.prod) {
!firebase.apps.length ? firebase.initializeApp(prodFirebaseConfig()) : firebase.app();
window.DD_RUM && window.DD_RUM.init({ ...datadogConfig, env: 'prod' });
Expand Down Expand Up @@ -101,7 +112,6 @@ const manageRoutes = async () => {
else if (route === "#allParticipants") allParticipantsScreen(auth, route);
else if (route === "#addressPrinted") addressesPrintedScreen(auth, route);
else if (route === "#assigned") assignedScreen(auth, route);
else if (route === "#status_shipped") kitStatusReportsShipped(auth, route);
else if (route === "#received") receivedKitsScreen(auth,route);
else if (route === "#kitshipment") kitShipmentScreen(auth, route);
else if (route === "#packagesintransit") packagesInTransitScreen(auth, route);
Expand Down
70 changes: 30 additions & 40 deletions serviceWorker.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');

const appVersion = "v24.7.0";
workbox.setConfig({debug: false});
const { registerRoute } = workbox.routing;
const { CacheFirst, NetworkFirst, StaleWhileRevalidate, NetworkOnly } = workbox.strategies;
const { CacheableResponse, CacheableResponsePlugin } = workbox.cacheableResponse;
const { CacheFirst, NetworkFirst } = workbox.strategies;
const { ExpirationPlugin } = workbox.expiration;
const { BackgroundSyncPlugin } = workbox.backgroundSync
const googleAnalytics = workbox.googleAnalytics;
const cacheNameMapper = {
"static-cache": `static-cache-${appVersion}`,
"images-cache": `images-cache-${appVersion}`,
};
const currCacheNameArray = Object.values(cacheNameMapper);

googleAnalytics.initialize();
registerRoute(/\.(?:js|css)$/, new NetworkFirst({cacheName: 'static-cache'}));
registerRoute(/\.(?:js|css|html)$/, new NetworkFirst({ cacheName: cacheNameMapper["static-cache"] }));
registerRoute(/\.(?:png|jpg|jpeg|svg|gif|ico)$/,
new CacheFirst({
cacheName: 'images-cache',
cacheName: cacheNameMapper["images-cache"],
plugins: [
new ExpirationPlugin({
maxEntries: 30,
Expand All @@ -21,41 +26,26 @@ registerRoute(/\.(?:png|jpg|jpeg|svg|gif|ico)$/,
})
);

registerRoute(
new RegExp('https://us-central1-nih-nci-dceg-connect-dev.cloudfunctions.net/.+'),
new NetworkFirst({
cacheName: 'api-cache',
plugins: [
new CacheableResponsePlugin({
statuses: [200],
})
]
}),
'GET'
);


const bgSyncPlugin = new BackgroundSyncPlugin('connectBiospecimen', {
maxRetentionTime: 24 * 60 // Retry for max of 24 Hours (specified in minutes)
self.addEventListener("install", () => {
self.skipWaiting();
});

registerRoute(
new RegExp('https://us-central1-nih-nci-dceg-connect-dev.cloudfunctions.net/.+'),
new NetworkOnly({
plugins: [bgSyncPlugin]
}),
'POST'
);
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(
cacheNames.map((cacheName) => {
if (!currCacheNameArray.includes(cacheName)) {
return caches.delete(cacheName);
}
})
);
})
);
});

registerRoute(
/index\.html$/,
new NetworkFirst({
cacheName: 'index-html-cache',
networkTimeoutSeconds: 3,
plugins: [
new CacheableResponsePlugin({
statuses: [0, 200],
}),
],
})
);
self.addEventListener("message", (event) => {
if (event.data.action === "getAppVersion") {
event.source.postMessage({ action: "sendAppVersion", payload: appVersion });
}
});
Loading