From 088f079dab240b467584bb075aca2e97348230a2 Mon Sep 17 00:00:00 2001 From: Bishoy Boktor <65934617+boktorbb-amzn@users.noreply.github.com> Date: Thu, 4 Feb 2021 15:32:15 -0800 Subject: [PATCH] [PURIFY] Removes Newsfeed plugin from ui (#10) (#15) * [PURIFY] Removes Newsfeed plugin button and feed (#10) * Removes elastic endpoints from newsfeed plugin code * Remove elastic endpoints, remove kibana manifest file for newsfeed, skip newsfeed tests Signed-off-by: Peter Nied --- src/plugins/kibana_overview/kibana.json | 4 ++-- src/plugins/newsfeed/common/constants.ts | 4 ++-- src/plugins/newsfeed/kibana.json | 6 ------ .../newsfeed/public/components/empty_news.test.tsx | 4 ++-- .../newsfeed/public/components/loading_news.test.tsx | 4 ++-- src/plugins/newsfeed/public/lib/api.test.ts | 12 ++++++------ test/common/config.js | 8 ++++---- test/functional/apps/home/_newsfeed.ts | 2 +- 8 files changed, 19 insertions(+), 25 deletions(-) delete mode 100644 src/plugins/newsfeed/kibana.json diff --git a/src/plugins/kibana_overview/kibana.json b/src/plugins/kibana_overview/kibana.json index 9ddcaabdaed6..d7829cb5f88b 100644 --- a/src/plugins/kibana_overview/kibana.json +++ b/src/plugins/kibana_overview/kibana.json @@ -4,6 +4,6 @@ "server": false, "ui": true, "requiredPlugins": ["navigation", "data", "home"], - "optionalPlugins": ["newsfeed"], - "requiredBundles": ["kibanaReact", "newsfeed"] + "optionalPlugins": [], + "requiredBundles": ["kibanaReact"] } diff --git a/src/plugins/newsfeed/common/constants.ts b/src/plugins/newsfeed/common/constants.ts index 7716ad24aa84..6131fc7ced29 100644 --- a/src/plugins/newsfeed/common/constants.ts +++ b/src/plugins/newsfeed/common/constants.ts @@ -23,6 +23,6 @@ export const NEWSFEED_FALLBACK_MAIN_INTERVAL = 120000; // 2 minutes export const NEWSFEED_LAST_FETCH_STORAGE_KEY = 'newsfeed.lastfetchtime'; export const NEWSFEED_HASH_SET_STORAGE_KEY = 'newsfeed.hashes'; -export const NEWSFEED_DEFAULT_SERVICE_BASE_URL = 'https://feeds.elastic.co'; -export const NEWSFEED_DEV_SERVICE_BASE_URL = 'https://feeds-staging.elastic.co'; +export const NEWSFEED_DEFAULT_SERVICE_BASE_URL = ''; +export const NEWSFEED_DEV_SERVICE_BASE_URL = ''; export const NEWSFEED_DEFAULT_SERVICE_PATH = '/kibana/v{VERSION}.json'; diff --git a/src/plugins/newsfeed/kibana.json b/src/plugins/newsfeed/kibana.json deleted file mode 100644 index b9f37b67f692..000000000000 --- a/src/plugins/newsfeed/kibana.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "id": "newsfeed", - "version": "kibana", - "server": true, - "ui": true -} diff --git a/src/plugins/newsfeed/public/components/empty_news.test.tsx b/src/plugins/newsfeed/public/components/empty_news.test.tsx index 33702df00a58..a7d9b608ab0a 100644 --- a/src/plugins/newsfeed/public/components/empty_news.test.tsx +++ b/src/plugins/newsfeed/public/components/empty_news.test.tsx @@ -22,8 +22,8 @@ import { shallow } from 'enzyme'; import toJson from 'enzyme-to-json'; import { NewsEmptyPrompt } from './empty_news'; -describe('empty_news', () => { - describe('rendering', () => { +describe.skip('empty_news', () => { + describe.skip('rendering', () => { it('renders the default Empty News', () => { const wrapper = shallow(); expect(toJson(wrapper)).toMatchSnapshot(); diff --git a/src/plugins/newsfeed/public/components/loading_news.test.tsx b/src/plugins/newsfeed/public/components/loading_news.test.tsx index ca449b8ee879..f56037bee76a 100644 --- a/src/plugins/newsfeed/public/components/loading_news.test.tsx +++ b/src/plugins/newsfeed/public/components/loading_news.test.tsx @@ -22,8 +22,8 @@ import { shallow } from 'enzyme'; import toJson from 'enzyme-to-json'; import { NewsLoadingPrompt } from './loading_news'; -describe('news_loading', () => { - describe('rendering', () => { +describe.skip('news_loading', () => { + describe.skip('rendering', () => { it('renders the default News Loading', () => { const wrapper = shallow(); expect(toJson(wrapper)).toMatchSnapshot(); diff --git a/src/plugins/newsfeed/public/lib/api.test.ts b/src/plugins/newsfeed/public/lib/api.test.ts index 89918acce6c7..8e4298e73dcf 100644 --- a/src/plugins/newsfeed/public/lib/api.test.ts +++ b/src/plugins/newsfeed/public/lib/api.test.ts @@ -51,7 +51,7 @@ jest.mock('uuid', () => ({ v4: () => 'NEW_UUID', })); -describe('NewsfeedApiDriver', () => { +describe.skip('NewsfeedApiDriver', () => { const kibanaVersion = '99.999.9-test_version'; // It'll remove the `-test_version` bit const userLanguage = 'en'; const fetchInterval = 2000; @@ -61,7 +61,7 @@ describe('NewsfeedApiDriver', () => { sinon.reset(); }); - describe('shouldFetch', () => { + describe.skip('shouldFetch', () => { it('defaults to true', () => { const driver = getDriver(); expect(driver.shouldFetch()).toBe(true); @@ -86,7 +86,7 @@ describe('NewsfeedApiDriver', () => { }); }); - describe('updateHashes', () => { + describe.skip('updateHashes', () => { it('returns previous and current storage', () => { const driver = getDriver(); const items: NewsfeedItem[] = [ @@ -178,7 +178,7 @@ describe('NewsfeedApiDriver', () => { ).toBe(false); }); - describe('modelItems', () => { + describe.skip('modelItems', () => { it('Models empty set with defaults', () => { const driver = getDriver(); const apiItems: ApiItem[] = []; @@ -451,7 +451,7 @@ describe('NewsfeedApiDriver', () => { }); }); -describe('getApi', () => { +describe.skip('getApi', () => { const mockHttpGet = jest.fn(); let httpMock = ({ fetch: mockHttpGet, @@ -616,7 +616,7 @@ describe('getApi', () => { }); }); - describe('Retry fetching', () => { + describe.skip('Retry fetching', () => { const successItems: ApiItem[] = [ { title: { en: 'hasNew test' }, diff --git a/test/common/config.js b/test/common/config.js index 9d6d531ae4b3..353453573929 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -17,7 +17,7 @@ * under the License. */ -import path from 'path'; +//import path from 'path'; import { format as formatUrl } from 'url'; import { esTestConfig, kbnTestConfig, kibanaServerTestUser } from '@kbn/test'; import { services } from './services'; @@ -58,9 +58,9 @@ export default function () { '--telemetry.optInStatusUrl=https://telemetry-staging.elastic.co/opt_in_status/v2/send', `--server.maxPayloadBytes=1679958`, // newsfeed mock service - `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'newsfeed')}`, - `--newsfeed.service.urlRoot=${servers.kibana.protocol}://${servers.kibana.hostname}:${servers.kibana.port}`, - `--newsfeed.service.pathTemplate=/api/_newsfeed-FTS-external-service-simulators/kibana/v{VERSION}.json`, + // `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'newsfeed')}`, + // `--newsfeed.service.urlRoot=${servers.kibana.protocol}://${servers.kibana.hostname}:${servers.kibana.port}`, + // `--newsfeed.service.pathTemplate=/api/_newsfeed-FTS-external-service-simulators/kibana/v{VERSION}.json`, ], }, services, diff --git a/test/functional/apps/home/_newsfeed.ts b/test/functional/apps/home/_newsfeed.ts index 4568ba2b47d8..b5406a127c20 100644 --- a/test/functional/apps/home/_newsfeed.ts +++ b/test/functional/apps/home/_newsfeed.ts @@ -25,7 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const deployment = getService('deployment'); const PageObjects = getPageObjects(['newsfeed']); - describe('Newsfeed', () => { + describe.skip('Newsfeed', () => { before(async () => { await PageObjects.newsfeed.resetPage(); });