diff --git a/react/javascript/helloworld-js/README.md b/react/javascript/helloworld-js/README.md index 147a94b..b759b8e 100644 --- a/react/javascript/helloworld-js/README.md +++ b/react/javascript/helloworld-js/README.md @@ -29,7 +29,11 @@ This example demonstrates a bare bones Looker extension using Javascript. yarn develop ``` - The extension is now running and serving the JavaScript locally at http://localhost:8080/bundle.js. + The extension is now running and serving the JavaScript locally at https://localhost:8080/bundle.js. Note that the + new extension loading mechanism requires that the development server listen on https as browsers do not support + mixed content. When the development extension first loads you may need to authorize the certificate that is generated. + This can easily be done by clicking the link that appears in the displayed development information. This will open + a new browser window which will allow the certificate to be authorized. 5. Log in to Looker and create a new project. @@ -46,7 +50,7 @@ This example demonstrates a bare bones Looker extension using Javascript. application: helloworld-js { label: "Helloworld (JavaScript)" - url: "http://localhost:8080/bundle.js" + url: "https://localhost:8080/bundle.js" entitlements: { core_api_methods: ["me"] } diff --git a/react/javascript/helloworld-js/babel.config.js b/react/javascript/helloworld-js/babel.config.js index 6a28636..f04ad1f 100644 --- a/react/javascript/helloworld-js/babel.config.js +++ b/react/javascript/helloworld-js/babel.config.js @@ -55,6 +55,14 @@ module.exports = (api) => { '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-runtime', 'babel-plugin-styled-components', + [ + 'file-loader', + { + publicPath: '/dist', + outputPath: '/dist', + limit: 66666, + }, + ], ], } } diff --git a/react/javascript/helloworld-js/package.json b/react/javascript/helloworld-js/package.json index 14bbe5b..097bfc4 100644 --- a/react/javascript/helloworld-js/package.json +++ b/react/javascript/helloworld-js/package.json @@ -7,7 +7,7 @@ "analyze": "export ANALYZE_MODE=static && yarn build", "build": "export BABEL_ENV=build && webpack --config webpack.prod.js", "clean": "rm -rf dist && rm -f .eslintcache", - "develop": "webpack serve --hot --port 8080 --config webpack.develop.js", + "develop": "webpack serve --hot --port 8080 --https --config webpack.develop.js", "prebuild": "yarn clean", "lint:es": "eslint 'src/**/*.js{,x}' --cache", "lint:es:fix": "eslint 'src/**/*.js{,x}' --cache --fix", @@ -32,6 +32,7 @@ "@styled-icons/material": "^10.28.0", "@styled-icons/material-outlined": "^10.34.0", "@styled-icons/material-rounded": "^10.34.0", + "babel-plugin-file-loader": "^2.0.0", "lodash": "^4.17.21", "react": "^16.14.0", "react-dom": "^16.14.0", diff --git a/react/javascript/helloworld-js/src/HelloWorld.js b/react/javascript/helloworld-js/src/HelloWorld.js index 190f53a..05ab21c 100644 --- a/react/javascript/helloworld-js/src/HelloWorld.js +++ b/react/javascript/helloworld-js/src/HelloWorld.js @@ -27,6 +27,7 @@ import React, { useEffect, useState, useContext } from 'react' import { Space, ComponentsProvider, Text } from '@looker/components' import { ExtensionContext } from '@looker/extension-sdk-react' +import spiral from './images/spirals.png' export const HelloWorld = () => { const { core40SDK } = useContext(ExtensionContext) @@ -52,6 +53,7 @@ export const HelloWorld = () => { {message} + diff --git a/react/javascript/helloworld-js/src/images/spirals.png b/react/javascript/helloworld-js/src/images/spirals.png new file mode 100644 index 0000000..88a9a9b Binary files /dev/null and b/react/javascript/helloworld-js/src/images/spirals.png differ diff --git a/react/javascript/helloworld-js/webpack.config.js b/react/javascript/helloworld-js/webpack.config.js index 4dab927..1117e9c 100644 --- a/react/javascript/helloworld-js/webpack.config.js +++ b/react/javascript/helloworld-js/webpack.config.js @@ -24,8 +24,8 @@ const path = require('path') -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') - .BundleAnalyzerPlugin +const BundleAnalyzerPlugin = + require('webpack-bundle-analyzer').BundleAnalyzerPlugin const PATHS = { app: path.join(__dirname, 'src/index.js'), diff --git a/react/typescript/kitchensink/src/components/Configure/Configure.tsx b/react/typescript/kitchensink/src/components/Configure/Configure.tsx index 3335db3..3eb557f 100644 --- a/react/typescript/kitchensink/src/components/Configure/Configure.tsx +++ b/react/typescript/kitchensink/src/components/Configure/Configure.tsx @@ -155,33 +155,6 @@ const Configure: React.FC = ({ const getValidationMessages = (): ValidationMessages | undefined => { let validationMessages: ValidationMessages | undefined - if (typeof localConfigurationData.dashboardId === 'string') { - if (!validationMessages) { - validationMessages = {} - } - validationMessages.dashboardId = { - type: 'error', - message: 'dashboard id is not numeric', - } - } - if (localConfigurationData.exploreId === '') { - if (!validationMessages) { - validationMessages = {} - } - validationMessages.exploreId = { - type: 'error', - message: 'explore id is empty', - } - } - if (typeof localConfigurationData.lookId === 'string') { - if (!validationMessages) { - validationMessages = {} - } - validationMessages.lookId = { - type: 'error', - message: 'look id is not numeric', - } - } return validationMessages } diff --git a/react/typescript/kitchensink/webpack.develop.js b/react/typescript/kitchensink/webpack.develop.js index ee6cb9a..a26060e 100644 --- a/react/typescript/kitchensink/webpack.develop.js +++ b/react/typescript/kitchensink/webpack.develop.js @@ -42,7 +42,8 @@ module.exports = { ], }, devServer: { - webSocketServer: 'sockjs', + client: false, + webSocketServer: false, host: 'localhost', allowedHosts: 'all', headers: { diff --git a/yarn.lock b/yarn.lock index d27275b..d9ebe32 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3842,6 +3842,15 @@ babel-plugin-dynamic-import-node@^2.3.3: dependencies: object.assign "^4.1.0" +babel-plugin-file-loader@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-file-loader/-/babel-plugin-file-loader-2.0.0.tgz#e9f7ecbd0f1131483f6f06a2a4cbc1574c00534f" + integrity sha512-MgonWXyl/VAMjMCU4YA3m0Zk95jdwLoQ/n8YM+M/CYKNtEfj9nk+bhgLbWKkUY2D9PzjQO8sx93QkOCMAAvn8Q== + dependencies: + big.js "^5.2.2" + fs-extra "^8.1.0" + mime "^2.4.4" + babel-plugin-istanbul@^6.0.0: version "6.1.1" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" @@ -6471,6 +6480,15 @@ fresh@0.5.2: resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" @@ -8304,6 +8322,13 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" @@ -8971,6 +8996,11 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== +mime@^2.4.4: + version "2.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" + integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -12641,7 +12671,7 @@ universal-user-agent@^6.0.0: resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== -universalify@^0.1.2: +universalify@^0.1.0, universalify@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==