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 explorer edit link issue #4109

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions explorer/Explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ export class Explorer
...this.explorerProgram.grapherConfigOnlyGrapherProps,
bakedGrapherURL: BAKED_GRAPHER_URL,
dataApiUrl: DATA_API_URL,
adminBaseUrl: ADMIN_BASE_URL,
hideEntityControls: this.showExplorerControls,
manuallyProvideData: false,
}
Expand Down Expand Up @@ -606,6 +607,7 @@ export class Explorer
...this.explorerProgram.grapherConfigOnlyGrapherProps,
bakedGrapherURL: BAKED_GRAPHER_URL,
dataApiUrl: DATA_API_URL,
adminBaseUrl: ADMIN_BASE_URL,
hideEntityControls: this.showExplorerControls,
manuallyProvideData: false,
}
Expand Down Expand Up @@ -757,6 +759,7 @@ export class Explorer
...this.explorerProgram.grapherConfigOnlyGrapherProps,
bakedGrapherURL: BAKED_GRAPHER_URL,
dataApiUrl: DATA_API_URL,
adminBaseUrl: ADMIN_BASE_URL,
hideEntityControls: this.showExplorerControls,
manuallyProvideData: true,
}
Expand Down
14 changes: 3 additions & 11 deletions packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -882,18 +882,10 @@ export class Grapher
}

@computed get editUrl(): string | undefined {
const yColumnSlugs = this.yColumnSlugs
if (this.showAdminControls) {
// This is a workaround to make the edit button work for MDims. We
// probably want to do this in a more general way.
if (window._OWID_MULTI_DIM_PROPS) {
const varId = yColumnSlugs[0]

return `${this.adminBaseUrl ?? ""}/admin/variables/${varId}/config`
} else
return `${this.adminBaseUrl}/admin/${
this.manager?.editUrl ?? `charts/${this.id}/edit`
}`
return `${this.adminBaseUrl}/admin/${
this.manager?.editUrl ?? `charts/${this.id}/edit`
}`
}
return undefined
}
Expand Down