mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[cli-dev-mode] get values from completed state subjects (#107428)
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
48a97f6d18
commit
3d8a2cfcf1
1 changed files with 23 additions and 7 deletions
|
@ -77,8 +77,11 @@ export interface CliDevModeOptions {
|
|||
cache: boolean;
|
||||
}
|
||||
|
||||
const firstAllTrue = (...sources: Array<Rx.Observable<boolean>>) =>
|
||||
Rx.combineLatest(sources).pipe(
|
||||
const getValue$ = <T>(source: Rx.BehaviorSubject<T>): Rx.Observable<T> =>
|
||||
source.isStopped ? Rx.of(source.getValue()) : source;
|
||||
|
||||
const firstAllTrue = (...sources: Array<Rx.BehaviorSubject<boolean>>) =>
|
||||
Rx.combineLatest(sources.map(getValue$)).pipe(
|
||||
filter((values) => values.every((v) => v === true)),
|
||||
take(1),
|
||||
mapTo(undefined)
|
||||
|
@ -198,11 +201,24 @@ export class CliDevMode {
|
|||
? Rx.EMPTY
|
||||
: Rx.timer(1000).pipe(
|
||||
tap(() => {
|
||||
this.log.warn(
|
||||
'please hold',
|
||||
!optimizerReady$.getValue()
|
||||
? 'optimizer is still bundling so requests have been paused'
|
||||
: 'server is not ready so requests have been paused'
|
||||
if (!optimizerReady$.getValue()) {
|
||||
this.log.warn(
|
||||
'please hold',
|
||||
'optimizer is still bundling so requests have been paused'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!serverReady$.getValue()) {
|
||||
this.log.warn(
|
||||
'please hold',
|
||||
'Kibana server is not ready so requests have been paused'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
'user is waiting for over 1 second and neither serverReady$ or optimizerReady$ is false'
|
||||
);
|
||||
})
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue