-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Setup for improving load times of Hawtio Online #801
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import * as camel3 from '@hawtio/camel-model-v3' | ||
import * as camel4 from '@hawtio/camel-model-v4' | ||
import { eventService } from '@hawtiosrc/core' | ||
import { MBeanNode } from '@hawtiosrc/plugins/shared' | ||
import { jolokiaService } from '@hawtiosrc/plugins/shared/jolokia-service' | ||
|
@@ -23,6 +21,9 @@ import { | |
} from './globals' | ||
import { ROUTE_OPERATIONS } from './routes-service' | ||
|
||
let _camel3: CamelModel | null = null | ||
let _camel4: CamelModel | null = null | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so if we change them to |
||
// TODO: Should be provided by @hawtio/camel-model package | ||
export type CamelModel = { | ||
apacheCamelModelVersion: string | ||
|
@@ -325,6 +326,7 @@ export function hasProperties(node: MBeanNode): boolean { | |
} | ||
|
||
export function getCamelVersions(): string[] { | ||
const { camel4, camel3 } = fetchCamelModules() | ||
return [camel3.apacheCamelModelVersion, camel4.apacheCamelModelVersion] | ||
} | ||
|
||
|
@@ -333,6 +335,7 @@ export function getCamelVersions(): string[] { | |
* the given node. Currently, it supports Camel v3 and v4. | ||
*/ | ||
export function getCamelModel(node: MBeanNode): CamelModel { | ||
const { camel4, camel3 } = fetchCamelModules() | ||
if (isCamelVersionEQGT(node, 4, 0)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When running I get an error that camel3 is null There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, rather they should be |
||
return camel4 as unknown as CamelModel | ||
} | ||
|
@@ -397,3 +400,23 @@ export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number | |
|
||
return compareVersions(camelVersion, major, minor) >= 0 | ||
} | ||
|
||
const camelModelPromises = Promise.all([ | ||
import('@hawtio/camel-model-v3').then(c => { | ||
_camel3 = c as unknown as CamelModel | ||
}), | ||
import('@hawtio/camel-model-v4').then(c => { | ||
_camel4 = c as unknown as CamelModel | ||
}), | ||
]) | ||
|
||
function fetchCamelModules(): { camel3: CamelModel; camel4: CamelModel } { | ||
if (!_camel3 || !_camel4) { | ||
;(async () => await camelModelPromises)() | ||
} | ||
|
||
return { | ||
camel3: _camel3!, | ||
camel4: _camel4!, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './about' | ||
export * from './icons' | ||
export * from './login' | ||
export * from './notification' | ||
export * from './page' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are they needed? Note that it will change the Hawtio API we expose to external plugin authors. So generally it needs to be justified with a clear reason. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './HawtioPage' | ||
export * from './HawtioLoadingPage' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to export
ui
?