Comments (5)
The reason for this is that the route change and thus page event is fired before the JS module is loaded and can customize the page load event.
We have an option to leverage the module first page vent via the module definition in cloud service config (and frontend operator). The issue with this approach is that the module will not have total freedom in what data we pass to the page event. Anything static is good. But any dynamic data has to be restricted.
Do we know the nature of the data we want to send via the page event? Is this something dynamic? (requires async request etc.)
from insights-chrome.
Generally, once the route is mounted in OCM we send some additional metadata like:
ocm_resource_type: 'all' | 'moa' | 'ocp' | 'ocptrial' | and more based on product
path: some paths are overwritten, like cluster details paths (to strip out the unique IDs in the path name
// next 2 fields are sent from cluster details
ocm_cluster_id: cluster ID
resource_id: external cluster ID
This information is available after a route change. Using react-router-dom we send additional information like this:
const { pathname } = useLocation();
const { setPageMetadata } = useAnalytics();
useEffect(() => {
setPageMetadata({
// additional metadata here
});
}, [pathname]);
No async call is needed as of now, as the redux store is updated with the information we need before the route mounts
from insights-chrome.
Do you think it would be possible to create a route-based static specification of the data? Something like
{
"eventConfig": {
"routes": {
"/foo/bar": {
"ocm_resource_type": "something",
...
},
...
}
}
}
from insights-chrome.
That could work for the ocm_resource_type
field if wildcards are supported as well. You can see the implementation on gitlab here (VPN required)
from insights-chrome.
We can use the router match notation to get the correct value.
from insights-chrome.
Related Issues (20)
- Login page does not load on ci-beta HOT 3
- Minified react error at /beta/security/insights HOT 1
- Product Docs, infinite load of chrome and component HOT 4
- AsyncComponent usage example
- Page drawer implementation enhancement HOT 3
- A11y errors caused by incorrect landmark elements in page structure HOT 1
- Help and Settings menus do not have discernible text for screen readers
- getToken() returns empty tokens HOT 8
- The chrome.auth.getToken() should wait for the jwt initPromise like the getUser() HOT 10
- Page breaks when clicking manifests link on side nav after manifests page has loaded HOT 2
- keyboard accessibility: Tab iterates over part of left navigation even when hidden HOT 3
- Question: what's the suggested strategy to deal with @patternfly versions? HOT 4
- Create test script for build vs regular one HOT 1
- getOfflineToken fails if there is a URL param HOT 12
- Analytics: isProd check includes local dev env URL HOT 6
- build fails on Fedora 36 with ERR_OSSL_EVP_UNSUPPORTED HOT 2
- Kiota headers get garbled HOT 2
- RTK Query mutation/POST request headers are missing HOT 3
- Getting a 403 on https://console.redhat.com/openshift/overview/rosa/hands-on/ HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insights-chrome.