Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple embed #47

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions react/javascript/simple-embed/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
env: {
browser: true,
es2021: true,
'jest/globals': true,
},
extends: [
'eslint:recommended',
'standard',
'plugin:jest-dom/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'plugin:testing-library/react',
'prettier',
'@looker/eslint-config/license-header',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'react',
'jest',
'jest-dom',
'prettier',
'react-hooks',
'sort-keys-fix',
'testing-library',
],
rules: {},
settings: {
react: {
version: 'detect',
},
},
}
7 changes: 7 additions & 0 deletions react/javascript/simple-embed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
!dist/index.js
.cache
.vscode
.env
.eslintcache
1 change: 1 addition & 0 deletions react/javascript/simple-embed/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.13.0
1 change: 1 addition & 0 deletions react/javascript/simple-embed/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
5 changes: 5 additions & 0 deletions react/javascript/simple-embed/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
}
21 changes: 21 additions & 0 deletions react/javascript/simple-embed/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 Looker Data Sciences, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions react/javascript/simple-embed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# todo
60 changes: 60 additions & 0 deletions react/javascript/simple-embed/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Looker Data Sciences, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

module.exports = (api) => {
const isTest = api.env('test')
api.cache(true)

return {
presets: [
[
'@babel/env',
{
targets: {
esmodules: true,
},
modules: isTest ? 'auto' : false,
},
],
[
'@babel/preset-react',
{
development: process.env.BABEL_ENV !== 'build',
},
],
],
env: {
build: {
ignore: ['**/*.test.js', '**/*.test.jsx', '__snapshots__', '__tests__'],
},
},
ignore: ['node_modules'],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-runtime',
'babel-plugin-styled-components',
],
}
}
23 changes: 23 additions & 0 deletions react/javascript/simple-embed/config/license-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Looker Data Sciences, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
34 changes: 34 additions & 0 deletions react/javascript/simple-embed/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*

MIT License

Copyright (c) 2021 Looker Data Sciences, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

*/

module.exports = {
automock: false,
moduleDirectories: ['./node_modules'],
moduleFileExtensions: ['js', 'jsx', 'json'],
restoreMocks: true,
testPathIgnorePatterns: [],
globals: {},
}
9 changes: 9 additions & 0 deletions react/javascript/simple-embed/manifest.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project_name: "simple-embed"

application: simple-embed {
label: "Simple Embed"
url: "http://localhost:8080/bundle.js"
entitlements: {
use_embeds: yes
}
}
102 changes: 102 additions & 0 deletions react/javascript/simple-embed/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"name": "helloworld-js",
"version": "0.1.0",
"description": "Looker Extension Hello World JavaScript Demo",
"main": "dist/bundle.js",
"scripts": {
"analyze": "export ANALYZE_MODE=static && yarn build",
"build": "export BABEL_ENV=build && webpack --config webpack.prod.js",
"clean": "rm -rf dist",
"develop": "webpack serve --hot --port 8080 --disable-host-check --config webpack.develop.js",
"prebuild": "yarn clean",
"lint:es": "eslint 'src/**/*.js{,x}' --cache",
"lint:es:fix": "eslint 'src/**/*.js{,x}' --cache --fix",
"test": "jest"
},
"author": "Looker",
"license": "MIT",
"engines": {
"node": ">=12"
},
"dependencies": {
"@looker/components": "^1.1.6",
"@looker/embed-sdk": "^1.6.0",
"@looker/extension-sdk": "^21.4.5",
"@looker/extension-sdk-react": "^21.4.5",
"@looker/icons": "1.1.5",
"@looker/sdk": "^21.4.3",
"@looker/sdk-rtl": "^21.0.12",
"@styled-icons/material": "10.28.0",
"@styled-icons/material-outlined": "10.28.0",
"@styled-icons/material-rounded": "10.28.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-is": "^16.13.1",
"react-router-dom": "^5.1.2",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-transform-react-jsx": "^7.12.10",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.10",
"@babel/preset-react": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@looker/components-test-utils": "^1.1.5",
"@looker/eslint-config": "^0.10.4",
"@looker/prettier-config": "^0.10.4",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.6.0",
"babel-loader": "^8.2.2",
"babel-preset-nano-react-app": "^0.1.0",
"dotenv": "^8.2.0",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-jest": "^24.3.6",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest-dom": "^3.8.1",
"eslint-plugin-mdx": "^1.6.8",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^4.2.0",
"prettier": "^2.1.1",
"jest": "^26.6.3",
"jest-junit": "^12.0.0",
"jest-styled-components": "^7.0.3",
"react-test-renderer": "^17.0.1",
"react-hot-loader": "^4.12.20",
"webpack": "^5.10.0",
"webpack-bundle-analyzer": "^4.2.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.10.3"
},
"babel": {
"presets": [
"nano-react-app"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
[
"@babel/plugin-transform-react-jsx",
{
"pragmaFrag": "React.Fragment"
}
]
]
}
}
36 changes: 36 additions & 0 deletions react/javascript/simple-embed/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Looker Data Sciences, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

import React from 'react'
import SimpleEmbed from './SimpleEmbed'
import { ExtensionProvider } from '@looker/extension-sdk-react'
import { hot } from 'react-hot-loader/root'

export const App = hot(() => {
return (
<ExtensionProvider>
<SimpleEmbed />
</ExtensionProvider>
)
})
Loading