Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the isolated linker #324

Merged
merged 2 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/dashboard-core-plugins/src/linker/Linker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class Linker extends Component<LinkerProps, LinkerState> {
isAlwaysEndPoint = false,
overrideIsolatedLinkerPanelId?: string
): void {
if (overrideIsolatedLinkerPanelId == null && !this.isOverlayShown()) {
if (overrideIsolatedLinkerPanelId === undefined && !this.isOverlayShown()) {
return;
}
const { isolatedLinkerPanelId } = this.props;
Expand Down Expand Up @@ -398,7 +398,7 @@ export class Linker extends Component<LinkerProps, LinkerState> {

handleAllLinksDeleted(): void {
const { links, isolatedLinkerPanelId } = this.props;
if (isolatedLinkerPanelId == null) {
if (isolatedLinkerPanelId === undefined) {
this.deleteLinks(links, true);
} else {
const isolatedLinks = links.filter(
Expand Down Expand Up @@ -519,7 +519,7 @@ export class Linker extends Component<LinkerProps, LinkerState> {
combinedLinks.push(linkInProgress);
}

if (isolateForPanelId != null) {
if (isolateForPanelId !== undefined) {
return combinedLinks.filter(
link =>
link?.start?.panelId === isolateForPanelId ||
Expand Down Expand Up @@ -614,7 +614,7 @@ export class Linker extends Component<LinkerProps, LinkerState> {
const isLinkOverlayShown = this.isOverlayShown();
const disabled = linkInProgress != null && linkInProgress.start != null;
const linkerOverlayMessage =
isolatedLinkerPanelId === null
isolatedLinkerPanelId === undefined
? 'Click a column source, then click a column target to create a filter link. Remove a filter link by clicking again to erase. Click done when finished.'
: 'Create a link between the source column button and a table column by clicking on one, then the other. Remove the link by clicking it directly. Click done when finished.';
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/dashboard-core-plugins/src/panels/ChartPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export class ChartPanel extends Component {
setActiveTool,
setDashboardIsolatedLinkerPanelId,
} = this.props;
setDashboardIsolatedLinkerPanelId(localDashboardId, null);
setDashboardIsolatedLinkerPanelId(localDashboardId, undefined);
setActiveTool(ToolType.LINKER);
}

Expand Down Expand Up @@ -1007,7 +1007,7 @@ const mapStateToProps = (state, ownProps) => {
localDashboardId
);
const isLinkerActive =
activeTool === ToolType.LINKER && isolatedLinkerPanelId === null;
activeTool === ToolType.LINKER && isolatedLinkerPanelId === undefined;
return {
columnSelectionValidator: getColumnSelectionValidatorForDashboard(
state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,12 +671,13 @@ const mapStateToProps = (state, ownProps) => {
);
const isLinkerActive =
activeTool === ToolType.LINKER &&
(isolatedLinkerPanelId === null || isolatedLinkerPanelId === panelId);
(isolatedLinkerPanelId === undefined || isolatedLinkerPanelId === panelId);
// Disable linking if linker is in isolated mode for a different panel
const disableLinking =
activeTool === ToolType.LINKER &&
isolatedLinkerPanelId !== null &&
isolatedLinkerPanelId !== undefined &&
isolatedLinkerPanelId !== panelId;

return {
columns: getColumnsForDashboard(state, localDashboardId),
columnSelectionValidator: getColumnSelectionValidatorForDashboard(
Expand Down