Browse Source

mol-plugin: transform ui tweak

David Sehnal 6 years ago
parent
commit
f786f72f6a

+ 1 - 0
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));
 

+ 2 - 1
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();
 

+ 1 - 0
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));