Skip to content
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: 0 additions & 1 deletion frontend/javascripts/messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ instead. Only enable this option if you understand its effect. All layers will n
"dataset.name.already_taken":
"This name is already being used by a different dataset. Please choose a different name.",
"dataset.no_data": "No data available! Something seems to be wrong with the dataset.",
"dataset.not_imported": "Please double check if you have the dataset imported:",
"dataset.changed_without_reload":
"Model.fetch was called for a task with another dataset, without reloading the page.",
"dataset.import.required.name": "Please provide a name for the dataset.",
Expand Down
17 changes: 14 additions & 3 deletions frontend/javascripts/viewer/model_initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export async function initialize(
datasetId,
version,
);
assertUsableDataset(apiDataset as StoreDataset, initialCommandType);
maybeFixDatasetNameInURL(apiDataset, initialCommandType);

const serverVolumeTracings = getServerVolumeTracings(serverTracings);
Expand Down Expand Up @@ -468,20 +469,30 @@ export function preprocessDataset(
return mutableDataset as StoreDataset;
}

function initializeDataset(initialFetch: boolean, dataset: StoreDataset): void {
function assertUsableDataset(dataset: StoreDataset, initialCommandType: TraceOrViewCommand) {
let error;
let annotationNote = "";
if (initialCommandType.type === ControlModeEnum.TRACE) {
annotationNote = `Failed to load annotation ${initialCommandType.annotationId}: `;
}

if (!dataset) {
error = messages["dataset.does_not_exist"];
error = `${annotationNote}${messages["dataset.does_not_exist"]}`;
} else if (!dataset.dataSource.dataLayers) {
error = `${messages["dataset.not_imported"]} '${dataset.name}'`;
let statusNote = ".";
if (dataset.dataSource.status) {
statusNote = `: ${dataset.dataSource.status}`;
}
error = `${annotationNote}Dataset ‘${dataset.name}’ (${dataset.id}) is not available${statusNote}`;
}

if (error) {
Toast.error(error);
throw HANDLED_ERROR;
}
}

function initializeDataset(initialFetch: boolean, dataset: StoreDataset): void {
// Make sure subsequent fetch calls are always for the same dataset
if (!initialFetch) {
ErrorHandling.assert(
Expand Down
2 changes: 2 additions & 0 deletions unreleased_changes/8956.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Changed
- Improved the error message when loading an unusable dataset or an annotation for an unusable dataset