|
@@ -2,10 +2,11 @@
|
|
|
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
*
|
|
|
* @author David Sehnal <david.sehnal@gmail.com>
|
|
|
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
|
*/
|
|
|
|
|
|
import * as React from 'react';
|
|
|
-import { InitVolumeStreaming } from '../../mol-plugin/behavior/dynamic/volume-streaming/transformers';
|
|
|
+import { InitVolumeStreaming, CreateVolumeStreamingInfo } from '../../mol-plugin/behavior/dynamic/volume-streaming/transformers';
|
|
|
import { CollapsableControls, CollapsableState } from '../base';
|
|
|
import { ApplyActionControl } from '../state/apply-action';
|
|
|
import { UpdateTransformControl } from '../state/update-transform';
|
|
@@ -13,6 +14,7 @@ import { BindingsHelp } from '../viewport/help';
|
|
|
import { ExpandGroup } from '../controls/common';
|
|
|
import { StructureHierarchyManager } from '../../mol-plugin-state/manager/structure/hierarchy';
|
|
|
import { FocusLoci } from '../../mol-plugin/behavior/dynamic/representation';
|
|
|
+import { StateSelection } from '../../mol-state';
|
|
|
|
|
|
interface VolumeStreamingControlState extends CollapsableState {
|
|
|
isBusy: boolean
|
|
@@ -31,14 +33,15 @@ export class VolumeStreamingControls extends CollapsableControls<{}, VolumeStrea
|
|
|
|
|
|
componentDidMount() {
|
|
|
// TODO: do not hide this but instead show some help text??
|
|
|
- this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, () => this.setState({ isHidden: !this.canEnable() }));
|
|
|
+ this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, () => {
|
|
|
+ this.setState({
|
|
|
+ isHidden: !this.canEnable(),
|
|
|
+ description: StructureHierarchyManager.getSelectedStructuresDescription(this.plugin)
|
|
|
+ })
|
|
|
+ });
|
|
|
this.subscribe(this.plugin.behaviors.state.isBusy, v => {
|
|
|
this.setState({ isBusy: v })
|
|
|
});
|
|
|
-
|
|
|
- this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, c => this.setState({
|
|
|
- description: StructureHierarchyManager.getSelectedStructuresDescription(this.plugin)
|
|
|
- }));
|
|
|
}
|
|
|
|
|
|
get pivot() {
|
|
@@ -55,7 +58,12 @@ export class VolumeStreamingControls extends CollapsableControls<{}, VolumeStrea
|
|
|
|
|
|
renderEnable() {
|
|
|
const pivot = this.pivot;
|
|
|
- return <ApplyActionControl state={pivot.cell.parent} action={InitVolumeStreaming} initiallyCollapsed={true} nodeRef={pivot.cell.transform.ref} simpleApply={{ header: 'Enable', icon: 'check' }} />;
|
|
|
+ const errored = this.plugin.state.data.select(StateSelection.Generators.ofTransformerWithError(CreateVolumeStreamingInfo, pivot.cell.transform.ref))[0];
|
|
|
+ const simpleApply = errored
|
|
|
+ ? { header: 'Error enabling', icon: 'alert' as const, title: errored.errorText }
|
|
|
+ : { header: 'Enable', icon: 'check' as const, title: 'Enable' }
|
|
|
+
|
|
|
+ return <ApplyActionControl state={pivot.cell.parent} action={InitVolumeStreaming} initiallyCollapsed={true} nodeRef={pivot.cell.transform.ref} simpleApply={simpleApply} />;
|
|
|
}
|
|
|
|
|
|
renderParams() {
|