Create a custom widget in Workshop for whatever third party libraries or bespoke needs you wish to develop with. Comes with examples to sync different types of data data, including object sets, between workshop and the widget.
Steps
- Upload Marketplace Bundle
- Install downloaded sdk into prebuilt React application
- Host it as a website (hosted application) in Foundry
- Iframe the hosted app in Workshop.
This product was created by following this guide on the community forum.
The first step is uploading your package to the Foundry Marketplace:
- Download the project's
.zip
file from this repository - Access your enrollment's marketplace at:
{enrollment-url}/workspace/marketplace
- In the marketplace interface, initiate the upload process:
- Select or create a store in your preferred project folder
- Click the "Upload to Store" button
- Select your downloaded
.zip
file
After upload, you'll need to install the package in your environment. For detailed instructions, see the official Palantir documentation.
The installation process has four main stages:
-
General Setup
- Configure package name
- Select installation location
-
Input Configuration
- Configure any required inputs. If no inputs are needed, proceed to next step
- Check project documentation for specific input requirements
-
Content Review
- Review resources to be installed such as Developer Console, the Ontology, and Functions
-
Validation
- System checks for any configuration errors
- Resolve any flagged issues
- Initiate installation
Some packages include applications built with the Ontology SDK. These require additional setup:
-
Locate the SDK application code in the
app/
directory of the project repository -
The following details will need to added to the source code for the application.
- Navigate to Developer Console:
{enrollment-url}/workspace/developer-console
- Find the installed application
- Copy the following details:
- CLIENT ID
- Enrollment URL
{enrollment-url}.palantirfoundry.com
- Navigate to Developer Console:
-
Configure your development environment:
- Add to
env.development
file underapp/
- (optional) Configure CORS in your control panel to allow
http://localhost:8080
- Add to
To run the application locally:
- Access the Developer Console's "Start Developing" section
- Follow the "Add Ontology SDK" setup process)
- In the
/app
directory, start the development server:This will launch your application atnpm run dev
http://localhost:8080
Host this widget online using foundry hosting.
Navigate to Website hosting
in the Custom Widget developer console app. Request a website domain which workshop can iframe. This example uses custom-widget.<enrollment>.palantirfoundry.com
. After this has accepting, move on to deploying the react app
Make sure you add the authorization code grant to the hosted domain.
Update production configuration is stored in .env.production
.
A foundry.config.json
file is included in the root of this project to make deploying to Foundry website hosting with @osdk/cli
easier. If you are not using Foundry website hosting for your application you may delete this file.
update it with the widget information
{
"foundryUrl": "https://<YOUR ENROLLEMENT>>.palantirfoundry.com",
"site": {
"application": "<SEE APPLICATION RID IN DEV CONSOLE>",
"directory": "./dist",
"autoVersion": {
"type": "git-describe",
"tagPrefix": ""
}
}
}
Navigate to the Deploying applications
tab in the custom widget developer console app and folow the instructions there to build and deploy the react app to the new website domain you've requested.
If you did not fill in the URL your production application will be hosted on you will need to fill in the VITE_FOUNDRY_REDIRECT_URL
in .env.production
. A default test is included in env.test.ts
to verify your production environment variables which you can enable by removing the skip condition or running tests with the environment variable set VERIFY_ENV_PRODUCTION=true
.
In order to make API requests to Foundry, CORS must be configured for the stack to allow the production origin to load resources. This will be automatically done for you if you are using Foundry website hosting. The configured OAuth client must also allow the production origin auth callback as a redirect URL.
Back into your foundry enrollment, open the Custom Widget Workshop module
that was installed with the marketplace zip file.
Input the hosted website domain where teh cusotm widget has been deployed, and configure the variables and events shared between the widget and workshop.