-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 311f63b
Showing
13 changed files
with
13,992 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
dist | ||
!dist/index.js | ||
.cache | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Basic Looker Extension Template | ||
|
||
This repository demonstrates a very basic extension (no react). | ||
|
||
## Getting Started for Development | ||
|
||
1. Clone or download a copy of this template to your development machine | ||
2. Navigate (`cd`) to the remplate directory on your system | ||
3. Install the dependencies with [Yarn](https://yarnpkg.com/). | ||
|
||
``` | ||
yarn install | ||
``` | ||
> You may need to update your Node version or use a [Node version manager](https://github.com/nvm-sh/nvm) to change your Node version. | ||
4. Start the development server | ||
``` | ||
yarn start | ||
``` | ||
Great! Your extension is now running and serving the JavaScript at http://localhost:8080/bundle.js. | ||
> __Note well:__ The webpack development server also supports https. To use, add the parameter --https to the start command | ||
`"start": "webpack-dev-server --hot --disable-host-check --https"` | ||
Should you decide to use https, you should visit the bundle URL you are running as there will likely be a certificate warning. The development server runs with a self-signed SSL certificate, so you will need to accept this to allow your browser to connect to it. | ||
5. Now log in to Looker and create a new project. | ||
This is found under __Develop__ => __Manage LookML Projects__ => __New LookML Project__. | ||
You'll want to select "Blank Project" as your "Starting Point". You'll now have a new project with no files. | ||
6. In your copy of the extension tablet you have `manifest.lkml` file. | ||
You can either drag & upload this file into your Looker project, or create a `manifest.lkml` with the same content. Change the `id`, `label`, or `url` as needed. | ||
``` | ||
application: my-basic-extension { | ||
label: "My Basic Extension" | ||
url: "http://localhost:8080/bundle.js" | ||
} | ||
``` | ||
7. Create a `model` LookML file in your project. The name doesn't matter. The model and connection won't be used, and in the future this step may be eliminated. | ||
- Add a connection in this model. It can be any connection, it doesn't matter which. | ||
- [Configure the model you created](https://docs.looker.com/data-modeling/getting-started/create-projects#configuring_a_model) so that it has access to some connection. | ||
8. Connect your new project to Git. You can do this multiple ways: | ||
- Create a new repository on GitHub or a similar service, and follow the instructions to [connect your project to Git](https://docs.looker.com/data-modeling/getting-started/setting-up-git-connection) | ||
- A simpler but less powerful approach is to set up git with the "Bare" repository option which does not require connecting to an external Git Service. | ||
9. Commit your changes and deploy your them to production through the Project UI. | ||
10. Reload the page and click the `Browse` dropdown menu. You should see your extension in the list. | ||
- The extension will load the JavaScript from the `url` you provided in the `application` definition/ | ||
- Reloading the extension page will bring in any new code changes from the extension template. (Webpack's hot reloading is not currently supported.) | ||
## Deployment | ||
The process above requires your local development server to be running to load the extension code. To allow other people to use the extension, we can build the JavaScript file and include it in the project directly. | ||
1. In your extension project directory on your development machine you can build the extension with `yarn build`. | ||
2. Drag and drop the generated `dist/bundle.js` file into the Looker project interface | ||
3. Modify your `manifest.lkml` to use `file` instead of `url`: | ||
``` | ||
application: my-basic-extension { | ||
label: "My Basic Extension" | ||
file: "bundle.js" | ||
} | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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 => { | ||
api.cache(true) | ||
|
||
return { | ||
presets: [ | ||
[ | ||
'@babel/env', | ||
{ | ||
targets: { | ||
browsers: 'Last 2 Chrome versions, Firefox ESR', | ||
node: '8.9', | ||
}, | ||
}, | ||
], | ||
[ | ||
'@babel/preset-react', | ||
{ | ||
development: process.env.BABEL_ENV !== 'build', | ||
}, | ||
], | ||
'@babel/preset-typescript', | ||
], | ||
env: { | ||
build: { | ||
ignore: [ | ||
'**/*.d.ts', | ||
'**/*.test.js', | ||
'**/*.test.jsx', | ||
'**/*.test.ts', | ||
'**/*.test.tsx', | ||
'__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', | ||
'react-hot-loader/babel' | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
application: extension-template { | ||
label: "Extension Template" | ||
url: "http://localhost:8080/bundle.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"name": "extension-basic", | ||
"version": "0.1.0", | ||
"description": "", | ||
"main": "dist/bundle.js", | ||
"scripts": { | ||
"start": "webpack-dev-server --hot --disable-host-check", | ||
"start-no-hot": "webpack-dev-server --no-inline --no-hot", | ||
"build": "tsc --noEmit && webpack --mode=production", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Looker", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"dependencies": { | ||
"@looker/components": "0.7.13", | ||
"@looker/embed-sdk": "^1.0.0-beta.4", | ||
"@looker/extension-sdk": "^0.7.0", | ||
"@looker/extension-sdk-react": "^0.3.0", | ||
"@looker/sdk": "^0.2.0-beta.26", | ||
"@types/node": "^12.7.5", | ||
"@types/react": "^16.9.11", | ||
"@types/react-dom": "^16.9.3", | ||
"@types/react-router-dom": "^5.1.0", | ||
"@types/readable-stream": "^2.3.5", | ||
"@types/styled-components": "4.1.8", | ||
"@types/styled-system": "^5.1.3", | ||
"add": "^2.0.6", | ||
"babel-loader": "^8.0.6", | ||
"lodash": "^4.17.15", | ||
"react": "^16.11.0", | ||
"react-dom": "^16.11.0", | ||
"react-hot-loader": "^4.12.18", | ||
"react-router-dom": "^5.1.2", | ||
"styled-components": "^4.4.1", | ||
"styled-system": "^5.1.2", | ||
"webpack": "^4.41.0", | ||
"webpack-cli": "^3.3.9", | ||
"webpack-dev-server": "^3.8.1", | ||
"yarn": "^1.22.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.4", | ||
"@babel/core": "^7.0.0-0", | ||
"@babel/plugin-proposal-class-properties": "^7.7.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.7.4", | ||
"@babel/plugin-transform-react-jsx": "^7.3.0", | ||
"@babel/plugin-transform-runtime": "^7.7.4", | ||
"@babel/preset-env": "^7.7.4", | ||
"@babel/preset-react": "^7.7.4", | ||
"@babel/preset-typescript": "^7.7.4", | ||
"@babel/runtime": "^7.7.4", | ||
"@types/lodash": "^4.14.144", | ||
"babel-preset-nano-react-app": "^0.1.0", | ||
"typescript": "^3.6.3" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"nano-react-app" | ||
], | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-proposal-class-properties", | ||
{ | ||
"loose": true | ||
} | ||
], | ||
[ | ||
"@babel/plugin-transform-react-jsx", | ||
{ | ||
"pragmaFrag": "React.Fragment" | ||
} | ||
] | ||
] | ||
} | ||
} |
Oops, something went wrong.