diff --git a/superset/assets/package-lock.json b/superset/assets/package-lock.json index 5a1ce4248..7bc8fbc8f 100644 --- a/superset/assets/package-lock.json +++ b/superset/assets/package-lock.json @@ -2228,7 +2228,7 @@ "dependencies": { "whatwg-fetch": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", + "resolved": "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==" } } diff --git a/superset/assets/src/visualizations/Iframe/Iframe.jsx b/superset/assets/src/visualizations/Iframe/Iframe.jsx new file mode 100644 index 000000000..eca92d629 --- /dev/null +++ b/superset/assets/src/visualizations/Iframe/Iframe.jsx @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import Mustache from 'mustache'; +import React from 'react'; +import PropTypes from 'prop-types'; + +const propTypes = { + className: PropTypes.string, + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, + url: PropTypes.string, +}; +const defaultProps = { + className: '', +}; + +class Iframe extends React.PureComponent { + render() { + const { className, url, width, height } = this.props; + const completeUrl = Mustache.render(url, { + width, + height, + }); + + return ( +