From 1daf7a08769ffcb9bc3441d9a168a0da344ec681 Mon Sep 17 00:00:00 2001 From: Birm Date: Wed, 10 Jan 2024 18:43:33 -0500 Subject: [PATCH 1/3] test open failed event --- apps/viewer/init.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/viewer/init.js b/apps/viewer/init.js index c948b229..c60f45b1 100644 --- a/apps/viewer/init.js +++ b/apps/viewer/init.js @@ -195,6 +195,10 @@ function initCore() { } $CAMIC.loadImg(function(e) { + $CAMIC.viewer.addHandler('open-failed', function(e){ + console.error(e.message) + alert("failed!") + }) // image loaded if (e.hasError) { // if this is a retry, assume normal behavior (one retry per slide) From 4cf3b4862d1c1212568356f039ba97312b9b02e8 Mon Sep 17 00:00:00 2001 From: Birm Date: Wed, 10 Jan 2024 18:49:46 -0500 Subject: [PATCH 2/3] tile error trigger redirect --- apps/heatmap/init.js | 4 ++++ apps/labeling/labeling.js | 4 ++++ apps/mini/init.js | 4 ++++ apps/model/model.js | 4 ++++ apps/segment/segment.js | 4 ++++ apps/viewer/init.js | 4 ++-- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/heatmap/init.js b/apps/heatmap/init.js index 6af0cea5..370a83d9 100644 --- a/apps/heatmap/init.js +++ b/apps/heatmap/init.js @@ -60,6 +60,10 @@ function initCore() { $CAMIC.loadImg(async function(e) { Loading.open(document.body, `Loading Data ...`); + $CAMIC.viewer.addHandler('open-failed', function(e){ + console.error(e.message, e) + redirect($D.pages.table, e.message, 5); + }) // image loaded if (e.hasError) { $UI.message.addError(e.message); diff --git a/apps/labeling/labeling.js b/apps/labeling/labeling.js index f7ce41e1..06f530fe 100644 --- a/apps/labeling/labeling.js +++ b/apps/labeling/labeling.js @@ -77,6 +77,10 @@ function initCore() { defaultText: `Slide: ${$D.params.data.name}`, }); } + $CAMIC.viewer.addHandler('open-failed', function(e){ + console.error(e.message, e) + redirect($D.pages.table, e.message, 5); + }) }); $CAMIC.viewer.addHandler('open', function() { diff --git a/apps/mini/init.js b/apps/mini/init.js index bbe10dac..7dbd4617 100644 --- a/apps/mini/init.js +++ b/apps/mini/init.js @@ -161,6 +161,10 @@ function initCore() { } $CAMIC.loadImg(function(e) { + $CAMIC.viewer.addHandler('open-failed', function(e){ + console.error(e.message, e) + redirect($D.pages.table, e.message, 5); + }) // image loaded if (e.hasError) { // if this is a retry, assume normal behavior (one retry per slide) diff --git a/apps/model/model.js b/apps/model/model.js index fdb370ba..99d117f5 100644 --- a/apps/model/model.js +++ b/apps/model/model.js @@ -404,6 +404,10 @@ function initCore() { } else { $D.params.data = e; } + $CAMIC.viewer.addHandler('open-failed', function(e){ + console.error(e.message, e) + redirect($D.pages.table, e.message, 5); + }) }); $CAMIC.store.getSlide($D.params.slideId).then((response) => { diff --git a/apps/segment/segment.js b/apps/segment/segment.js index 578879d9..c6bf774d 100644 --- a/apps/segment/segment.js +++ b/apps/segment/segment.js @@ -371,6 +371,10 @@ function initCore() { } else { $D.params.data = e; } + $CAMIC.viewer.addHandler('open-failed', function(e){ + console.error(e.message, e) + redirect($D.pages.table, e.message, 5); + }) }); $CAMIC.viewer.addOnceHandler('open', function(e) { diff --git a/apps/viewer/init.js b/apps/viewer/init.js index c60f45b1..cc08e0b8 100644 --- a/apps/viewer/init.js +++ b/apps/viewer/init.js @@ -196,8 +196,8 @@ function initCore() { $CAMIC.loadImg(function(e) { $CAMIC.viewer.addHandler('open-failed', function(e){ - console.error(e.message) - alert("failed!") + console.error(e.message, e) + redirect($D.pages.table, e.message, 5); }) // image loaded if (e.hasError) { From 25b7947f6aac42ea2fbfa9e44fb5ce634c43e0e5 Mon Sep 17 00:00:00 2001 From: Birm Date: Wed, 10 Jan 2024 18:52:55 -0500 Subject: [PATCH 3/3] lintfix --- apps/heatmap/init.js | 6 +++--- apps/labeling/labeling.js | 6 +++--- apps/model/model.js | 6 +++--- apps/segment/segment.js | 6 +++--- apps/viewer/init.js | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/heatmap/init.js b/apps/heatmap/init.js index 370a83d9..ea25a642 100644 --- a/apps/heatmap/init.js +++ b/apps/heatmap/init.js @@ -60,10 +60,10 @@ function initCore() { $CAMIC.loadImg(async function(e) { Loading.open(document.body, `Loading Data ...`); - $CAMIC.viewer.addHandler('open-failed', function(e){ - console.error(e.message, e) + $CAMIC.viewer.addHandler('open-failed', function(e) { + console.error(e.message, e); redirect($D.pages.table, e.message, 5); - }) + }); // image loaded if (e.hasError) { $UI.message.addError(e.message); diff --git a/apps/labeling/labeling.js b/apps/labeling/labeling.js index 06f530fe..50899f0b 100644 --- a/apps/labeling/labeling.js +++ b/apps/labeling/labeling.js @@ -77,10 +77,10 @@ function initCore() { defaultText: `Slide: ${$D.params.data.name}`, }); } - $CAMIC.viewer.addHandler('open-failed', function(e){ - console.error(e.message, e) + $CAMIC.viewer.addHandler('open-failed', function(e) { + console.error(e.message, e); redirect($D.pages.table, e.message, 5); - }) + }); }); $CAMIC.viewer.addHandler('open', function() { diff --git a/apps/model/model.js b/apps/model/model.js index 99d117f5..ad35d55e 100644 --- a/apps/model/model.js +++ b/apps/model/model.js @@ -404,10 +404,10 @@ function initCore() { } else { $D.params.data = e; } - $CAMIC.viewer.addHandler('open-failed', function(e){ - console.error(e.message, e) + $CAMIC.viewer.addHandler('open-failed', function(e) { + console.error(e.message, e); redirect($D.pages.table, e.message, 5); - }) + }); }); $CAMIC.store.getSlide($D.params.slideId).then((response) => { diff --git a/apps/segment/segment.js b/apps/segment/segment.js index c6bf774d..46c92240 100644 --- a/apps/segment/segment.js +++ b/apps/segment/segment.js @@ -371,10 +371,10 @@ function initCore() { } else { $D.params.data = e; } - $CAMIC.viewer.addHandler('open-failed', function(e){ - console.error(e.message, e) + $CAMIC.viewer.addHandler('open-failed', function(e) { + console.error(e.message, e); redirect($D.pages.table, e.message, 5); - }) + }); }); $CAMIC.viewer.addOnceHandler('open', function(e) { diff --git a/apps/viewer/init.js b/apps/viewer/init.js index cc08e0b8..8a0c8643 100644 --- a/apps/viewer/init.js +++ b/apps/viewer/init.js @@ -195,10 +195,10 @@ function initCore() { } $CAMIC.loadImg(function(e) { - $CAMIC.viewer.addHandler('open-failed', function(e){ - console.error(e.message, e) + $CAMIC.viewer.addHandler('open-failed', function(e) { + console.error(e.message, e); redirect($D.pages.table, e.message, 5); - }) + }); // image loaded if (e.hasError) { // if this is a retry, assume normal behavior (one retry per slide)