Skip to content
Snippets Groups Projects
Commit f786f72f authored by David Sehnal's avatar David Sehnal
Browse files

mol-plugin: transform ui tweak

parent bc5b2219
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
......@@ -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();
......
......@@ -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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment