diff --git a/docs/sources/visualizations/news-panel.md b/docs/sources/visualizations/news-panel.md index 020a1ea983b..11c75358198 100644 --- a/docs/sources/visualizations/news-panel.md +++ b/docs/sources/visualizations/news-panel.md @@ -10,3 +10,7 @@ weight = 800 This panel visualization displays an RSS feed. By default, it displays articles from the Grafana Labs blog. Enter the URL of an RSS in the URL field in the Display section. This panel type does not accept any other queries. + +In version 8.5, we discontinued the "Use Proxy" option for Grafana news panels. As a result, RSS feeds that are not configured for request by Grafana's frontend (with the appropriate [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)) may not load. + +If the RSS feed you're trying to display fails to load, consider rehosting the RSS feed or prefixing the RSS URL with your own "CORS proxy". Alternatively, you can use the community [RSS/Atom data source](https://grafana.com/grafana/plugins/volkovlabs-rss-datasource/) in combination with the [Dynamic text](https://grafana.com/grafana/plugins/marcusolsson-dynamictext-panel/) community panel to display the RSS feed. diff --git a/public/app/plugins/panel/news/NewsPanel.tsx b/public/app/plugins/panel/news/NewsPanel.tsx index c96dc1e5ac5..e75390bb65a 100755 --- a/public/app/plugins/panel/news/NewsPanel.tsx +++ b/public/app/plugins/panel/news/NewsPanel.tsx @@ -12,7 +12,7 @@ import { loadFeed } from './feed'; import { PanelProps, DataFrameView, dateTimeFormat, GrafanaTheme2, textUtil } from '@grafana/data'; import { NewsItem } from './types'; import { PanelOptions } from './models.gen'; -import { DEFAULT_FEED_URL, PROXY_PREFIX } from './constants'; +import { DEFAULT_FEED_URL } from './constants'; import { css, cx } from '@emotion/css'; import { RefreshEvent } from '@grafana/runtime'; import { Unsubscribable } from 'rxjs'; @@ -50,20 +50,18 @@ export class NewsPanel extends PureComponent { async loadChannel() { const { options } = this.props; try { - const url = options.feedUrl - ? options.useProxy - ? `${PROXY_PREFIX}${options.feedUrl}` - : options.feedUrl - : DEFAULT_FEED_URL; + const url = options.feedUrl || DEFAULT_FEED_URL; const feed = await loadFeed(url); const frame = feedToDataFrame(feed); + this.setState({ news: new DataFrameView(frame), isError: false, }); } catch (err) { console.error('Error Loading News', err); + this.setState({ news: undefined, isError: true, @@ -79,10 +77,10 @@ export class NewsPanel extends PureComponent { const useWideLayout = width > 600; if (isError) { - return
Error Loading News
; + return
Error loading RSS feed.
; } if (!news) { - return
loading...
; + return
Loading...
; } return ( diff --git a/public/app/plugins/panel/news/constants.ts b/public/app/plugins/panel/news/constants.ts index 3cdab1a3ab8..8af16365442 100644 --- a/public/app/plugins/panel/news/constants.ts +++ b/public/app/plugins/panel/news/constants.ts @@ -1,2 +1 @@ export const DEFAULT_FEED_URL = 'https://grafana.com/blog/news.xml'; -export const PROXY_PREFIX = 'https://cors-anywhere.herokuapp.com/'; diff --git a/public/app/plugins/panel/news/models.cue b/public/app/plugins/panel/news/models.cue index 49dba195210..b4e632e9c66 100644 --- a/public/app/plugins/panel/news/models.cue +++ b/public/app/plugins/panel/news/models.cue @@ -21,7 +21,6 @@ Panel: { PanelOptions: { // empty/missing will default to grafana blog feedUrl?: string - useProxy?: bool showImage?: bool | *true } } diff --git a/public/app/plugins/panel/news/models.gen.ts b/public/app/plugins/panel/news/models.gen.ts index 61a31557145..fa953457c4a 100644 --- a/public/app/plugins/panel/news/models.gen.ts +++ b/public/app/plugins/panel/news/models.gen.ts @@ -9,7 +9,6 @@ export const modelVersion = Object.freeze([0, 0]); export interface PanelOptions { feedUrl?: string; showImage?: boolean; - useProxy?: boolean; } export const defaultPanelOptions: PanelOptions = { diff --git a/public/app/plugins/panel/news/module.tsx b/public/app/plugins/panel/news/module.tsx index 34f0447b44e..382cddb2c7b 100755 --- a/public/app/plugins/panel/news/module.tsx +++ b/public/app/plugins/panel/news/module.tsx @@ -1,8 +1,7 @@ -import { isString } from 'lodash'; import { PanelPlugin } from '@grafana/data'; import { NewsPanel } from './NewsPanel'; import { PanelOptions, defaultPanelOptions } from './models.gen'; -import { DEFAULT_FEED_URL, PROXY_PREFIX } from './constants'; +import { DEFAULT_FEED_URL } from './constants'; export const plugin = new PanelPlugin(NewsPanel).setPanelOptions((builder) => { builder @@ -19,18 +18,6 @@ export const plugin = new PanelPlugin(NewsPanel).setPanelOptions(( path: 'showImage', name: 'Show image', description: 'Controls if the news item social (og:image) image is shown above text content', - showIf: (currentConfig: PanelOptions) => { - return isString(currentConfig.feedUrl) && !currentConfig.feedUrl.startsWith(PROXY_PREFIX); - }, defaultValue: defaultPanelOptions.showImage, - }) - .addBooleanSwitch({ - path: 'useProxy', - name: 'Use Proxy', - description: 'If the feed is unable to connect, consider a CORS proxy', - showIf: (currentConfig: PanelOptions) => { - return isString(currentConfig.feedUrl) && !currentConfig.feedUrl.startsWith(PROXY_PREFIX); - }, - defaultValue: defaultPanelOptions.useProxy, }); });