@red-hat-developer-hub/backstage-plugin-intelligent-assistant 5.0.1 → 5.0.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/alpha.d.ts +1 -2
  3. package/dist/components/Attachment.esm.js +10 -12
  4. package/dist/components/Attachment.esm.js.map +1 -1
  5. package/dist/components/CollapsedHistoryStrip.esm.js +46 -51
  6. package/dist/components/CollapsedHistoryStrip.esm.js.map +1 -1
  7. package/dist/components/FilePreview.esm.js +3 -2
  8. package/dist/components/FilePreview.esm.js.map +1 -1
  9. package/dist/components/LightSpeedChat.esm.js +580 -745
  10. package/dist/components/LightSpeedChat.esm.js.map +1 -1
  11. package/dist/components/LightspeedChatBox.esm.js +2 -3
  12. package/dist/components/LightspeedChatBox.esm.js.map +1 -1
  13. package/dist/components/LightspeedChatBoxHeader.esm.js +38 -34
  14. package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
  15. package/dist/components/LightspeedChatContainer.esm.js +6 -8
  16. package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
  17. package/dist/components/LightspeedChatModelsState.esm.js +67 -73
  18. package/dist/components/LightspeedChatModelsState.esm.js.map +1 -1
  19. package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
  20. package/dist/components/LightspeedDrawerProvider.esm.js +13 -16
  21. package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
  22. package/dist/components/LightspeedFABContent.esm.js +40 -9
  23. package/dist/components/LightspeedFABContent.esm.js.map +1 -1
  24. package/dist/components/LightspeedPage.esm.js +1 -10
  25. package/dist/components/LightspeedPage.esm.js.map +1 -1
  26. package/dist/components/McpConfigureServerModal.esm.js +79 -86
  27. package/dist/components/McpConfigureServerModal.esm.js.map +1 -1
  28. package/dist/components/McpServersSettings.esm.js +246 -212
  29. package/dist/components/McpServersSettings.esm.js.map +1 -1
  30. package/dist/components/MessageBarModelSelector.esm.js +29 -33
  31. package/dist/components/MessageBarModelSelector.esm.js.map +1 -1
  32. package/dist/components/PermissionRequiredState.esm.js +63 -63
  33. package/dist/components/PermissionRequiredState.esm.js.map +1 -1
  34. package/dist/components/RenameConversationModal.esm.js +38 -31
  35. package/dist/components/RenameConversationModal.esm.js.map +1 -1
  36. package/dist/components/Router.esm.js +4 -13
  37. package/dist/components/Router.esm.js.map +1 -1
  38. package/dist/components/ToastAlertGroup.esm.js +24 -40
  39. package/dist/components/ToastAlertGroup.esm.js.map +1 -1
  40. package/dist/components/ToolCallContent.esm.js +8 -11
  41. package/dist/components/ToolCallContent.esm.js.map +1 -1
  42. package/dist/components/notebooks/AddDocumentModal.esm.js +232 -252
  43. package/dist/components/notebooks/AddDocumentModal.esm.js.map +1 -1
  44. package/dist/components/notebooks/DeleteDocumentModal.esm.js +35 -77
  45. package/dist/components/notebooks/DeleteDocumentModal.esm.js.map +1 -1
  46. package/dist/components/notebooks/DeleteNotebookModal.esm.js +46 -81
  47. package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -1
  48. package/dist/components/notebooks/DocumentSidebar.esm.js +172 -196
  49. package/dist/components/notebooks/DocumentSidebar.esm.js.map +1 -1
  50. package/dist/components/notebooks/FileListItem.esm.js +69 -57
  51. package/dist/components/notebooks/FileListItem.esm.js.map +1 -1
  52. package/dist/components/notebooks/FileTypeIcon.esm.js +17 -27
  53. package/dist/components/notebooks/FileTypeIcon.esm.js.map +1 -1
  54. package/dist/components/notebooks/NotebookCard.esm.js +86 -25
  55. package/dist/components/notebooks/NotebookCard.esm.js.map +1 -1
  56. package/dist/components/notebooks/NotebookView.esm.js +367 -380
  57. package/dist/components/notebooks/NotebookView.esm.js.map +1 -1
  58. package/dist/components/notebooks/NotebooksTab.esm.js +93 -30
  59. package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -1
  60. package/dist/components/notebooks/OverwriteConfirmModal.esm.js +142 -184
  61. package/dist/components/notebooks/OverwriteConfirmModal.esm.js.map +1 -1
  62. package/dist/components/notebooks/UploadResourceScreen.esm.js +58 -50
  63. package/dist/components/notebooks/UploadResourceScreen.esm.js.map +1 -1
  64. package/dist/components/notebooks/notebookDialogStyles.esm.js +33 -37
  65. package/dist/components/notebooks/notebookDialogStyles.esm.js.map +1 -1
  66. package/dist/const.esm.js +15 -2
  67. package/dist/const.esm.js.map +1 -1
  68. package/dist/hooks/useAutoScroll.esm.js +11 -11
  69. package/dist/hooks/useAutoScroll.esm.js.map +1 -1
  70. package/dist/hooks/useBufferedMessages.esm.js +5 -5
  71. package/dist/hooks/useBufferedMessages.esm.js.map +1 -1
  72. package/dist/hooks/useIsMobile.esm.js +3 -3
  73. package/dist/hooks/useIsMobile.esm.js.map +1 -1
  74. package/dist/translations/de.esm.js +1 -2
  75. package/dist/translations/de.esm.js.map +1 -1
  76. package/dist/translations/es.esm.js +1 -2
  77. package/dist/translations/es.esm.js.map +1 -1
  78. package/dist/translations/fr.esm.js +1 -2
  79. package/dist/translations/fr.esm.js.map +1 -1
  80. package/dist/translations/it.esm.js +1 -2
  81. package/dist/translations/it.esm.js.map +1 -1
  82. package/dist/translations/ja.esm.js +1 -2
  83. package/dist/translations/ja.esm.js.map +1 -1
  84. package/dist/translations/ref.esm.js +1 -2
  85. package/dist/translations/ref.esm.js.map +1 -1
  86. package/dist/types.esm.js.map +1 -1
  87. package/dist/utils/fab-anchor-utils.esm.js +41 -0
  88. package/dist/utils/fab-anchor-utils.esm.js.map +1 -0
  89. package/dist/utils/scoped-dialog-utils.esm.js +6 -3
  90. package/dist/utils/scoped-dialog-utils.esm.js.map +1 -1
  91. package/package.json +4 -8
  92. package/dist/utils/generateClassName.esm.js +0 -12
  93. package/dist/utils/generateClassName.esm.js.map +0 -1
@@ -2,7 +2,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useCallback, useEffect } from 'react';
3
3
  import { useApi, configApiRef, fetchApiRef } from '@backstage/core-plugin-api';
4
4
  import { usePermission } from '@backstage/plugin-permission-react';
5
- import { makeStyles } from '@material-ui/core';
5
+ import GlobalStyles from '@mui/material/GlobalStyles';
6
+ import { styled } from '@mui/material/styles';
6
7
  import Typography from '@mui/material/Typography';
7
8
  import { Title, Button, Alert, Switch, Tooltip } from '@patternfly/react-core';
8
9
  import { TimesIcon, PencilAltIcon, SortAmountDownIcon, KeyIcon, InfoCircleIcon, ExclamationCircleIcon, CheckCircleIcon, SortAmountUpIcon } from '@patternfly/react-icons';
@@ -13,24 +14,40 @@ import { useTranslation } from '../hooks/useTranslation.esm.js';
13
14
  import { McpConfigureServerModal } from './McpConfigureServerModal.esm.js';
14
15
  import { formatApiError, getDisplayStatus, compareMcpServers, getDisplayDetail, getEnabledToggleChecked, isEnabledToggleUnavailable } from './mcpServersDisplayUtils.esm.js';
15
16
 
16
- const useStyles = makeStyles((theme) => ({
17
- "@global": {
18
- ".pf-v6-c-backdrop": {
19
- zIndex: "1400 !important"
20
- },
21
- ".pf-v5-c-backdrop": {
22
- zIndex: "1400 !important"
23
- }
24
- },
25
- root: {
26
- padding: 0,
27
- height: "100%",
28
- minHeight: 0,
29
- flex: 1,
30
- width: "100%",
31
- overflow: "auto"
32
- },
33
- headerRow: {
17
+ const mcpClasses = {
18
+ headerRow: "ia-mcp-headerRow",
19
+ selectedCount: "ia-mcp-selectedCount",
20
+ title: "ia-mcp-title",
21
+ closeButton: "ia-mcp-closeButton",
22
+ nameHeaderButton: "ia-mcp-nameHeaderButton",
23
+ statusHeaderButton: "ia-mcp-statusHeaderButton",
24
+ sortHeaderIconActive: "ia-mcp-sortHeaderIconActive",
25
+ sortHeaderIconInactive: "ia-mcp-sortHeaderIconInactive",
26
+ nameHeaderText: "ia-mcp-nameHeaderText",
27
+ nameCell: "ia-mcp-nameCell",
28
+ statusHeader: "ia-mcp-statusHeader",
29
+ statusColumnCell: "ia-mcp-statusColumnCell",
30
+ rowName: "ia-mcp-rowName",
31
+ nameValue: "ia-mcp-nameValue",
32
+ statusCell: "ia-mcp-statusCell",
33
+ statusValue: "ia-mcp-statusValue",
34
+ statusOk: "ia-mcp-statusOk",
35
+ statusWarn: "ia-mcp-statusWarn",
36
+ statusDisabled: "ia-mcp-statusDisabled",
37
+ actionButton: "ia-mcp-actionButton",
38
+ tableRow: "ia-mcp-tableRow",
39
+ toggleCell: "ia-mcp-toggleCell",
40
+ table: "ia-mcp-table",
41
+ alert: "ia-mcp-alert"
42
+ };
43
+ const StyledMcpRoot = styled("div")(({ theme }) => ({
44
+ padding: 0,
45
+ height: "100%",
46
+ minHeight: 0,
47
+ flex: 1,
48
+ width: "100%",
49
+ overflow: "auto",
50
+ [`& .${mcpClasses.headerRow}`]: {
34
51
  display: "flex",
35
52
  alignItems: "flex-start",
36
53
  justifyContent: "space-between",
@@ -39,20 +56,20 @@ const useStyles = makeStyles((theme) => ({
39
56
  marginLeft: theme.spacing(3),
40
57
  marginRight: theme.spacing(2)
41
58
  },
42
- selectedCount: {
59
+ [`& .${mcpClasses.selectedCount}`]: {
43
60
  color: theme.palette.text.secondary,
44
61
  marginTop: theme.spacing(0.5),
45
62
  fontSize: "0.75rem"
46
63
  },
47
- title: {
64
+ [`& .${mcpClasses.title}`]: {
48
65
  fontSize: "1.125rem"
49
66
  },
50
- closeButton: {
51
- marginTop: -theme.spacing(1),
52
- marginRight: -theme.spacing(1),
67
+ [`& .${mcpClasses.closeButton}`]: {
68
+ marginTop: theme.spacing(-1),
69
+ marginRight: theme.spacing(-1),
53
70
  color: theme.palette.text.primary
54
71
  },
55
- nameHeaderButton: {
72
+ [`& .${mcpClasses.nameHeaderButton}`]: {
56
73
  paddingLeft: 0,
57
74
  paddingTop: 0,
58
75
  paddingBottom: 0,
@@ -66,7 +83,7 @@ const useStyles = makeStyles((theme) => ({
66
83
  display: "inline-flex",
67
84
  alignItems: "center"
68
85
  },
69
- statusHeaderButton: {
86
+ [`& .${mcpClasses.statusHeaderButton}`]: {
70
87
  paddingLeft: 0,
71
88
  paddingTop: 0,
72
89
  paddingBottom: 0,
@@ -79,68 +96,66 @@ const useStyles = makeStyles((theme) => ({
79
96
  display: "inline-flex",
80
97
  alignItems: "center"
81
98
  },
82
- sortHeaderIconActive: {
99
+ [`& .${mcpClasses.sortHeaderIconActive}`]: {
83
100
  color: "var(--pf-t--global--icon--color--brand--default)"
84
101
  },
85
- sortHeaderIconInactive: {
102
+ [`& .${mcpClasses.sortHeaderIconInactive}`]: {
86
103
  color: "var(--pf-t--global--icon--color--subtle)"
87
104
  },
88
- nameHeaderText: {
105
+ [`& .${mcpClasses.nameHeaderText}`]: {
89
106
  paddingLeft: "7px",
90
107
  fontSize: "0.75rem",
91
108
  lineHeight: "1.25rem",
92
109
  fontWeight: 600
93
110
  },
94
- nameCell: {
111
+ [`& .${mcpClasses.nameCell}`]: {
95
112
  paddingLeft: "8px !important"
96
113
  },
97
- statusHeader: {
114
+ [`& .${mcpClasses.statusHeader}`]: {
98
115
  paddingLeft: "0 !important"
99
116
  },
100
- statusColumnCell: {
117
+ [`& .${mcpClasses.statusColumnCell}`]: {
101
118
  paddingLeft: "0 !important"
102
119
  },
103
- rowName: {
120
+ [`& .${mcpClasses.rowName}`]: {
104
121
  fontSize: "1rem",
105
122
  fontWeight: 500,
106
123
  whiteSpace: "nowrap"
107
124
  },
108
- nameValue: {
125
+ [`& .${mcpClasses.nameValue}`]: {
109
126
  fontSize: "0.875rem",
110
127
  fontWeight: 500
111
128
  },
112
- statusCell: {
129
+ [`& .${mcpClasses.statusCell}`]: {
113
130
  display: "flex",
114
131
  alignItems: "center",
115
132
  gap: theme.spacing(1),
116
133
  whiteSpace: "nowrap"
117
134
  },
118
- statusValue: {
135
+ [`& .${mcpClasses.statusValue}`]: {
119
136
  fontSize: "0.875rem"
120
137
  },
121
- statusOk: {
138
+ [`& .${mcpClasses.statusOk}`]: {
122
139
  color: "var(--pf-t--global--icon--color--status--custom--default)"
123
140
  },
124
- statusWarn: {
141
+ [`& .${mcpClasses.statusWarn}`]: {
125
142
  color: "var(--pf-t--global--icon--color--status--danger--default)"
126
143
  },
127
- statusDisabled: {
144
+ [`& .${mcpClasses.statusDisabled}`]: {
128
145
  color: "var(--pf-t--global--icon--color--subtle)"
129
146
  },
130
- actionButton: {
147
+ [`& .${mcpClasses.actionButton}`]: {
131
148
  color: theme.palette.text.secondary,
132
149
  opacity: 0,
133
150
  transition: "opacity 0.15s ease-in-out"
134
151
  },
135
- tableRow: {
136
- "&:hover $actionButton, &:focus-within $actionButton": {
137
- opacity: 1
138
- }
152
+ [`& .${mcpClasses.tableRow}:hover .${mcpClasses.actionButton}, & .${mcpClasses.tableRow}:focus-within .${mcpClasses.actionButton}`]: {
153
+ opacity: 1
139
154
  },
140
- toggleCell: {
155
+ [`& .${mcpClasses.toggleCell}`]: {
141
156
  paddingRight: "0 !important"
142
157
  },
143
- table: {
158
+ [`& .${mcpClasses.table}`]: {
144
159
  width: "100%",
145
160
  backgroundColor: "transparent",
146
161
  "--pf-v6-c-table--BackgroundColor": "transparent",
@@ -163,7 +178,7 @@ const useStyles = makeStyles((theme) => ({
163
178
  verticalAlign: "middle"
164
179
  }
165
180
  },
166
- alert: {
181
+ [`& .${mcpClasses.alert}`]: {
167
182
  marginLeft: theme.spacing(3),
168
183
  marginRight: theme.spacing(3),
169
184
  marginBottom: theme.spacing(2)
@@ -193,7 +208,6 @@ const McpServersSettings = ({
193
208
  onClose,
194
209
  backgroundColor
195
210
  }) => {
196
- const classes = useStyles();
197
211
  const { t } = useTranslation();
198
212
  const configApi = useApi(configApiRef);
199
213
  const fetchApi = useApi(fetchApiRef);
@@ -384,187 +398,207 @@ const McpServersSettings = ({
384
398
  return /* @__PURE__ */ jsx(
385
399
  Icon,
386
400
  {
387
- className: isActive ? classes.sortHeaderIconActive : classes.sortHeaderIconInactive
401
+ className: isActive ? mcpClasses.sortHeaderIconActive : mcpClasses.sortHeaderIconInactive
388
402
  }
389
403
  );
390
404
  };
391
- return /* @__PURE__ */ jsxs(
392
- "div",
393
- {
394
- className: classes.root,
395
- style: backgroundColor ? { backgroundColor } : void 0,
396
- children: [
397
- /* @__PURE__ */ jsxs("div", { className: classes.headerRow, children: [
398
- /* @__PURE__ */ jsxs("div", { children: [
399
- /* @__PURE__ */ jsx(Title, { headingLevel: "h2", size: "xl", className: classes.title, children: t("mcp.settings.title") }),
400
- /* @__PURE__ */ jsx("div", { className: classes.selectedCount, children: t("mcp.settings.selectedCount", {
401
- selectedCount: String(selectedCount),
402
- totalCount: String(servers.length)
403
- }) })
404
- ] }),
405
- /* @__PURE__ */ jsx(
406
- Button,
407
- {
408
- "aria-label": t("mcp.settings.closeAriaLabel"),
409
- icon: /* @__PURE__ */ jsx(TimesIcon, {}),
410
- variant: "plain",
411
- className: classes.closeButton,
412
- onClick: onClose
413
- }
414
- )
415
- ] }),
416
- error && /* @__PURE__ */ jsx(
417
- Alert,
418
- {
419
- variant: "danger",
420
- isInline: true,
421
- title: error,
422
- className: classes.alert
423
- }
424
- ),
425
- !mcpToolsPermission.loading && !canManageMcp && /* @__PURE__ */ jsx(
426
- Alert,
427
- {
428
- variant: "info",
429
- isInline: true,
430
- title: t("mcp.settings.readOnlyAccess"),
431
- className: classes.alert
405
+ return /* @__PURE__ */ jsxs(StyledMcpRoot, { style: backgroundColor ? { backgroundColor } : void 0, children: [
406
+ /* @__PURE__ */ jsx(
407
+ GlobalStyles,
408
+ {
409
+ styles: {
410
+ ".pf-v6-c-backdrop": {
411
+ zIndex: "1400 !important"
412
+ },
413
+ ".pf-v5-c-backdrop": {
414
+ zIndex: "1400 !important"
432
415
  }
433
- ),
434
- /* @__PURE__ */ jsxs(
435
- Table,
436
- {
437
- variant: "compact",
438
- "aria-label": t("mcp.settings.tableAriaLabel"),
439
- className: classes.table,
440
- children: [
441
- /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
442
- /* @__PURE__ */ jsx(Th, { width: 10, screenReaderText: t("mcp.settings.enabled") }),
443
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(
444
- Button,
416
+ }
417
+ }
418
+ ),
419
+ /* @__PURE__ */ jsxs("div", { className: mcpClasses.headerRow, children: [
420
+ /* @__PURE__ */ jsxs("div", { children: [
421
+ /* @__PURE__ */ jsx(Title, { headingLevel: "h2", size: "xl", className: mcpClasses.title, children: t("mcp.settings.title") }),
422
+ /* @__PURE__ */ jsx("div", { className: mcpClasses.selectedCount, children: t("mcp.settings.selectedCount", {
423
+ selectedCount: String(selectedCount),
424
+ totalCount: String(servers.length)
425
+ }) })
426
+ ] }),
427
+ /* @__PURE__ */ jsx(
428
+ Button,
429
+ {
430
+ "aria-label": t("mcp.settings.closeAriaLabel"),
431
+ icon: /* @__PURE__ */ jsx(TimesIcon, {}),
432
+ variant: "plain",
433
+ className: mcpClasses.closeButton,
434
+ onClick: onClose
435
+ }
436
+ )
437
+ ] }),
438
+ error && /* @__PURE__ */ jsx(
439
+ Alert,
440
+ {
441
+ variant: "danger",
442
+ isInline: true,
443
+ title: error,
444
+ className: mcpClasses.alert
445
+ }
446
+ ),
447
+ !mcpToolsPermission.loading && !canManageMcp && /* @__PURE__ */ jsx(
448
+ Alert,
449
+ {
450
+ variant: "info",
451
+ isInline: true,
452
+ title: t("mcp.settings.readOnlyAccess"),
453
+ className: mcpClasses.alert
454
+ }
455
+ ),
456
+ /* @__PURE__ */ jsxs(
457
+ Table,
458
+ {
459
+ variant: "compact",
460
+ "aria-label": t("mcp.settings.tableAriaLabel"),
461
+ className: mcpClasses.table,
462
+ children: [
463
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
464
+ /* @__PURE__ */ jsx(Th, { width: 10, screenReaderText: t("mcp.settings.enabled") }),
465
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(
466
+ Button,
467
+ {
468
+ variant: "link",
469
+ className: mcpClasses.nameHeaderButton,
470
+ icon: renderSortIcon("name"),
471
+ iconPosition: "right",
472
+ onClick: () => onSortColumnClick("name"),
473
+ children: /* @__PURE__ */ jsx(
474
+ Typography,
445
475
  {
446
- variant: "link",
447
- className: classes.nameHeaderButton,
448
- icon: renderSortIcon("name"),
449
- iconPosition: "right",
450
- onClick: () => onSortColumnClick("name"),
451
- children: /* @__PURE__ */ jsx(Typography, { component: "span", className: classes.nameHeaderText, children: t("mcp.settings.name") })
476
+ component: "span",
477
+ className: mcpClasses.nameHeaderText,
478
+ children: t("mcp.settings.name")
452
479
  }
453
- ) }),
454
- /* @__PURE__ */ jsx(Th, { className: classes.statusHeader, children: /* @__PURE__ */ jsx(
455
- Button,
480
+ )
481
+ }
482
+ ) }),
483
+ /* @__PURE__ */ jsx(Th, { className: mcpClasses.statusHeader, children: /* @__PURE__ */ jsx(
484
+ Button,
485
+ {
486
+ variant: "link",
487
+ className: mcpClasses.statusHeaderButton,
488
+ icon: renderSortIcon("status"),
489
+ iconPosition: "right",
490
+ onClick: () => onSortColumnClick("status"),
491
+ children: /* @__PURE__ */ jsx(
492
+ Typography,
456
493
  {
457
- variant: "link",
458
- className: classes.statusHeaderButton,
459
- icon: renderSortIcon("status"),
460
- iconPosition: "right",
461
- onClick: () => onSortColumnClick("status"),
462
- children: /* @__PURE__ */ jsx(Typography, { component: "span", className: classes.nameHeaderText, children: t("mcp.settings.status") })
494
+ component: "span",
495
+ className: mcpClasses.nameHeaderText,
496
+ children: t("mcp.settings.status")
463
497
  }
464
- ) }),
465
- /* @__PURE__ */ jsx(Th, { screenReaderText: t("mcp.settings.edit") })
466
- ] }) }),
467
- /* @__PURE__ */ jsxs(Tbody, { children: [
468
- isLoading && /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 4, children: t("mcp.settings.loading") }) }),
469
- !isLoading && sortedServers.length === 0 && /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 4, children: t("mcp.settings.noneAvailable") }) }),
470
- sortedServers.map((server) => {
471
- const displayStatus = getDisplayStatus(server);
472
- const displayDetail = getDisplayDetail(server, displayStatus, t);
473
- let statusClass = classes.statusWarn;
474
- if (displayStatus === "ok") {
475
- statusClass = classes.statusOk;
476
- } else if (displayStatus === "disabled") {
477
- statusClass = classes.statusDisabled;
478
- }
479
- return /* @__PURE__ */ jsxs(Tr, { className: classes.tableRow, children: [
480
- /* @__PURE__ */ jsx(Td, { width: 10, className: classes.toggleCell, children: (() => {
481
- const isUnavailable = isEnabledToggleUnavailable(displayStatus);
482
- const isChecked = getEnabledToggleChecked(
483
- server,
484
- displayStatus
485
- );
486
- const isRowSaving = Boolean(isSaving[server.name]);
487
- const isToggleDisabled = isUnavailable || isRowSaving || !canManageMcp;
488
- const switchControl = /* @__PURE__ */ jsx(
489
- Switch,
498
+ )
499
+ }
500
+ ) }),
501
+ /* @__PURE__ */ jsx(Th, { screenReaderText: t("mcp.settings.edit") })
502
+ ] }) }),
503
+ /* @__PURE__ */ jsxs(Tbody, { children: [
504
+ isLoading && /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 4, children: t("mcp.settings.loading") }) }),
505
+ !isLoading && sortedServers.length === 0 && /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 4, children: t("mcp.settings.noneAvailable") }) }),
506
+ sortedServers.map((server) => {
507
+ const displayStatus = getDisplayStatus(server);
508
+ const displayDetail = getDisplayDetail(server, displayStatus, t);
509
+ let statusClass = mcpClasses.statusWarn;
510
+ if (displayStatus === "ok") {
511
+ statusClass = mcpClasses.statusOk;
512
+ } else if (displayStatus === "disabled") {
513
+ statusClass = mcpClasses.statusDisabled;
514
+ }
515
+ return /* @__PURE__ */ jsxs(Tr, { className: mcpClasses.tableRow, children: [
516
+ /* @__PURE__ */ jsx(Td, { width: 10, className: mcpClasses.toggleCell, children: (() => {
517
+ const isUnavailable = isEnabledToggleUnavailable(displayStatus);
518
+ const isChecked = getEnabledToggleChecked(
519
+ server,
520
+ displayStatus
521
+ );
522
+ const isRowSaving = Boolean(isSaving[server.name]);
523
+ const isToggleDisabled = isUnavailable || isRowSaving || !canManageMcp;
524
+ const switchControl = /* @__PURE__ */ jsx(
525
+ Switch,
526
+ {
527
+ id: `mcp-switch-${server.id}`,
528
+ "aria-label": t(
529
+ "mcp.settings.toggleServerAriaLabel",
490
530
  {
491
- id: `mcp-switch-${server.id}`,
492
- "aria-label": t(
493
- "mcp.settings.toggleServerAriaLabel",
494
- {
495
- serverName: server.name
496
- }
497
- ),
498
- isChecked,
499
- isDisabled: isToggleDisabled,
500
- onChange: (_event, checked) => {
501
- void patchServer(server.name, {
502
- enabled: checked
503
- }).catch(() => {
504
- });
505
- }
531
+ serverName: server.name
506
532
  }
507
- );
508
- if (!isToggleDisabled) {
509
- return switchControl;
533
+ ),
534
+ isChecked,
535
+ isDisabled: isToggleDisabled,
536
+ onChange: (_event, checked) => {
537
+ void patchServer(server.name, {
538
+ enabled: checked
539
+ }).catch(() => {
540
+ });
510
541
  }
511
- return /* @__PURE__ */ jsx(Tooltip, { content: displayDetail, children: /* @__PURE__ */ jsx(Typography, { component: "span", children: switchControl }) });
512
- })() }),
513
- /* @__PURE__ */ jsx(
514
- Td,
515
- {
516
- width: 35,
517
- className: `${classes.rowName} ${classes.nameCell}`,
518
- children: /* @__PURE__ */ jsx(Typography, { component: "span", className: classes.nameValue, children: server.name })
519
- }
520
- ),
521
- /* @__PURE__ */ jsx(Td, { width: 40, className: classes.statusColumnCell, children: /* @__PURE__ */ jsxs("div", { className: classes.statusCell, children: [
522
- getStatusIcon(displayStatus, statusClass),
523
- displayStatus === "failed" ? /* @__PURE__ */ jsx(
524
- Tooltip,
525
- {
526
- content: server.validationError ?? t("mcp.settings.token.validationFailed"),
527
- children: /* @__PURE__ */ jsx(
528
- Typography,
529
- {
530
- component: "span",
531
- className: classes.statusValue,
532
- children: displayDetail
533
- }
534
- )
535
- }
536
- ) : /* @__PURE__ */ jsx(
542
+ }
543
+ );
544
+ if (!isToggleDisabled) {
545
+ return switchControl;
546
+ }
547
+ return /* @__PURE__ */ jsx(Tooltip, { content: displayDetail, children: /* @__PURE__ */ jsx(Typography, { component: "span", children: switchControl }) });
548
+ })() }),
549
+ /* @__PURE__ */ jsx(
550
+ Td,
551
+ {
552
+ width: 35,
553
+ className: `${mcpClasses.rowName} ${mcpClasses.nameCell}`,
554
+ children: /* @__PURE__ */ jsx(Typography, { component: "span", className: mcpClasses.nameValue, children: server.name })
555
+ }
556
+ ),
557
+ /* @__PURE__ */ jsx(Td, { width: 40, className: mcpClasses.statusColumnCell, children: /* @__PURE__ */ jsxs("div", { className: mcpClasses.statusCell, children: [
558
+ getStatusIcon(displayStatus, statusClass),
559
+ displayStatus === "failed" ? /* @__PURE__ */ jsx(
560
+ Tooltip,
561
+ {
562
+ content: server.validationError ?? t("mcp.settings.token.validationFailed"),
563
+ children: /* @__PURE__ */ jsx(
537
564
  Typography,
538
565
  {
539
566
  component: "span",
540
- className: classes.statusValue,
567
+ className: mcpClasses.statusValue,
541
568
  children: displayDetail
542
569
  }
543
570
  )
544
- ] }) }),
545
- /* @__PURE__ */ jsx(Td, { width: 15, isActionCell: true, style: { textAlign: "right" }, children: /* @__PURE__ */ jsx(
546
- Button,
547
- {
548
- "aria-label": t("mcp.settings.editServerAriaLabel", {
549
- serverName: server.name
550
- }),
551
- icon: /* @__PURE__ */ jsx(PencilAltIcon, {}),
552
- variant: "plain",
553
- className: classes.actionButton,
554
- isDisabled: !canManageMcp,
555
- onClick: () => configureModal.open(server)
556
- }
557
- ) })
558
- ] }, server.id);
559
- })
560
- ] })
561
- ]
562
- }
563
- ),
564
- /* @__PURE__ */ jsx(McpConfigureServerModal, { ...configureModal })
565
- ]
566
- }
567
- );
571
+ }
572
+ ) : /* @__PURE__ */ jsx(
573
+ Typography,
574
+ {
575
+ component: "span",
576
+ className: mcpClasses.statusValue,
577
+ children: displayDetail
578
+ }
579
+ )
580
+ ] }) }),
581
+ /* @__PURE__ */ jsx(Td, { width: 15, isActionCell: true, style: { textAlign: "right" }, children: /* @__PURE__ */ jsx(
582
+ Button,
583
+ {
584
+ "aria-label": t("mcp.settings.editServerAriaLabel", {
585
+ serverName: server.name
586
+ }),
587
+ icon: /* @__PURE__ */ jsx(PencilAltIcon, {}),
588
+ variant: "plain",
589
+ className: mcpClasses.actionButton,
590
+ isDisabled: !canManageMcp,
591
+ onClick: () => configureModal.open(server)
592
+ }
593
+ ) })
594
+ ] }, server.id);
595
+ })
596
+ ] })
597
+ ]
598
+ }
599
+ ),
600
+ /* @__PURE__ */ jsx(McpConfigureServerModal, { ...configureModal })
601
+ ] });
568
602
  };
569
603
 
570
604
  export { McpServersSettings };