Skip to content

Commit 6b4b192

Browse files
Call triggers/reload with fallback layer name (#8298)
* check if histogram is available before reloading its data * use fallbacklayer name for triggers/request route * pass tracing id to api reloadbuckets * add changelog * address review --------- Co-authored-by: Philipp Otto <philippotto@users.noreply.github.com>
1 parent e5aecf5 commit 6b4b192

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
3939
- Fixed some layout issues in the upload view. [#8231](https://github.com/scalableminds/webknossos/pull/8231)
4040
- Fixed `FATAL: role "postgres" does not exist` error message in Docker compose. [#8240](https://github.com/scalableminds/webknossos/pull/8240)
4141
- Fixed the Zarr 3 implementation not accepting BytesCodec without "configuration" key. [#8282](https://github.com/scalableminds/webknossos/pull/8282)
42+
- Fixed that reloading the data of a volume annotation layer did not work properly. [#8298](https://github.com/scalableminds/webknossos/pull/8298)
4243
- Removed the magnification slider for the TIFF export within the download modal if only one magnification is available for the selected layer. [#8297](https://github.com/scalableminds/webknossos/pull/8297)
4344

4445
### Removed

frontend/javascripts/oxalis/view/left-border-tabs/layer_settings_tab.tsx

+25-9
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,19 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
386386
);
387387
};
388388

389-
getReloadDataButton = (layerName: string) => {
389+
getReloadDataButton = (
390+
layerName: string,
391+
isHistogramAvailable: boolean,
392+
maybeFallbackLayerName: string | null,
393+
) => {
390394
const tooltipText = "Use this when the data on the server changed.";
391395
return (
392396
<FastTooltip title={tooltipText}>
393-
<div onClick={() => this.reloadLayerData(layerName)}>
397+
<div
398+
onClick={() =>
399+
this.reloadLayerData(layerName, isHistogramAvailable, maybeFallbackLayerName)
400+
}
401+
>
394402
<ReloadOutlined className="icon-margin-right" />
395403
Reload data from server
396404
</div>
@@ -585,6 +593,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
585593
isInEditMode: boolean,
586594
layerName: string,
587595
layerSettings: DatasetLayerConfiguration,
596+
isHistogramAvailable: boolean,
588597
hasLessThanTwoColorLayers: boolean = true,
589598
) => {
590599
const { tracing, dataset, isAdminOrManager } = this.props;
@@ -645,7 +654,10 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
645654
}
646655
: null,
647656
this.props.dataset.isEditable
648-
? { label: this.getReloadDataButton(layerName), key: "reloadDataButton" }
657+
? {
658+
label: this.getReloadDataButton(layerName, isHistogramAvailable, maybeFallbackLayer),
659+
key: "reloadDataButton",
660+
}
649661
: null,
650662
{
651663
label: this.getFindDataButton(layerName, isDisabled, isColorLayer, maybeVolumeTracing),
@@ -976,6 +988,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
976988
);
977989

978990
const defaultLayerViewConfig = getDefaultLayerViewConfiguration();
991+
const isHistogramAvailable = isHistogramSupported(elementClass) && isColorLayer;
979992

980993
return (
981994
<div key={layerName} style={style} ref={setNodeRef}>
@@ -985,6 +998,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
985998
isInEditMode,
986999
layerName,
9871000
layerConfiguration,
1001+
isHistogramAvailable,
9881002
hasLessThanTwoColorLayers,
9891003
)}
9901004
{isDisabled ? null : (
@@ -994,9 +1008,7 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
9941008
marginLeft: 10,
9951009
}}
9961010
>
997-
{isHistogramSupported(elementClass) && layerName != null && isColorLayer
998-
? this.getHistogram(layerName, layerConfiguration)
999-
: null}
1011+
{isHistogramAvailable && this.getHistogram(layerName, layerConfiguration)}
10001012
<NumberSliderSetting
10011013
label={opacityLabel}
10021014
min={0}
@@ -1077,9 +1089,13 @@ class DatasetSettings extends React.PureComponent<DatasetSettingsProps, State> {
10771089
);
10781090
};
10791091

1080-
reloadLayerData = async (layerName: string): Promise<void> => {
1081-
await clearCache(this.props.dataset, layerName);
1082-
this.props.reloadHistogram(layerName);
1092+
reloadLayerData = async (
1093+
layerName: string,
1094+
isHistogramAvailable: boolean,
1095+
maybeFallbackLayerName: string | null,
1096+
): Promise<void> => {
1097+
await clearCache(this.props.dataset, maybeFallbackLayerName ?? layerName);
1098+
if (isHistogramAvailable) this.props.reloadHistogram(layerName);
10831099
await api.data.reloadBuckets(layerName);
10841100
Toast.success(`Successfully reloaded data of layer ${layerName}.`);
10851101
};

0 commit comments

Comments
 (0)