@hawtio/ai-plugin 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +195 -207
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -208,6 +208,7 @@ var init_ai_service = __esm({
|
|
|
208
208
|
if (typeof answer !== "string") {
|
|
209
209
|
messages.push(answer);
|
|
210
210
|
}
|
|
211
|
+
log.debug("Current messages:", messages);
|
|
211
212
|
return answer;
|
|
212
213
|
}
|
|
213
214
|
async invokeTools(dialogId, toolCalls) {
|
|
@@ -266,9 +267,11 @@ var init_ai_service = __esm({
|
|
|
266
267
|
};
|
|
267
268
|
}
|
|
268
269
|
extractThink(message) {
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
const content = message.content;
|
|
271
|
+
let think;
|
|
272
|
+
if (message.additional_kwargs?.reasoning_content) {
|
|
273
|
+
think = message.additional_kwargs?.reasoning_content;
|
|
274
|
+
}
|
|
272
275
|
return { content, think };
|
|
273
276
|
}
|
|
274
277
|
toBotMessage(answer, thinkInfo, toolCallsInfo, toolCallsApprove) {
|
|
@@ -276,7 +279,7 @@ var init_ai_service = __esm({
|
|
|
276
279
|
return aiService.createBotMessage(`Error: ${answer}`);
|
|
277
280
|
}
|
|
278
281
|
if (!answer.tool_calls || answer.tool_calls.length === 0) {
|
|
279
|
-
const { content: content2, think } = aiService.extractThink(answer
|
|
282
|
+
const { content: content2, think } = aiService.extractThink(answer);
|
|
280
283
|
const extraContent2 = think ? { beforeMainContent: thinkInfo(think) } : void 0;
|
|
281
284
|
return aiService.createBotMessage(content2, extraContent2);
|
|
282
285
|
}
|
|
@@ -2039,7 +2042,7 @@ function pluginPathWithNodeId(node, searchParams = new URLSearchParams(window.lo
|
|
|
2039
2042
|
return { pathname: pluginPath, search: query };
|
|
2040
2043
|
}
|
|
2041
2044
|
function useChatbot() {
|
|
2042
|
-
const [messages,
|
|
2045
|
+
const [messages, setMessages] = (0, import_react7.useState)([]);
|
|
2043
2046
|
const [dialogs, setDialogs] = (0, import_react7.useState)([]);
|
|
2044
2047
|
const [conversations, setConversations] = (0, import_react7.useState)([]);
|
|
2045
2048
|
const [announcement, setAnnouncement] = (0, import_react7.useState)("");
|
|
@@ -2050,7 +2053,7 @@ function useChatbot() {
|
|
|
2050
2053
|
if (!dialogId) {
|
|
2051
2054
|
return;
|
|
2052
2055
|
}
|
|
2053
|
-
|
|
2056
|
+
setMessages(messages2);
|
|
2054
2057
|
let dialog = dialogs.find((d) => d.id === dialogId);
|
|
2055
2058
|
if (dialog) {
|
|
2056
2059
|
dialog.setMessages(messages2);
|
|
@@ -2069,7 +2072,7 @@ function useChatbot() {
|
|
|
2069
2072
|
};
|
|
2070
2073
|
return {
|
|
2071
2074
|
messages,
|
|
2072
|
-
setMessages
|
|
2075
|
+
setMessages,
|
|
2073
2076
|
dialogs,
|
|
2074
2077
|
setDialogs,
|
|
2075
2078
|
conversations,
|
|
@@ -2131,11 +2134,12 @@ var init_Jmx = __esm({
|
|
|
2131
2134
|
});
|
|
2132
2135
|
|
|
2133
2136
|
// src/ai-plugin/jmx-ai/DiagnosisChatbot.tsx
|
|
2134
|
-
var import_ui, import_Chatbot, import_ChatbotContent, import_ChatbotConversationHistoryNav, import_ChatbotFooter, import_ChatbotHeader, import_Message, import_MessageBar, import_MessageBox, import_react_core2, import_wrench_icon, import_react8, import_jsx_runtime2, DiagnosisChatbot, DiagnosisChatbotHeader, DiagnosisChatbotContent, DiagnosisChatbotFooter, ThinkInfo, ToolCallsInfo, ToolCallsApprove;
|
|
2137
|
+
var import_ui, import_chatbot, import_Chatbot, import_ChatbotContent, import_ChatbotConversationHistoryNav, import_ChatbotFooter, import_ChatbotHeader, import_Message, import_MessageBar, import_MessageBox, import_react_core2, import_wrench_icon, import_react8, import_jsx_runtime2, DiagnosisChatbot, DiagnosisChatbotHeader, DiagnosisChatbotContent, DiagnosisChatbotFooter, ThinkInfo, ToolCallsInfo, ToolCallsApprove;
|
|
2135
2138
|
var init_DiagnosisChatbot = __esm({
|
|
2136
2139
|
"src/ai-plugin/jmx-ai/DiagnosisChatbot.tsx"() {
|
|
2137
2140
|
"use strict";
|
|
2138
2141
|
import_ui = require("@hawtio/react/ui");
|
|
2142
|
+
import_chatbot = require("@patternfly/chatbot");
|
|
2139
2143
|
import_Chatbot = __toESM(require("@patternfly/chatbot/dist/dynamic/Chatbot"));
|
|
2140
2144
|
import_ChatbotContent = __toESM(require("@patternfly/chatbot/dist/dynamic/ChatbotContent"));
|
|
2141
2145
|
import_ChatbotConversationHistoryNav = __toESM(require("@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav"));
|
|
@@ -2152,14 +2156,14 @@ var init_DiagnosisChatbot = __esm({
|
|
|
2152
2156
|
init_globals();
|
|
2153
2157
|
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2154
2158
|
DiagnosisChatbot = () => {
|
|
2155
|
-
const { setMessages
|
|
2159
|
+
const { setMessages, dialogs, conversations } = (0, import_react8.useContext)(ChatbotContext);
|
|
2156
2160
|
const [isDrawerOpen, setIsDrawerOpen] = (0, import_react8.useState)(false);
|
|
2157
2161
|
const [filteredConversations, setFilteredConversations] = (0, import_react8.useState)(conversations);
|
|
2158
2162
|
const onSelectItemInHistory = (selected) => {
|
|
2159
2163
|
log.debug("Selected conversation with ID:", selected);
|
|
2160
2164
|
const dialog = dialogs.find((c) => c.id === selected);
|
|
2161
2165
|
if (dialog) {
|
|
2162
|
-
|
|
2166
|
+
setMessages(dialog.messages);
|
|
2163
2167
|
setIsDrawerOpen(!isDrawerOpen);
|
|
2164
2168
|
}
|
|
2165
2169
|
};
|
|
@@ -2190,7 +2194,7 @@ var init_DiagnosisChatbot = __esm({
|
|
|
2190
2194
|
onNewChat: () => {
|
|
2191
2195
|
setIsDrawerOpen(!isDrawerOpen);
|
|
2192
2196
|
setFilteredConversations(conversations);
|
|
2193
|
-
|
|
2197
|
+
setMessages([]);
|
|
2194
2198
|
},
|
|
2195
2199
|
handleTextInputChange: handleSearchTextChange,
|
|
2196
2200
|
drawerContent: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
@@ -2273,7 +2277,7 @@ var init_DiagnosisChatbot = __esm({
|
|
|
2273
2277
|
] });
|
|
2274
2278
|
};
|
|
2275
2279
|
ThinkInfo = (think) => {
|
|
2276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_core2.Alert, { variant: "info", title: "
|
|
2280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_core2.Alert, { variant: "info", title: "Thinking", isExpandable: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_chatbot.MarkdownContent, { content: think }) });
|
|
2277
2281
|
};
|
|
2278
2282
|
ToolCallsInfo = (call, index) => {
|
|
2279
2283
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_core2.Alert, { variant: "info", customIcon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_wrench_icon.default, {}), title: call.name, isExpandable: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { children: [
|
|
@@ -2296,7 +2300,8 @@ var init_DiagnosisChatbot = __esm({
|
|
|
2296
2300
|
updateConversations(newMessages);
|
|
2297
2301
|
setAnnouncement(`User approved tool usage. Message from Bot is loading.`);
|
|
2298
2302
|
log.debug("approve - newMessages:", newMessages);
|
|
2299
|
-
const
|
|
2303
|
+
const dialogId = newMessages[0].id;
|
|
2304
|
+
const answer = await aiService.invokeTools(dialogId, toolCalls2);
|
|
2300
2305
|
log.debug("Answer:", answer);
|
|
2301
2306
|
const loadedMessages = [];
|
|
2302
2307
|
loadedMessages.push(...newMessages);
|
|
@@ -2314,7 +2319,7 @@ var init_DiagnosisChatbot = __esm({
|
|
|
2314
2319
|
const newMessages = [];
|
|
2315
2320
|
newMessages.push(...messages);
|
|
2316
2321
|
newMessages.push(aiService.createUserMessage(username, "Rejected"));
|
|
2317
|
-
|
|
2322
|
+
updateConversations(newMessages);
|
|
2318
2323
|
setIsSendButtonDisabled(false);
|
|
2319
2324
|
};
|
|
2320
2325
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_core2.Flex, { columnGap: { default: "columnGapSm" }, children: [
|
|
@@ -2331,111 +2336,6 @@ var init_JmxContent = __esm({
|
|
|
2331
2336
|
}
|
|
2332
2337
|
});
|
|
2333
2338
|
|
|
2334
|
-
// src/ai-plugin/jmx-ai/util.ts
|
|
2335
|
-
function isObject(value) {
|
|
2336
|
-
const type = typeof value;
|
|
2337
|
-
return value != null && (type === "object" || type === "function");
|
|
2338
|
-
}
|
|
2339
|
-
function isNumber(value) {
|
|
2340
|
-
return typeof value === "number" && !Number.isNaN(value);
|
|
2341
|
-
}
|
|
2342
|
-
function stringSorter(a, b, sortDesc) {
|
|
2343
|
-
let res = a.localeCompare(b);
|
|
2344
|
-
if (sortDesc) {
|
|
2345
|
-
res *= -1;
|
|
2346
|
-
}
|
|
2347
|
-
return res;
|
|
2348
|
-
}
|
|
2349
|
-
function objectSorter(aValue, bValue, sortDesc) {
|
|
2350
|
-
if (isNumber(aValue)) {
|
|
2351
|
-
if (!sortDesc) {
|
|
2352
|
-
return aValue - bValue;
|
|
2353
|
-
}
|
|
2354
|
-
return bValue - aValue;
|
|
2355
|
-
} else {
|
|
2356
|
-
return stringSorter(aValue, bValue, sortDesc);
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
function escapeMBean(mbean) {
|
|
2360
|
-
return encodeURI(applyJolokiaEscapeRules(mbean));
|
|
2361
|
-
}
|
|
2362
|
-
function applyJolokiaEscapeRules(mbean) {
|
|
2363
|
-
return mbean.replace(/!/g, "!!").replace(/\//g, "!/").replace(/"/g, '!"');
|
|
2364
|
-
}
|
|
2365
|
-
var init_util = __esm({
|
|
2366
|
-
"src/ai-plugin/jmx-ai/util.ts"() {
|
|
2367
|
-
"use strict";
|
|
2368
|
-
}
|
|
2369
|
-
});
|
|
2370
|
-
|
|
2371
|
-
// src/ai-plugin/jmx-ai/attributes/attribute-service.ts
|
|
2372
|
-
var import_react9, AttributeService, attributeService;
|
|
2373
|
-
var init_attribute_service = __esm({
|
|
2374
|
-
"src/ai-plugin/jmx-ai/attributes/attribute-service.ts"() {
|
|
2375
|
-
"use strict";
|
|
2376
|
-
import_react9 = require("@hawtio/react");
|
|
2377
|
-
init_globals();
|
|
2378
|
-
init_util();
|
|
2379
|
-
AttributeService = class {
|
|
2380
|
-
handles = [];
|
|
2381
|
-
requestOptions() {
|
|
2382
|
-
return {};
|
|
2383
|
-
}
|
|
2384
|
-
setupConfig(request) {
|
|
2385
|
-
return request;
|
|
2386
|
-
}
|
|
2387
|
-
async read(mbean) {
|
|
2388
|
-
return await import_react9.jolokiaService.readAttributes(mbean, this.requestOptions());
|
|
2389
|
-
}
|
|
2390
|
-
async readWithCallback(mbean, callback) {
|
|
2391
|
-
const attrs = await import_react9.jolokiaService.readAttributes(mbean, this.requestOptions());
|
|
2392
|
-
callback(attrs);
|
|
2393
|
-
}
|
|
2394
|
-
async register(request, callback) {
|
|
2395
|
-
const handle = await import_react9.jolokiaService.register(this.setupConfig(request), callback);
|
|
2396
|
-
log.debug("Register handle:", handle);
|
|
2397
|
-
this.handles.push(handle);
|
|
2398
|
-
}
|
|
2399
|
-
unregisterAll() {
|
|
2400
|
-
log.debug("Unregister all handles:", this.handles);
|
|
2401
|
-
this.handles.forEach((handle) => import_react9.jolokiaService.unregister(handle));
|
|
2402
|
-
this.handles = [];
|
|
2403
|
-
}
|
|
2404
|
-
async buildUrl(mbean, attribute) {
|
|
2405
|
-
const jolokiaUrl = await import_react9.jolokiaService.getFullJolokiaUrl();
|
|
2406
|
-
return `${jolokiaUrl}/read/${escapeMBean(mbean)}/${attribute}`;
|
|
2407
|
-
}
|
|
2408
|
-
async canInvoke(mbean, attribute, type) {
|
|
2409
|
-
return true;
|
|
2410
|
-
}
|
|
2411
|
-
async update(mbeanName, attribute, value) {
|
|
2412
|
-
await import_react9.jolokiaService.writeAttribute(mbeanName, attribute, value, this.requestOptions());
|
|
2413
|
-
import_react9.eventService.notify({ type: "success", message: `Updated attribute: ${attribute}` });
|
|
2414
|
-
}
|
|
2415
|
-
async bulkRequest(requests) {
|
|
2416
|
-
return import_react9.jolokiaService.bulkRequest(requests.map(this.setupConfig));
|
|
2417
|
-
}
|
|
2418
|
-
};
|
|
2419
|
-
attributeService = new AttributeService();
|
|
2420
|
-
}
|
|
2421
|
-
});
|
|
2422
|
-
|
|
2423
|
-
// src/ai-plugin/jmx-ai/attributes/AttributeModal.tsx
|
|
2424
|
-
var import_react10, import_react_core3, import_react_icons, import_react11, import_jsx_runtime3;
|
|
2425
|
-
var init_AttributeModal = __esm({
|
|
2426
|
-
"src/ai-plugin/jmx-ai/attributes/AttributeModal.tsx"() {
|
|
2427
|
-
"use strict";
|
|
2428
|
-
import_react10 = require("@hawtio/react");
|
|
2429
|
-
import_react_core3 = require("@patternfly/react-core");
|
|
2430
|
-
import_react_icons = require("@patternfly/react-icons");
|
|
2431
|
-
import_react11 = require("react");
|
|
2432
|
-
init_ai_service();
|
|
2433
|
-
init_globals();
|
|
2434
|
-
init_attribute_service();
|
|
2435
|
-
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2436
|
-
}
|
|
2437
|
-
});
|
|
2438
|
-
|
|
2439
2339
|
// node_modules/jolokia.js/dist/jolokia.mjs
|
|
2440
2340
|
function prepareRequest(request, agentOptions, params) {
|
|
2441
2341
|
const opts = Object.assign({}, agentOptions, { dataType: "json" }, params);
|
|
@@ -3252,18 +3152,107 @@ What potential issues or anomalies do you see?`;
|
|
|
3252
3152
|
}
|
|
3253
3153
|
});
|
|
3254
3154
|
|
|
3155
|
+
// src/ai-plugin/jmx-ai/util.ts
|
|
3156
|
+
function isObject(value) {
|
|
3157
|
+
const type = typeof value;
|
|
3158
|
+
return value != null && (type === "object" || type === "function");
|
|
3159
|
+
}
|
|
3160
|
+
function isNumber(value) {
|
|
3161
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
3162
|
+
}
|
|
3163
|
+
function stringSorter(a, b, sortDesc) {
|
|
3164
|
+
let res = a.localeCompare(b);
|
|
3165
|
+
if (sortDesc) {
|
|
3166
|
+
res *= -1;
|
|
3167
|
+
}
|
|
3168
|
+
return res;
|
|
3169
|
+
}
|
|
3170
|
+
function objectSorter(aValue, bValue, sortDesc) {
|
|
3171
|
+
if (isNumber(aValue)) {
|
|
3172
|
+
if (!sortDesc) {
|
|
3173
|
+
return aValue - bValue;
|
|
3174
|
+
}
|
|
3175
|
+
return bValue - aValue;
|
|
3176
|
+
} else {
|
|
3177
|
+
return stringSorter(aValue, bValue, sortDesc);
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
function escapeMBean(mbean) {
|
|
3181
|
+
return encodeURI(applyJolokiaEscapeRules(mbean));
|
|
3182
|
+
}
|
|
3183
|
+
function applyJolokiaEscapeRules(mbean) {
|
|
3184
|
+
return mbean.replace(/!/g, "!!").replace(/\//g, "!/").replace(/"/g, '!"');
|
|
3185
|
+
}
|
|
3186
|
+
var init_util = __esm({
|
|
3187
|
+
"src/ai-plugin/jmx-ai/util.ts"() {
|
|
3188
|
+
"use strict";
|
|
3189
|
+
}
|
|
3190
|
+
});
|
|
3191
|
+
|
|
3192
|
+
// src/ai-plugin/jmx-ai/attributes/attribute-service.ts
|
|
3193
|
+
var import_react9, AttributeService, attributeService;
|
|
3194
|
+
var init_attribute_service = __esm({
|
|
3195
|
+
"src/ai-plugin/jmx-ai/attributes/attribute-service.ts"() {
|
|
3196
|
+
"use strict";
|
|
3197
|
+
import_react9 = require("@hawtio/react");
|
|
3198
|
+
init_globals();
|
|
3199
|
+
init_util();
|
|
3200
|
+
AttributeService = class {
|
|
3201
|
+
handles = [];
|
|
3202
|
+
requestOptions() {
|
|
3203
|
+
return {};
|
|
3204
|
+
}
|
|
3205
|
+
setupConfig(request) {
|
|
3206
|
+
return request;
|
|
3207
|
+
}
|
|
3208
|
+
async read(mbean) {
|
|
3209
|
+
return await import_react9.jolokiaService.readAttributes(mbean, this.requestOptions());
|
|
3210
|
+
}
|
|
3211
|
+
async readWithCallback(mbean, callback) {
|
|
3212
|
+
const attrs = await import_react9.jolokiaService.readAttributes(mbean, this.requestOptions());
|
|
3213
|
+
callback(attrs);
|
|
3214
|
+
}
|
|
3215
|
+
async register(request, callback) {
|
|
3216
|
+
const handle = await import_react9.jolokiaService.register(this.setupConfig(request), callback);
|
|
3217
|
+
log.debug("Register handle:", handle);
|
|
3218
|
+
this.handles.push(handle);
|
|
3219
|
+
}
|
|
3220
|
+
unregisterAll() {
|
|
3221
|
+
log.debug("Unregister all handles:", this.handles);
|
|
3222
|
+
this.handles.forEach((handle) => import_react9.jolokiaService.unregister(handle));
|
|
3223
|
+
this.handles = [];
|
|
3224
|
+
}
|
|
3225
|
+
async buildUrl(mbean, attribute) {
|
|
3226
|
+
const jolokiaUrl = await import_react9.jolokiaService.getFullJolokiaUrl();
|
|
3227
|
+
return `${jolokiaUrl}/read/${escapeMBean(mbean)}/${attribute}`;
|
|
3228
|
+
}
|
|
3229
|
+
async canInvoke(mbean, attribute, type) {
|
|
3230
|
+
return true;
|
|
3231
|
+
}
|
|
3232
|
+
async update(mbeanName, attribute, value) {
|
|
3233
|
+
await import_react9.jolokiaService.writeAttribute(mbeanName, attribute, value, this.requestOptions());
|
|
3234
|
+
import_react9.eventService.notify({ type: "success", message: `Updated attribute: ${attribute}` });
|
|
3235
|
+
}
|
|
3236
|
+
async bulkRequest(requests) {
|
|
3237
|
+
return import_react9.jolokiaService.bulkRequest(requests.map(this.setupConfig));
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
attributeService = new AttributeService();
|
|
3241
|
+
}
|
|
3242
|
+
});
|
|
3243
|
+
|
|
3255
3244
|
// src/ai-plugin/jmx-ai/attributes/Attributes.tsx
|
|
3256
|
-
var
|
|
3245
|
+
var import_react10, import_ui2, import_react_core3, import_react_icons, import_react_table, import_react11, import_jsx_runtime3, Attributes, AiJmxToolbar;
|
|
3257
3246
|
var init_Attributes = __esm({
|
|
3258
3247
|
"src/ai-plugin/jmx-ai/attributes/Attributes.tsx"() {
|
|
3259
3248
|
"use strict";
|
|
3260
|
-
|
|
3249
|
+
import_react10 = require("@hawtio/react");
|
|
3261
3250
|
import_ui2 = require("@hawtio/react/ui");
|
|
3262
|
-
|
|
3263
|
-
|
|
3251
|
+
import_react_core3 = require("@patternfly/react-core");
|
|
3252
|
+
import_react_icons = require("@patternfly/react-icons");
|
|
3264
3253
|
import_react_table = require("@patternfly/react-table");
|
|
3265
3254
|
init_jolokia();
|
|
3266
|
-
|
|
3255
|
+
import_react11 = require("react");
|
|
3267
3256
|
init_ai_service();
|
|
3268
3257
|
init_context();
|
|
3269
3258
|
init_DiagnosisChatbot();
|
|
@@ -3271,16 +3260,16 @@ var init_Attributes = __esm({
|
|
|
3271
3260
|
init_jmx_ai_service();
|
|
3272
3261
|
init_util();
|
|
3273
3262
|
init_attribute_service();
|
|
3274
|
-
|
|
3263
|
+
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3275
3264
|
Attributes = () => {
|
|
3276
|
-
const { selectedNode } = (0,
|
|
3277
|
-
const [attributes, setAttributes] = (0,
|
|
3278
|
-
const [isReading, setIsReading] = (0,
|
|
3279
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
3280
|
-
const [sortDirection, setSortDirection] = (0,
|
|
3281
|
-
const [selected, setSelected] = (0,
|
|
3282
|
-
const [reload, setReload] = (0,
|
|
3283
|
-
(0,
|
|
3265
|
+
const { selectedNode } = (0, import_react11.useContext)(MBeanTreeContext);
|
|
3266
|
+
const [attributes, setAttributes] = (0, import_react11.useState)({});
|
|
3267
|
+
const [isReading, setIsReading] = (0, import_react11.useState)(true);
|
|
3268
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react11.useState)(false);
|
|
3269
|
+
const [sortDirection, setSortDirection] = (0, import_react11.useState)("asc");
|
|
3270
|
+
const [selected, setSelected] = (0, import_react11.useState)({ name: "", value: "" });
|
|
3271
|
+
const [reload, setReload] = (0, import_react11.useState)(false);
|
|
3272
|
+
(0, import_react11.useEffect)(() => {
|
|
3284
3273
|
if (!selectedNode || !selectedNode.mbean || !selectedNode.objectName) {
|
|
3285
3274
|
return;
|
|
3286
3275
|
}
|
|
@@ -3300,7 +3289,7 @@ var init_Attributes = __esm({
|
|
|
3300
3289
|
);
|
|
3301
3290
|
return () => attributeService.unregisterAll();
|
|
3302
3291
|
}, [selectedNode]);
|
|
3303
|
-
(0,
|
|
3292
|
+
(0, import_react11.useEffect)(() => {
|
|
3304
3293
|
if (!selectedNode || !selectedNode.mbean || !selectedNode.objectName || !reload) {
|
|
3305
3294
|
return;
|
|
3306
3295
|
}
|
|
@@ -3316,14 +3305,14 @@ var init_Attributes = __esm({
|
|
|
3316
3305
|
return null;
|
|
3317
3306
|
}
|
|
3318
3307
|
if (isReading) {
|
|
3319
|
-
return /* @__PURE__ */ (0,
|
|
3308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react10.HawtioLoadingCard, {});
|
|
3320
3309
|
}
|
|
3321
3310
|
const rows = Object.entries(attributes).map(([name, value]) => ({
|
|
3322
3311
|
name,
|
|
3323
3312
|
value: isObject(value) ? JSON.stringify(value) : String(value)
|
|
3324
3313
|
}));
|
|
3325
3314
|
if (rows.length === 0) {
|
|
3326
|
-
return /* @__PURE__ */ (0,
|
|
3315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react10.HawtioEmptyCard, { message: "This MBean has no attributes." });
|
|
3327
3316
|
}
|
|
3328
3317
|
const selectAttribute = (attribute) => {
|
|
3329
3318
|
setSelected(attribute);
|
|
@@ -3343,8 +3332,8 @@ var init_Attributes = __esm({
|
|
|
3343
3332
|
},
|
|
3344
3333
|
columnIndex: 0
|
|
3345
3334
|
});
|
|
3346
|
-
const panelContent = /* @__PURE__ */ (0,
|
|
3347
|
-
|
|
3335
|
+
const panelContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3336
|
+
import_react10.AttributeModal,
|
|
3348
3337
|
{
|
|
3349
3338
|
isOpen: isModalOpen,
|
|
3350
3339
|
onClose: () => setIsModalOpen(false),
|
|
@@ -3352,34 +3341,34 @@ var init_Attributes = __esm({
|
|
|
3352
3341
|
input: selected
|
|
3353
3342
|
}
|
|
3354
3343
|
);
|
|
3355
|
-
const attributesTable = /* @__PURE__ */ (0,
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3357
|
-
/* @__PURE__ */ (0,
|
|
3358
|
-
/* @__PURE__ */ (0,
|
|
3359
|
-
/* @__PURE__ */ (0,
|
|
3360
|
-
/* @__PURE__ */ (0,
|
|
3344
|
+
const attributesTable = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { id: "attribute-table-with-panel", children: [
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AiJmxToolbar, { attributes }),
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_table.Table, { "aria-label": "Attributes", variant: "compact", children: [
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_table.Thead, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_table.Tr, { children: [
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_table.Th, { sort: getSortParams(), children: "Attribute" }),
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_table.Th, { children: "Value" })
|
|
3361
3350
|
] }) }),
|
|
3362
|
-
/* @__PURE__ */ (0,
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_table.Tbody, { children: rows.sort((a, b) => objectSorter(a.name, b.name, sortDirection === "desc")).map((att, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3363
3352
|
import_react_table.Tr,
|
|
3364
3353
|
{
|
|
3365
3354
|
isClickable: true,
|
|
3366
3355
|
isRowSelected: selected.name === att.name,
|
|
3367
3356
|
onRowClick: () => selectAttribute(att),
|
|
3368
3357
|
children: [
|
|
3369
|
-
/* @__PURE__ */ (0,
|
|
3370
|
-
/* @__PURE__ */ (0,
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_table.Td, { children: att.name }),
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_table.Td, { children: att.value })
|
|
3371
3360
|
]
|
|
3372
3361
|
},
|
|
3373
3362
|
att.name + "-" + index
|
|
3374
3363
|
)) })
|
|
3375
3364
|
] })
|
|
3376
3365
|
] });
|
|
3377
|
-
return /* @__PURE__ */ (0,
|
|
3366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.Drawer, { isExpanded: isModalOpen, className: "pf-m-inline-on-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.DrawerContent, { panelContent, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.DrawerContentBody, { hasPadding: true, children: attributesTable }) }) }) });
|
|
3378
3367
|
};
|
|
3379
3368
|
AiJmxToolbar = ({ attributes }) => {
|
|
3380
|
-
const { selectedNode } = (0,
|
|
3381
|
-
const { username } = (0,
|
|
3382
|
-
const { setAnnouncement, setIsChatbotOpen, updateConversations } = (0,
|
|
3369
|
+
const { selectedNode } = (0, import_react11.useContext)(MBeanTreeContext);
|
|
3370
|
+
const { username } = (0, import_react11.useContext)(import_ui2.PageContext);
|
|
3371
|
+
const { setAnnouncement, setIsChatbotOpen, updateConversations } = (0, import_react11.useContext)(ChatbotContext);
|
|
3383
3372
|
if (!selectedNode || !selectedNode.mbean || !selectedNode.objectName) {
|
|
3384
3373
|
return null;
|
|
3385
3374
|
}
|
|
@@ -3407,7 +3396,7 @@ var init_Attributes = __esm({
|
|
|
3407
3396
|
updateConversations(loadedMessages);
|
|
3408
3397
|
setAnnouncement("Diagnosis complete.");
|
|
3409
3398
|
};
|
|
3410
|
-
return /* @__PURE__ */ (0,
|
|
3399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.Toolbar, { id: "ai-jmx-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.ToolbarContent, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.ToolbarItem, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_core3.Button, { variant: "primary", size: "sm", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_icons.MonitoringIcon, {}), onClick: diagnose, children: "Diagnose" }) }) }) });
|
|
3411
3400
|
};
|
|
3412
3401
|
}
|
|
3413
3402
|
});
|
|
@@ -3416,36 +3405,35 @@ var init_Attributes = __esm({
|
|
|
3416
3405
|
var init_attributes = __esm({
|
|
3417
3406
|
"src/ai-plugin/jmx-ai/attributes/index.ts"() {
|
|
3418
3407
|
"use strict";
|
|
3419
|
-
init_AttributeModal();
|
|
3420
3408
|
init_Attributes();
|
|
3421
3409
|
}
|
|
3422
3410
|
});
|
|
3423
3411
|
|
|
3424
3412
|
// src/ai-plugin/jmx-ai/JmxContent.tsx
|
|
3425
|
-
var
|
|
3413
|
+
var import_react12, import_react_core4, import_popper_core, import_cubes_icon, import_react13, import_react_router_dom2, import_jsx_runtime4, JmxContent;
|
|
3426
3414
|
var init_JmxContent2 = __esm({
|
|
3427
3415
|
"src/ai-plugin/jmx-ai/JmxContent.tsx"() {
|
|
3428
3416
|
"use strict";
|
|
3429
|
-
|
|
3430
|
-
|
|
3417
|
+
import_react12 = require("@hawtio/react");
|
|
3418
|
+
import_react_core4 = require("@patternfly/react-core");
|
|
3431
3419
|
import_popper_core = require("@patternfly/react-core/dist/esm/helpers/Popper/thirdparty/popper-core");
|
|
3432
3420
|
import_cubes_icon = require("@patternfly/react-icons/dist/esm/icons/cubes-icon");
|
|
3433
|
-
|
|
3421
|
+
import_react13 = __toESM(require("react"));
|
|
3434
3422
|
import_react_router_dom2 = require("react-router-dom");
|
|
3435
3423
|
init_DiagnosisChatbot();
|
|
3436
3424
|
init_JmxContent();
|
|
3437
3425
|
init_attributes();
|
|
3438
3426
|
init_context();
|
|
3439
3427
|
init_globals();
|
|
3440
|
-
|
|
3428
|
+
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
3441
3429
|
JmxContent = () => {
|
|
3442
|
-
const { selectedNode } = (0,
|
|
3430
|
+
const { selectedNode } = (0, import_react13.useContext)(MBeanTreeContext);
|
|
3443
3431
|
const { pathname, search } = (0, import_react_router_dom2.useLocation)();
|
|
3444
3432
|
const chatbotContext = useChatbot();
|
|
3445
3433
|
const { isChatbotOpen, setIsChatbotOpen } = chatbotContext;
|
|
3446
|
-
const drawerRef = (0,
|
|
3434
|
+
const drawerRef = (0, import_react13.useRef)(void 0);
|
|
3447
3435
|
if (!selectedNode) {
|
|
3448
|
-
return /* @__PURE__ */ (0,
|
|
3436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.PageSection, { hasBodyWrapper: false, isFilled: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.EmptyState, { headingLevel: "h1", icon: import_cubes_icon.CubesIcon, titleText: "Select MBean", variant: "full" }) });
|
|
3449
3437
|
}
|
|
3450
3438
|
const mBeanApplicable = (node) => Boolean(node.objectName);
|
|
3451
3439
|
const mBeanCollectionApplicable = (node) => Boolean(node.children?.every((child) => child.objectName));
|
|
@@ -3453,42 +3441,42 @@ var init_JmxContent2 = __esm({
|
|
|
3453
3441
|
const tableSelector = (node) => {
|
|
3454
3442
|
const tablePriorityList = [
|
|
3455
3443
|
{ condition: mBeanApplicable, element: Attributes },
|
|
3456
|
-
{ condition: mBeanCollectionApplicable, element:
|
|
3444
|
+
{ condition: mBeanCollectionApplicable, element: import_react12.AttributeTable }
|
|
3457
3445
|
];
|
|
3458
|
-
return tablePriorityList.find((entry) => entry.condition(node))?.element ??
|
|
3446
|
+
return tablePriorityList.find((entry) => entry.condition(node))?.element ?? import_react12.JmxContentMBeans;
|
|
3459
3447
|
};
|
|
3460
3448
|
const allNavItems = [
|
|
3461
3449
|
{ id: "attributes", title: "Attributes", component: tableSelector(selectedNode), isApplicable: () => true },
|
|
3462
|
-
{ id: "operations", title: "Operations", component:
|
|
3463
|
-
{ id: "chart", title: "Chart", component:
|
|
3450
|
+
{ id: "operations", title: "Operations", component: import_react12.Operations, isApplicable: mBeanApplicable },
|
|
3451
|
+
{ id: "chart", title: "Chart", component: import_react12.Chart, isApplicable: hasAnyApplicableMBean }
|
|
3464
3452
|
];
|
|
3465
3453
|
const navItems = allNavItems.filter((nav) => nav.isApplicable(selectedNode));
|
|
3466
3454
|
const searchWithNid = pluginPathWithNodeId(selectedNode, new URLSearchParams(search)).search;
|
|
3467
|
-
const mbeanNav = /* @__PURE__ */ (0,
|
|
3468
|
-
const mbeanRoutes = navItems.map((nav) => /* @__PURE__ */ (0,
|
|
3469
|
-
const jmxAiToolbar = /* @__PURE__ */ (0,
|
|
3470
|
-
const jmxContent = /* @__PURE__ */ (0,
|
|
3471
|
-
/* @__PURE__ */ (0,
|
|
3455
|
+
const mbeanNav = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.Nav, { "aria-label": "MBean Nav", variant: "horizontal-subnav", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.NavList, { children: navItems.map((nav) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.NavItem, { isActive: pathname === `${pluginPath}/${nav.id}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_router_dom2.NavLink, { to: { pathname: nav.id, search }, children: nav.title }) }, nav.id)) }) });
|
|
3456
|
+
const mbeanRoutes = navItems.map((nav) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_router_dom2.Route, { path: nav.id, element: import_react13.default.createElement(nav.component) }, nav.id));
|
|
3457
|
+
const jmxAiToolbar = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.Toolbar, { id: "jmx-ai-toolbar", style: { float: import_popper_core.right }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.ToolbarItem, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.Button, { variant: "secondary", size: "sm", onClick: () => setIsChatbotOpen(!isChatbotOpen), children: "Chat" }) }) });
|
|
3458
|
+
const jmxContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_core4.PageGroup, { id: "jmx-content", children: [
|
|
3459
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_core4.PageSection, { id: "jmx-content-header", hasBodyWrapper: false, children: [
|
|
3472
3460
|
jmxAiToolbar,
|
|
3473
|
-
/* @__PURE__ */ (0,
|
|
3474
|
-
/* @__PURE__ */ (0,
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.Title, { headingLevel: "h1", children: selectedNode.name }),
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.Content, { component: "small", children: selectedNode.objectName })
|
|
3475
3463
|
] }),
|
|
3476
|
-
/* @__PURE__ */ (0,
|
|
3477
|
-
/* @__PURE__ */ (0,
|
|
3478
|
-
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.PageSection, { type: "tabs", hasBodyWrapper: false, children: mbeanNav }),
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3466
|
+
import_react_core4.PageSection,
|
|
3479
3467
|
{
|
|
3480
3468
|
id: "jmx-content-main",
|
|
3481
3469
|
padding: { default: "noPadding" },
|
|
3482
3470
|
hasOverflowScroll: true,
|
|
3483
3471
|
"aria-label": "jmx-content-main",
|
|
3484
3472
|
hasBodyWrapper: false,
|
|
3485
|
-
children: /* @__PURE__ */ (0,
|
|
3473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_router_dom2.Routes, { children: [
|
|
3486
3474
|
mbeanRoutes,
|
|
3487
|
-
/* @__PURE__ */ (0,
|
|
3475
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3488
3476
|
import_react_router_dom2.Route,
|
|
3489
3477
|
{
|
|
3490
3478
|
path: "/",
|
|
3491
|
-
element: /* @__PURE__ */ (0,
|
|
3479
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_router_dom2.Navigate, { to: { pathname: navItems[0]?.id ?? "", search: searchWithNid } })
|
|
3492
3480
|
},
|
|
3493
3481
|
"root"
|
|
3494
3482
|
)
|
|
@@ -3499,8 +3487,8 @@ var init_JmxContent2 = __esm({
|
|
|
3499
3487
|
const onDrawerExpand = () => {
|
|
3500
3488
|
drawerRef.current && drawerRef.current.focus();
|
|
3501
3489
|
};
|
|
3502
|
-
const panelContent = /* @__PURE__ */ (0,
|
|
3503
|
-
return /* @__PURE__ */ (0,
|
|
3490
|
+
const panelContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.DrawerPanelContent, { isResizable: true, defaultSize: "500px", minSize: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.DrawerPanelBody, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DiagnosisChatbot, {}) }) });
|
|
3491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChatbotContext.Provider, { value: chatbotContext, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.Drawer, { isExpanded: isChatbotOpen, isInline: true, onExpand: onDrawerExpand, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.DrawerContent, { panelContent, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_core4.DrawerContentBody, { children: jmxContent }) }) }) });
|
|
3504
3492
|
};
|
|
3505
3493
|
}
|
|
3506
3494
|
});
|
|
@@ -3512,23 +3500,23 @@ var init_JmxTreeView = __esm({
|
|
|
3512
3500
|
});
|
|
3513
3501
|
|
|
3514
3502
|
// src/ai-plugin/jmx-ai/JmxTreeView.tsx
|
|
3515
|
-
var
|
|
3503
|
+
var import_react14, import_react_core5, import_react15, import_react_router_dom3, import_jsx_runtime5, JmxTreeView;
|
|
3516
3504
|
var init_JmxTreeView2 = __esm({
|
|
3517
3505
|
"src/ai-plugin/jmx-ai/JmxTreeView.tsx"() {
|
|
3518
3506
|
"use strict";
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3507
|
+
import_react14 = require("@hawtio/react");
|
|
3508
|
+
import_react_core5 = require("@patternfly/react-core");
|
|
3509
|
+
import_react15 = require("react");
|
|
3522
3510
|
import_react_router_dom3 = require("react-router-dom");
|
|
3523
3511
|
init_JmxTreeView();
|
|
3524
3512
|
init_context();
|
|
3525
|
-
|
|
3513
|
+
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3526
3514
|
JmxTreeView = () => {
|
|
3527
|
-
const { tree, selectedNode, setSelectedNode } = (0,
|
|
3528
|
-
const [expanded, setExpanded] = (0,
|
|
3529
|
-
const [filteredTree, setFilteredTree] = (0,
|
|
3515
|
+
const { tree, selectedNode, setSelectedNode } = (0, import_react15.useContext)(MBeanTreeContext);
|
|
3516
|
+
const [expanded, setExpanded] = (0, import_react15.useState)(0 /* Default */);
|
|
3517
|
+
const [filteredTree, setFilteredTree] = (0, import_react15.useState)(tree.getTree());
|
|
3530
3518
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
3531
|
-
(0,
|
|
3519
|
+
(0, import_react15.useEffect)(() => {
|
|
3532
3520
|
setFilteredTree(tree.getTree());
|
|
3533
3521
|
}, [tree]);
|
|
3534
3522
|
const onSearch = (event) => {
|
|
@@ -3536,7 +3524,7 @@ var init_JmxTreeView2 = __esm({
|
|
|
3536
3524
|
setExpanded(0 /* Default */);
|
|
3537
3525
|
const input = event.target.value;
|
|
3538
3526
|
if (!input) setFilteredTree(tree.getTree());
|
|
3539
|
-
const treeElements =
|
|
3527
|
+
const treeElements = import_react14.MBeanTree.filter(tree.getTree(), (node) => node.name.toLowerCase().includes(input.toLowerCase()));
|
|
3540
3528
|
if (treeElements.length === 0) setFilteredTree(tree.getTree());
|
|
3541
3529
|
else {
|
|
3542
3530
|
setFilteredTree(treeElements);
|
|
@@ -3561,8 +3549,8 @@ var init_JmxTreeView2 = __esm({
|
|
|
3561
3549
|
return {};
|
|
3562
3550
|
}
|
|
3563
3551
|
};
|
|
3564
|
-
return /* @__PURE__ */ (0,
|
|
3565
|
-
|
|
3552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3553
|
+
import_react_core5.TreeView,
|
|
3566
3554
|
{
|
|
3567
3555
|
id: "jmx-tree-view",
|
|
3568
3556
|
data: filteredTree,
|
|
@@ -3571,7 +3559,7 @@ var init_JmxTreeView2 = __esm({
|
|
|
3571
3559
|
activeItems: selectedNode ? [selectedNode] : [],
|
|
3572
3560
|
...expandedProp(),
|
|
3573
3561
|
onSelect,
|
|
3574
|
-
toolbar: /* @__PURE__ */ (0,
|
|
3562
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react14.PluginTreeViewToolbar, { onSearch, onSetExpanded: setAllExpanded })
|
|
3575
3563
|
}
|
|
3576
3564
|
);
|
|
3577
3565
|
};
|
|
@@ -3579,29 +3567,29 @@ var init_JmxTreeView2 = __esm({
|
|
|
3579
3567
|
});
|
|
3580
3568
|
|
|
3581
3569
|
// src/ai-plugin/jmx-ai/Jmx.tsx
|
|
3582
|
-
var
|
|
3570
|
+
var import_react_core6, import_cubes_icon2, import_jsx_runtime6, Jmx;
|
|
3583
3571
|
var init_Jmx2 = __esm({
|
|
3584
3572
|
"src/ai-plugin/jmx-ai/Jmx.tsx"() {
|
|
3585
3573
|
"use strict";
|
|
3586
|
-
|
|
3574
|
+
import_react_core6 = require("@patternfly/react-core");
|
|
3587
3575
|
import_cubes_icon2 = require("@patternfly/react-icons/dist/esm/icons/cubes-icon");
|
|
3588
3576
|
init_react_split_es();
|
|
3589
3577
|
init_context();
|
|
3590
3578
|
init_Jmx();
|
|
3591
3579
|
init_JmxContent2();
|
|
3592
3580
|
init_JmxTreeView2();
|
|
3593
|
-
|
|
3581
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3594
3582
|
Jmx = () => {
|
|
3595
3583
|
const { tree, loaded, selectedNode, setSelectedNode } = useMBeanTree();
|
|
3596
3584
|
if (!loaded) {
|
|
3597
|
-
return /* @__PURE__ */ (0,
|
|
3585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_core6.PageSection, { hasBodyWrapper: false, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_core6.Spinner, { "aria-label": "Loading MBean tree" }) });
|
|
3598
3586
|
}
|
|
3599
3587
|
if (tree.isEmpty()) {
|
|
3600
|
-
return /* @__PURE__ */ (0,
|
|
3588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_core6.PageSection, { hasBodyWrapper: false, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_core6.EmptyState, { headingLevel: "h1", icon: import_cubes_icon2.CubesIcon, titleText: "No MBeans found", variant: "full" }) });
|
|
3601
3589
|
}
|
|
3602
|
-
return /* @__PURE__ */ (0,
|
|
3603
|
-
/* @__PURE__ */ (0,
|
|
3604
|
-
/* @__PURE__ */ (0,
|
|
3590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MBeanTreeContext.Provider, { value: { tree, selectedNode, setSelectedNode }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(react_split_es_default, { className: "jmx-split", sizes: [30, 70], minSize: 200, gutterSize: 5, children: [
|
|
3591
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(JmxTreeView, {}) }),
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(JmxContent, {}) })
|
|
3605
3593
|
] }) });
|
|
3606
3594
|
};
|
|
3607
3595
|
}
|
|
@@ -3629,7 +3617,7 @@ __export(index_exports, {
|
|
|
3629
3617
|
plugin: () => plugin
|
|
3630
3618
|
});
|
|
3631
3619
|
module.exports = __toCommonJS(index_exports);
|
|
3632
|
-
var
|
|
3620
|
+
var import_react17 = require("@hawtio/react");
|
|
3633
3621
|
var import_main = require("@patternfly/chatbot/dist/css/main.css");
|
|
3634
3622
|
|
|
3635
3623
|
// src/ai-plugin/common/index.ts
|
|
@@ -3721,7 +3709,7 @@ var aiCommon = () => {
|
|
|
3721
3709
|
};
|
|
3722
3710
|
|
|
3723
3711
|
// src/ai-plugin/jmx-ai/index.ts
|
|
3724
|
-
var
|
|
3712
|
+
var import_react16 = require("@hawtio/react");
|
|
3725
3713
|
init_globals();
|
|
3726
3714
|
|
|
3727
3715
|
// src/ai-plugin/jmx-ai/help.md
|
|
@@ -3731,7 +3719,7 @@ var help_default = "# JMX AI - Hawtio AI Plugin\n\nThis view is provided by the
|
|
|
3731
3719
|
var order2 = 41;
|
|
3732
3720
|
var jmxAi = () => {
|
|
3733
3721
|
log.info("Loading", pluginName);
|
|
3734
|
-
|
|
3722
|
+
import_react16.hawtio.addDeferredPlugin(pluginName, async () => {
|
|
3735
3723
|
return Promise.resolve().then(() => (init_ui(), ui_exports)).then(({ Jmx: Jmx2 }) => {
|
|
3736
3724
|
return {
|
|
3737
3725
|
id: pluginName,
|
|
@@ -3739,11 +3727,11 @@ var jmxAi = () => {
|
|
|
3739
3727
|
path: pluginPath,
|
|
3740
3728
|
component: Jmx2,
|
|
3741
3729
|
knownQueryParams: ["nid"],
|
|
3742
|
-
isActive: async () =>
|
|
3730
|
+
isActive: async () => import_react16.workspace.hasMBeans()
|
|
3743
3731
|
};
|
|
3744
3732
|
});
|
|
3745
3733
|
});
|
|
3746
|
-
|
|
3734
|
+
import_react16.helpRegistry.add(pluginName, pluginTitle, help_default, order2);
|
|
3747
3735
|
};
|
|
3748
3736
|
|
|
3749
3737
|
// src/ai-plugin/index.ts
|
|
@@ -3751,7 +3739,7 @@ var plugin = () => {
|
|
|
3751
3739
|
aiCommon();
|
|
3752
3740
|
jmxAi();
|
|
3753
3741
|
};
|
|
3754
|
-
|
|
3742
|
+
import_react17.configManager.addProductInfo("Hawtio AI Plugin", "0.2.2");
|
|
3755
3743
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3756
3744
|
0 && (module.exports = {
|
|
3757
3745
|
plugin
|