Closed abought closed 6 years ago
Sample usage details per @benralexander request. I will hold merge until we hear back, in case he requests any additional tweaks to meet their needs.
Once this is good we can bundle this up as LZ 0.7.1.
If you are using a completely new custom layout, you can simply specify this option in the button configuration by default when specifying panel.dashboard.components
:
{
components: [
{
type: "remove_panel",
position: "right",
color: "red",
group_position: "end",
suppress_confirm: true
}
]
}
But more often, you will be using an existing layout, so you will need to modify the layout object before rendering the plot for the first time. (there isn't any especially elegant mechanism for customizing just one piece of a deeply nested thing)
Here is about the least fragile version of that I could come up with.
// Get and customize a layout
var layout = LocusZoom.Layouts.get("plot", "standard_association");
layout.panels.forEach(function(panelLayout) {
panelLayout.dashboard.components.forEach(function(buttonLayout) {
if (buttonLayout.type === "remove_panel") {
buttonLayout.suppress_confirm = true;
}
});
});
// After the layout has been constructed- with any customizations desired- render the plot normally.
var plot = LocusZoom.populate("#plot", data_sources, layout);
Ben has tried it out, and merged. We'll release 0.7.1 in the AM.
Request from: Ben Alexander:
When a panel is removed from the plot, it automatically shows a dialog: "Are you sure you want to remove this panel? This cannot be undone!". As the portal experiments with more features to dynamically add panels, Ben would like an option to suppress this dialog from showing.