Files
redash/client/app/components/visualizations/visualizationComponents.jsx
Levko Kravets 681b2f1abd Introduce Link component (#5122)
* Introduce Link component

* Use Link component for external links as well

* Remove unused file (I hope it's really not needed)

* Use Link component in visualizations library

* Simplify Link component implementation

* CR1

* Trigger build

* CR2
2020-08-30 15:33:38 +03:00

44 lines
1.4 KiB
JavaScript

import React from "react";
import { pick } from "lodash";
import HelpTrigger from "@/components/HelpTrigger";
import Link from "@/components/Link";
import { Renderer as VisRenderer, Editor as VisEditor, updateVisualizationsSettings } from "@redash/viz/lib";
import { clientConfig } from "@/services/auth";
import countriesDataUrl from "@redash/viz/lib/visualizations/choropleth/maps/countries.geo.json";
import subdivJapanDataUrl from "@redash/viz/lib/visualizations/choropleth/maps/japan.prefectures.geo.json";
function wrapComponentWithSettings(WrappedComponent) {
return function VisualizationComponent(props) {
updateVisualizationsSettings({
HelpTriggerComponent: HelpTrigger,
LinkComponent: Link,
choroplethAvailableMaps: {
countries: {
name: "Countries",
url: countriesDataUrl,
},
subdiv_japan: {
name: "Japan/Prefectures",
url: subdivJapanDataUrl,
},
},
...pick(clientConfig, [
"dateFormat",
"dateTimeFormat",
"integerFormat",
"floatFormat",
"booleanValues",
"tableCellMaxJSONSize",
"allowCustomJSVisualizations",
"hidePlotlyModeBar",
]),
});
return <WrappedComponent {...props} />;
};
}
export const Renderer = wrapComponentWithSettings(VisRenderer);
export const Editor = wrapComponentWithSettings(VisEditor);