-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to set custom message via webpage plugin (#288)
- Loading branch information
Showing
8 changed files
with
71 additions
and
19 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
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
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
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,35 @@ | ||
--- | ||
id: customize_html | ||
title: Customize HTML | ||
sidebar_label: Customize HTML | ||
--- | ||
|
||
DataHub allows for some basic customization in the frontend. You can use the web plugin to inject custom javascript into DataHub frontend. Please check [Plugins Guide](./plugins.md) to see how to get started. | ||
|
||
Right now there are two use cases for custom javascript: | ||
|
||
1. Inject trackers such as google analytics. For example: | ||
|
||
```typescript | ||
const script = document.createElement('script'); | ||
script.innerHTML = ` | ||
... | ||
`; | ||
document.body.appendChild(script); | ||
``` | ||
|
||
2. Customize some of the messages in DataHub. Currently DataHub allows the plugin to set the following messages: | ||
|
||
```typescript | ||
interface Window { | ||
// Users will see this message if they cannot | ||
// access any | ||
NO_ENVIRONMENT_MESSAGE?: string; | ||
} | ||
``` | ||
|
||
You can set the message directly in the custom_script.ts: | ||
|
||
```typescript | ||
window.NO_ENVIRONMENT_MESSAGE = 'Lorem ipsum dolor sit amet.'; | ||
``` |
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
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
// Place your custom css/js logic here | ||
|
||
export {}; | ||
|
||
// Use the following definitions to override default DataHub | ||
// behavior | ||
declare global { | ||
/* tslint:disable:interface-name */ | ||
interface Window { | ||
// Users will see this message if they cannot | ||
// access any | ||
NO_ENVIRONMENT_MESSAGE?: string; | ||
} | ||
} |
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