From 4cf3b4862d1c1212568356f039ba97312b9b02e8 Mon Sep 17 00:00:00 2001 From: Birm Date: Wed, 10 Jan 2024 18:49:46 -0500 Subject: [PATCH] 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) {