Closed aminoz007 closed 4 years ago
There is an example here: https://github.com/newrelic-experimental/nr1-rssreader
:tada: This issue has been resolved in version 0.16.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
@norbertsuski I tested the rss parser with New Relic status page and it returned the list of incident as expected. My only problem is with the iframe.
Another remark: the CORS proxy should be configurable since some people may use their own internal proxy. https://cors-anywhere.herokuapp.com/ can be selected by default but we should be able to change it. Currently, https://cors-anywhere.herokuapp.com/ has a limit of 100 request per referrer per hour, so a customer will need to use his own proxy server to avoid this limitation. Ideally, by default https://cors-anywhere.herokuapp.com/ is used, however this URL should be configurable.
I spent a lot of time trying to get the Iframe to work for the RSS feed but it seems very hard to implement.
The "connexion refused" and "refused to display" errors are all because some sites like "Slack" don't allow CORS.
I tried to use the Proxy to get the html and then pass it as srcDoc for the iframe, that actually worked, it returned the HTML in the stacked nerdlet, however the CSS and images were not loaded because the HTML I got back from the proxy has relative paths (example: <link rel="stylesheet" href="/css/v2/averta-font.css">
).
To get the CSS and Images/Fonts, I manipulated the HTML returned by the proxy and added the absolute URL with the proxy url (<link rel="stylesheet" href="https://api.allorigins.win/raw?url=https://status.slack.com//css/v2/averta-font.css">
), I have used this snippet:
const url = "https://api.allorigins.win/raw?url="+this.props.src; const networkResponse = await axios.get(url); let updatedHtml = networkResponse.data.replace(/src="(.?)"/g,
src="${url}$1"
); updatedHtml = updatedHtml.replace(/href="(.?)"/g,href="${url}$1"
);
That actually worked and added the styles properly, however when I clicked on anything in the Iframe the style was gone.
I think I might be able to fix that as well but it seems like a lot of work for a small thing.
Besides, we can't guarantee that it will work properly for all external status pages.
I will let you take a look, but if you share my opinion it would be probably easier to change the "See status page button" into a link and open the page in a different window (see screenshot below).
@aminoz007 I'm inclined to close this again based on #82. Please confirm.
We need to add RSS feed as a provider
Summary
Many status pages don't adhere to the status IO or statusPage IO spec/standard. However, most of them support RSS feed which has the same xml structure regardless of the status page using it. It will be interesting to include an RSS feed parser as an option to support status pages that don't provide APIs. This react lib can help achieving this goal: https://www.npmjs.com/package/rss-parser
Desired Behaviour
The customer can choose in the list of provider: "RSS Feed". Using the RSS feed parser we can get the list of incidents, we have to display the incidents in the same format as the current format (top incidents and then when we click we open the list of all incidents). RSS feed does not provide the summary status (e.g. "All operational"), so we can replace the traffic light and summary with a link, by clicking on the link we should open a stacked nerdlet that has an Iframe of the status page: ";
Additional context
This has been requested by many people.