From d22023bec9892d44e9ff55d778d4011cab59f61a Mon Sep 17 00:00:00 2001 From: ManApart Date: Tue, 3 Sep 2019 15:07:18 -0400 Subject: [PATCH] Add mapbox token to env variables smartcitiesdata/discovery-ui#184 co-authored-by: Cameron Marsh --- config/config.js | 1 + package-lock.json | 18 +++++++++--------- run.sh | 1 + .../chart/chart-visualization.js | 3 +++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/config/config.js b/config/config.js index 388c174..9ed612a 100644 --- a/config/config.js +++ b/config/config.js @@ -3,3 +3,4 @@ window.GTM_ID = '' window.BASE_URL = 'example.com' window.STREETS_TILE_LAYER_URL = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' window.LOGO_URL = 'https://placekitten.com/530/530' +window.MAPBOX_ACCESS_TOKEN = '' diff --git a/package-lock.json b/package-lock.json index 1dbd6bb..ab9ede4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7891,7 +7891,7 @@ }, "external-editor": { "version": "2.2.0", - "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", "dev": true, "requires": { @@ -10389,7 +10389,7 @@ }, "html-webpack-plugin": { "version": "3.2.0", - "resolved": "http://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", "integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=", "dev": true, "requires": { @@ -11005,7 +11005,7 @@ }, "inquirer": { "version": "5.2.0", - "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", "dev": true, "requires": { @@ -15603,7 +15603,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -19989,7 +19989,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -21700,7 +21700,7 @@ }, "simple-html-tokenizer": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/simple-html-tokenizer/-/simple-html-tokenizer-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/simple-html-tokenizer/-/simple-html-tokenizer-0.1.1.tgz", "integrity": "sha1-BcLuxXn//+FFoDCsJs/qYbmA+r4=" }, "simplicial-complex": { @@ -22754,7 +22754,7 @@ }, "table": { "version": "4.0.3", - "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz", "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", "dev": true, "requires": { @@ -23089,7 +23089,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { @@ -24555,7 +24555,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { "string-width": "^1.0.1", diff --git a/run.sh b/run.sh index 8a8f08a..6a24035 100755 --- a/run.sh +++ b/run.sh @@ -5,6 +5,7 @@ window.API_HOST = '${API_HOST}' window.GTM_ID = '${GTM_ID}' window.BASE_URL = '${BASE_URL}' window.STREETS_TILE_LAYER_URL = '${STREETS_TILE_LAYER_URL}' +window.MAPBOX_ACCESS_TOKEN = '${MAPBOX_ACCESS_TOKEN}' window.LOGO_URL = '${LOGO_URL}' EOL diff --git a/src/components/visualizations/chart/chart-visualization.js b/src/components/visualizations/chart/chart-visualization.js index 1d39a4d..3d48284 100644 --- a/src/components/visualizations/chart/chart-visualization.js +++ b/src/components/visualizations/chart/chart-visualization.js @@ -18,10 +18,12 @@ const getDataSourceOptions = dataSources => { export default class ChartVisualization extends Component { constructor(props) { super(props) + this.state = { data: [], layout: {}, frames: [] } } render() { + return ( { @@ -36,6 +38,7 @@ export default class ChartVisualization extends Component { onUpdate={(data, layout, frames) => this.setState({ data, layout, frames })} useResizeHandler advancedTraceTypeSelector + config={{ mapboxAccessToken: window.MAPBOX_ACCESS_TOKEN }} >