@red-hat-developer-hub/backstage-plugin-lightspeed 2.6.0 → 2.6.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 +14 -0
- package/dist/alpha/LightspeedFAB.esm.js.map +1 -1
- package/dist/alpha/LightspeedProvider.esm.js.map +1 -1
- package/dist/alpha.esm.js +1 -1
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/LightspeedApiClient.esm.js +1 -1
- package/dist/api/LightspeedApiClient.esm.js.map +1 -1
- package/dist/api/NotebooksApiClient.esm.js.map +1 -1
- package/dist/api/api.esm.js.map +1 -1
- package/dist/api/notebooksApi.esm.js.map +1 -1
- package/dist/components/Attachment.esm.js +2 -2
- package/dist/components/Attachment.esm.js.map +1 -1
- package/dist/components/AttachmentContext.esm.js +1 -1
- package/dist/components/AttachmentContext.esm.js.map +1 -1
- package/dist/components/DeleteModal.esm.js.map +1 -1
- package/dist/components/FilePreview.esm.js.map +1 -1
- package/dist/components/LightSpeedChat.esm.js +16 -16
- package/dist/components/LightSpeedChat.esm.js.map +1 -1
- package/dist/components/LightspeedChatBox.esm.js +5 -5
- package/dist/components/LightspeedChatBox.esm.js.map +1 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js +1 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
- package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
- package/dist/components/LightspeedChatModelsState.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerContext.esm.js +1 -1
- package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerStateExposer.esm.js.map +1 -1
- package/dist/components/LightspeedFAB.esm.js.map +1 -1
- package/dist/components/LightspeedIcon.esm.js.map +1 -1
- package/dist/components/LightspeedPage.esm.js.map +1 -1
- package/dist/components/McpServersSettings.esm.js +3 -3
- package/dist/components/McpServersSettings.esm.js.map +1 -1
- package/dist/components/McpSettingsIcon.esm.js.map +1 -1
- package/dist/components/PermissionRequiredIcon.esm.js.map +1 -1
- package/dist/components/PermissionRequiredState.esm.js.map +1 -1
- package/dist/components/RenameConversationModal.esm.js.map +1 -1
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/ToolCallContent.esm.js +3 -3
- package/dist/components/ToolCallContent.esm.js.map +1 -1
- package/dist/components/Trans.esm.js.map +1 -1
- package/dist/components/notebooks/AddDocumentModal.esm.js.map +1 -1
- package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -1
- package/dist/components/notebooks/DocumentSidebar.esm.js +2 -2
- package/dist/components/notebooks/DocumentSidebar.esm.js.map +1 -1
- package/dist/components/notebooks/FileListItem.esm.js.map +1 -1
- package/dist/components/notebooks/FileTypeIcon.esm.js.map +1 -1
- package/dist/components/notebooks/NotebookCard.esm.js +1 -1
- package/dist/components/notebooks/NotebookCard.esm.js.map +1 -1
- package/dist/components/notebooks/NotebookView.esm.js +3 -3
- package/dist/components/notebooks/NotebookView.esm.js.map +1 -1
- package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -1
- package/dist/components/notebooks/OverwriteConfirmModal.esm.js.map +1 -1
- package/dist/components/notebooks/RenameNotebookModal.esm.js.map +1 -1
- package/dist/components/notebooks/SidebarCollapseIcon.esm.js.map +1 -1
- package/dist/components/notebooks/UploadResourceScreen.esm.js +1 -1
- package/dist/components/notebooks/UploadResourceScreen.esm.js.map +1 -1
- package/dist/const.esm.js.map +1 -1
- package/dist/dev.esm.js.map +1 -1
- package/dist/hooks/notebooks/useCreateNotebook.esm.js.map +1 -1
- package/dist/hooks/notebooks/useCreateNotebookMessage.esm.js.map +1 -1
- package/dist/hooks/notebooks/useDeleteNotebook.esm.js.map +1 -1
- package/dist/hooks/notebooks/useDocumentStatusPolling.esm.js.map +1 -1
- package/dist/hooks/notebooks/useLightspeedNotebooksPermission.esm.js.map +1 -1
- package/dist/hooks/notebooks/useNotebookDocuments.esm.js.map +1 -1
- package/dist/hooks/notebooks/useNotebookSession.esm.js.map +1 -1
- package/dist/hooks/notebooks/useNotebookSessions.esm.js.map +1 -1
- package/dist/hooks/notebooks/useRenameNotebook.esm.js.map +1 -1
- package/dist/hooks/notebooks/useUploadDocument.esm.js.map +1 -1
- package/dist/hooks/toolCallsCacheStore.esm.js +1 -1
- package/dist/hooks/toolCallsCacheStore.esm.js.map +1 -1
- package/dist/hooks/useAllModels.esm.js.map +1 -1
- package/dist/hooks/useAutoScroll.esm.js +1 -1
- package/dist/hooks/useAutoScroll.esm.js.map +1 -1
- package/dist/hooks/useBackstageUserIdentity.esm.js.map +1 -1
- package/dist/hooks/useBufferedMessages.esm.js.map +1 -1
- package/dist/hooks/useCaptureFeedback.esm.js.map +1 -1
- package/dist/hooks/useConversationMessages.esm.js +1 -1
- package/dist/hooks/useConversationMessages.esm.js.map +1 -1
- package/dist/hooks/useConversations.esm.js.map +1 -1
- package/dist/hooks/useCreateCoversationMessage.esm.js.map +1 -1
- package/dist/hooks/useDeleteConversation.esm.js.map +1 -1
- package/dist/hooks/useDisplayModeSettings.esm.js +1 -1
- package/dist/hooks/useDisplayModeSettings.esm.js.map +1 -1
- package/dist/hooks/useFeedbackActions.esm.js +3 -3
- package/dist/hooks/useFeedbackActions.esm.js.map +1 -1
- package/dist/hooks/useFeedbackState.esm.js.map +1 -1
- package/dist/hooks/useFeedbackStatus.esm.js.map +1 -1
- package/dist/hooks/useIsMobile.esm.js.map +1 -1
- package/dist/hooks/useLastOpenedConversation.esm.js.map +1 -1
- package/dist/hooks/useLightspeedDeletePermission.esm.js.map +1 -1
- package/dist/hooks/useLightspeedDrawerContext.esm.js +1 -1
- package/dist/hooks/useLightspeedDrawerContext.esm.js.map +1 -1
- package/dist/hooks/useLightspeedProviderState.esm.js +2 -2
- package/dist/hooks/useLightspeedProviderState.esm.js.map +1 -1
- package/dist/hooks/useLightspeedUpdatePermission.esm.js.map +1 -1
- package/dist/hooks/useLightspeedViewPermission.esm.js.map +1 -1
- package/dist/hooks/usePinnedChatsSettings.esm.js +2 -2
- package/dist/hooks/usePinnedChatsSettings.esm.js.map +1 -1
- package/dist/hooks/useQuestionValidation.esm.js.map +1 -1
- package/dist/hooks/useRenameConversation.esm.js.map +1 -1
- package/dist/hooks/useSortSettings.esm.js +2 -2
- package/dist/hooks/useSortSettings.esm.js.map +1 -1
- package/dist/hooks/useStopConversation.esm.js.map +1 -1
- package/dist/hooks/useTranslation.esm.js.map +1 -1
- package/dist/hooks/useWelcomePrompts.esm.js.map +1 -1
- package/dist/plugin.esm.js +2 -2
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/translations/de.esm.js.map +1 -1
- package/dist/translations/es.esm.js.map +1 -1
- package/dist/translations/fr.esm.js.map +1 -1
- package/dist/translations/index.esm.js.map +1 -1
- package/dist/translations/it.esm.js.map +1 -1
- package/dist/translations/ja.esm.js.map +1 -1
- package/dist/translations/ref.esm.js.map +1 -1
- package/dist/types.esm.js.map +1 -1
- package/dist/utils/attachment-utils.esm.js.map +1 -1
- package/dist/utils/formatToolResponseForMarkdown.esm.js.map +1 -1
- package/dist/utils/lightspeed-chatbox-utils.esm.js +4 -4
- package/dist/utils/lightspeed-chatbox-utils.esm.js.map +1 -1
- package/dist/utils/notebook-upload-utils.esm.js +1 -1
- package/dist/utils/notebook-upload-utils.esm.js.map +1 -1
- package/dist/utils/notebooks-utils.esm.js +1 -1
- package/dist/utils/notebooks-utils.esm.js.map +1 -1
- package/dist/utils/prompt-utils.esm.js.map +1 -1
- package/dist/utils/queryClient.esm.js.map +1 -1
- package/dist/utils/reasoningParser.esm.js.map +1 -1
- package/dist/utils/toolCallMapper.esm.js +2 -2
- package/dist/utils/toolCallMapper.esm.js.map +1 -1
- package/dist/utils/user-utils.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebooksTab.esm.js","sources":["../../../src/components/notebooks/NotebooksTab.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TranslationFunction } from '@backstage/core-plugin-api/alpha';\n\nimport { Typography } from '@material-ui/core';\nimport { Button } from '@patternfly/react-core';\nimport { PlusCircleIcon } from '@patternfly/react-icons';\nimport { CatalogIcon } from '@patternfly/react-icons/dist/esm/icons';\n\nimport { lightspeedTranslationRef } from '../../translations/ref';\nimport { NotebookSession } from '../../types';\nimport { NotebookCard } from './NotebookCard';\n\ntype NotebooksTabProps = {\n notebooks: NotebookSession[];\n hasNotebooks: boolean;\n classes: Record<string, string>;\n openNotebookMenuId: string | null;\n setOpenNotebookMenuId: React.Dispatch<React.SetStateAction<string | null>>;\n onSelectNotebook: (notebook: NotebookSession) => void;\n onRename: (sessionId: string) => void;\n onDelete: (sessionId: string) => void;\n onCreateNotebook: () => void;\n t: TranslationFunction<typeof lightspeedTranslationRef.T>;\n};\n\nexport const NotebooksTab = ({\n notebooks,\n hasNotebooks,\n classes,\n openNotebookMenuId,\n setOpenNotebookMenuId,\n onSelectNotebook,\n onRename,\n onDelete,\n onCreateNotebook,\n t,\n}: NotebooksTabProps) => (\n <div className={classes.notebooksContainer}>\n <div className={classes.notebooksHeader}>\n <Typography variant=\"h6\" className={classes.notebooksHeading}>\n {t('notebooks.title')}\n </Typography>\n {hasNotebooks && (\n <Button\n variant=\"primary\"\n className={classes.notebooksAction}\n icon={<PlusCircleIcon />}\n onClick={onCreateNotebook}\n >\n {t('notebooks.empty.action')}\n </Button>\n )}\n </div>\n {!hasNotebooks ? (\n <div className={classes.notebooksEmptyState}>\n <CatalogIcon className={classes.notebooksIcon} />\n <Typography variant=\"h6\" className={classes.notebooksHeadingEmpty}>\n {t('notebooks.empty.title')}\n </Typography>\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={classes.notebooksDescription}\n >\n {t('notebooks.empty.description')}\n </Typography>\n <Button\n variant=\"primary\"\n className={classes.notebooksActionEmpty}\n onClick={onCreateNotebook}\n >\n {t('notebooks.empty.action')}\n </Button>\n </div>\n ) : (\n <div className={classes.notebooksGrid}>\n {notebooks.map(notebook => (\n <NotebookCard\n key={notebook.session_id}\n notebook={notebook}\n classes={classes}\n openNotebookMenuId={openNotebookMenuId}\n setOpenNotebookMenuId={setOpenNotebookMenuId}\n onClick={onSelectNotebook}\n onRename={onRename}\n onDelete={onDelete}\n t={t}\n />\n ))}\n </div>\n )}\n </div>\n);\n"],"names":[],"mappings":";;;;;;;AAwCO,MAAM,eAAe,CAAC;AAAA,EAC3B,SAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,kBAAA;AAAA,EACA,qBAAA;AAAA,EACA,gBAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF,CAAA,
|
|
1
|
+
{"version":3,"file":"NotebooksTab.esm.js","sources":["../../../src/components/notebooks/NotebooksTab.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TranslationFunction } from '@backstage/core-plugin-api/alpha';\n\nimport { Typography } from '@material-ui/core';\nimport { Button } from '@patternfly/react-core';\nimport { PlusCircleIcon } from '@patternfly/react-icons';\nimport { CatalogIcon } from '@patternfly/react-icons/dist/esm/icons';\n\nimport { lightspeedTranslationRef } from '../../translations/ref';\nimport { NotebookSession } from '../../types';\nimport { NotebookCard } from './NotebookCard';\n\ntype NotebooksTabProps = {\n notebooks: NotebookSession[];\n hasNotebooks: boolean;\n classes: Record<string, string>;\n openNotebookMenuId: string | null;\n setOpenNotebookMenuId: React.Dispatch<React.SetStateAction<string | null>>;\n onSelectNotebook: (notebook: NotebookSession) => void;\n onRename: (sessionId: string) => void;\n onDelete: (sessionId: string) => void;\n onCreateNotebook: () => void;\n t: TranslationFunction<typeof lightspeedTranslationRef.T>;\n};\n\nexport const NotebooksTab = ({\n notebooks,\n hasNotebooks,\n classes,\n openNotebookMenuId,\n setOpenNotebookMenuId,\n onSelectNotebook,\n onRename,\n onDelete,\n onCreateNotebook,\n t,\n}: NotebooksTabProps) => (\n <div className={classes.notebooksContainer}>\n <div className={classes.notebooksHeader}>\n <Typography variant=\"h6\" className={classes.notebooksHeading}>\n {t('notebooks.title')}\n </Typography>\n {hasNotebooks && (\n <Button\n variant=\"primary\"\n className={classes.notebooksAction}\n icon={<PlusCircleIcon />}\n onClick={onCreateNotebook}\n >\n {t('notebooks.empty.action')}\n </Button>\n )}\n </div>\n {!hasNotebooks ? (\n <div className={classes.notebooksEmptyState}>\n <CatalogIcon className={classes.notebooksIcon} />\n <Typography variant=\"h6\" className={classes.notebooksHeadingEmpty}>\n {t('notebooks.empty.title')}\n </Typography>\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={classes.notebooksDescription}\n >\n {t('notebooks.empty.description')}\n </Typography>\n <Button\n variant=\"primary\"\n className={classes.notebooksActionEmpty}\n onClick={onCreateNotebook}\n >\n {t('notebooks.empty.action')}\n </Button>\n </div>\n ) : (\n <div className={classes.notebooksGrid}>\n {notebooks.map(notebook => (\n <NotebookCard\n key={notebook.session_id}\n notebook={notebook}\n classes={classes}\n openNotebookMenuId={openNotebookMenuId}\n setOpenNoteb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E,uBAAuB,CAAA,EAC5B,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,OAAA;AAAA,QACR,KAAA,EAAM,eAAA;AAAA,QACN,WAAW,OAAA,CAAQ,oBAAA;AAAA,QAElB,YAAE,6BAA6B;AAAA;AAAA,KAClC;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,SAAA;AAAA,QACR,WAAW,OAAA,CAAQ,oBAAA;AAAA,QACnB,OAAA,EAAS,gBAAA;AAAA,QAER,YAAE,wBAAwB;AAAA;AAAA;AAC7B,GAAA,EACF,CAAA,uBAEC,KAAA,EAAA,EAAI,SAAA,EAAW,QAAQ,aAAA,EACrB,QAAA,EAAA,SAAA,CAAU,IAAI,CAAA,QAAA,qBACb,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MAEC,QAAA;AAAA,MACA,OAAA;AAAA,MACA,kBAAA;AAAA,MACA,qBAAA;AAAA,MACA,OAAA,EAAS,gBAAA;AAAA,MACT,QAAA;AAAA,MACA,QAAA;AAAA,MACA;AAAA,KAAA;AAAA,IARK,QAAA,CAAS;AAAA,GAUjB,CAAA,EACH;AAAA,CAAA,EAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverwriteConfirmModal.esm.js","sources":["../../../src/components/notebooks/OverwriteConfirmModal.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@mui/icons-material/Close';\nimport Alert from '@mui/material/Alert';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { useTranslation } from '../../hooks/useTranslation';\nimport { FileTypeIcon } from './FileTypeIcon';\n\nconst useStyles = makeStyles(theme => ({\n dialogPaper: {\n borderRadius: 24,\n maxWidth: 578,\n },\n dialogTitle: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '24px 24px 16px',\n },\n titleText: {\n fontWeight: 500,\n fontSize: '1.25rem',\n lineHeight: '1.625rem',\n letterSpacing: '-0.25px',\n },\n closeButton: {\n color: theme.palette.grey[700],\n },\n dialogContent: {\n padding: '0 24px 24px',\n },\n fileList: {\n margin: 0,\n padding: 0,\n listStyle: 'none',\n },\n fileItem: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n padding: `${theme.spacing(2)}px 0`,\n borderBottom:\n '1px solid var(--pf-t--global--border--color--default, #c7c7c7)',\n cursor: 'pointer',\n },\n fileName: {\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n fontSize: '0.875rem',\n lineHeight: '1.25rem',\n },\n dialogActions: {\n justifyContent: 'left',\n padding: theme.spacing(2.5),\n gap: theme.spacing(1),\n },\n overwriteButton: {\n textTransform: 'none',\n borderRadius: 999,\n },\n cancelButton: {\n textTransform: 'none',\n borderRadius: 999,\n },\n warningAlert: {\n borderRadius: '6px',\n },\n}));\n\ntype OverwriteConfirmModalProps = {\n isOpen: boolean;\n onClose: () => void;\n onConfirm: () => void;\n fileNames: string[];\n};\n\nexport const OverwriteConfirmModal = ({\n isOpen,\n onClose,\n onConfirm,\n fileNames,\n}: OverwriteConfirmModalProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <Dialog\n open={isOpen}\n onClose={onClose}\n aria-labelledby=\"overwrite-confirm-modal-title\"\n PaperProps={{\n className: classes.dialogPaper,\n }}\n >\n <DialogTitle className={classes.dialogTitle}>\n <Typography component=\"h2\" className={classes.titleText}>\n {t('notebook.overwrite.modal.title')}\n </Typography>\n <IconButton\n aria-label={t('common.close')}\n onClick={onClose}\n className={classes.closeButton}\n size=\"small\"\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n\n <DialogContent className={classes.dialogContent}>\n <Alert severity=\"warning\" className={classes.warningAlert}>\n {t('notebook.overwrite.modal.description')}\n </Alert>\n\n <ul className={classes.fileList}>\n {fileNames.map(name => (\n <li key={name} className={classes.fileItem}>\n <FileTypeIcon fileName={name} />\n <Typography className={classes.fileName}>{name}</Typography>\n </li>\n ))}\n </ul>\n </DialogContent>\n\n <DialogActions className={classes.dialogActions}>\n <Button\n variant=\"contained\"\n color=\"error\"\n className={classes.overwriteButton}\n onClick={onConfirm}\n >\n {t('notebook.overwrite.modal.action')}\n </Button>\n <Button\n variant=\"outlined\"\n className={classes.cancelButton}\n onClick={onClose}\n >\n {t('common.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"OverwriteConfirmModal.esm.js","sources":["../../../src/components/notebooks/OverwriteConfirmModal.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@mui/icons-material/Close';\nimport Alert from '@mui/material/Alert';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { useTranslation } from '../../hooks/useTranslation';\nimport { FileTypeIcon } from './FileTypeIcon';\n\nconst useStyles = makeStyles(theme => ({\n dialogPaper: {\n borderRadius: 24,\n maxWidth: 578,\n },\n dialogTitle: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '24px 24px 16px',\n },\n titleText: {\n fontWeight: 500,\n fontSize: '1.25rem',\n lineHeight: '1.625rem',\n letterSpacing: '-0.25px',\n },\n closeButton: {\n color: theme.palette.grey[700],\n },\n dialogContent: {\n padding: '0 24px 24px',\n },\n fileList: {\n margin: 0,\n padding: 0,\n listStyle: 'none',\n },\n fileItem: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n padding: `${theme.spacing(2)}px 0`,\n borderBottom:\n '1px solid var(--pf-t--global--border--color--default, #c7c7c7)',\n cursor: 'pointer',\n },\n fileName: {\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n fontSize: '0.875rem',\n lineHeight: '1.25rem',\n },\n dialogActions: {\n justifyContent: 'left',\n padding: theme.spacing(2.5),\n gap: theme.spacing(1),\n },\n overwriteButton: {\n textTransform: 'none',\n borderRadius: 999,\n },\n cancelButton: {\n textTransform: 'none',\n borderRadius: 999,\n },\n warningAlert: {\n borderRadius: '6px',\n },\n}));\n\ntype OverwriteConfirmModalProps = {\n isOpen: boolean;\n onClose: () => void;\n onConfirm: () => void;\n fileNames: string[];\n};\n\nexport const OverwriteConfirmModal = ({\n isOpen,\n onClose,\n onConfirm,\n fileNames,\n}: OverwriteConfirmModalProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <Dialog\n open={isOpen}\n onClose={onClose}\n aria-labelledby=\"overwrite-confirm-modal-title\"\n PaperProps={{\n className: classes.dialogPaper,\n }}\n >\n <DialogTitle className={classes.dialogTitle}>\n <Typography component=\"h2\" className={classes.titleText}>\n {t('notebook.overwrite.modal.title')}\n </Typography>\n <IconButton\n aria-label={t('common.close')}\n onClick={onClose}\n className={classes.closeButton}\n size=\"small\"\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n\n <DialogContent className={classes.dialogContent}>\n <Alert severity=\"warning\" className={classes.warningAlert}>\n {t('notebook.overwrite.modal.description')}\n </Alert>\n\n <ul className={classes.fileList}>\n {fileNames.map(name => (\n <li key={name} className={classes.fileItem}>\n <FileTypeIcon fileName={name} />\n <Typography className={classes.fileName}>{name}</Typography>\n </li>\n ))}\n </ul>\n </DialogContent>\n\n <DialogActions className={classes.dialogActions}>\n <Button\n variant=\"contained\"\n color=\"error\"\n className={classes.overwriteButton}\n onClick={onConfirm}\n >\n {t('notebook.overwrite.modal.action')}\n </Button>\n <Button\n variant=\"outlined\"\n className={classes.cancelButton}\n onClick={onClose}\n >\n {t('common.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,WAAA,EAAa;AAAA,IACX,YAAA,EAAc,EAAA;AAAA,IACd,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,WAAA,EAAa;AAAA,IACX,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB,eAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,UAAA,EAAY,GAAA;AAAA,IACZ,QAAA,EAAU,SAAA;AAAA,IACV,UAAA,EAAY,UAAA;AAAA,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AAG,SAAA,EAAW,OAAA,CAAQ,QAAA,EACpB,QAAA,EAAA,SAAA,CAAU,GAAA,CAAI,CAAA,IAAA,qBACb,IAAA,CAAC,IAAA,EAAA,EAAc,SAAA,EAAW,OAAA,CAAQ,QAAA,EAChC,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EAAa,UAAU,IAAA,EAAM,CAAA;AAAA,4BAC9B,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,OAAA,CAAQ,UAAW,QAAA,EAAA,IAAA,EAAK;AAAA,WAAA,EAAA,EAFxC,IAGT,CACD,CAAA,EACH;AAAA,SAAA,EACF,CAAA;AAAA,wBAEA,IAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAW,OAAA,CAAQ,aAAA,EAChC,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,WAAA;AAAA,cACR,KAAA,EAAM,OAAA;AAAA,cACN,WAAW,OAAA,CAAQ,eAAA;AAAA,cACnB,OAAA,EAAS,SAAA;AAAA,cAER,YAAE,iCAAiC;AAAA;AAAA,WACtC;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,UAAA;AAAA,cACR,WAAW,OAAA,CAAQ,YAAA;AAAA,cACnB,OAAA,EAAS,OAAA;AAAA,cAER,YAAE,eAAe;AAAA;AAAA;AACpB,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenameNotebookModal.esm.js","sources":["../../../src/components/notebooks/RenameNotebookModal.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\n\nimport { TextField } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@mui/icons-material/Close';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { useRenameNotebook } from '../../hooks/notebooks/useRenameNotebook';\nimport { useTranslation } from '../../hooks/useTranslation';\n\nconst useStyles = makeStyles(theme => ({\n dialogPaper: {\n borderRadius: 16,\n },\n dialogTitle: {\n padding: '16px 20px',\n fontStyle: 'inherit',\n },\n titleRow: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n },\n titleText: {\n fontWeight: 'bold',\n },\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[700],\n },\n dialogContent: {\n paddingTop: 0,\n paddingLeft: theme.spacing(2.5),\n },\n description: {\n marginBottom: theme.spacing(3),\n },\n textField: {\n marginTop: 0,\n },\n errorBox: {\n maxWidth: 650,\n marginLeft: theme.spacing(2.5),\n marginRight: theme.spacing(2.5),\n },\n dialogActions: {\n justifyContent: 'left',\n padding: theme.spacing(2.5),\n gap: theme.spacing(1),\n },\n submitButton: {\n textTransform: 'none',\n borderRadius: 999,\n backgroundColor: 'var(--pf-t--global--color--brand--default)',\n '&:hover': {\n backgroundColor: 'var(--pf-t--global--color--brand--default)',\n },\n },\n cancelButton: {\n textTransform: 'none',\n borderRadius: 999,\n },\n}));\n\nexport const RenameNotebookModal = ({\n isOpen,\n onClose,\n sessionId,\n currentName,\n}: {\n isOpen: boolean;\n onClose: () => void;\n sessionId: string;\n currentName: string;\n}) => {\n const classes = useStyles();\n const { t } = useTranslation();\n const { mutateAsync: renameNotebook, isError, error } = useRenameNotebook();\n const [name, setName] = useState<string>('');\n const [originalName, setOriginalName] = useState<string>('');\n\n useEffect(() => {\n if (isOpen) {\n setName(currentName);\n setOriginalName(currentName);\n }\n }, [isOpen, currentName]);\n\n const handleRename = async () => {\n try {\n await renameNotebook({ sessionId, name });\n onClose();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(e);\n }\n };\n\n return (\n <Dialog\n open={isOpen}\n onClose={onClose}\n aria-labelledby=\"rename-notebook-modal\"\n aria-describedby=\"rename-notebook-modal-body\"\n fullWidth\n PaperProps={{\n className: classes.dialogPaper,\n }}\n >\n <DialogTitle className={classes.dialogTitle}>\n <Box className={classes.titleRow}>\n <Typography component=\"span\" className={classes.titleText}>\n {t('notebooks.rename.title').replace('{{name}}', currentName)}\n </Typography>\n <IconButton\n aria-label=\"close\"\n onClick={onClose}\n title={t('common.close')}\n size=\"large\"\n className={classes.closeButton}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent\n id=\"rename-notebook-modal-body\"\n className={classes.dialogContent}\n >\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={classes.description}\n >\n {t('notebooks.rename.description')}\n </Typography>\n <TextField\n id=\"outlined-notebook-name-input\"\n label={t('notebooks.rename.label')}\n onChange={event => setName(event.target.value)}\n fullWidth\n value={name}\n className={classes.textField}\n variant=\"outlined\"\n placeholder={t('notebooks.rename.placeholder')}\n InputProps={{\n autoFocus: true,\n }}\n />\n </DialogContent>\n {isError && (\n <Box className={classes.errorBox}>\n <Alert severity=\"error\">{String(error)}</Alert>\n </Box>\n )}\n <DialogActions className={classes.dialogActions}>\n <Button\n variant=\"contained\"\n className={classes.submitButton}\n disabled={name.trim() === '' || name.trim() === originalName.trim()}\n onClick={handleRename}\n >\n {t('notebooks.rename.action')}\n </Button>\n <Button\n key=\"cancel\"\n variant=\"outlined\"\n className={classes.cancelButton}\n onClick={onClose}\n >\n {t('common.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,WAAa,EAAA;AAAA,IACX,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,OAAS,EAAA,WAAA;AAAA,IACT,SAAW,EAAA;AAAA,GACb;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,UAAY,EAAA,QAAA;AAAA,IACZ,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GACtB;AAAA,EACA,SAAW,EAAA;AAAA,IACT,UAAY,EAAA;AAAA,GACd;AAAA,EACA,WAAa,EAAA;AAAA,IACX,QAAU,EAAA,UAAA;AAAA,IACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACpB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG;AAAA,GAC/B;AAAA,EACA,aAAe,EAAA;AAAA,IACb,UAAY,EAAA,CAAA;AAAA,IACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,GAChC;AAAA,EACA,WAAa,EAAA;AAAA,IACX,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,SAAW,EAAA;AAAA,IACT,SAAW,EAAA;AAAA,GACb;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA,GAAA;AAAA,IACV,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC7B,WAAA,EAAa,K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A,WAC9B;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,OAAQ,EAAA,UAAA;AAAA,cACR,WAAW,OAAQ,CAAA,YAAA;AAAA,cACnB,OAAS,EAAA,OAAA;AAAA,cAER,YAAE,eAAe;AAAA,aAAA;AAAA,YALd;AAAA;AAMN,SACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"RenameNotebookModal.esm.js","sources":["../../../src/components/notebooks/RenameNotebookModal.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\n\nimport { TextField } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@mui/icons-material/Close';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { useRenameNotebook } from '../../hooks/notebooks/useRenameNotebook';\nimport { useTranslation } from '../../hooks/useTranslation';\n\nconst useStyles = makeStyles(theme => ({\n dialogPaper: {\n borderRadius: 16,\n },\n dialogTitle: {\n padding: '16px 20px',\n fontStyle: 'inherit',\n },\n titleRow: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n },\n titleText: {\n fontWeight: 'bold',\n },\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[700],\n },\n dialogContent: {\n paddingTop: 0,\n paddingLeft: theme.spacing(2.5),\n },\n description: {\n marginBottom: theme.spacing(3),\n },\n textField: {\n marginTop: 0,\n },\n errorBox: {\n maxWidth: 650,\n marginLeft: theme.spacing(2.5),\n marginRight: theme.spacing(2.5),\n },\n dialogActions: {\n justifyContent: 'left',\n padding: theme.spacing(2.5),\n gap: theme.spacing(1),\n },\n submitButton: {\n textTransform: 'none',\n borderRadius: 999,\n backgroundColor: 'var(--pf-t--global--color--brand--default)',\n '&:hover': {\n backgroundColor: 'var(--pf-t--global--color--brand--default)',\n },\n },\n cancelButton: {\n textTransform: 'none',\n borderRadius: 999,\n },\n}));\n\nexport const RenameNotebookModal = ({\n isOpen,\n onClose,\n sessionId,\n currentName,\n}: {\n isOpen: boolean;\n onClose: () => void;\n sessionId: string;\n currentName: string;\n}) => {\n const classes = useStyles();\n const { t } = useTranslation();\n const { mutateAsync: renameNotebook, isError, error } = useRenameNotebook();\n const [name, setName] = useState<string>('');\n const [originalName, setOriginalName] = useState<string>('');\n\n useEffect(() => {\n if (isOpen) {\n setName(currentName);\n setOriginalName(currentName);\n }\n }, [isOpen, currentName]);\n\n const handleRename = async () => {\n try {\n await renameNotebook({ sessionId, name });\n onClose();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(e);\n }\n };\n\n return (\n <Dialog\n open={isOpen}\n onClose={onClose}\n aria-labelledby=\"rename-notebook-modal\"\n aria-describedby=\"rename-notebook-modal-body\"\n fullWidth\n PaperProps={{\n className: classes.dialogPaper,\n }}\n >\n <DialogTitle className={classes.dialogTitle}>\n <Box className={classes.titleRow}>\n <Typography component=\"span\" className={classes.titleText}>\n {t('notebooks.rename.title').replace('{{name}}', currentName)}\n </Typography>\n <IconButton\n aria-label=\"close\"\n onClick={onClose}\n title={t('common.close')}\n size=\"large\"\n className={classes.closeButton}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent\n id=\"rename-notebook-modal-body\"\n className={classes.dialogContent}\n >\n <Typography\n variant=\"body2\"\n color=\"textSecondary\"\n className={classes.description}\n >\n {t('notebooks.rename.description')}\n </Typography>\n <TextField\n id=\"outlined-notebook-name-input\"\n label={t('notebooks.rename.label')}\n onChange={event => setName(event.target.value)}\n fullWidth\n value={name}\n className={classes.textField}\n variant=\"outlined\"\n placeholder={t('notebooks.rename.placeholder')}\n InputProps={{\n autoFocus: true,\n }}\n />\n </DialogContent>\n {isError && (\n <Box className={classes.errorBox}>\n <Alert severity=\"error\">{String(error)}</Alert>\n </Box>\n )}\n <DialogActions className={classes.dialogActions}>\n <Button\n variant=\"contained\"\n className={classes.submitButton}\n disabled={name.trim() === '' || name.trim() === originalName.trim()}\n onClick={handleRename}\n >\n {t('notebooks.rename.action')}\n </Button>\n <Button\n key=\"cancel\"\n variant=\"outlined\"\n className={classes.cancelButton}\n onClick={onClose}\n >\n {t('common.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,WAAA,EAAa;AAAA,IACX,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,WAAA,EAAa;AAAA,IACX,OAAA,EAAS,WAAA;AAAA,IACT,SAAA,EAAW;AAAA,GACb;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,GAAA,EAAK,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,GACtB;AAAA,EACA,SAAA,EAAW;AAAA,IACT,UAAA,EAAY;AAAA,GACd;AAAA,EACA,WAAA,EAAa;AAAA,IACX,QAAA,EAAU,UAAA;AAAA,IACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,GAAA,EAAK,KAAA,C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EAAI,SAAA,EAAW,OAAA,CAAQ,QAAA,EACtB,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,OAAA,EAAS,QAAA,EAAA,MAAA,CAAO,KAAK,GAAE,CAAA,EACzC,CAAA;AAAA,wBAEF,IAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAW,OAAA,CAAQ,aAAA,EAChC,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,WAAA;AAAA,cACR,WAAW,OAAA,CAAQ,YAAA;AAAA,cACnB,QAAA,EAAU,KAAK,IAAA,EAAK,KAAM,MAAM,IAAA,CAAK,IAAA,EAAK,KAAM,YAAA,CAAa,IAAA,EAAK;AAAA,cAClE,OAAA,EAAS,YAAA;AAAA,cAER,YAAE,yBAAyB;AAAA;AAAA,WAC9B;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,OAAA,EAAQ,UAAA;AAAA,cACR,WAAW,OAAA,CAAQ,YAAA;AAAA,cACnB,OAAA,EAAS,OAAA;AAAA,cAER,YAAE,eAAe;AAAA,aAAA;AAAA,YALd;AAAA;AAMN,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarCollapseIcon.esm.js","sources":["../../../src/components/notebooks/SidebarCollapseIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype IconProps = {\n className?: string;\n};\n\nexport const SidebarCollapseIcon = ({ className }: IconProps) => (\n <svg\n className={className}\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M16 21V3H14V21H16ZM12 17V7L7 12L12 17Z\" fill=\"currentColor\" />\n </svg>\n);\n\nexport const SidebarExpandIcon = ({ className }: IconProps) => (\n <svg\n className={className}\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M9 21V3H11V21H9ZM13 17V7L18 12L13 17Z\" fill=\"currentColor\" />\n </svg>\n);\n\ntype AddCircleFilledIconProps = IconProps & {\n disabled?: boolean;\n};\n\nexport const AddCircleFilledIcon = ({\n className,\n disabled,\n}: AddCircleFilledIconProps) => (\n <svg\n className={className}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M7.75 0C12.0312 1.02089e-05 15.5 3.46877 15.5 7.75C15.5 12.0312 12.0312 15.5 7.75 15.5C3.46877 15.5 1.02086e-05 12.0312 0 7.75C0 3.46876 3.46876 0 7.75 0ZM6.875 3.25C6.66876 3.25 6.5 3.41876 6.5 3.625V6.5H3.625C3.41876 6.5 3.25 6.66876 3.25 6.875V8.625C3.25001 8.83123 3.41877 9 3.625 9H6.5V11.875C6.50002 12.0812 6.66877 12.25 6.875 12.25H8.625C8.83122 12.25 8.99998 12.0812 9 11.875V9H11.875C12.0812 8.99998 12.25 8.83122 12.25 8.625V6.875C12.25 6.66877 12.0812 6.50002 11.875 6.5H9V3.625C9 3.41877 8.83123 3.25001 8.625 3.25H6.875Z\"\n fill={disabled ? '#8a8d90' : '#0066CC'}\n />\n </svg>\n);\n"],"names":[],"mappings":";;AAoBO,MAAM,
|
|
1
|
+
{"version":3,"file":"SidebarCollapseIcon.esm.js","sources":["../../../src/components/notebooks/SidebarCollapseIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype IconProps = {\n className?: string;\n};\n\nexport const SidebarCollapseIcon = ({ className }: IconProps) => (\n <svg\n className={className}\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M16 21V3H14V21H16ZM12 17V7L7 12L12 17Z\" fill=\"currentColor\" />\n </svg>\n);\n\nexport const SidebarExpandIcon = ({ className }: IconProps) => (\n <svg\n className={className}\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M9 21V3H11V21H9ZM13 17V7L18 12L13 17Z\" fill=\"currentColor\" />\n </svg>\n);\n\ntype AddCircleFilledIconProps = IconProps & {\n disabled?: boolean;\n};\n\nexport const AddCircleFilledIcon = ({\n className,\n disabled,\n}: AddCircleFilledIconProps) => (\n <svg\n className={className}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M7.75 0C12.0312 1.02089e-05 15.5 3.46877 15.5 7.75C15.5 12.0312 12.0312 15.5 7.75 15.5C3.46877 15.5 1.02086e-05 12.0312 0 7.75C0 3.46876 3.46876 0 7.75 0ZM6.875 3.25C6.66876 3.25 6.5 3.41876 6.5 3.625V6.5H3.625C3.41876 6.5 3.25 6.66876 3.25 6.875V8.625C3.25001 8.83123 3.41877 9 3.625 9H6.5V11.875C6.50002 12.0812 6.66877 12.25 6.875 12.25H8.625C8.83122 12.25 8.99998 12.0812 9 11.875V9H11.875C12.0812 8.99998 12.25 8.83122 12.25 8.625V6.875C12.25 6.66877 12.0812 6.50002 11.875 6.5H9V3.625C9 3.41877 8.83123 3.25001 8.625 3.25H6.875Z\"\n fill={disabled ? '#8a8d90' : '#0066CC'}\n />\n </svg>\n);\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAA,GAAsB,CAAC,EAAE,SAAA,EAAU,qBAC9C,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,SAAA;AAAA,IACA,KAAA,EAAM,IAAA;AAAA,IACN,MAAA,EAAO,IAAA;AAAA,IACP,OAAA,EAAQ,WAAA;AAAA,IACR,IAAA,EAAK,MAAA;AAAA,IACL,KAAA,EAAM,4BAAA;AAAA,IAEN,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,wCAAA,EAAyC,MAAK,cAAA,EAAe;AAAA;AACvE;AAGK,MAAM,iBAAA,GAAoB,CAAC,EAAE,SAAA,EAAU,qBAC5C,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,SAAA;AAAA,IACA,KAAA,EAAM,IAAA;AAAA,IACN,MAAA,EAAO,IAAA;AAAA,IACP,OAAA,EAAQ,WAAA;AAAA,IACR,IAAA,EAAK,MAAA;AAAA,IACL,KAAA,EAAM,4BAAA;AAAA,IAEN,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,uCAAA,EAAwC,MAAK,cAAA,EAAe;AAAA;AACtE;AAOK,MAAM,sBAAsB,CAAC;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAA,qBACE,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,SAAA;AAAA,IACA,KAAA,EAAM,IAAA;AAAA,IACN,MAAA,EAAO,IAAA;AAAA,IACP,OAAA,EAAQ,WAAA;AAAA,IACR,IAAA,EAAK,MAAA;AAAA,IACL,KAAA,EAAM,4BAAA;AAAA,IAEN,QAAA,kBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,CAAA,EAAE,whBAAA;AAAA,QACF,IAAA,EAAM,WAAW,SAAA,GAAY;AAAA;AAAA;AAC/B;AACF;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Typography, makeStyles } from '@material-ui/core';
|
|
3
3
|
import { Button } from '@patternfly/react-core';
|
|
4
4
|
import { AddCircleOIcon } from '@patternfly/react-icons';
|
|
5
5
|
import { CatalogIcon } from '@patternfly/react-icons/dist/esm/icons';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadResourceScreen.esm.js","sources":["../../../src/components/notebooks/UploadResourceScreen.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles, Typography } from '@material-ui/core';\nimport { Button } from '@patternfly/react-core';\nimport { AddCircleOIcon } from '@patternfly/react-icons';\nimport { CatalogIcon } from '@patternfly/react-icons/dist/esm/icons';\n\nimport { useTranslation } from '../../hooks/useTranslation';\n\nconst useStyles = makeStyles(theme => ({\n container: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n flex: 1,\n textAlign: 'center',\n gap: theme.spacing(2),\n },\n icon: {\n fontSize: 48,\n color: 'var(--pf-t--global--icon--color--subtle)',\n },\n heading: {\n fontWeight: 500,\n fontSize: '1.5rem',\n lineHeight: '2rem',\n letterSpacing: '-0.25px',\n },\n uploadButton: {\n textTransform: 'none',\n borderRadius: 999,\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n}));\n\ntype UploadResourceScreenProps = {\n onUploadClick: () => void;\n};\n\nexport const UploadResourceScreen = ({\n onUploadClick,\n}: UploadResourceScreenProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.container}>\n <CatalogIcon className={classes.icon} />\n <Typography className={classes.heading}>\n {t('notebook.view.upload.heading')}\n </Typography>\n <Button\n variant=\"secondary\"\n className={classes.uploadButton}\n icon={<AddCircleOIcon />}\n iconPosition=\"end\"\n onClick={onUploadClick}\n >\n {t('notebook.view.upload.action')}\n </Button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,SAAA,GAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"UploadResourceScreen.esm.js","sources":["../../../src/components/notebooks/UploadResourceScreen.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles, Typography } from '@material-ui/core';\nimport { Button } from '@patternfly/react-core';\nimport { AddCircleOIcon } from '@patternfly/react-icons';\nimport { CatalogIcon } from '@patternfly/react-icons/dist/esm/icons';\n\nimport { useTranslation } from '../../hooks/useTranslation';\n\nconst useStyles = makeStyles(theme => ({\n container: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n flex: 1,\n textAlign: 'center',\n gap: theme.spacing(2),\n },\n icon: {\n fontSize: 48,\n color: 'var(--pf-t--global--icon--color--subtle)',\n },\n heading: {\n fontWeight: 500,\n fontSize: '1.5rem',\n lineHeight: '2rem',\n letterSpacing: '-0.25px',\n },\n uploadButton: {\n textTransform: 'none',\n borderRadius: 999,\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n}));\n\ntype UploadResourceScreenProps = {\n onUploadClick: () => void;\n};\n\nexport const UploadResourceScreen = ({\n onUploadClick,\n}: UploadResourceScreenProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.container}>\n <CatalogIcon className={classes.icon} />\n <Typography className={classes.heading}>\n {t('notebook.view.upload.heading')}\n </Typography>\n <Button\n variant=\"secondary\"\n className={classes.uploadButton}\n icon={<AddCircleOIcon />}\n iconPosition=\"end\"\n onClick={onUploadClick}\n >\n {t('notebook.view.upload.action')}\n </Button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,SAAA,EAAW;AAAA,IACT,OAAA,EAAS,MAAA;AAAA,IACT,aAAA,EAAe,QAAA;AAAA,IACf,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB,QAAA;AAAA,IAChB,IAAA,EAAM,CAAA;AAAA,IACN,SAAA,EAAW,QAAA;AAAA,IACX,GAAA,EAAK,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,GACtB;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU,EAAA;AAAA,IACV,KAAA,EAAO;AAAA,GACT;AAAA,EACA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,GAAA;AAAA,IACZ,QAAA,EAAU,QAAA;AAAA,IACV,UAAA,EAAY,MAAA;AAAA,IACZ,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,aAAA,EAAe,MAAA;AAAA,IACf,YAAA,EAAc,GAAA;AAAA,IACd,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,YAAA,EAAc,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA;AAEjC,CAAA,CAAE,CAAA;AAMK,MAAM,uBAAuB,CAAC;AAAA,EACnC;AACF,CAAA,KAAiC;AAC/B,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAE7B,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,SAAA,EACtB,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,SAAA,EAAW,OAAA,CAAQ,IAAA,EAAM,CAAA;AAAA,wBACrC,UAAA,EAAA,EAAW,SAAA,EAAW,QAAQ,OAAA,EAC5B,QAAA,EAAA,CAAA,CAAE,8BAA8B,CAAA,EACnC,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,WAAA;AAAA,QACR,WAAW,OAAA,CAAQ,YAAA;AAAA,QACnB,IAAA,sBAAO,cAAA,EAAA,EAAe,CAAA;AAAA,QACtB,YAAA,EAAa,KAAA;AAAA,QACb,OAAA,EAAS,aAAA;AAAA,QAER,YAAE,6BAA6B;AAAA;AAAA;AAClC,GAAA,EACF,CAAA;AAEJ;;;;"}
|
package/dist/const.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.esm.js","sources":["../src/const.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SamplePrompts } from './types';\n\nexport const TEMP_CONVERSATION_ID = 'temp-conversation-id';\n\nexport const LIGHTSPEED_APP_DRAWER_ID = 'lightspeed';\n\n// Translation keys for disclaimers\nexport const FUNCTION_DISCLAIMER_WITHOUT_QUESTION_VALIDATION_KEY =\n 'disclaimer.withoutValidation';\nexport const FUNCTION_DISCLAIMER_KEY = 'disclaimer.withValidation';\n\nconst createPrompt = (titleKey: string, messageKey: string) => {\n return { titleKey, messageKey };\n};\n\nexport const supportedFileTypes = {\n 'text/plain': ['.txt'],\n 'application/json': ['.json'],\n 'application/yaml': ['.yaml', '.yml'],\n};\n\nexport const NOTEBOOK_MAX_FILES = 10;\nexport const NOTEBOOK_MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024; // 25 MB\nexport const UNTITLED_NOTEBOOK_NAME = 'Untitled Notebook';\n\nexport const NOTEBOOK_ALLOWED_EXTENSIONS: Record<string, string[]> = {\n 'text/plain': ['.txt', '.log'],\n 'text/markdown': ['.md'],\n 'application/pdf': ['.pdf'],\n 'application/json': ['.json'],\n 'application/x-yaml': ['.yaml', '.yml'],\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [\n '.docx',\n ],\n 'application/vnd.oasis.opendocument.text': ['.odt'],\n};\n\nexport const NOTEBOOK_EXTENSION_TO_FILE_TYPE: Record<string, string> = {\n '.txt': 'txt',\n '.md': 'md',\n '.pdf': 'pdf',\n '.json': 'json',\n '.yaml': 'yaml',\n '.yml': 'yaml',\n '.log': 'log',\n '.docx': 'txt',\n '.odt': 'txt',\n};\n\nexport const DEFAULT_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt(\n 'prompts.codeReadability.title',\n 'prompts.codeReadability.message',\n ),\n createPrompt('prompts.debugging.title', 'prompts.debugging.message'),\n createPrompt(\n 'prompts.developmentConcept.title',\n 'prompts.developmentConcept.message',\n ),\n createPrompt(\n 'prompts.codeOptimization.title',\n 'prompts.codeOptimization.message',\n ),\n createPrompt('prompts.documentation.title', 'prompts.documentation.message'),\n createPrompt('prompts.gitWorkflows.title', 'prompts.gitWorkflows.message'),\n createPrompt(\n 'prompts.testingStrategies.title',\n 'prompts.testingStrategies.message',\n ),\n createPrompt(\n 'prompts.sortingAlgorithms.title',\n 'prompts.sortingAlgorithms.message',\n ),\n createPrompt('prompts.eventDriven.title', 'prompts.eventDriven.message'),\n];\n\nexport const RHDH_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt('prompts.tekton.title', 'prompts.tekton.message'),\n createPrompt('prompts.openshift.title', 'prompts.openshift.message'),\n createPrompt('prompts.rhdh.title', 'prompts.rhdh.message'),\n];\n\n// Topic restriction valid provider IDs\nexport const VALID_TOPIC_RESTRICTION_PROVIDER_IDS = [\n 'lightspeed_question_validity-shield',\n];\n\n// Matches app shell margin on main when ApplicationDrawer is docked (e.g. Root.tsx).\nexport const DOCKED_CONTENT_OFFSET =\n 'calc(var(--docked-drawer-width, 500px) + 1.5em)';\n"],"names":[],"mappings":"AAkBO,MAAM,
|
|
1
|
+
{"version":3,"file":"const.esm.js","sources":["../src/const.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SamplePrompts } from './types';\n\nexport const TEMP_CONVERSATION_ID = 'temp-conversation-id';\n\nexport const LIGHTSPEED_APP_DRAWER_ID = 'lightspeed';\n\n// Translation keys for disclaimers\nexport const FUNCTION_DISCLAIMER_WITHOUT_QUESTION_VALIDATION_KEY =\n 'disclaimer.withoutValidation';\nexport const FUNCTION_DISCLAIMER_KEY = 'disclaimer.withValidation';\n\nconst createPrompt = (titleKey: string, messageKey: string) => {\n return { titleKey, messageKey };\n};\n\nexport const supportedFileTypes = {\n 'text/plain': ['.txt'],\n 'application/json': ['.json'],\n 'application/yaml': ['.yaml', '.yml'],\n};\n\nexport const NOTEBOOK_MAX_FILES = 10;\nexport const NOTEBOOK_MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024; // 25 MB\nexport const UNTITLED_NOTEBOOK_NAME = 'Untitled Notebook';\n\nexport const NOTEBOOK_ALLOWED_EXTENSIONS: Record<string, string[]> = {\n 'text/plain': ['.txt', '.log'],\n 'text/markdown': ['.md'],\n 'application/pdf': ['.pdf'],\n 'application/json': ['.json'],\n 'application/x-yaml': ['.yaml', '.yml'],\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [\n '.docx',\n ],\n 'application/vnd.oasis.opendocument.text': ['.odt'],\n};\n\nexport const NOTEBOOK_EXTENSION_TO_FILE_TYPE: Record<string, string> = {\n '.txt': 'txt',\n '.md': 'md',\n '.pdf': 'pdf',\n '.json': 'json',\n '.yaml': 'yaml',\n '.yml': 'yaml',\n '.log': 'log',\n '.docx': 'txt',\n '.odt': 'txt',\n};\n\nexport const DEFAULT_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt(\n 'prompts.codeReadability.title',\n 'prompts.codeReadability.message',\n ),\n createPrompt('prompts.debugging.title', 'prompts.debugging.message'),\n createPrompt(\n 'prompts.developmentConcept.title',\n 'prompts.developmentConcept.message',\n ),\n createPrompt(\n 'prompts.codeOptimization.title',\n 'prompts.codeOptimization.message',\n ),\n createPrompt('prompts.documentation.title', 'prompts.documentation.message'),\n createPrompt('prompts.gitWorkflows.title', 'prompts.gitWorkflows.message'),\n createPrompt(\n 'prompts.testingStrategies.title',\n 'prompts.testingStrategies.message',\n ),\n createPrompt(\n 'prompts.sortingAlgorithms.title',\n 'prompts.sortingAlgorithms.message',\n ),\n createPrompt('prompts.eventDriven.title', 'prompts.eventDriven.message'),\n];\n\nexport const RHDH_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt('prompts.tekton.title', 'prompts.tekton.message'),\n createPrompt('prompts.openshift.title', 'prompts.openshift.message'),\n createPrompt('prompts.rhdh.title', 'prompts.rhdh.message'),\n];\n\n// Topic restriction valid provider IDs\nexport const VALID_TOPIC_RESTRICTION_PROVIDER_IDS = [\n 'lightspeed_question_validity-shield',\n];\n\n// Matches app shell margin on main when ApplicationDrawer is docked (e.g. Root.tsx).\nexport const DOCKED_CONTENT_OFFSET =\n 'calc(var(--docked-drawer-width, 500px) + 1.5em)';\n"],"names":[],"mappings":"AAkBO,MAAM,oBAAA,GAAuB;AAE7B,MAAM,wBAAA,GAA2B;AAOxC,MAAM,YAAA,GAAe,CAAC,QAAA,EAAkB,UAAA,KAAuB;AAC7D,EAAA,OAAO,EAAE,UAAU,UAAA,EAAW;AAChC,CAAA;AAEO,MAAM,kBAAA,GAAqB;AAAA,EAChC,YAAA,EAAc,CAAC,MAAM,CAAA;AAAA,EACrB,kBAAA,EAAoB,CAAC,OAAO,CAAA;AAAA,EAC5B,kBAAA,EAAoB,CAAC,OAAA,EAAS,MAAM;AACtC;AAEO,MAAM,kBAAA,GAAqB;AAC3B,MAAM,4BAAA,GAA+B,KAAK,IAAA,GAAO;AACjD,MAAM,sBAAA,GAAyB;AAE/B,MAAM,2BAAA,GAAwD;AAAA,EACnE,YAAA,EAAc,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,EAC7B,eAAA,EAAiB,CAAC,KAAK,CAAA;AAAA,EACvB,iBAAA,EAAmB,CAAC,MAAM,CAAA;AAAA,EAC1B,kBAAA,EAAoB,CAAC,OAAO,CAAA;AAAA,EAC5B,oBAAA,EAAsB,CAAC,OAAA,EAAS,MAAM,CAAA;AAAA,EACtC,yEAAA,EAA2E;AAAA,IACzE;AAAA,GACF;AAAA,EACA,yCAAA,EAA2C,CAAC,MAAM;AACpD;AAEO,MAAM,+BAAA,GAA0D;AAAA,EACrE,MAAA,EAAQ,KAAA;AAAA,EACR,KAAA,EAAO,IAAA;AAAA,EACP,MAAA,EAAQ,KAAA;AAAA,EACR,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,MAAA;AAAA,EACT,MAAA,EAAQ,MAAA;AAAA,EACR,MAAA,EAAQ,KAAA;AAAA,EACR,OAAA,EAAS,KAAA;AAAA,EACT,MAAA,EAAQ;AACV;AAEO,MAAM,sBAAA,GAAwC;AAAA,EACnD,YAAA;AAAA,IACE,+BAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA,CAAa,2BAA2B,2BAA2B,CAAA;AAAA,EACnE,YAAA;AAAA,IACE,kCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA;AAAA,IACE,gCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA,CAAa,+BAA+B,+BAA+B,CAAA;AAAA,EAC3E,YAAA,CAAa,8BAA8B,8BAA8B,CAAA;AAAA,EACzE,YAAA;AAAA,IACE,iCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA;AAAA,IACE,iCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA,CAAa,6BAA6B,6BAA6B;AACzE;AAEO,MAAM,mBAAA,GAAqC;AAAA,EAChD,YAAA,CAAa,wBAAwB,wBAAwB,CAAA;AAAA,EAC7D,YAAA,CAAa,2BAA2B,2BAA2B,CAAA;AAAA,EACnE,YAAA,CAAa,sBAAsB,sBAAsB;AAC3D;AAGO,MAAM,oCAAA,GAAuC;AAAA,EAClD;AACF;AAGO,MAAM,qBAAA,GACX;;;;"}
|
package/dist/dev.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.esm.js","sources":["../dev/CustomDrawer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@mui/material/Box';\nimport Drawer from '@mui/material/Drawer';\n\nimport { ThemeConfig } from '@red-hat-developer-hub/backstage-plugin-theme';\n\n/**\n * @internal\n */\nexport type CustomDrawerProps = {\n children: React.ReactNode;\n minWidth?: number;\n maxWidth?: number;\n initialWidth?: number;\n isDrawerOpen: boolean;\n drawerWidth?: number;\n onWidthChange?: (width: number) => void;\n [key: string]: any;\n};\n\n/**\n * @internal\n */\nexport const CustomDrawer = (props: CustomDrawerProps) => {\n const {\n children,\n minWidth = 400,\n maxWidth = 800,\n initialWidth = 400,\n isDrawerOpen,\n drawerWidth,\n onWidthChange,\n ...drawerProps\n } = props;\n\n // Ensure anchor is always 'right' and not overridden by drawerProps\n const { anchor: _, ...restDrawerProps } = drawerProps;\n\n return (\n <Drawer\n {...restDrawerProps}\n anchor=\"right\"\n sx={{\n '& .v5-MuiDrawer-paper': {\n width: drawerWidth || initialWidth,\n boxSizing: 'border-box',\n backgroundColor: theme => {\n const themeConfig = theme as ThemeConfig;\n return (\n themeConfig.palette?.rhdh?.general?.sidebarBackgroundColor ||\n theme.palette.background.paper\n );\n },\n justifyContent: 'space-between',\n },\n // Only apply header offset when global header exists\n 'body:has(#global-header) &': {\n '& .v5-MuiDrawer-paper': {\n top: '64px !important',\n height: 'calc(100vh - 64px) !important',\n },\n },\n }}\n variant=\"persistent\"\n open={isDrawerOpen}\n >\n <Box sx={{ height: '100%', position: 'relative' }}>{children}</Box>\n </Drawer>\n );\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"dev.esm.js","sources":["../dev/CustomDrawer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@mui/material/Box';\nimport Drawer from '@mui/material/Drawer';\n\nimport { ThemeConfig } from '@red-hat-developer-hub/backstage-plugin-theme';\n\n/**\n * @internal\n */\nexport type CustomDrawerProps = {\n children: React.ReactNode;\n minWidth?: number;\n maxWidth?: number;\n initialWidth?: number;\n isDrawerOpen: boolean;\n drawerWidth?: number;\n onWidthChange?: (width: number) => void;\n [key: string]: any;\n};\n\n/**\n * @internal\n */\nexport const CustomDrawer = (props: CustomDrawerProps) => {\n const {\n children,\n minWidth = 400,\n maxWidth = 800,\n initialWidth = 400,\n isDrawerOpen,\n drawerWidth,\n onWidthChange,\n ...drawerProps\n } = props;\n\n // Ensure anchor is always 'right' and not overridden by drawerProps\n const { anchor: _, ...restDrawerProps } = drawerProps;\n\n return (\n <Drawer\n {...restDrawerProps}\n anchor=\"right\"\n sx={{\n '& .v5-MuiDrawer-paper': {\n width: drawerWidth || initialWidth,\n boxSizing: 'border-box',\n backgroundColor: theme => {\n const themeConfig = theme as ThemeConfig;\n return (\n themeConfig.palette?.rhdh?.general?.sidebarBackgroundColor ||\n theme.palette.background.paper\n );\n },\n justifyContent: 'space-between',\n },\n // Only apply header offset when global header exists\n 'body:has(#global-header) &': {\n '& .v5-MuiDrawer-paper': {\n top: '64px !important',\n height: 'calc(100vh - 64px) !important',\n },\n },\n }}\n variant=\"persistent\"\n open={isDrawerOpen}\n >\n <Box sx={{ height: '100%', position: 'relative' }}>{children}</Box>\n </Drawer>\n );\n};\n"],"names":[],"mappings":";;;;AAsCO,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACxD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,QAAA,GAAW,GAAA;AAAA,IACX,QAAA,GAAW,GAAA;AAAA,IACX,YAAA,GAAe,GAAA;AAAA,IACf,YAAA;AAAA,IACA,WAAA;AAAA,IACA,aAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAGJ,EAAA,MAAM,EAAE,MAAA,EAAQ,CAAA,EAAG,GAAG,iBAAgB,GAAI,WAAA;AAE1C,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,MAAA,EAAO,OAAA;AAAA,MACP,EAAA,EAAI;AAAA,QACF,uBAAA,EAAyB;AAAA,UACvB,OAAO,WAAA,IAAe,YAAA;AAAA,UACtB,SAAA,EAAW,YAAA;AAAA,UACX,iBAAiB,CAAA,KAAA,KAAS;AACxB,YAAA,MAAM,WAAA,GAAc,KAAA;AACpB,YAAA,OACE,YAAY,OAAA,EAAS,IAAA,EAAM,SAAS,sBAAA,IACpC,KAAA,CAAM,QAAQ,UAAA,CAAW,KAAA;AAAA,UAE7B,CAAA;AAAA,UACA,cAAA,EAAgB;AAAA,SAClB;AAAA;AAAA,QAEA,4BAAA,EAA8B;AAAA,UAC5B,uBAAA,EAAyB;AAAA,YACvB,GAAA,EAAK,iBAAA;AAAA,YACL,MAAA,EAAQ;AAAA;AACV;AACF,OACF;AAAA,MACA,OAAA,EAAQ,YAAA;AAAA,MACR,IAAA,EAAM,YAAA;AAAA,MAEN,QAAA,kBAAA,GAAA,CAAC,OAAI,EAAA,EAAI,EAAE,QAAQ,MAAA,EAAQ,QAAA,EAAU,UAAA,EAAW,EAAI,QAAA,EAAS;AAAA;AAAA,GAC/D;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateNotebook.esm.js","sources":["../../../src/hooks/notebooks/useCreateNotebook.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NotebookSession } from '../../types';\n\ntype CreateNotebookParams = {\n name: string;\n description?: string;\n};\n\nexport const useCreateNotebook = (): UseMutationResult<\n NotebookSession,\n unknown,\n CreateNotebookParams\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async ({ name, description }: CreateNotebookParams) => {\n return notebooksApi.createSession(name, description);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['notebooks', 'sessions'] });\n },\n });\n};\n"],"names":[],"mappings":";;;;AAgCO,MAAM,oBAAoB,MAI5B;AACH,
|
|
1
|
+
{"version":3,"file":"useCreateNotebook.esm.js","sources":["../../../src/hooks/notebooks/useCreateNotebook.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NotebookSession } from '../../types';\n\ntype CreateNotebookParams = {\n name: string;\n description?: string;\n};\n\nexport const useCreateNotebook = (): UseMutationResult<\n NotebookSession,\n unknown,\n CreateNotebookParams\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async ({ name, description }: CreateNotebookParams) => {\n return notebooksApi.createSession(name, description);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['notebooks', 'sessions'] });\n },\n });\n};\n"],"names":[],"mappings":";;;;AAgCO,MAAM,oBAAoB,MAI5B;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,cAAc,cAAA,EAAe;AAEnC,EAAA,OAAO,WAAA,CAAY;AAAA,IACjB,UAAA,EAAY,OAAO,EAAE,IAAA,EAAM,aAAY,KAA4B;AACjE,MAAA,OAAO,YAAA,CAAa,aAAA,CAAc,IAAA,EAAM,WAAW,CAAA;AAAA,IACrD,CAAA;AAAA,IACA,WAAW,MAAM;AACf,MAAA,WAAA,CAAY,kBAAkB,EAAE,QAAA,EAAU,CAAC,WAAA,EAAa,UAAU,GAAG,CAAA;AAAA,IACvE;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateNotebookMessage.esm.js","sources":["../../../src/hooks/notebooks/useCreateNotebookMessage.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\n\nexport type CreateNotebookMessageVariables = {\n prompt: string;\n sessionId: string;\n};\n\nexport const useCreateNotebookMessage = (): UseMutationResult<\n ReadableStreamDefaultReader<Uint8Array>,\n Error,\n CreateNotebookMessageVariables\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n\n return useMutation({\n mutationFn: async ({\n prompt,\n sessionId,\n }: CreateNotebookMessageVariables) => {\n if (!sessionId) {\n throw new Error('Failed to generate AI response');\n }\n\n return await notebooksApi.querySession(sessionId, prompt);\n },\n onError: error => {\n // eslint-disable-next-line\n console.warn(error);\n },\n });\n};\n"],"names":[],"mappings":";;;;AA2BO,MAAM,2BAA2B,MAInC;AACH,
|
|
1
|
+
{"version":3,"file":"useCreateNotebookMessage.esm.js","sources":["../../../src/hooks/notebooks/useCreateNotebookMessage.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\n\nexport type CreateNotebookMessageVariables = {\n prompt: string;\n sessionId: string;\n};\n\nexport const useCreateNotebookMessage = (): UseMutationResult<\n ReadableStreamDefaultReader<Uint8Array>,\n Error,\n CreateNotebookMessageVariables\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n\n return useMutation({\n mutationFn: async ({\n prompt,\n sessionId,\n }: CreateNotebookMessageVariables) => {\n if (!sessionId) {\n throw new Error('Failed to generate AI response');\n }\n\n return await notebooksApi.querySession(sessionId, prompt);\n },\n onError: error => {\n // eslint-disable-next-line\n console.warn(error);\n },\n });\n};\n"],"names":[],"mappings":";;;;AA2BO,MAAM,2BAA2B,MAInC;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAE3C,EAAA,OAAO,WAAA,CAAY;AAAA,IACjB,YAAY,OAAO;AAAA,MACjB,MAAA;AAAA,MACA;AAAA,KACF,KAAsC;AACpC,MAAA,IAAI,CAAC,SAAA,EAAW;AACd,QAAA,MAAM,IAAI,MAAM,gCAAgC,CAAA;AAAA,MAClD;AAEA,MAAA,OAAO,MAAM,YAAA,CAAa,YAAA,CAAa,SAAA,EAAW,MAAM,CAAA;AAAA,IAC1D,CAAA;AAAA,IACA,SAAS,CAAA,KAAA,KAAS;AAEhB,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA,IACpB;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeleteNotebook.esm.js","sources":["../../../src/hooks/notebooks/useDeleteNotebook.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\n\nexport const useDeleteNotebook = (): UseMutationResult<\n void,\n unknown,\n string\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (sessionId: string) => {\n await notebooksApi.deleteSession(sessionId);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['notebooks', 'sessions'] });\n },\n });\n};\n"],"names":[],"mappings":";;;;AA0BO,MAAM,oBAAoB,MAI5B;AACH,
|
|
1
|
+
{"version":3,"file":"useDeleteNotebook.esm.js","sources":["../../../src/hooks/notebooks/useDeleteNotebook.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\n\nexport const useDeleteNotebook = (): UseMutationResult<\n void,\n unknown,\n string\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (sessionId: string) => {\n await notebooksApi.deleteSession(sessionId);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['notebooks', 'sessions'] });\n },\n });\n};\n"],"names":[],"mappings":";;;;AA0BO,MAAM,oBAAoB,MAI5B;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,cAAc,cAAA,EAAe;AAEnC,EAAA,OAAO,WAAA,CAAY;AAAA,IACjB,UAAA,EAAY,OAAO,SAAA,KAAsB;AACvC,MAAA,MAAM,YAAA,CAAa,cAAc,SAAS,CAAA;AAAA,IAC5C,CAAA;AAAA,IACA,WAAW,MAAM;AACf,MAAA,WAAA,CAAY,kBAAkB,EAAE,QAAA,EAAU,CAAC,WAAA,EAAa,UAAU,GAAG,CAAA;AAAA,IACvE;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentStatusPolling.esm.js","sources":["../../../src/hooks/notebooks/useDocumentStatusPolling.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQueries } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { DocumentStatus } from '../../types';\n\nexport type PendingUpload = {\n fileName: string;\n documentId: string;\n};\n\nexport type DocumentPollingResult = {\n fileName: string;\n documentId: string;\n status: DocumentStatus['status'] | 'polling';\n};\n\nconst POLL_INTERVAL_MS = 5000;\n\nexport const useDocumentStatusPolling = (\n sessionId: string,\n pendingUploads: PendingUpload[],\n): DocumentPollingResult[] => {\n const notebooksApi = useApi(notebooksApiRef);\n\n const results = useQueries({\n queries: pendingUploads.map(upload => ({\n queryKey: ['notebooks', 'documentStatus', sessionId, upload.documentId],\n queryFn: () =>\n notebooksApi.getDocumentStatus(sessionId, upload.documentId),\n refetchInterval: (query: {\n state: { data?: DocumentStatus; status: string };\n }) => {\n if (query.state.status === 'error') {\n return false;\n }\n const status = query.state.data?.status;\n if (\n status === 'completed' ||\n status === 'failed' ||\n status === 'cancelled'\n ) {\n return false;\n }\n return POLL_INTERVAL_MS;\n },\n retry: 10,\n enabled: Boolean(upload.documentId),\n })),\n });\n\n return pendingUploads.map((upload, index) => {\n const result = results[index];\n const dataStatus = result?.data?.status;\n const isQueryError = result?.isError;\n return {\n fileName: upload.fileName,\n documentId: upload.documentId,\n status: isQueryError ? 'failed' : (dataStatus ?? 'polling'),\n };\n });\n};\n"],"names":[],"mappings":";;;;AAkCA,MAAM,
|
|
1
|
+
{"version":3,"file":"useDocumentStatusPolling.esm.js","sources":["../../../src/hooks/notebooks/useDocumentStatusPolling.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQueries } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { DocumentStatus } from '../../types';\n\nexport type PendingUpload = {\n fileName: string;\n documentId: string;\n};\n\nexport type DocumentPollingResult = {\n fileName: string;\n documentId: string;\n status: DocumentStatus['status'] | 'polling';\n};\n\nconst POLL_INTERVAL_MS = 5000;\n\nexport const useDocumentStatusPolling = (\n sessionId: string,\n pendingUploads: PendingUpload[],\n): DocumentPollingResult[] => {\n const notebooksApi = useApi(notebooksApiRef);\n\n const results = useQueries({\n queries: pendingUploads.map(upload => ({\n queryKey: ['notebooks', 'documentStatus', sessionId, upload.documentId],\n queryFn: () =>\n notebooksApi.getDocumentStatus(sessionId, upload.documentId),\n refetchInterval: (query: {\n state: { data?: DocumentStatus; status: string };\n }) => {\n if (query.state.status === 'error') {\n return false;\n }\n const status = query.state.data?.status;\n if (\n status === 'completed' ||\n status === 'failed' ||\n status === 'cancelled'\n ) {\n return false;\n }\n return POLL_INTERVAL_MS;\n },\n retry: 10,\n enabled: Boolean(upload.documentId),\n })),\n });\n\n return pendingUploads.map((upload, index) => {\n const result = results[index];\n const dataStatus = result?.data?.status;\n const isQueryError = result?.isError;\n return {\n fileName: upload.fileName,\n documentId: upload.documentId,\n status: isQueryError ? 'failed' : (dataStatus ?? 'polling'),\n };\n });\n};\n"],"names":[],"mappings":";;;;AAkCA,MAAM,gBAAA,GAAmB,GAAA;AAElB,MAAM,wBAAA,GAA2B,CACtC,SAAA,EACA,cAAA,KAC4B;AAC5B,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAE3C,EAAA,MAAM,UAAU,UAAA,CAAW;AAAA,IACzB,OAAA,EAAS,cAAA,CAAe,GAAA,CAAI,CAAA,MAAA,MAAW;AAAA,MACrC,UAAU,CAAC,WAAA,EAAa,gBAAA,EAAkB,SAAA,EAAW,OAAO,UAAU,CAAA;AAAA,MACtE,SAAS,MACP,YAAA,CAAa,iBAAA,CAAkB,SAAA,EAAW,OAAO,UAAU,CAAA;AAAA,MAC7D,eAAA,EAAiB,CAAC,KAAA,KAEZ;AACJ,QAAA,IAAI,KAAA,CAAM,KAAA,CAAM,MAAA,KAAW,OAAA,EAAS;AAClC,UAAA,OAAO,KAAA;AAAA,QACT;AACA,QAAA,MAAM,MAAA,GAAS,KAAA,CAAM,KAAA,CAAM,IAAA,EAAM,MAAA;AACjC,QAAA,IACE,MAAA,KAAW,WAAA,IACX,MAAA,KAAW,QAAA,IACX,WAAW,WAAA,EACX;AACA,UAAA,OAAO,KAAA;AAAA,QACT;AACA,QAAA,OAAO,gBAAA;AAAA,MACT,CAAA;AAAA,MACA,KAAA,EAAO,EAAA;AAAA,MACP,OAAA,EAAS,OAAA,CAAQ,MAAA,CAAO,UAAU;AAAA,KACpC,CAAE;AAAA,GACH,CAAA;AAED,EAAA,OAAO,cAAA,CAAe,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAA,KAAU;AAC3C,IAAA,MAAM,MAAA,GAAS,QAAQ,KAAK,CAAA;AAC5B,IAAA,MAAM,UAAA,GAAa,QAAQ,IAAA,EAAM,MAAA;AACjC,IAAA,MAAM,eAAe,MAAA,EAAQ,OAAA;AAC7B,IAAA,OAAO;AAAA,MACL,UAAU,MAAA,CAAO,QAAA;AAAA,MACjB,YAAY,MAAA,CAAO,UAAA;AAAA,MACnB,MAAA,EAAQ,YAAA,GAAe,QAAA,GAAY,UAAA,IAAc;AAAA,KACnD;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLightspeedNotebooksPermission.esm.js","sources":["../../../src/hooks/notebooks/useLightspeedNotebooksPermission.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { lightspeedNotebooksUsePermission } from '@red-hat-developer-hub/backstage-plugin-lightspeed-common';\n\nexport const useLightspeedNotebooksPermission = () => {\n const result = usePermission({\n permission: lightspeedNotebooksUsePermission,\n });\n\n return {\n loading: result.loading,\n allowed: result.allowed,\n };\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,mCAAmC,MAAM;AACpD,EAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"useLightspeedNotebooksPermission.esm.js","sources":["../../../src/hooks/notebooks/useLightspeedNotebooksPermission.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { lightspeedNotebooksUsePermission } from '@red-hat-developer-hub/backstage-plugin-lightspeed-common';\n\nexport const useLightspeedNotebooksPermission = () => {\n const result = usePermission({\n permission: lightspeedNotebooksUsePermission,\n });\n\n return {\n loading: result.loading,\n allowed: result.allowed,\n };\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,mCAAmC,MAAM;AACpD,EAAA,MAAM,SAAS,aAAA,CAAc;AAAA,IAC3B,UAAA,EAAY;AAAA,GACb,CAAA;AAED,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO;AAAA,GAClB;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotebookDocuments.esm.js","sources":["../../../src/hooks/notebooks/useNotebookDocuments.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { SessionDocument } from '../../types';\n\nexport const useNotebookDocuments = (\n sessionId?: string,\n): UseQueryResult<SessionDocument[], Error> => {\n const notebooksApi = useApi(notebooksApiRef);\n return useQuery({\n queryKey: ['notebooks', 'documents', sessionId],\n queryFn: async () => {\n return await notebooksApi.listDocuments(sessionId!);\n },\n enabled: Boolean(sessionId),\n staleTime: 0,\n });\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useNotebookDocuments.esm.js","sources":["../../../src/hooks/notebooks/useNotebookDocuments.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { SessionDocument } from '../../types';\n\nexport const useNotebookDocuments = (\n sessionId?: string,\n): UseQueryResult<SessionDocument[], Error> => {\n const notebooksApi = useApi(notebooksApiRef);\n return useQuery({\n queryKey: ['notebooks', 'documents', sessionId],\n queryFn: async () => {\n return await notebooksApi.listDocuments(sessionId!);\n },\n enabled: Boolean(sessionId),\n staleTime: 0,\n });\n};\n"],"names":[],"mappings":";;;;AAuBO,MAAM,oBAAA,GAAuB,CAClC,SAAA,KAC6C;AAC7C,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,WAAA,EAAa,WAAA,EAAa,SAAS,CAAA;AAAA,IAC9C,SAAS,YAAY;AACnB,MAAA,OAAO,MAAM,YAAA,CAAa,aAAA,CAAc,SAAU,CAAA;AAAA,IACpD,CAAA;AAAA,IACA,OAAA,EAAS,QAAQ,SAAS,CAAA;AAAA,IAC1B,SAAA,EAAW;AAAA,GACZ,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotebookSession.esm.js","sources":["../../../src/hooks/notebooks/useNotebookSession.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NotebookSession } from '../../types';\n\nexport const useNotebookSession = (\n sessionId?: string,\n): UseQueryResult<NotebookSession, Error> => {\n const notebooksApi = useApi(notebooksApiRef);\n return useQuery({\n queryKey: ['notebooks', 'session', sessionId],\n queryFn: async () => {\n return await notebooksApi.getSession(sessionId!);\n },\n enabled: Boolean(sessionId),\n staleTime: 1000 * 60,\n });\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useNotebookSession.esm.js","sources":["../../../src/hooks/notebooks/useNotebookSession.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NotebookSession } from '../../types';\n\nexport const useNotebookSession = (\n sessionId?: string,\n): UseQueryResult<NotebookSession, Error> => {\n const notebooksApi = useApi(notebooksApiRef);\n return useQuery({\n queryKey: ['notebooks', 'session', sessionId],\n queryFn: async () => {\n return await notebooksApi.getSession(sessionId!);\n },\n enabled: Boolean(sessionId),\n staleTime: 1000 * 60,\n });\n};\n"],"names":[],"mappings":";;;;AAuBO,MAAM,kBAAA,GAAqB,CAChC,SAAA,KAC2C;AAC3C,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,WAAA,EAAa,SAAA,EAAW,SAAS,CAAA;AAAA,IAC5C,SAAS,YAAY;AACnB,MAAA,OAAO,MAAM,YAAA,CAAa,UAAA,CAAW,SAAU,CAAA;AAAA,IACjD,CAAA;AAAA,IACA,OAAA,EAAS,QAAQ,SAAS,CAAA;AAAA,IAC1B,WAAW,GAAA,GAAO;AAAA,GACnB,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotebookSessions.esm.js","sources":["../../../src/hooks/notebooks/useNotebookSessions.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NotebookSession } from '../../types';\n\nexport const useNotebookSessions = (\n enabled: boolean = true,\n): UseQueryResult<NotebookSession[], Error> => {\n const notebooksApi = useApi(notebooksApiRef);\n return useQuery({\n queryKey: ['notebooks', 'sessions'],\n queryFn: async () => {\n return await notebooksApi.listSessions();\n },\n enabled,\n staleTime: 1000 * 60,\n });\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useNotebookSessions.esm.js","sources":["../../../src/hooks/notebooks/useNotebookSessions.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NotebookSession } from '../../types';\n\nexport const useNotebookSessions = (\n enabled: boolean = true,\n): UseQueryResult<NotebookSession[], Error> => {\n const notebooksApi = useApi(notebooksApiRef);\n return useQuery({\n queryKey: ['notebooks', 'sessions'],\n queryFn: async () => {\n return await notebooksApi.listSessions();\n },\n enabled,\n staleTime: 1000 * 60,\n });\n};\n"],"names":[],"mappings":";;;;AAuBO,MAAM,mBAAA,GAAsB,CACjC,OAAA,GAAmB,IAAA,KAC0B;AAC7C,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,WAAA,EAAa,UAAU,CAAA;AAAA,IAClC,SAAS,YAAY;AACnB,MAAA,OAAO,MAAM,aAAa,YAAA,EAAa;AAAA,IACzC,CAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAW,GAAA,GAAO;AAAA,GACnB,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRenameNotebook.esm.js","sources":["../../../src/hooks/notebooks/useRenameNotebook.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\n\ntype RenameNotebookPayload = {\n sessionId: string;\n name: string;\n};\n\nexport const useRenameNotebook = (): UseMutationResult<\n void,\n unknown,\n RenameNotebookPayload\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: RenameNotebookPayload) => {\n await notebooksApi.renameSession(payload.sessionId, payload.name);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['notebooks', 'sessions'] });\n },\n });\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,oBAAoB,MAI5B;AACH,
|
|
1
|
+
{"version":3,"file":"useRenameNotebook.esm.js","sources":["../../../src/hooks/notebooks/useRenameNotebook.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\n\ntype RenameNotebookPayload = {\n sessionId: string;\n name: string;\n};\n\nexport const useRenameNotebook = (): UseMutationResult<\n void,\n unknown,\n RenameNotebookPayload\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (payload: RenameNotebookPayload) => {\n await notebooksApi.renameSession(payload.sessionId, payload.name);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['notebooks', 'sessions'] });\n },\n });\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,oBAAoB,MAI5B;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,cAAc,cAAA,EAAe;AAEnC,EAAA,OAAO,WAAA,CAAY;AAAA,IACjB,UAAA,EAAY,OAAO,OAAA,KAAmC;AACpD,MAAA,MAAM,YAAA,CAAa,aAAA,CAAc,OAAA,CAAQ,SAAA,EAAW,QAAQ,IAAI,CAAA;AAAA,IAClE,CAAA;AAAA,IACA,WAAW,MAAM;AACf,MAAA,WAAA,CAAY,kBAAkB,EAAE,QAAA,EAAU,CAAC,WAAA,EAAa,UAAU,GAAG,CAAA;AAAA,IACvE;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUploadDocument.esm.js","sources":["../../../src/hooks/notebooks/useUploadDocument.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NOTEBOOK_EXTENSION_TO_FILE_TYPE } from '../../const';\nimport { UploadDocumentResponse } from '../../types';\n\ntype UploadDocumentParams = {\n sessionId: string;\n file: File;\n};\n\nconst getFileType = (fileName: string): string => {\n const lastDot = fileName.lastIndexOf('.');\n const ext = lastDot >= 0 ? fileName.slice(lastDot).toLowerCase() : '';\n return NOTEBOOK_EXTENSION_TO_FILE_TYPE[ext] ?? 'txt';\n};\n\nexport const useUploadDocument = (): UseMutationResult<\n UploadDocumentResponse,\n Error,\n UploadDocumentParams\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async ({ sessionId, file }: UploadDocumentParams) => {\n const fileType = getFileType(file.name);\n return notebooksApi.uploadDocument(sessionId, file, fileType, file.name);\n },\n onSuccess: (_data, variables) => {\n queryClient.invalidateQueries({\n queryKey: ['notebooks', 'documents', variables.sessionId],\n });\n },\n });\n};\n"],"names":[],"mappings":";;;;;AAiCA,MAAM,WAAA,GAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"useUploadDocument.esm.js","sources":["../../../src/hooks/notebooks/useUploadDocument.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n useMutation,\n useQueryClient,\n type UseMutationResult,\n} from '@tanstack/react-query';\n\nimport { notebooksApiRef } from '../../api/notebooksApi';\nimport { NOTEBOOK_EXTENSION_TO_FILE_TYPE } from '../../const';\nimport { UploadDocumentResponse } from '../../types';\n\ntype UploadDocumentParams = {\n sessionId: string;\n file: File;\n};\n\nconst getFileType = (fileName: string): string => {\n const lastDot = fileName.lastIndexOf('.');\n const ext = lastDot >= 0 ? fileName.slice(lastDot).toLowerCase() : '';\n return NOTEBOOK_EXTENSION_TO_FILE_TYPE[ext] ?? 'txt';\n};\n\nexport const useUploadDocument = (): UseMutationResult<\n UploadDocumentResponse,\n Error,\n UploadDocumentParams\n> => {\n const notebooksApi = useApi(notebooksApiRef);\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async ({ sessionId, file }: UploadDocumentParams) => {\n const fileType = getFileType(file.name);\n return notebooksApi.uploadDocument(sessionId, file, fileType, file.name);\n },\n onSuccess: (_data, variables) => {\n queryClient.invalidateQueries({\n queryKey: ['notebooks', 'documents', variables.sessionId],\n });\n },\n });\n};\n"],"names":[],"mappings":";;;;;AAiCA,MAAM,WAAA,GAAc,CAAC,QAAA,KAA6B;AAChD,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,WAAA,CAAY,GAAG,CAAA;AACxC,EAAA,MAAM,GAAA,GAAM,WAAW,CAAA,GAAI,QAAA,CAAS,MAAM,OAAO,CAAA,CAAE,aAAY,GAAI,EAAA;AACnE,EAAA,OAAO,+BAAA,CAAgC,GAAG,CAAA,IAAK,KAAA;AACjD,CAAA;AAEO,MAAM,oBAAoB,MAI5B;AACH,EAAA,MAAM,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,cAAc,cAAA,EAAe;AAEnC,EAAA,OAAO,WAAA,CAAY;AAAA,IACjB,UAAA,EAAY,OAAO,EAAE,SAAA,EAAW,MAAK,KAA4B;AAC/D,MAAA,MAAM,QAAA,GAAW,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AACtC,MAAA,OAAO,aAAa,cAAA,CAAe,SAAA,EAAW,IAAA,EAAM,QAAA,EAAU,KAAK,IAAI,CAAA;AAAA,IACzE,CAAA;AAAA,IACA,SAAA,EAAW,CAAC,KAAA,EAAO,SAAA,KAAc;AAC/B,MAAA,WAAA,CAAY,iBAAA,CAAkB;AAAA,QAC5B,QAAA,EAAU,CAAC,WAAA,EAAa,WAAA,EAAa,UAAU,SAAS;AAAA,OACzD,CAAA;AAAA,IACH;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -19,7 +19,7 @@ function touchCacheKey(key) {
|
|
|
19
19
|
}
|
|
20
20
|
function getSharedToolCallsCache(key) {
|
|
21
21
|
const v = sharedToolCallsCache[key];
|
|
22
|
-
return v?.length ? v :
|
|
22
|
+
return v?.length ? v : void 0;
|
|
23
23
|
}
|
|
24
24
|
function setSharedToolCallsCache(key, toolCalls) {
|
|
25
25
|
sharedToolCallsCache[key] = toolCalls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolCallsCacheStore.esm.js","sources":["../../src/hooks/toolCallsCacheStore.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ToolCall } from '../types';\n\n/**\n * Caps how many conversation/message-index entries we retain. Oldest touched\n * entries are evicted first (approximate LRU via insertion order in keyOrder).\n */\nconst MAX_TOOL_CALLS_CACHE_KEYS = 256;\n\nconst sharedToolCallsCache: Record<string, ToolCall[]> = {};\nconst keyOrder: string[] = [];\n\nfunction removeKeyFromOrder(key: string) {\n const i = keyOrder.indexOf(key);\n if (i >= 0) {\n keyOrder.splice(i, 1);\n }\n}\n\nfunction touchCacheKey(key: string) {\n removeKeyFromOrder(key);\n keyOrder.push(key);\n while (keyOrder.length > MAX_TOOL_CALLS_CACHE_KEYS) {\n const oldest = keyOrder.shift();\n if (oldest) {\n delete sharedToolCallsCache[oldest];\n }\n }\n}\n\nexport function getSharedToolCallsCache(key: string): ToolCall[] | undefined {\n const v = sharedToolCallsCache[key];\n return v?.length ? v : undefined;\n}\n\nexport function setSharedToolCallsCache(key: string, toolCalls: ToolCall[]) {\n sharedToolCallsCache[key] = toolCalls;\n touchCacheKey(key);\n}\n\n/**\n * Drop all cached tool rows for a conversation (e.g. after server delete).\n */\nexport function clearSharedToolCallsCacheForConversation(\n conversationId: string,\n) {\n const prefix = `${conversationId}-`;\n for (const key of [...Object.keys(sharedToolCallsCache)]) {\n if (key.startsWith(prefix)) {\n delete sharedToolCallsCache[key];\n removeKeyFromOrder(key);\n }\n }\n}\n\n/**\n * Moves tool-call cache entries from a per-stream session prefix (used while\n * conversation id is still temp) to the persisted conversation id. Only keys\n * for this prefix are migrated so a late stream cannot clobber another temp\n * session.\n */\nexport function migrateSharedToolCallsCacheSessionPrefixToConversation(\n sessionPrefix: string,\n newConversationId: string,\n) {\n const keyPrefix = `${sessionPrefix}-`;\n for (const key of [...Object.keys(sharedToolCallsCache)]) {\n if (key.startsWith(keyPrefix)) {\n const messageIndex = key.slice(keyPrefix.length);\n const newKey = `${newConversationId}-${messageIndex}`;\n sharedToolCallsCache[newKey] = sharedToolCallsCache[key];\n delete sharedToolCallsCache[key];\n removeKeyFromOrder(key);\n touchCacheKey(newKey);\n }\n }\n}\n\n/** Removes cache entries written under a per-temp-stream session prefix. */\nexport function clearSharedToolCallsCacheSessionPrefix(sessionPrefix: string) {\n const keyPrefix = `${sessionPrefix}-`;\n for (const key of [...Object.keys(sharedToolCallsCache)]) {\n if (key.startsWith(keyPrefix)) {\n delete sharedToolCallsCache[key];\n removeKeyFromOrder(key);\n }\n }\n}\n\n/** Clears the store; only used from unit tests. */\nexport function resetSharedToolCallsCacheStoreForTests() {\n for (const key of Object.keys(sharedToolCallsCache)) {\n delete sharedToolCallsCache[key];\n }\n keyOrder.length = 0;\n}\n"],"names":[],"mappings":"AAsBA,MAAM,
|
|
1
|
+
{"version":3,"file":"toolCallsCacheStore.esm.js","sources":["../../src/hooks/toolCallsCacheStore.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ToolCall } from '../types';\n\n/**\n * Caps how many conversation/message-index entries we retain. Oldest touched\n * entries are evicted first (approximate LRU via insertion order in keyOrder).\n */\nconst MAX_TOOL_CALLS_CACHE_KEYS = 256;\n\nconst sharedToolCallsCache: Record<string, ToolCall[]> = {};\nconst keyOrder: string[] = [];\n\nfunction removeKeyFromOrder(key: string) {\n const i = keyOrder.indexOf(key);\n if (i >= 0) {\n keyOrder.splice(i, 1);\n }\n}\n\nfunction touchCacheKey(key: string) {\n removeKeyFromOrder(key);\n keyOrder.push(key);\n while (keyOrder.length > MAX_TOOL_CALLS_CACHE_KEYS) {\n const oldest = keyOrder.shift();\n if (oldest) {\n delete sharedToolCallsCache[oldest];\n }\n }\n}\n\nexport function getSharedToolCallsCache(key: string): ToolCall[] | undefined {\n const v = sharedToolCallsCache[key];\n return v?.length ? v : undefined;\n}\n\nexport function setSharedToolCallsCache(key: string, toolCalls: ToolCall[]) {\n sharedToolCallsCache[key] = toolCalls;\n touchCacheKey(key);\n}\n\n/**\n * Drop all cached tool rows for a conversation (e.g. after server delete).\n */\nexport function clearSharedToolCallsCacheForConversation(\n conversationId: string,\n) {\n const prefix = `${conversationId}-`;\n for (const key of [...Object.keys(sharedToolCallsCache)]) {\n if (key.startsWith(prefix)) {\n delete sharedToolCallsCache[key];\n removeKeyFromOrder(key);\n }\n }\n}\n\n/**\n * Moves tool-call cache entries from a per-stream session prefix (used while\n * conversation id is still temp) to the persisted conversation id. Only keys\n * for this prefix are migrated so a late stream cannot clobber another temp\n * session.\n */\nexport function migrateSharedToolCallsCacheSessionPrefixToConversation(\n sessionPrefix: string,\n newConversationId: string,\n) {\n const keyPrefix = `${sessionPrefix}-`;\n for (const key of [...Object.keys(sharedToolCallsCache)]) {\n if (key.startsWith(keyPrefix)) {\n const messageIndex = key.slice(keyPrefix.length);\n const newKey = `${newConversationId}-${messageIndex}`;\n sharedToolCallsCache[newKey] = sharedToolCallsCache[key];\n delete sharedToolCallsCache[key];\n removeKeyFromOrder(key);\n touchCacheKey(newKey);\n }\n }\n}\n\n/** Removes cache entries written under a per-temp-stream session prefix. */\nexport function clearSharedToolCallsCacheSessionPrefix(sessionPrefix: string) {\n const keyPrefix = `${sessionPrefix}-`;\n for (const key of [...Object.keys(sharedToolCallsCache)]) {\n if (key.startsWith(keyPrefix)) {\n delete sharedToolCallsCache[key];\n removeKeyFromOrder(key);\n }\n }\n}\n\n/** Clears the store; only used from unit tests. */\nexport function resetSharedToolCallsCacheStoreForTests() {\n for (const key of Object.keys(sharedToolCallsCache)) {\n delete sharedToolCallsCache[key];\n }\n keyOrder.length = 0;\n}\n"],"names":[],"mappings":"AAsBA,MAAM,yBAAA,GAA4B,GAAA;AAElC,MAAM,uBAAmD,EAAC;AAC1D,MAAM,WAAqB,EAAC;AAE5B,SAAS,mBAAmB,GAAA,EAAa;AACvC,EAAA,MAAM,CAAA,GAAI,QAAA,CAAS,OAAA,CAAQ,GAAG,CAAA;AAC9B,EAAA,IAAI,KAAK,CAAA,EAAG;AACV,IAAA,QAAA,CAAS,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,EACtB;AACF;AAEA,SAAS,cAAc,GAAA,EAAa;AAClC,EAAA,kBAAA,CAAmB,GAAG,CAAA;AACtB,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AAiB,CAAA,CAAA,EAAI,YAAY,CAAA,CAAA;AACnD,MAAA,oBAAA,CAAqB,MAAM,CAAA,GAAI,oBAAA,CAAqB,GAAG,CAAA;AACvD,MAAA,OAAO,qBAAqB,GAAG,CAAA;AAC/B,MAAA,kBAAA,CAAmB,GAAG,CAAA;AACtB,MAAA,aAAA,CAAc,MAAM,CAAA;AAAA,IACtB;AAAA,EACF;AACF;AAGO,SAAS,uCAAuC,aAAA,EAAuB;AAC5E,EAAA,MAAM,SAAA,GAAY,GAAG,aAAa,CAAA,CAAA,CAAA;AAClC,EAAA,KAAA,MAAW,OAAO,CAAC,GAAG,OAAO,IAAA,CAAK,oBAAoB,CAAC,CAAA,EAAG;AACxD,IAAA,IAAI,GAAA,CAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AAC7B,MAAA,OAAO,qBAAqB,GAAG,CAAA;AAC/B,MAAA,kBAAA,CAAmB,GAAG,CAAA;AAAA,IACxB;AAAA,EACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAllModels.esm.js","sources":["../../src/hooks/useAllModels.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { LCSModel } from '../types';\n\n// Fetch all models\nexport const useAllModels = (): UseQueryResult<LCSModel[], Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['models'],\n queryFn: async () => {\n const response = await lightspeedApi.getAllModels();\n return response;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,eAAe,MAAyC;AACnE,
|
|
1
|
+
{"version":3,"file":"useAllModels.esm.js","sources":["../../src/hooks/useAllModels.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { LCSModel } from '../types';\n\n// Fetch all models\nexport const useAllModels = (): UseQueryResult<LCSModel[], Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['models'],\n queryFn: async () => {\n const response = await lightspeedApi.getAllModels();\n return response;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,eAAe,MAAyC;AACnE,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,QAAQ,CAAA;AAAA,IACnB,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,YAAA,EAAa;AAClD,MAAA,OAAO,QAAA;AAAA,IACT,CAAA;AAAA,IACA,SAAA,EAAW,MAAO,EAAA,GAAK;AAAA;AAAA,GACxB,CAAA;AACH;;;;"}
|
|
@@ -30,7 +30,7 @@ const useAutoScroll = (containerRef, options = {}) => {
|
|
|
30
30
|
React.useEffect(() => {
|
|
31
31
|
const container = containerRef.current;
|
|
32
32
|
if (!container) {
|
|
33
|
-
return
|
|
33
|
+
return void 0;
|
|
34
34
|
}
|
|
35
35
|
container.addEventListener("scroll", onScroll, { passive: true });
|
|
36
36
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoScroll.esm.js","sources":["../../src/hooks/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\ninterface useAutoScrollOptions {\n deltaUp?: number;\n deltaDown?: number;\n delay?: number;\n}\n\nexport const useAutoScroll = (\n containerRef: React.RefObject<HTMLElement>,\n options: useAutoScrollOptions = {},\n) => {\n const { deltaUp = 10, deltaDown = 60, delay = 200 } = options;\n\n const [autoScroll, setAutoScroll] = React.useState(true);\n const lastScrollTop = React.useRef(0);\n const manualScrollInterrupted = React.useRef(false);\n const debounceTimeout = React.useRef<NodeJS.Timeout | null>(null);\n\n const onScroll = React.useCallback(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const currentScrollTop = container.scrollTop;\n const isScrollingDown = currentScrollTop > lastScrollTop.current;\n\n const distanceFromBottom =\n container.scrollHeight - container.scrollTop - container.clientHeight;\n\n const delta = isScrollingDown ? deltaDown : deltaUp;\n const isAtBottom = distanceFromBottom <= delta;\n\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n\n if (isAtBottom && manualScrollInterrupted.current && isScrollingDown) {\n debounceTimeout.current = setTimeout(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, delay);\n }\n\n if (!isAtBottom && !manualScrollInterrupted.current) {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }\n\n lastScrollTop.current = currentScrollTop;\n }, [containerRef, deltaUp, deltaDown, delay]);\n\n React.useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return undefined;\n }\n\n container.addEventListener('scroll', onScroll, { passive: true });\n return () => {\n container.removeEventListener('scroll', onScroll);\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n };\n }, [onScroll, containerRef]);\n\n const resumeAutoScroll = React.useCallback(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, []);\n\n const stopAutoScroll = React.useCallback(() => {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }, []);\n\n const scrollToTop = React.useCallback(() => {\n stopAutoScroll();\n const container = containerRef.current;\n if (!container) return;\n\n container.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }, [stopAutoScroll, containerRef]);\n\n const scrollToBottom = React.useCallback(() => {\n const container = containerRef.current;\n if (container) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'smooth',\n });\n }\n resumeAutoScroll();\n }, [resumeAutoScroll, containerRef]);\n\n return {\n autoScroll,\n resumeAutoScroll,\n stopAutoScroll,\n scrollToBottom,\n scrollToTop,\n };\n};\n"],"names":[],"mappings":";;AAuBO,MAAM,
|
|
1
|
+
{"version":3,"file":"useAutoScroll.esm.js","sources":["../../src/hooks/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\ninterface useAutoScrollOptions {\n deltaUp?: number;\n deltaDown?: number;\n delay?: number;\n}\n\nexport const useAutoScroll = (\n containerRef: React.RefObject<HTMLElement>,\n options: useAutoScrollOptions = {},\n) => {\n const { deltaUp = 10, deltaDown = 60, delay = 200 } = options;\n\n const [autoScroll, setAutoScroll] = React.useState(true);\n const lastScrollTop = React.useRef(0);\n const manualScrollInterrupted = React.useRef(false);\n const debounceTimeout = React.useRef<NodeJS.Timeout | null>(null);\n\n const onScroll = React.useCallback(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const currentScrollTop = container.scrollTop;\n const isScrollingDown = currentScrollTop > lastScrollTop.current;\n\n const distanceFromBottom =\n container.scrollHeight - container.scrollTop - container.clientHeight;\n\n const delta = isScrollingDown ? deltaDown : deltaUp;\n const isAtBottom = distanceFromBottom <= delta;\n\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n\n if (isAtBottom && manualScrollInterrupted.current && isScrollingDown) {\n debounceTimeout.current = setTimeout(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, delay);\n }\n\n if (!isAtBottom && !manualScrollInterrupted.current) {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }\n\n lastScrollTop.current = currentScrollTop;\n }, [containerRef, deltaUp, deltaDown, delay]);\n\n React.useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return undefined;\n }\n\n container.addEventListener('scroll', onScroll, { passive: true });\n return () => {\n container.removeEventListener('scroll', onScroll);\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n };\n }, [onScroll, containerRef]);\n\n const resumeAutoScroll = React.useCallback(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, []);\n\n const stopAutoScroll = React.useCallback(() => {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }, []);\n\n const scrollToTop = React.useCallback(() => {\n stopAutoScroll();\n const container = containerRef.current;\n if (!container) return;\n\n container.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }, [stopAutoScroll, containerRef]);\n\n const scrollToBottom = React.useCallback(() => {\n const container = containerRef.current;\n if (container) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'smooth',\n });\n }\n resumeAutoScroll();\n }, [resumeAutoScroll, containerRef]);\n\n return {\n autoScroll,\n resumeAutoScroll,\n stopAutoScroll,\n scrollToBottom,\n scrollToTop,\n };\n};\n"],"names":[],"mappings":";;AAuBO,MAAM,aAAA,GAAgB,CAC3B,YAAA,EACA,OAAA,GAAgC,EAAC,KAC9B;AACH,EAAA,MAAM,EAAE,OAAA,GAAU,EAAA,EAAI,YAAY,EAAA,EAAI,KAAA,GAAQ,KAAI,GAAI,OAAA;AAEtD,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,KAAA,CAAM,SAAS,IAAI,CAAA;AACvD,EAAA,MAAM,aAAA,GAAgB,KAAA,CAAM,MAAA,CAAO,CAAC,CAAA;AACpC,EAAA,MAAM,uBAAA,GAA0B,KAAA,CAAM,MAAA,CAAO,KAAK,CAAA;AAClD,EAAA,MAAM,eAAA,GAAkB,KAAA,CAAM,MAAA,CAA8B,IAAI,CAAA;AAEhE,EAAA,MAAM,QAAA,GAAW,KAAA,CAAM,WAAA,CAAY,MAAM;AACvC,IAAA,MAAM,YAAY,YAAA,CAAa,OAAA;AAC/B,IAAA,IAAI,CAAC,SAAA,EAAW;AAEhB,IAAA,MAAM,mBAAmB,SAAA,CAAU,SAAA;AACnC,IAAA,MAAM,eAAA,GAAkB,mBAAmB,aAAA,CAAc,OAAA;AAEzD,IAAA,MAAM,kBAAA,GACJ,SAAA,CAAU,YAAA,GAAe,SAAA,CAAU,YAAY,SAAA,CAAU,YAAA;AAE3D,IAAA,MAAM,KAAA,GAAQ,kBAAkB,SAAA,GAAY,OAAA;AAC5C,IAAA,MAAM,aAAa,kBAAA,IAAsB,KAAA;AAEzC,IAAA,IAAI,eAAA,CAAgB,OAAA,EAAS,YAAA,CAAa,eAAA,CAAgB,OAAO,CAAA;AAEjE,IAAA,IAAI,UAAA,IAA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AA,CAAwB,OAAA,GAAU,IAAA;AAClC,IAAA,aAAA,CAAc,KAAK,CAAA;AAAA,EACrB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,WAAA,CAAY,MAAM;AAC1C,IAAA,cAAA,EAAe;AACf,IAAA,MAAM,YAAY,YAAA,CAAa,OAAA;AAC/B,IAAA,IAAI,CAAC,SAAA,EAAW;AAEhB,IAAA,SAAA,CAAU,QAAA,CAAS;AAAA,MACjB,GAAA,EAAK,CAAA;AAAA,MACL,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,cAAA,EAAgB,YAAY,CAAC,CAAA;AAEjC,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,WAAA,CAAY,MAAM;AAC7C,IAAA,MAAM,YAAY,YAAA,CAAa,OAAA;AAC/B,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,SAAA,CAAU,QAAA,CAAS;AAAA,QACjB,KAAK,SAAA,CAAU,YAAA;AAAA,QACf,QAAA,EAAU;AAAA,OACX,CAAA;AAAA,IACH;AACA,IAAA,gBAAA,EAAiB;AAAA,EACnB,CAAA,EAAG,CAAC,gBAAA,EAAkB,YAAY,CAAC,CAAA;AAEnC,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackstageUserIdentity.esm.js","sources":["../../src/hooks/useBackstageUserIdentity.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useAsync } from 'react-use';\n\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\n\nexport const useBackstageUserIdentity = () => {\n const identityApi = useApi(identityApiRef);\n const { value: user } = useAsync(async () => {\n const identityRef = await identityApi.getBackstageIdentity();\n return identityRef.userEntityRef;\n });\n return user;\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,2BAA2B,MAAM;AAC5C,
|
|
1
|
+
{"version":3,"file":"useBackstageUserIdentity.esm.js","sources":["../../src/hooks/useBackstageUserIdentity.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useAsync } from 'react-use';\n\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\n\nexport const useBackstageUserIdentity = () => {\n const identityApi = useApi(identityApiRef);\n const { value: user } = useAsync(async () => {\n const identityRef = await identityApi.getBackstageIdentity();\n return identityRef.userEntityRef;\n });\n return user;\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,2BAA2B,MAAM;AAC5C,EAAA,MAAM,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAK,GAAI,SAAS,YAAY;AAC3C,IAAA,MAAM,WAAA,GAAc,MAAM,WAAA,CAAY,oBAAA,EAAqB;AAC3D,IAAA,OAAO,WAAA,CAAY,aAAA;AAAA,EACrB,CAAC,CAAA;AACD,EAAA,OAAO,IAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBufferedMessages.esm.js","sources":["../../src/hooks/useBufferedMessages.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nexport const useBufferedMessages = <T>(messages: T[], interval = 30): T[] => {\n const [bufferedMessages, setBufferedMessages] = React.useState(messages);\n const lastUpdateTime = React.useRef(0);\n const animationFrame = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n const now = Date.now();\n\n const update = () => {\n setBufferedMessages(messages);\n lastUpdateTime.current = now;\n };\n\n if (now - lastUpdateTime.current > interval) {\n update();\n } else {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n animationFrame.current = requestAnimationFrame(update);\n }\n\n return () => {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n };\n }, [messages, interval]);\n\n return bufferedMessages;\n};\n"],"names":[],"mappings":";;AAiBO,MAAM,
|
|
1
|
+
{"version":3,"file":"useBufferedMessages.esm.js","sources":["../../src/hooks/useBufferedMessages.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nexport const useBufferedMessages = <T>(messages: T[], interval = 30): T[] => {\n const [bufferedMessages, setBufferedMessages] = React.useState(messages);\n const lastUpdateTime = React.useRef(0);\n const animationFrame = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n const now = Date.now();\n\n const update = () => {\n setBufferedMessages(messages);\n lastUpdateTime.current = now;\n };\n\n if (now - lastUpdateTime.current > interval) {\n update();\n } else {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n animationFrame.current = requestAnimationFrame(update);\n }\n\n return () => {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n };\n }, [messages, interval]);\n\n return bufferedMessages;\n};\n"],"names":[],"mappings":";;AAiBO,MAAM,mBAAA,GAAsB,CAAI,QAAA,EAAe,QAAA,GAAW,EAAA,KAAY;AAC3E,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,KAAA,CAAM,SAAS,QAAQ,CAAA;AACvE,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,MAAA,CAAO,CAAC,CAAA;AACrC,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,MAAA,CAAsB,IAAI,CAAA;AAEvD,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAA,MAAM,GAAA,GAAM,KAAK,GAAA,EAAI;AAErB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,mBAAA,CAAoB,QAAQ,CAAA;AAC5B,MAAA,cAAA,CAAe,OAAA,GAAU,GAAA;AAAA,IAC3B,CAAA;AAEA,IAAA,IAAI,GAAA,GAAM,cAAA,CAAe,OAAA,GAAU,QAAA,EAAU;AAC3C,MAAA,MAAA,EAAO;AAAA,IACT,CAAA,MAAO;AACL,MAAA,IAAI,cAAA,CAAe,OAAA,EAAS,oBAAA,CAAqB,cAAA,CAAe,OAAO,CAAA;AACvE,MAAA,cAAA,CAAe,OAAA,GAAU,sBAAsB,MAAM,CAAA;AAAA,IACvD;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,cAAA,CAAe,OAAA,EAAS,oBAAA,CAAqB,cAAA,CAAe,OAAO,CAAA;AAAA,IACzE,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,QAAA,EAAU,QAAQ,CAAC,CAAA;AAEvB,EAAA,OAAO,gBAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaptureFeedback.esm.js","sources":["../../src/hooks/useCaptureFeedback.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { CaptureFeedback } from '../types';\n\nexport const useCaptureFeedback = (): UseMutationResult<\n { response: string },\n Error,\n CaptureFeedback\n> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n\n return useMutation({\n mutationFn: async (payload: CaptureFeedback) => {\n if (!payload.conversation_id) {\n throw new Error('Failed to capture the user Feedback');\n }\n\n return await lightspeedApi.captureFeedback(payload);\n },\n onError: error => {\n // eslint-disable-next-line\n console.warn(error);\n },\n });\n};\n"],"names":[],"mappings":";;;;AAsBO,MAAM,qBAAqB,MAI7B;AACH,
|
|
1
|
+
{"version":3,"file":"useCaptureFeedback.esm.js","sources":["../../src/hooks/useCaptureFeedback.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { CaptureFeedback } from '../types';\n\nexport const useCaptureFeedback = (): UseMutationResult<\n { response: string },\n Error,\n CaptureFeedback\n> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n\n return useMutation({\n mutationFn: async (payload: CaptureFeedback) => {\n if (!payload.conversation_id) {\n throw new Error('Failed to capture the user Feedback');\n }\n\n return await lightspeedApi.captureFeedback(payload);\n },\n onError: error => {\n // eslint-disable-next-line\n console.warn(error);\n },\n });\n};\n"],"names":[],"mappings":";;;;AAsBO,MAAM,qBAAqB,MAI7B;AACH,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAE7C,EAAA,OAAO,WAAA,CAAY;AAAA,IACjB,UAAA,EAAY,OAAO,OAAA,KAA6B;AAC9C,MAAA,IAAI,CAAC,QAAQ,eAAA,EAAiB;AAC5B,QAAA,MAAM,IAAI,MAAM,qCAAqC,CAAA;AAAA,MACvD;AAEA,MAAA,OAAO,MAAM,aAAA,CAAc,eAAA,CAAgB,OAAO,CAAA;AAAA,IACpD,CAAA;AAAA,IACA,SAAS,CAAA,KAAA,KAAS;AAEhB,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA,IACpB;AAAA,GACD,CAAA;AACH;;;;"}
|