Skip to content

Commit 55d5705

Browse files
authored
Use (first usable) datastore url when importing remote dataset (#6462)
* use (first usable) datastore url when importing remote dataset * update changelog
1 parent 626f88f commit 55d5705

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
2121
- Fixed sharing button for users who are currently visiting a dataset or annotation which was shared with them. [#6438](https://github.com/scalableminds/webknossos/pull/6438)
2222
- Fixed the duplicate function for annotations with an editable mapping (a.k.a. supervoxel proofreading) layer. [#6446](https://github.com/scalableminds/webknossos/pull/6446)
2323
- Fixed isosurface loading for volume annotations with mappings. [#6458](https://github.com/scalableminds/webknossos/pull/6458)
24+
- Fixed importing of remote datastore (e.g., zarr) when datastore is set up separately. [#6462](https://github.com/scalableminds/webknossos/pull/6462)
2425

2526
### Removed
2627

frontend/javascripts/admin/admin_rest_api.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1479,12 +1479,13 @@ export async function exploreRemoteDataset(
14791479
}
14801480

14811481
export async function storeRemoteDataset(
1482+
datastoreUrl: string,
14821483
datasetName: string,
14831484
organizationName: string,
14841485
datasource: string,
14851486
): Promise<Response> {
14861487
return doWithToken((token) =>
1487-
fetch(`/data/datasets/${organizationName}/${datasetName}?token=${token}`, {
1488+
fetch(`${datastoreUrl}/data/datasets/${organizationName}/${datasetName}?token=${token}`, {
14881489
method: "PUT",
14891490
headers: { "Content-Type": "application/json" },
14901491
body: datasource,

frontend/javascripts/admin/dataset/dataset_add_zarr_view.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Form, Input, Button, Col, Radio, Row, Collapse } from "antd";
22
import { connect } from "react-redux";
33
import React, { useState } from "react";
4-
import type { APIUser } from "types/api_flow_types";
4+
import type { APIDataStore, APIUser } from "types/api_flow_types";
55
import type { OxalisState } from "oxalis/store";
66
import { exploreRemoteDataset, isDatasetNameValid, storeRemoteDataset } from "admin/admin_rest_api";
77
import messages from "messages";
@@ -21,6 +21,7 @@ const RadioGroup = Radio.Group;
2121

2222
type OwnProps = {
2323
onAdded: (arg0: string, arg1: string) => Promise<void>;
24+
datastores: Array<APIDataStore>;
2425
};
2526
type StateProps = {
2627
activeUser: APIUser | null | undefined;
@@ -136,6 +137,13 @@ function DatasetAddZarrView(props: Props) {
136137
}
137138

138139
async function handleStoreDataset() {
140+
const uploadableDatastores = props.datastores.filter((datastore) => datastore.allowsUpload);
141+
const datastoreToUse = uploadableDatastores[0];
142+
if (!datastoreToUse) {
143+
Toast.error("Could not find datastore that allows uploading.");
144+
return;
145+
}
146+
139147
if (datasourceConfig && activeUser) {
140148
let configJSON;
141149
try {
@@ -148,6 +156,7 @@ function DatasetAddZarrView(props: Props) {
148156
throw new Error(nameValidationResult);
149157
}
150158
const response = await storeRemoteDataset(
159+
datastoreToUse.url,
151160
configJSON.id.name,
152161
activeUser.organization,
153162
datasourceConfig,

0 commit comments

Comments
 (0)