@datalayer/core 0.0.26 → 1.0.1
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/lib/api/index.d.ts +1 -1
- package/lib/api/index.js +1 -1
- package/lib/client/utils/spacerUtils.d.ts +2 -2
- package/lib/client/utils/spacerUtils.js +4 -4
- package/lib/components/auth/Login.d.ts +4 -0
- package/lib/components/auth/Login.js +8 -2
- package/lib/components/auth/Login.stories.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +7 -7
- package/lib/components/progress/CreditsIndicator.d.ts +7 -1
- package/lib/components/progress/CreditsIndicator.js +4 -2
- package/lib/components/{screenshot/ScreenCapture.d.ts → screencapture/Screencapture.d.ts} +5 -5
- package/lib/components/{screenshot/ScreenCapture.js → screencapture/Screencapture.js} +2 -2
- package/lib/components/screencapture/ScreencaptureButton.d.ts +3 -0
- package/lib/components/{screenshot/ScreenCaptureButton.js → screencapture/ScreencaptureButton.js} +8 -8
- package/lib/components/screencapture/index.d.ts +2 -0
- package/lib/components/{screenshot → screencapture}/index.js +2 -2
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/layouts/{LayoutScreenshot.css → LayoutScreencapture.css} +2 -2
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +3 -0
- package/lib/hooks/layouts/{LayoutScreenshot.js → LayoutScreencapture.js} +14 -14
- package/lib/hooks/layouts/index.d.ts +1 -1
- package/lib/hooks/layouts/index.js +1 -1
- package/lib/hooks/useCache.d.ts +12 -2
- package/lib/hooks/useCache.js +180 -68
- package/lib/hooks/useCellOutputshot.js +2 -2
- package/lib/hooks/useScreencapture.d.ts +18 -0
- package/lib/hooks/useScreencapture.js +53 -0
- package/lib/models/CreditsDTO.d.ts +1 -1
- package/lib/models/CreditsDTO.js +1 -1
- package/lib/models/Datasource.d.ts +4 -4
- package/lib/models/Datasource.js +7 -7
- package/lib/models/EnvironmentDTO.d.ts +3 -3
- package/lib/models/EnvironmentDTO.js +3 -3
- package/lib/models/HealthCheck.d.ts +2 -2
- package/lib/models/HealthCheck.js +2 -2
- package/lib/models/IAMProviderUsers.d.ts +11 -0
- package/lib/models/IAMProvidersSpecs.d.ts +2 -1
- package/lib/models/IAMProvidersSpecs.js +14 -0
- package/lib/models/ItemDTO.d.ts +3 -3
- package/lib/models/ItemDTO.js +10 -10
- package/lib/models/LexicalDTO.d.ts +3 -3
- package/lib/models/LexicalDTO.js +4 -4
- package/lib/models/NotebookDTO.d.ts +3 -3
- package/lib/models/NotebookDTO.js +6 -6
- package/lib/models/Page.js +1 -1
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/PageTag.js +21 -0
- package/lib/models/RuntimeDTO.d.ts +4 -4
- package/lib/models/RuntimeDTO.js +9 -9
- package/lib/models/RuntimeSnapshotDTO.d.ts +3 -3
- package/lib/models/RuntimeSnapshotDTO.js +7 -7
- package/lib/models/Secret.d.ts +4 -4
- package/lib/models/Secret.js +7 -7
- package/lib/models/Space.js +3 -0
- package/lib/models/SpaceDTO.d.ts +3 -3
- package/lib/models/SpaceDTO.js +14 -14
- package/lib/models/UserDTO.d.ts +2 -2
- package/lib/models/UserDTO.js +2 -2
- package/lib/state/substates/LayoutState.d.ts +5 -5
- package/lib/state/substates/LayoutState.js +3 -3
- package/lib/theme/DatalayerTheme.js +5 -5
- package/lib/utils/Screencapture.d.ts +1 -0
- package/lib/utils/{Screenshot.js → Screencapture.js} +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/views/datasources/DatasourceNew.d.ts +7 -1
- package/lib/views/datasources/DatasourceNew.js +3 -3
- package/lib/views/datasources/Datasources.d.ts +7 -1
- package/lib/views/datasources/Datasources.js +6 -4
- package/package.json +1 -1
- package/style/screencapture/index.css +58 -0
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +0 -3
- package/lib/components/screenshot/index.d.ts +0 -2
- package/lib/hooks/layouts/LayoutScreenshot.d.ts +0 -3
- package/lib/hooks/useScreenshot.d.ts +0 -18
- package/lib/hooks/useScreenshot.js +0 -53
- package/lib/utils/Screenshot.d.ts +0 -1
package/lib/api/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Minimal API layer for the Datalayer platform providing base HTTP client and functional API methods.
|
|
3
3
|
*
|
|
4
4
|
* This module contains the low-level API functionality. For high-level object-oriented
|
|
5
|
-
* Client classes, use @datalayer/core/
|
|
5
|
+
* Client classes, use @datalayer/core/client instead.
|
|
6
6
|
*
|
|
7
7
|
* @module @datalayer/core/api
|
|
8
8
|
*/
|
package/lib/api/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Minimal API layer for the Datalayer platform providing base HTTP client and functional API methods.
|
|
7
7
|
*
|
|
8
8
|
* This module contains the low-level API functionality. For high-level object-oriented
|
|
9
|
-
* Client classes, use @datalayer/core/
|
|
9
|
+
* Client classes, use @datalayer/core/client instead.
|
|
10
10
|
*
|
|
11
11
|
* @module @datalayer/core/api
|
|
12
12
|
*/
|
|
@@ -12,7 +12,7 @@ import { LexicalDTO } from '../../models/LexicalDTO';
|
|
|
12
12
|
* to avoid code duplication.
|
|
13
13
|
*
|
|
14
14
|
* @param response - Raw API response containing space items
|
|
15
|
-
* @param
|
|
15
|
+
* @param client - Client instance to pass to model constructors
|
|
16
16
|
* @returns Array of Notebook and Lexical model instances
|
|
17
17
|
*/
|
|
18
|
-
export declare function convertSpaceItemsToModels(items: GetSpaceItemsResponse['items'],
|
|
18
|
+
export declare function convertSpaceItemsToModels(items: GetSpaceItemsResponse['items'], client: DatalayerClient): (NotebookDTO | LexicalDTO)[];
|
|
@@ -11,20 +11,20 @@ import { ItemTypes } from '../constants';
|
|
|
11
11
|
* to avoid code duplication.
|
|
12
12
|
*
|
|
13
13
|
* @param response - Raw API response containing space items
|
|
14
|
-
* @param
|
|
14
|
+
* @param client - Client instance to pass to model constructors
|
|
15
15
|
* @returns Array of Notebook and Lexical model instances
|
|
16
16
|
*/
|
|
17
|
-
export function convertSpaceItemsToModels(items,
|
|
17
|
+
export function convertSpaceItemsToModels(items, client) {
|
|
18
18
|
const modelItems = [];
|
|
19
19
|
for (const item of items) {
|
|
20
20
|
// Check various possible type fields
|
|
21
21
|
const itemType = item.type_s;
|
|
22
22
|
// Only include notebooks and lexicals
|
|
23
23
|
if (itemType === ItemTypes.NOTEBOOK) {
|
|
24
|
-
modelItems.push(new NotebookDTO(item,
|
|
24
|
+
modelItems.push(new NotebookDTO(item, client));
|
|
25
25
|
}
|
|
26
26
|
else if (itemType === ItemTypes.LEXICAL) {
|
|
27
|
-
modelItems.push(new LexicalDTO(item,
|
|
27
|
+
modelItems.push(new LexicalDTO(item, client));
|
|
28
28
|
}
|
|
29
29
|
// Skip everything else (exercises, cells, etc.)
|
|
30
30
|
}
|
|
@@ -14,8 +14,10 @@ import { CenteredSpinner } from '../display';
|
|
|
14
14
|
import { isInsideJupyterLab, validateLength } from '../../utils';
|
|
15
15
|
import { useNavigate, useCache, useToast, useIAM } from '../../hooks';
|
|
16
16
|
import { LoginToken } from './LoginToken';
|
|
17
|
+
/** Inline Google "G" icon for the login button. */
|
|
18
|
+
const GoogleIcon = () => (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 48 48", children: [_jsx("path", { fill: "#EA4335", d: "M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z" }), _jsx("path", { fill: "#4285F4", d: "M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z" }), _jsx("path", { fill: "#FBBC05", d: "M10.53 28.59a14.5 14.5 0 0 1 0-9.18l-7.98-6.19a24.1 24.1 0 0 0 0 21.56l7.98-6.19z" }), _jsx("path", { fill: "#34A853", d: "M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z" })] }));
|
|
17
19
|
export const Login = (props) => {
|
|
18
|
-
const { heading, homeRoute, loginRoute, showEmailLogin = true, showGitHubLogin = true, showTokenLogin = true, } = props;
|
|
20
|
+
const { heading, homeRoute, loginRoute, showEmailLogin = true, showGitHubLogin = true, showGoogleLogin = true, showTokenLogin = true, } = props;
|
|
19
21
|
const { useLogin, useOAuth2AuthorizationURL } = useCache({ loginRoute });
|
|
20
22
|
const loginMutation = useLogin();
|
|
21
23
|
const getOAuth2URLMutation = useOAuth2AuthorizationURL();
|
|
@@ -68,6 +70,9 @@ export const Login = (props) => {
|
|
|
68
70
|
if (!iamProvidersAuthorizationURL[IAMProvidersSpecs.GitHub.name]) {
|
|
69
71
|
initIAMProvider(IAMProvidersSpecs.GitHub);
|
|
70
72
|
}
|
|
73
|
+
if (!iamProvidersAuthorizationURL[IAMProvidersSpecs.Google.name]) {
|
|
74
|
+
initIAMProvider(IAMProvidersSpecs.Google);
|
|
75
|
+
}
|
|
71
76
|
if (!iamProvidersAuthorizationURL[IAMProvidersSpecs.LinkedIn.name]) {
|
|
72
77
|
initIAMProvider(IAMProvidersSpecs.LinkedIn);
|
|
73
78
|
}
|
|
@@ -163,6 +168,7 @@ export const Login = (props) => {
|
|
|
163
168
|
: heading
|
|
164
169
|
? 'Login with Datalayer'
|
|
165
170
|
: 'Login' }), _jsx(Box, { pt: 6 }), _jsx(Link, { href: "https://datalayer.app/password", target: "_blank", children: "Forgot password?" })] })] })), _jsx(Box, { children: _jsxs(Box, { display: "flex", flexDirection: "column", sx: { margin: 'auto' }, children: [showGitHubLogin &&
|
|
166
|
-
iamProvidersAuthorizationURL[IAMProvidersSpecs.GitHub.name] && (_jsx(Button, { leadingVisual: MarkGithubIcon, href: iamProvidersAuthorizationURL[IAMProvidersSpecs.GitHub.name], as: "a", style: { margin: '10px 0' }, children: "Login with GitHub" })),
|
|
171
|
+
iamProvidersAuthorizationURL[IAMProvidersSpecs.GitHub.name] && (_jsx(Button, { leadingVisual: MarkGithubIcon, href: iamProvidersAuthorizationURL[IAMProvidersSpecs.GitHub.name], as: "a", style: { margin: '10px 0' }, children: "Login with GitHub" })), showGoogleLogin &&
|
|
172
|
+
iamProvidersAuthorizationURL[IAMProvidersSpecs.Google.name] && (_jsx(Button, { leadingVisual: GoogleIcon, href: iamProvidersAuthorizationURL[IAMProvidersSpecs.Google.name], as: "a", style: { margin: '10px 0' }, children: "Login with Google" })), showTokenLogin && (_jsx(LoginToken, { homeRoute: homeRoute, style: { margin: '10px 0' } }))] }) })] }) })) : loadingWithToken ? (_jsx(CenteredSpinner, { message: "Checking authentication\u2026" })) : (_jsx(_Fragment, {})) })] }));
|
|
167
173
|
};
|
|
168
174
|
export default Login;
|
|
@@ -22,6 +22,7 @@ declare const meta: {
|
|
|
22
22
|
passwordRoute?: string | undefined;
|
|
23
23
|
showEmailLogin?: boolean | undefined;
|
|
24
24
|
showGitHubLogin?: boolean | undefined;
|
|
25
|
+
showGoogleLogin?: boolean | undefined;
|
|
25
26
|
showTokenLogin?: boolean | undefined;
|
|
26
27
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
27
28
|
tags: string[];
|
|
@@ -57,11 +57,11 @@ export function ConsumptionBar(props) {
|
|
|
57
57
|
const title = duration
|
|
58
58
|
? `${formatTimeRemaining(secondsRemaining)} left - ${((progress / 100) * burntCredits).toFixed(2)} / ${burntCredits.toFixed(2)} credits`
|
|
59
59
|
: `Started at ${new Date(startedAt * 1000).toISOString()} - ${burntCredits.toFixed(2)} credits consumed`;
|
|
60
|
-
return (_jsx(_Fragment, { children: _jsx(Tooltip, { text: title, direction: "w", children: _jsx(Button, { variant: "invisible",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
return (_jsx(_Fragment, { children: _jsx(Tooltip, { text: title, direction: "w", children: _jsx(Button, { variant: "invisible", onClick: onClick, onKeyDown: onClick
|
|
61
|
+
? event => {
|
|
62
|
+
if (event.key === 'Enter' || event.key === 'Space') {
|
|
63
|
+
onClick();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
: undefined, tabIndex: onClick ? 0 : -1, sx: { cursor: onClick ? 'pointer' : 'default' }, children: _jsx(Box, { sx: { width: '70px' }, children: _jsx(ProgressBar, { style: style, animated: expiredAt ? false : true, bg: bg, progress: progress }) }) }) }) }));
|
|
67
67
|
}
|
|
@@ -9,7 +9,13 @@ type ICreditsIndicatorProps = {
|
|
|
9
9
|
*/
|
|
10
10
|
kernelId: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Route to navigate to when the indicator is clicked.
|
|
13
|
+
* Ignored if `onClick` is provided.
|
|
14
|
+
*/
|
|
15
|
+
navigateTo?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Callback on progress bar click event.
|
|
18
|
+
* Takes precedence over `navigateTo`.
|
|
13
19
|
*/
|
|
14
20
|
onClick?: () => void;
|
|
15
21
|
/**
|
|
@@ -6,16 +6,18 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
6
6
|
import { useState, useEffect } from 'react';
|
|
7
7
|
import { Box } from '@datalayer/primer-addons';
|
|
8
8
|
import { ConsumptionBar } from '../../components/progress';
|
|
9
|
+
import useNavigate from '../../hooks/useNavigate';
|
|
9
10
|
/**
|
|
10
11
|
* Credits indicator component.
|
|
11
12
|
*/
|
|
12
13
|
export function CreditsIndicator(props) {
|
|
13
|
-
const { serviceManager, kernelId, onClick, onUpdate } = props;
|
|
14
|
+
const { serviceManager, kernelId, navigateTo, onClick, onUpdate } = props;
|
|
15
|
+
const navigate = useNavigate();
|
|
14
16
|
const [model, setModel] = useState();
|
|
15
17
|
useEffect(() => {
|
|
16
18
|
serviceManager.runtimesManager.findById(kernelId).then(model => {
|
|
17
19
|
setModel(model);
|
|
18
20
|
});
|
|
19
21
|
}, [kernelId, serviceManager]);
|
|
20
|
-
return model ? (_jsx(Box, { display: "flex", style: { alignItems: 'center' }, children: _jsx(ConsumptionBar, { startedAt: parseFloat(model.started_at), expiredAt: model.expired_at ? parseFloat(model.expired_at) : undefined, burningRate: model.burning_rate, onClick: onClick, onUpdate: onUpdate, style: { cursor: 'pointer' } }) })) : (_jsx(_Fragment, {}));
|
|
22
|
+
return model ? (_jsx(Box, { display: "flex", style: { alignItems: 'center' }, children: _jsx(ConsumptionBar, { startedAt: parseFloat(model.started_at), expiredAt: model.expired_at ? parseFloat(model.expired_at) : undefined, burningRate: model.burning_rate, onClick: onClick ?? (navigateTo ? () => navigate(navigateTo) : undefined), onUpdate: onUpdate, style: { cursor: 'pointer' } }) })) : (_jsx(_Fragment, {}));
|
|
21
23
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Component, CSSProperties } from 'react';
|
|
2
|
-
type
|
|
2
|
+
type ScreencaptureProps = {
|
|
3
3
|
children: any;
|
|
4
4
|
onStartCapture?: () => void;
|
|
5
5
|
onEndCapture: (url: string) => void;
|
|
6
6
|
};
|
|
7
|
-
type
|
|
7
|
+
type ScreencaptureState = {
|
|
8
8
|
on: boolean;
|
|
9
9
|
startX: number;
|
|
10
10
|
startY: number;
|
|
@@ -22,8 +22,8 @@ type ScreenCaptureState = {
|
|
|
22
22
|
cropHeigth: number;
|
|
23
23
|
imageURL: string;
|
|
24
24
|
};
|
|
25
|
-
export declare class
|
|
26
|
-
state:
|
|
25
|
+
export declare class Screencapture extends Component<ScreencaptureProps, ScreencaptureState> {
|
|
26
|
+
state: ScreencaptureState;
|
|
27
27
|
handleWindowResize: () => void;
|
|
28
28
|
componentDidMount: () => void;
|
|
29
29
|
componentWillUnmount: () => void;
|
|
@@ -35,4 +35,4 @@ export declare class ScreenCapture extends Component<ScreenCaptureProps, ScreenC
|
|
|
35
35
|
renderChild: () => any;
|
|
36
36
|
render(): any;
|
|
37
37
|
}
|
|
38
|
-
export default
|
|
38
|
+
export default Screencapture;
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { Component } from 'react';
|
|
7
7
|
import html2canvas from 'html2canvas';
|
|
8
|
-
export class
|
|
8
|
+
export class Screencapture extends Component {
|
|
9
9
|
state = {
|
|
10
10
|
on: false,
|
|
11
11
|
startX: 0,
|
|
@@ -167,4 +167,4 @@ export class ScreenCapture extends Component {
|
|
|
167
167
|
return (_jsxs("div", { onMouseMove: this.handleMouseMove, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp, children: [this.renderChild(), _jsx("div", { className: `overlay ${isMouseDown && 'highlighting'}`, style: { borderWidth: `${borderWidth}` } }), _jsx("div", { className: "crosshairs", style: { left: crossHairsLeft + 'px', top: crossHairsTop + 'px' } })] }));
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
export default
|
|
170
|
+
export default Screencapture;
|
package/lib/components/{screenshot/ScreenCaptureButton.js → screencapture/ScreencaptureButton.js}
RENAMED
|
@@ -4,16 +4,16 @@ import { ScreenFullIcon } from '@primer/octicons-react';
|
|
|
4
4
|
import { lazyWithPreload, WithSuspense } from '../../utils';
|
|
5
5
|
import { useToast } from '../../hooks';
|
|
6
6
|
import { useLayoutStore } from '../../state';
|
|
7
|
-
const
|
|
8
|
-
export const
|
|
7
|
+
const Screencapture = WithSuspense(lazyWithPreload(() => import('./Screencapture')));
|
|
8
|
+
export const ScreencaptureButton = (props) => {
|
|
9
9
|
const { enqueueToast } = useToast();
|
|
10
|
-
const {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const { setScreencapture, hideScreencapture } = useLayoutStore();
|
|
11
|
+
const handleScreencapture = (screenCapture) => {
|
|
12
|
+
setScreencapture(screenCapture);
|
|
13
|
+
hideScreencapture();
|
|
14
14
|
enqueueToast('Screen is captured.', { variant: 'success' });
|
|
15
15
|
};
|
|
16
|
-
return (_jsx(
|
|
16
|
+
return (_jsx(Screencapture, { onEndCapture: handleScreencapture, children: ({ onStartCapture }) => (_jsx(Tooltip, { text: "Take a screen capture", direction: "s", children: _jsx(Button, { variant: "invisible", children: _jsx(Link, { href: "javascript: return false;", sx: {
|
|
17
17
|
color: 'fg.muted',
|
|
18
18
|
':hover, :focus, &[aria-expanded=true]': {
|
|
19
19
|
background: 'none !important',
|
|
@@ -24,4 +24,4 @@ export const ScreenCaptureButton = (props) => {
|
|
|
24
24
|
onStartCapture();
|
|
25
25
|
}, children: _jsx(ScreenFullIcon, {}) }) }) })) }));
|
|
26
26
|
};
|
|
27
|
-
export default
|
|
27
|
+
export default ScreencaptureButton;
|
|
@@ -221,9 +221,9 @@ export function ContentsBrowser(props) {
|
|
|
221
221
|
return child.type === 'directory' ? (_jsx(DirectoryItem, { item: child, contents: contents, current: selectedItem, documentRegistry: documentRegistry, onContextMenu: onContextMenu, onSelect: onSelect }, child.name)) : (_jsx(TreeItem, { item: child, current: selectedItem?.path === child.path, onSelect: item => {
|
|
222
222
|
onSelect(item, refresh);
|
|
223
223
|
}, onContextMenu: onContextMenu }, child.name));
|
|
224
|
-
}) }), _jsx(ActionMenu, { anchorRef: contextMenuAnchor ?? undefined, open: contextMenuAnchor?.current !== null, onOpenChange: () => {
|
|
224
|
+
}) }), contextMenuAnchor !== null && (_jsx(ActionMenu, { anchorRef: contextMenuAnchor ?? undefined, open: contextMenuAnchor?.current !== null, onOpenChange: () => {
|
|
225
225
|
setContextMenuAnchor(null);
|
|
226
|
-
}, children: _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { title: "Delete the active item.", onSelect: onSelectDelete, children: "Delete\u2026" }), localContents && (_jsx(ActionList.Item, { title: "Copy the active item to the local drive.", onSelect: onSelectCopyToLocal, children: "Copy to local drive\u2026" }))] }) }) }), openDeleteConfirmation && (_jsx(Dialog, { title: _jsx("span", { style: { color: 'var(--fgColor-default)' }, children: "Confirm deletion" }), onClose: () => {
|
|
226
|
+
}, children: _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { title: "Delete the active item.", onSelect: onSelectDelete, children: "Delete\u2026" }), localContents && (_jsx(ActionList.Item, { title: "Copy the active item to the local drive.", onSelect: onSelectCopyToLocal, children: "Copy to local drive\u2026" }))] }) }) })), openDeleteConfirmation && (_jsx(Dialog, { title: _jsx("span", { style: { color: 'var(--fgColor-default)' }, children: "Confirm deletion" }), onClose: () => {
|
|
227
227
|
setOpenDeleteConfirmation(false);
|
|
228
228
|
}, footerButtons: [
|
|
229
229
|
{
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export * from './useParams';
|
|
|
19
19
|
export * from './useOnClickOutside';
|
|
20
20
|
export * from './useRef';
|
|
21
21
|
export * from './useRuntimes';
|
|
22
|
-
export * from './
|
|
22
|
+
export * from './useScreencapture';
|
|
23
23
|
export * from './useToast';
|
|
24
24
|
export * from './useUpload';
|
|
25
25
|
export * from './useUser';
|
package/lib/hooks/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export * from './useParams';
|
|
|
24
24
|
export * from './useOnClickOutside';
|
|
25
25
|
export * from './useRef';
|
|
26
26
|
export * from './useRuntimes';
|
|
27
|
-
export * from './
|
|
27
|
+
export * from './useScreencapture';
|
|
28
28
|
export * from './useToast';
|
|
29
29
|
export * from './useUpload';
|
|
30
30
|
export * from './useUser';
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
.crosshairs::before {
|
|
23
23
|
height: 24px;
|
|
24
24
|
width: 2px;
|
|
25
|
-
background: #
|
|
25
|
+
background: #fff;
|
|
26
26
|
top: -11px;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.crosshairs::after {
|
|
30
30
|
width: 24px;
|
|
31
31
|
height: 2px;
|
|
32
|
-
background: #
|
|
32
|
+
background: #fff;
|
|
33
33
|
left: -11px;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -5,11 +5,11 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useEffect } from 'react';
|
|
7
7
|
import { Box } from '@primer/react';
|
|
8
|
-
import {
|
|
8
|
+
import { useScreencapture, useToast } from '..';
|
|
9
9
|
import { lazyWithPreload, WithSuspense } from '../../utils';
|
|
10
10
|
import { useLayoutStore } from '../../state';
|
|
11
|
-
import '
|
|
12
|
-
const
|
|
11
|
+
import '../../../style/screencapture/index.css';
|
|
12
|
+
const Screencapture = WithSuspense(lazyWithPreload(() => import('../../components/screencapture/Screencapture')));
|
|
13
13
|
const Capture = (props) => {
|
|
14
14
|
const { onStartCapture } = props;
|
|
15
15
|
useEffect(() => {
|
|
@@ -17,28 +17,28 @@ const Capture = (props) => {
|
|
|
17
17
|
}, []);
|
|
18
18
|
return _jsx(_Fragment, {});
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const ScreencaptureContent = (props) => {
|
|
21
21
|
// const { screenshotDisplay } = props;
|
|
22
22
|
const { enqueueToast } = useToast();
|
|
23
|
-
const {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const { setScreencapture, hideScreencapture } = useLayoutStore();
|
|
24
|
+
const handleScreencapture = (screenCapture) => {
|
|
25
|
+
setScreencapture(screenCapture);
|
|
26
|
+
hideScreencapture();
|
|
27
27
|
enqueueToast('Screen is captured.', { variant: 'success' });
|
|
28
28
|
};
|
|
29
|
-
return (_jsx(Box, { children: _jsx(
|
|
29
|
+
return (_jsx(Box, { children: _jsx(Screencapture, { onEndCapture: handleScreencapture, children: ({ onStartCapture }) => _jsx(Capture, { onStartCapture: onStartCapture }) }) }));
|
|
30
30
|
};
|
|
31
|
-
export const
|
|
31
|
+
export const LayoutScreencapture = () => {
|
|
32
32
|
const { screenshot } = useLayoutStore();
|
|
33
|
-
const {
|
|
33
|
+
const { displayScreencapture, closeScreencapture } = useScreencapture();
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
if (screenshot && screenshot.open) {
|
|
36
|
-
|
|
36
|
+
displayScreencapture(() => (_jsx(ScreencaptureContent, { screenshotDisplay: screenshot })));
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
|
|
39
|
+
closeScreencapture();
|
|
40
40
|
}
|
|
41
41
|
}, [screenshot]);
|
|
42
42
|
return _jsx(_Fragment, {});
|
|
43
43
|
};
|
|
44
|
-
export default
|
|
44
|
+
export default LayoutScreencapture;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './LayoutBackdrop';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './LayoutScreencapture';
|
package/lib/hooks/useCache.d.ts
CHANGED
|
@@ -316,6 +316,7 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
316
316
|
autorization_url: string;
|
|
317
317
|
}, Error, Record<string, string>, unknown>;
|
|
318
318
|
useGetGitHubProfile: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
319
|
+
useGetGoogleProfile: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
319
320
|
useGetLinkedinProfile: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
320
321
|
usePostLinkedinShare: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
321
322
|
linkedinUserUrn: string;
|
|
@@ -325,7 +326,7 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
325
326
|
usePostLinkedinShareWithUpload: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
326
327
|
linkedinUserUrn: string;
|
|
327
328
|
postText: string;
|
|
328
|
-
uploadObject
|
|
329
|
+
uploadObject?: string;
|
|
329
330
|
accessToken: string;
|
|
330
331
|
}, unknown>;
|
|
331
332
|
useRegisterToWaitingList: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
@@ -450,7 +451,8 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
450
451
|
space: Partial<IAnySpace>;
|
|
451
452
|
organization?: IAnyOrganization;
|
|
452
453
|
}, unknown>;
|
|
453
|
-
useUpdateSpace: () => import("@tanstack/react-query").UseMutationResult<any, Error, Partial<IAnySpace>, unknown>;
|
|
454
|
+
useUpdateSpace: () => import("@tanstack/react-query").UseMutationResult<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>;
|
|
455
|
+
useDeleteSpace: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
454
456
|
useUpdateOrganizationSpace: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
455
457
|
organizationId: string;
|
|
456
458
|
spaceId: string;
|
|
@@ -506,6 +508,7 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
506
508
|
id: string;
|
|
507
509
|
url: string | undefined;
|
|
508
510
|
messageCount: number;
|
|
511
|
+
agent_spec_id: string | undefined;
|
|
509
512
|
pod_name: string;
|
|
510
513
|
environment_name: string;
|
|
511
514
|
environment_title?: string;
|
|
@@ -525,6 +528,7 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
525
528
|
id: string;
|
|
526
529
|
url: string | undefined;
|
|
527
530
|
messageCount: number;
|
|
531
|
+
agent_spec_id: string | undefined;
|
|
528
532
|
pod_name: string;
|
|
529
533
|
environment_name: string;
|
|
530
534
|
environment_title?: string;
|
|
@@ -544,6 +548,8 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
544
548
|
creditsLimit?: number;
|
|
545
549
|
type?: string;
|
|
546
550
|
editorVariant?: string;
|
|
551
|
+
enableCodemode?: boolean;
|
|
552
|
+
agentSpecId?: string;
|
|
547
553
|
}, unknown>;
|
|
548
554
|
useDeleteAgentRuntime: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
549
555
|
useRefreshAgentRuntimes: () => () => void;
|
|
@@ -710,6 +716,10 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
710
716
|
useRefreshSpaceAssignments: (options?: UseMutationOptions<unknown, Error, string>) => import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
711
717
|
useDeleteItem: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
712
718
|
useSpaceItems: (spaceId: string) => import("@tanstack/react-query").UseQueryResult<any[], Error>;
|
|
719
|
+
useSpaceDefaultItems: (spaceId: string | undefined) => import("@tanstack/react-query").UseQueryResult<{
|
|
720
|
+
defaultNotebookUid: string | null;
|
|
721
|
+
defaultDocumentUid: string | null;
|
|
722
|
+
}, Error>;
|
|
713
723
|
useMakeItemPublic: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
714
724
|
useMakeItemPrivate: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
715
725
|
useSearchPublicItems: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|