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

refactored PluginSpec.config

parent 545cd650
No related branches found
No related tags found
No related merge requests found
......@@ -83,18 +83,18 @@ export class Viewer {
...DefaultPluginSpec.components,
remoteState: o.layoutShowRemoteState ? 'default' : 'none',
},
config: DefaultPluginSpec.config
config: [
[PluginConfig.Viewport.ShowExpand, o.viewportShowExpand],
[PluginConfig.Viewport.ShowSelectionMode, o.viewportShowSelectionMode],
[PluginConfig.Viewport.ShowAnimation, o.viewportShowAnimation],
[PluginConfig.State.DefaultServer, o.pluginStateServer],
[PluginConfig.State.CurrentServer, o.pluginStateServer],
[PluginConfig.VolumeStreaming.DefaultServer, o.volumeStreamingServer],
[PluginConfig.Download.DefaultPdbProvider, o.pdbProvider],
[PluginConfig.Download.DefaultEmdbProvider, o.emdbProvider]
]
};
spec.config?.set(PluginConfig.Viewport.ShowExpand, o.viewportShowExpand);
spec.config?.set(PluginConfig.Viewport.ShowSelectionMode, o.viewportShowSelectionMode);
spec.config?.set(PluginConfig.Viewport.ShowAnimation, o.viewportShowAnimation);
spec.config?.set(PluginConfig.State.DefaultServer, o.pluginStateServer);
spec.config?.set(PluginConfig.State.CurrentServer, o.pluginStateServer);
spec.config?.set(PluginConfig.VolumeStreaming.DefaultServer, o.volumeStreamingServer);
spec.config?.set(PluginConfig.Download.DefaultPdbProvider, o.pdbProvider);
spec.config?.set(PluginConfig.Download.DefaultEmdbProvider, o.emdbProvider);
const element = document.getElementById(elementId);
if (!element) throw new Error(`Could not get element with id '${elementId}'`);
this.plugin = createPlugin(element, spec);
......
......@@ -64,8 +64,8 @@ export class PluginConfigManager {
this._config.delete(key);
}
constructor(initial?: Map<PluginConfigItem, unknown>) {
constructor(initial?: [PluginConfigItem, unknown][]) {
if (!initial) return;
initial.forEach((v, k) => this._config.set(k, v));
initial.forEach(([k, v]) => this._config.set(k, v));
}
}
\ No newline at end of file
......@@ -15,7 +15,6 @@ import { Plugin } from '../mol-plugin-ui/plugin';
import { PluginBehaviors } from './behavior';
import { StructureFocusRepresentation } from './behavior/dynamic/selection/structure-focus-representation';
import { BoxifyVolumeStreaming, CreateVolumeStreamingBehavior, InitVolumeStreaming } from './behavior/dynamic/volume-streaming/transformers';
import { PluginConfig } from './config';
import { PluginContext } from './context';
import { PluginSpec } from './spec';
import { AssignColorVolume } from '../mol-plugin-state/actions/volume';
......@@ -89,11 +88,7 @@ export const DefaultPluginSpec: PluginSpec = {
AnimateAssemblyUnwind,
AnimateUnitsExplode,
AnimateStateInterpolation
],
config: new Map([
[PluginConfig.State.DefaultServer, 'https://webchem.ncbr.muni.cz/molstar-state'],
[PluginConfig.VolumeStreaming.DefaultServer, 'https://ds.litemol.org']
])
]
};
export function createPlugin(target: HTMLElement, spec?: PluginSpec): PluginContext {
......
......@@ -30,7 +30,7 @@ interface PluginSpec {
controls?: React.ComponentClass
}
},
config?: Map<PluginConfigItem, unknown>
config?: [PluginConfigItem, unknown][]
}
namespace PluginSpec {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment