From f786f72f6a209b6bfb5eed9e947d5cf42dbbc4d0 Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Wed, 21 Nov 2018 12:48:12 +0100 Subject: [PATCH] mol-plugin: transform ui tweak --- src/mol-plugin/ui/state/apply-action.tsx | 1 + src/mol-plugin/ui/state/common.tsx | 3 ++- src/mol-plugin/ui/state/update-transform.tsx | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mol-plugin/ui/state/apply-action.tsx b/src/mol-plugin/ui/state/apply-action.tsx index 585c8fe67..cfc0157dc 100644 --- a/src/mol-plugin/ui/state/apply-action.tsx +++ b/src/mol-plugin/ui/state/apply-action.tsx @@ -45,6 +45,7 @@ class ApplyActionContol extends TransformContolBase<ApplyActionContol.Props, App getHeaderFallback() { return this.props.action.id; } canApply() { return !this.state.error && !this.state.busy; } applyText() { return 'Apply'; } + isUpdate() { return false; } private _getInfo = memoizeOne((t: Transform.Ref, v: string) => StateTransformParameters.infoFromAction(this.plugin, this.props.state, this.props.action, this.props.nodeRef)); diff --git a/src/mol-plugin/ui/state/common.tsx b/src/mol-plugin/ui/state/common.tsx index d58978b55..faa468f19 100644 --- a/src/mol-plugin/ui/state/common.tsx +++ b/src/mol-plugin/ui/state/common.tsx @@ -102,6 +102,7 @@ abstract class TransformContolBase<P, S extends TransformContolBase.ControlState abstract getHeaderFallback(): string; abstract canApply(): boolean; abstract applyText(): string; + abstract isUpdate(): boolean; abstract state: S; private busy: Subject<boolean>; @@ -146,7 +147,7 @@ abstract class TransformContolBase<P, S extends TransformContolBase.ControlState render() { const info = this.getInfo(); - if (info.isEmpty) return null; + if (info.isEmpty && this.isUpdate()) return null; const display = this.getHeader(); diff --git a/src/mol-plugin/ui/state/update-transform.tsx b/src/mol-plugin/ui/state/update-transform.tsx index 040e0195b..40b61774d 100644 --- a/src/mol-plugin/ui/state/update-transform.tsx +++ b/src/mol-plugin/ui/state/update-transform.tsx @@ -32,6 +32,7 @@ class UpdateTransformContol extends TransformContolBase<UpdateTransformContol.Pr getHeaderFallback() { return this.props.transform.transformer.definition.name; } canApply() { return !this.state.error && !this.state.busy && !this.state.isInitial; } applyText() { return this.canApply() ? 'Update' : 'Nothing to Update'; } + isUpdate() { return true; } private _getInfo = memoizeOne((t: Transform) => StateTransformParameters.infoFromTransform(this.plugin, this.props.state, this.props.transform)); -- GitLab