Improving security checks & removing unused log

This commit is contained in:
luke14free 2016-11-18 19:47:30 +01:00 committed by Arik Fraimovich
parent edd2a1b547
commit 02d27c1a0b
2 changed files with 5 additions and 3 deletions

View File

@ -65,7 +65,6 @@ function ChartEditor(clientConfig) {
scatter: { name: 'Scatter', icon: 'circle-o' },
};
console.log(clientConfig);
if (clientConfig.allowCustomJSVisualizations) {
scope.chartTypes.custom = { name: 'Custom', icon: 'code' };
}

View File

@ -426,7 +426,7 @@ const PlotlyChart = () => {
};
};
const CustomPlotlyChart = () => {
const CustomPlotlyChart = (clientConfig) => {
const customChart = {
restrict: 'E',
template: '<div></div>',
@ -436,6 +436,9 @@ const CustomPlotlyChart = () => {
height: '=',
},
link(scope, element) {
if (!clientConfig.allowCustomJSVisualizations) {
return;
}
const refresh = () => {
const codeCall = eval(`codeCall = function(x, ys, element, Plotly){ ${scope.options.customCode} }`);
codeCall(scope.x, scope.ys, element[0].children[0], Plotly);
@ -472,5 +475,5 @@ const CustomPlotlyChart = () => {
export default function (ngModule) {
ngModule.constant('ColorPalette', ColorPalette);
ngModule.directive('plotlyChart', PlotlyChart);
ngModule.directive('customPlotlyChart', CustomPlotlyChart);
ngModule.directive('customPlotlyChart', ['clientConfig', CustomPlotlyChart]);
}