mirror of
https://github.com/getredash/redash.git
synced 2026-03-21 16:00:09 -04:00
* Add visualizations project settings * Move visualizations to redash-visualizations * Delete shared components * Remove antd from deps * Remove p-r-5 from table utils * Remove visualization deps from package.json * Rename package and change its version * Test preinstall script * Update Dockerfile build for frontend * Test adding dockerignore * Update jest tests * Add step for jest tests * Include viz-lib on dev commands * User prettier v1 for now * Delete unused libs on the app * Add readme draft (to be finished) * Add getOptions to Editor * Add required libraries and finish basic example * Bump version
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import React from "react";
|
|
import { pick } from "lodash";
|
|
import HelpTrigger from "@/components/HelpTrigger";
|
|
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,
|
|
choroplethAvailableMaps: {
|
|
countries: {
|
|
name: "Countries",
|
|
url: countriesDataUrl,
|
|
},
|
|
subdiv_japan: {
|
|
name: "Japan/Prefectures",
|
|
url: subdivJapanDataUrl,
|
|
},
|
|
},
|
|
...pick(clientConfig, [
|
|
"dateFormat",
|
|
"dateTimeFormat",
|
|
"integerFormat",
|
|
"floatFormat",
|
|
"booleanValues",
|
|
"tableCellMaxJSONSize",
|
|
"allowCustomJSVisualization",
|
|
"hidePlotlyModeBar",
|
|
]),
|
|
});
|
|
|
|
return <WrappedComponent {...props} />;
|
|
};
|
|
}
|
|
|
|
export const Renderer = wrapComponentWithSettings(VisRenderer);
|
|
export const Editor = wrapComponentWithSettings(VisEditor);
|