Skip to content
Snippets Groups Projects
Commit 5402ee00 authored by dsehnal's avatar dsehnal
Browse files

ApplyActionControl param handling

parent 02654ea5
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ Note that since we don't clearly distinguish between a public and private interf ...@@ -15,6 +15,7 @@ Note that since we don't clearly distinguish between a public and private interf
- Add interior cylinder caps - Add interior cylinder caps
- Add per-pixel object clipping - Add per-pixel object clipping
- Fix `QualityAssessment` assignment bug for structures with different auth vs label sequence numbering - Fix `QualityAssessment` assignment bug for structures with different auth vs label sequence numbering
- Refresh `ApplyActionControl`'s param definition when toggling expanded state
## [v3.26.0] - 2022-12-04 ## [v3.26.0] - 2022-12-04
......
...@@ -28,7 +28,8 @@ namespace ApplyActionControl { ...@@ -28,7 +28,8 @@ namespace ApplyActionControl {
params: any, params: any,
error?: string, error?: string,
busy: boolean, busy: boolean,
isInitial: boolean isInitial: boolean,
isCollapsed?: boolean,
} }
} }
...@@ -40,7 +41,7 @@ class ApplyActionControl extends TransformControlBase<ApplyActionControl.Props, ...@@ -40,7 +41,7 @@ class ApplyActionControl extends TransformControlBase<ApplyActionControl.Props,
ref: this.props.nodeRef ref: this.props.nodeRef
}); });
} }
getInfo() { return this._getInfo(this.props.nodeRef, this.props.state.transforms.get(this.props.nodeRef).version); } getInfo() { return this._getInfo(this.props.nodeRef, this.props.state.transforms.get(this.props.nodeRef).version, this.state?.isCollapsed); }
getTransformerId() { return this.props.state.transforms.get(this.props.nodeRef).transformer.id; } getTransformerId() { return this.props.state.transforms.get(this.props.nodeRef).transformer.id; }
getHeader() { return this.props.hideHeader ? 'none' : this.props.action.definition.display; } getHeader() { return this.props.hideHeader ? 'none' : this.props.action.definition.display; }
canApply() { return !this.state.error && !this.state.busy; } canApply() { return !this.state.error && !this.state.busy; }
...@@ -49,9 +50,9 @@ class ApplyActionControl extends TransformControlBase<ApplyActionControl.Props, ...@@ -49,9 +50,9 @@ class ApplyActionControl extends TransformControlBase<ApplyActionControl.Props,
isUpdate() { return false; } isUpdate() { return false; }
getSourceAndTarget() { return { a: this.props.state.cells.get(this.props.nodeRef)!.obj }; } getSourceAndTarget() { return { a: this.props.state.cells.get(this.props.nodeRef)!.obj }; }
private _getInfo = memoizeLatest((t: StateTransform.Ref, v: string) => StateTransformParameters.infoFromAction(this.plugin, this.props.state, this.props.action, this.props.nodeRef)); private _getInfo = memoizeLatest((t: StateTransform.Ref, v: string, collapsed?: boolean) => StateTransformParameters.infoFromAction(this.plugin, this.props.state, this.props.action, this.props.nodeRef));
state = { plugin: this.plugin, ref: this.props.nodeRef, version: this.props.state.transforms.get(this.props.nodeRef).version, error: void 0, isInitial: true, params: this.getInfo().initialValues, busy: false, isCollapsed: this.props.initiallyCollapsed }; state: ApplyActionControl.ComponentState = { plugin: this.plugin, ref: this.props.nodeRef, version: this.props.state.transforms.get(this.props.nodeRef).version, error: void 0, isInitial: true, params: this.getInfo().initialValues, busy: false, isCollapsed: this.props.initiallyCollapsed };
static getDerivedStateFromProps(props: ApplyActionControl.Props, state: ApplyActionControl.ComponentState) { static getDerivedStateFromProps(props: ApplyActionControl.Props, state: ApplyActionControl.ComponentState) {
const version = props.state.transforms.get(props.nodeRef).version; const version = props.state.transforms.get(props.nodeRef).version;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment