Skip to content

Commit

Permalink
[Fixes #1101] Upgrade to Jolokia 2.1.3 with hawtio-adjusted types
Browse files Browse the repository at this point in the history
  • Loading branch information
grgrzybek committed Sep 9, 2024
1 parent ff2f91b commit 1ebc3c7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions packages/hawtio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@hawtio/camel-model-v4_0": "npm:@hawtio/camel-model@~4.0.5",
"@hawtio/camel-model-v4_4": "npm:@hawtio/camel-model@~4.4.2",
"@jolokia.js/simple": "^2.1.2",
"@jolokia.js/simple": "^2.1.3",
"@module-federation/utilities": "^3.1.6",
"@patternfly/react-charts": "~7.3.0",
"@patternfly/react-code-editor": "~5.3.3",
Expand All @@ -56,7 +56,7 @@
"@types/react-router-dom": "^5.3.3",
"dagre": "^0.8.5",
"eventemitter3": "^5.0.1",
"jolokia.js": "^2.1.2",
"jolokia.js": "^2.1.3",
"jquery": "^3.7.1",
"js-logger": "^1.6.1",
"jwt-decode": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hawtio/src/plugins/shared/connect-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class ConnectService implements IConnectService {
{
success: () => resolve({ type: 'success' }),
error: () => resolve({ type: 'failure' }),
ajaxError: (response: Response | null, error: DOMException | TypeError | string | null) => {
fetchError: (response: Response | null, error: DOMException | TypeError | string | null) => {
if (response) {
log.debug('Login error:', response.status, response.statusText)
if (response.status === 429) {
Expand Down
18 changes: 9 additions & 9 deletions packages/hawtio/src/plugins/shared/jolokia-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ class JolokiaService implements IJolokiaService {
}

const options = await this.loadJolokiaOptions()
if (!options.ajaxError) {
// Default fetch() error handler (still called "ajaxError" in Jolokia 2.1.x for compatibility reasons)
options.ajaxError = this.fetchError()
if (!options.fetchError) {
// Default fetch() error handler (called "fetchError" in Jolokia 2.1.x, called "ajaxError" in 2.0.x and earlier)
options.fetchError = this.fetchError()
}

const jolokia = new Jolokia(options)
Expand Down Expand Up @@ -445,7 +445,7 @@ class JolokiaService implements IJolokiaService {

jolokia.list(
escapeMBeanPath(this.config.mbean),
onListSuccessAndError(successFn, errorFn, { ajaxError: this.fetchError(resolve) }),
onListSuccessAndError(successFn, errorFn, { fetchError: this.fetchError(resolve) }),
)
})
}
Expand Down Expand Up @@ -513,13 +513,13 @@ class JolokiaService implements IJolokiaService {

const { method, mbean } = this.config

const { success, error: errorFn, ajaxError } = options
const { success, error: errorFn, fetchError } = options

return new Promise((resolve, reject) => {
// Override ajaxError to make sure it terminates in case of ajax error
options.ajaxError = (response, error) => {
if (ajaxError !== "ignore") {
ajaxError?.(response, error)
// Override fetchError to make sure it terminates in case of ajax error
options.fetchError = (response, error) => {
if (fetchError !== "ignore") {
fetchError?.(response, error)
}
reject(error)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/hawtio/src/plugins/shared/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Workspace implements IWorkspace {
error: (response: JolokiaErrorResponse) => {
log.debug('Error - fetching JMX tree:', response)
},
ajaxError: (response: Response | null, error: DOMException | TypeError | string | null) => {
fetchError: (response: Response | null, error: DOMException | TypeError | string | null) => {
const text = response?.statusText || error
log.debug('Ajax error - fetching JMX tree:', text, '-', error)
},
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ __metadata:
dependencies:
"@hawtio/camel-model-v4_0": "npm:@hawtio/camel-model@~4.0.5"
"@hawtio/camel-model-v4_4": "npm:@hawtio/camel-model@~4.4.2"
"@jolokia.js/simple": "npm:^2.1.3"
"@module-federation/utilities": "npm:^3.1.6"
"@patternfly/react-charts": "npm:~7.3.0"
"@patternfly/react-code-editor": "npm:~5.3.3"
Expand All @@ -830,7 +831,7 @@ __metadata:
jest-environment-jsdom: "npm:^29.7.0"
jest-fetch-mock: "npm:^3.0.3"
jest-watch-typeahead: "npm:^2.2.2"
jolokia.js: "npm:^2.0.3"
jolokia.js: "npm:^2.1.3"
jquery: "npm:^3.7.1"
js-logger: "npm:^1.6.1"
jwt-decode: "npm:^4.0.0"
Expand Down Expand Up @@ -1159,6 +1160,15 @@ __metadata:
languageName: node
linkType: hard

"@jolokia.js/simple@npm:^2.1.3":
version: 2.1.3
resolution: "@jolokia.js/simple@npm:2.1.3"
dependencies:
jolokia.js: "npm:^2.1.3"
checksum: 10/bb0e3157be2605b1466cf824e758925d03e7342cf8647be35ab799be8a1e6b320bc1a25912971252b0dab1adea744f556b3d92f070286d155e459866e97b2cbb
languageName: node
linkType: hard

"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2, @jridgewell/gen-mapping@npm:^0.3.5":
version: 0.3.5
resolution: "@jridgewell/gen-mapping@npm:0.3.5"
Expand Down Expand Up @@ -8745,20 +8755,10 @@ __metadata:
languageName: node
linkType: hard

"jolokia.js@npm:^2.0.3":
version: 2.0.3
resolution: "jolokia.js@npm:2.0.3"
dependencies:
jquery: "npm:^3.7.1"
peerDependencies:
cubism: ^1.6.0
jsdom: ^22.1.0
peerDependenciesMeta:
cubism:
optional: true
jsdom:
optional: true
checksum: 10/0410a7563b5a2fb2b947309ff0fe863bd5df4ec4acf52e8184df8f92765b707a89398ad94aac138965911abf7639821ced8c4116b8a9fbf9e3f8c60fca1a9982
"jolokia.js@npm:^2.1.3":
version: 2.1.3
resolution: "jolokia.js@npm:2.1.3"
checksum: 10/15dfaa7b646a02b54c80ae531c798f038710cf9ac091af049627c2890085aa5c8fcac05bd622ff1a1fa4ce3fc00b05f15eaf0ecb400861181e8ee16ae410e104
languageName: node
linkType: hard

Expand Down

0 comments on commit 1ebc3c7

Please sign in to comment.