extension-typescript-template is a Looker extension using React and TypeScript.
-
Install the dependencies with Yarn.
yarn install
-
Build the project
yarn build
-
Start the development server
yarn develop
The development server is now running and serving the JavaScript at https://localhost:8080/bundle.js.
-
Now log in to Looker and create a new project.
Depending on the version of Looker, a new project can be created under:
- Develop => Manage LookML Projects => New LookML Project, or
- Develop => Projects => New LookML Project
Select "Blank Project" as the "Starting Point". This creates a new LookML project with no files.
-
Create a
manifestfileEither drag and upload the
manifest.lkmlfile in this directory into your Looker project, or create amanifest.lkmlwith the same content. Change theid,label, orurlas needed.project_name: "extension-typescript-template" application: extension-typescript-template { label: "extension-typescript-template React/TypeScript extension" url: "https://localhost:8080/bundle.js" entitlements: { core_api_methods: ["me"] } } -
Create a
modelLookML file in your project.Typically, the model is named the same as the extension project. The model is used to control access to the extension.
- Configure the model you created so that it has access to some connection (any connection).
-
Connect the new project to Git.
- Create a new repository on GitHub or a similar service, and follow the instructions to connect your project to Git
-
Commit the changes and deploy them to production through the Project UI.
-
Reload the page and click the
Browsedropdown menu. You should see the extension label in the list.- The extension will load the JavaScript from the
urlyou provided in theapplicationdefinition. By default, this ishttps://localhost:8080/bundle.js. If you change the port your server runs on in thepackage.json, you will need to also update it in themanifest.lkml. - Reloading the extension page will bring in any new code changes from the extension template.
- The extension will load the JavaScript from the
To allow other people to use the extension, build the JavaScript bundle file and directly include it in the project.
-
Build the extension with
yarn buildin the extension project directory on your development machine. -
Drag and drop the generated
dist/bundle.jsfile into the Looker project interface -
Modify your
manifest.lkmlto usefileinstead ofurl:project_name: "extension-typescript-template" application: extension-typescript-template { label: "A Looker React/TypeScript extension" file: "bundle.js" entitlements: { core_api_methods: ["me"] } }