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 ...@@ -45,6 +45,7 @@ class ApplyActionContol extends TransformContolBase<ApplyActionContol.Props, App
getHeaderFallback() { return this.props.action.id; } getHeaderFallback() { return this.props.action.id; }
canApply() { return !this.state.error && !this.state.busy; } canApply() { return !this.state.error && !this.state.busy; }
applyText() { return 'Apply'; } 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)); 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 ...@@ -102,6 +102,7 @@ abstract class TransformContolBase<P, S extends TransformContolBase.ControlState
abstract getHeaderFallback(): string; abstract getHeaderFallback(): string;
abstract canApply(): boolean; abstract canApply(): boolean;
abstract applyText(): string; abstract applyText(): string;
abstract isUpdate(): boolean;
abstract state: S; abstract state: S;
private busy: Subject<boolean>; private busy: Subject<boolean>;
...@@ -146,7 +147,7 @@ abstract class TransformContolBase<P, S extends TransformContolBase.ControlState ...@@ -146,7 +147,7 @@ abstract class TransformContolBase<P, S extends TransformContolBase.ControlState
render() { render() {
const info = this.getInfo(); const info = this.getInfo();
if (info.isEmpty) return null; if (info.isEmpty && this.isUpdate()) return null;
const display = this.getHeader(); const display = this.getHeader();
......
...@@ -32,6 +32,7 @@ class UpdateTransformContol extends TransformContolBase<UpdateTransformContol.Pr ...@@ -32,6 +32,7 @@ class UpdateTransformContol extends TransformContolBase<UpdateTransformContol.Pr
getHeaderFallback() { return this.props.transform.transformer.definition.name; } getHeaderFallback() { return this.props.transform.transformer.definition.name; }
canApply() { return !this.state.error && !this.state.busy && !this.state.isInitial; } canApply() { return !this.state.error && !this.state.busy && !this.state.isInitial; }
applyText() { return this.canApply() ? 'Update' : 'Nothing to Update'; } 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)); 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.
Please register or to comment