Skip to content

Commit

Permalink
implement temporary solution for the newsfeed plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Jan 16, 2020
1 parent be2c6b7 commit 62c88e7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/plugins/newsfeed/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core
import { FetchResult, NewsfeedPluginInjectedConfig } from '../types';
import { NewsfeedNavButton, NewsfeedApiFetchResult } from './components/newsfeed_header_nav_button';
import { getApi } from './lib/api';
import { Observable } from 'rxjs';

export type Setup = void;
export type Start = void;
Expand Down Expand Up @@ -54,16 +53,19 @@ export class NewsfeedPublicPlugin implements Plugin<Setup, Start> {
}

private fetchNewsfeed(core: CoreStart) {
// const { http, injectedMetadata } = core;
// const config = injectedMetadata.getInjectedVar(
// 'newsfeed'
// ) as NewsfeedPluginInjectedConfig['newsfeed'];
//
return new Observable<void | FetchResult | null>();
// return getApi(http, config, this.kibanaVersion).pipe(
// takeUntil(this.stop$), // stop the interval when stop method is called
// catchError(() => Rx.of(null)) // do not throw error
// );
const { http, injectedMetadata } = core;
const config = injectedMetadata.getInjectedVar('newsfeed') as
| NewsfeedPluginInjectedConfig['newsfeed']
| undefined;

if (!config) {
// running in new platform, injected metadata not available
return new Rx.Observable<void | FetchResult | null>();
}
return getApi(http, config, this.kibanaVersion).pipe(
takeUntil(this.stop$), // stop the interval when stop method is called
catchError(() => Rx.of(null)) // do not throw error
);
}

private mount(api$: NewsfeedApiFetchResult, targetDomElement: HTMLElement) {
Expand Down

0 comments on commit 62c88e7

Please sign in to comment.