@datalayer/core 1.0.20 → 1.0.21
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/README.md +27 -0
- package/lib/api/DatalayerApi.d.ts +5 -1
- package/lib/api/DatalayerApi.js +55 -8
- package/lib/api/iam/oauth2.d.ts +3 -3
- package/lib/api/iam/oauth2.js +2 -2
- package/lib/api/iam/profile.d.ts +9 -1
- package/lib/api/iam/profile.js +15 -0
- package/lib/api/runtimes/checkpoints.js +1 -1
- package/lib/api/runtimes/snapshots.d.ts +7 -7
- package/lib/api/runtimes/snapshots.js +9 -9
- package/lib/client/auth/storage.js +103 -12
- package/lib/client/index.d.ts +7 -7
- package/lib/client/index.js +1 -1
- package/lib/client/mixins/RuntimesMixin.d.ts +6 -6
- package/lib/client/mixins/RuntimesMixin.js +5 -5
- package/lib/client/mixins/SpacerMixin.js +22 -1
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +4 -3
- package/lib/components/avatars/DLAvatar.d.ts +24 -0
- package/lib/components/avatars/DLAvatar.js +26 -0
- package/lib/components/avatars/UserProfileAvatar.js +4 -4
- package/lib/components/avatars/index.d.ts +1 -0
- package/lib/components/avatars/index.js +1 -0
- package/lib/components/checkout/StripeCheckout.d.ts +24 -3
- package/lib/components/checkout/StripeCheckout.js +1116 -55
- package/lib/components/display/DatalayerBox.js +6 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +2 -2
- package/lib/components/snapshots/{RuntimeSnapshotMenu.d.ts → SandboxSnapshotMenu.d.ts} +4 -4
- package/lib/components/snapshots/{RuntimeSnapshotMenu.js → SandboxSnapshotMenu.js} +33 -33
- package/lib/components/snapshots/index.d.ts +1 -1
- package/lib/components/snapshots/index.js +1 -1
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/components/tokens/SpaceVariantToken.js +7 -4
- package/lib/components/users/PeerIndicator.js +5 -4
- package/lib/hooks/useCache.d.ts +125 -18
- package/lib/hooks/useCache.js +893 -120
- package/lib/hooks/useDatalayer.js +31 -3
- package/lib/hooks/useIAM.js +1 -8
- package/lib/hooks/useProjects.d.ts +44 -0
- package/lib/hooks/useProjects.js +26 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/mocks/components/FlashMock.js +8 -2
- package/lib/models/{RuntimeSnapshot.d.ts → CodeSandboxSnapshot.d.ts} +5 -5
- package/lib/models/{RuntimeSnapshot.js → CodeSandboxSnapshot.js} +1 -1
- package/lib/models/{RuntimeSnapshotDTO.d.ts → CodeSandboxSnapshotDTO.d.ts} +30 -30
- package/lib/models/{RuntimeSnapshotDTO.js → CodeSandboxSnapshotDTO.js} +6 -6
- package/lib/models/Environment.d.ts +4 -0
- package/lib/models/IAM.d.ts +66 -0
- package/lib/models/Organization.d.ts +1 -0
- package/lib/models/Organization.js +1 -0
- package/lib/models/Page.d.ts +2 -2
- package/lib/models/Page.js +2 -2
- package/lib/models/Profile.d.ts +1 -1
- package/lib/models/RuntimeDTO.d.ts +2 -2
- package/lib/models/Space.d.ts +1 -0
- package/lib/models/Space.js +29 -5
- package/lib/models/SpaceDTO.d.ts +4 -0
- package/lib/models/SpaceDTO.js +5 -0
- package/lib/models/Usage.d.ts +15 -0
- package/lib/models/Usage.js +9 -0
- package/lib/models/User.d.ts +21 -0
- package/lib/models/User.js +6 -2
- package/lib/models/index.d.ts +2 -2
- package/lib/models/index.js +2 -2
- package/lib/otel/auth.js +0 -4
- package/lib/services/index.d.ts +1 -1
- package/lib/services/index.js +1 -1
- package/lib/state/substates/IAMState.js +0 -7
- package/lib/state/substates/RuntimesState.d.ts +9 -9
- package/lib/state/substates/RuntimesState.js +3 -3
- package/lib/stateful/runtimes/actions.d.ts +17 -17
- package/lib/stateful/runtimes/actions.js +35 -55
- package/lib/stateful/runtimes/apis.d.ts +3 -3
- package/lib/stateful/runtimes/snapshots.d.ts +2 -2
- package/lib/stateful/runtimes/snapshots.js +7 -7
- package/lib/utils/Format.d.ts +6 -0
- package/lib/utils/Format.js +17 -0
- package/lib/utils/Snapshot.d.ts +1 -1
- package/lib/utils/Snapshot.js +1 -1
- package/lib/views/datasources/DatasourceDetail.d.ts +7 -1
- package/lib/views/datasources/DatasourceDetail.js +61 -23
- package/lib/views/datasources/DatasourceNew.d.ts +8 -1
- package/lib/views/datasources/DatasourceNew.js +23 -10
- package/lib/views/datasources/Datasources.d.ts +5 -1
- package/lib/views/datasources/Datasources.js +38 -30
- package/lib/views/iam-tokens/IAMTokenNew.d.ts +3 -1
- package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
- package/lib/views/iam-tokens/IAMTokens.d.ts +3 -1
- package/lib/views/iam-tokens/IAMTokens.js +2 -2
- package/lib/views/otel/OtelHeader.d.ts +5 -0
- package/lib/views/otel/OtelHeader.js +3 -3
- package/lib/views/profile/UserBadge.d.ts +7 -2
- package/lib/views/profile/UserBadge.js +11 -2
- package/lib/views/secrets/Secrets.js +21 -21
- package/package.json +8 -7
|
@@ -4,14 +4,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
import { useState, useEffect } from 'react';
|
|
7
|
-
import { PageLayout, Button, IconButton, Text, Label } from '@primer/react';
|
|
8
|
-
import { Blankslate,
|
|
7
|
+
import { PageLayout, Button, IconButton, Text, Label, Heading, } from '@primer/react';
|
|
8
|
+
import { Blankslate, Table, DataTable } from '@primer/react/experimental';
|
|
9
|
+
import { DatabaseIcon } from '@primer/octicons-react';
|
|
9
10
|
import { Box } from '@datalayer/primer-addons';
|
|
10
11
|
import { EditIcon } from '@datalayer/icons-react';
|
|
11
12
|
import { useCache, useNavigate } from '../../hooks/index.js';
|
|
12
|
-
const DatasourcesTable = ({ datasourcesListRoute, }) => {
|
|
13
|
+
const DatasourcesTable = ({ datasourcesListRoute, principalUid, principalKind, }) => {
|
|
13
14
|
const { useDatasources } = useCache();
|
|
14
|
-
const datasourcesQuery = useDatasources();
|
|
15
|
+
const datasourcesQuery = useDatasources({ principalUid, principalKind });
|
|
15
16
|
const navigate = useNavigate();
|
|
16
17
|
const [datasources, setDatasources] = useState([]);
|
|
17
18
|
useEffect(() => {
|
|
@@ -19,33 +20,40 @@ const DatasourcesTable = ({ datasourcesListRoute, }) => {
|
|
|
19
20
|
setDatasources(datasourcesQuery.data || []);
|
|
20
21
|
}
|
|
21
22
|
}, [datasourcesQuery.data]);
|
|
22
|
-
return datasources.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "Datasources" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No Datasources found." }) })] })) : (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
return datasources.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "Datasources" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No Datasources found." }) })] })) : (_jsx(Table.Container, { children: _jsx(DataTable, { "aria-labelledby": "teams", "aria-describedby": "teams-subtitle", data: datasources, columns: [
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
{
|
|
26
|
+
header: 'Type',
|
|
27
|
+
field: 'variant',
|
|
28
|
+
renderCell: datasource => _jsx(Label, { children: datasource.variant }),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
header: 'Name',
|
|
32
|
+
field: 'name',
|
|
33
|
+
rowHeader: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
header: 'Description',
|
|
37
|
+
field: 'description',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
header: '',
|
|
41
|
+
field: 'id',
|
|
42
|
+
renderCell: datasource => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(datasourcesListRoute
|
|
43
|
+
? `${datasourcesListRoute}/${datasource.id}`
|
|
44
|
+
: `${datasource.id}`, e) })),
|
|
45
|
+
},
|
|
46
|
+
] }) }));
|
|
46
47
|
};
|
|
47
|
-
export const Datasources = ({ newDatasourceRoute = '/new/datasource', datasourcesListRoute, } = {}) => {
|
|
48
|
+
export const Datasources = ({ newDatasourceRoute = '/new/datasource', datasourcesListRoute, principalUid, principalKind, } = {}) => {
|
|
48
49
|
const navigate = useNavigate();
|
|
49
|
-
return (
|
|
50
|
+
return (_jsx(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: _jsx(PageLayout.Content, { children: _jsxs(Box, { sx: { maxWidth: 960, mx: 'auto', width: '100%' }, children: [_jsxs(Box, { sx: {
|
|
51
|
+
display: 'flex',
|
|
52
|
+
alignItems: 'flex-start',
|
|
53
|
+
justifyContent: 'space-between',
|
|
54
|
+
gap: 3,
|
|
55
|
+
flexWrap: 'wrap',
|
|
56
|
+
mb: 4,
|
|
57
|
+
}, children: [_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { fontSize: 3, mb: 1 }, children: "Datasources" }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Configure external data providers available to your workspaces and agents." })] }), _jsx(Button, { size: "small", variant: "primary", leadingVisual: DatabaseIcon, onClick: e => navigate(newDatasourceRoute, e), children: "New datasource" })] }), _jsx(DatasourcesTable, { datasourcesListRoute: datasourcesListRoute, principalUid: principalUid, principalKind: principalKind })] }) }) }));
|
|
50
58
|
};
|
|
51
59
|
export default Datasources;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type IAMTokenNewProps = {
|
|
2
2
|
/** Route to navigate when clicking "List my Tokens". Defaults to '/settings/iam/tokens'. */
|
|
3
3
|
tokensListRoute?: string;
|
|
4
|
+
/** Whether to render the "New API Key" title header in create mode. Defaults to true. */
|
|
5
|
+
showTitle?: boolean;
|
|
4
6
|
};
|
|
5
|
-
export declare const IAMTokenNew: ({ tokensListRoute, }?: IAMTokenNewProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const IAMTokenNew: ({ tokensListRoute, showTitle, }?: IAMTokenNewProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export default IAMTokenNew;
|
|
@@ -10,7 +10,7 @@ import { CopyIcon } from '@primer/octicons-react';
|
|
|
10
10
|
import { Calendar, defaultCalendarStrings } from '@fluentui/react';
|
|
11
11
|
import { useCache, useNavigate, useToast } from '../../hooks/index.js';
|
|
12
12
|
import { useRunStore } from '../../state/index.js';
|
|
13
|
-
export const IAMTokenNew = ({ tokensListRoute = '/settings/iam/tokens', } = {}) => {
|
|
13
|
+
export const IAMTokenNew = ({ tokensListRoute = '/settings/iam/tokens', showTitle = true, } = {}) => {
|
|
14
14
|
const runStore = useRunStore();
|
|
15
15
|
const { useCreateToken } = useCache();
|
|
16
16
|
const createTokenMutation = useCreateToken();
|
|
@@ -108,7 +108,7 @@ export const IAMTokenNew = ({ tokensListRoute = '/settings/iam/tokens', } = {})
|
|
|
108
108
|
variant: 'success',
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
} })] })] }), _jsx(Box, { mt: 3, children: _jsx(Button, { onClick: e => navigate(tokensListRoute, e), children: "List my API Keys" }) })] })) : (_jsxs(_Fragment, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New API Key" }) }) }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Token type" }), _jsx(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: _jsx(Select.Option, { value: "user_token", children: "User Token" }) }), _jsx(FormControl.Caption, { children: "Pick the most appropriate token type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The token name is a short name that identifies in a unique way your token." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Expiration day" }), _jsx(Calendar, { showGoToToday: true, onSelectDate: expirationDateChange, value: formValues.expirationDate, strings: defaultCalendarStrings }), validationResult.expirationDate !== true ? (_jsx(FormControl.Validation, { variant: "error", children: "Pick an expiration date in the future." })) : (_jsxs(FormControl.Validation, { variant: "success", children: ["Expiration date:", ' ', formValues.expirationDate?.toLocaleDateString(), "."] }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.name ||
|
|
111
|
+
} })] })] }), _jsx(Box, { mt: 3, children: _jsx(Button, { onClick: e => navigate(tokensListRoute, e), children: "List my API Keys" }) })] })) : (_jsxs(_Fragment, { children: [showTitle ? (_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New API Key" }) }) })) : null, _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Token type" }), _jsx(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: _jsx(Select.Option, { value: "user_token", children: "User Token" }) }), _jsx(FormControl.Caption, { children: "Pick the most appropriate token type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The token name is a short name that identifies in a unique way your token." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Expiration day" }), _jsx(Calendar, { showGoToToday: true, onSelectDate: expirationDateChange, value: formValues.expirationDate, strings: defaultCalendarStrings }), validationResult.expirationDate !== true ? (_jsx(FormControl.Validation, { variant: "error", children: "Pick an expiration date in the future." })) : (_jsxs(FormControl.Validation, { variant: "success", children: ["Expiration date:", ' ', formValues.expirationDate?.toLocaleDateString(), "."] }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.name ||
|
|
112
112
|
!validationResult.description ||
|
|
113
113
|
!validationResult.expirationDate, sx: { marginTop: 2 }, onClick: e => {
|
|
114
114
|
e.preventDefault();
|
|
@@ -5,6 +5,8 @@ export type IAMTokensProps = {
|
|
|
5
5
|
tokensListRoute?: string;
|
|
6
6
|
/** Whether to display view titles/headings. Defaults to true. */
|
|
7
7
|
showTitle?: boolean;
|
|
8
|
+
/** Whether to render the "New API Key" button in this component header. Defaults to true. */
|
|
9
|
+
showNewButton?: boolean;
|
|
8
10
|
};
|
|
9
|
-
export declare const IAMTokens: ({ newTokenRoute, tokensListRoute, showTitle, }?: IAMTokensProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const IAMTokens: ({ newTokenRoute, tokensListRoute, showTitle, showNewButton, }?: IAMTokensProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export default IAMTokens;
|
|
@@ -80,8 +80,8 @@ const TokensTable = ({ tokensListRoute, showTitle = true, }) => {
|
|
|
80
80
|
setDeletingToken(null);
|
|
81
81
|
}, confirmButtonContent: "Delete", confirmButtonType: "danger", children: ["Are you sure you want to delete the token", ' ', _jsx("strong", { children: deletingToken.name }), "? This action cannot be undone."] }))] }));
|
|
82
82
|
};
|
|
83
|
-
export const IAMTokens = ({ newTokenRoute = '/new/token', tokensListRoute, showTitle = true, } = {}) => {
|
|
83
|
+
export const IAMTokens = ({ newTokenRoute = '/new/token', tokensListRoute, showTitle = true, showNewButton = true, } = {}) => {
|
|
84
84
|
const navigate = useNavigate();
|
|
85
|
-
return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [showTitle && (_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "API Keys" }) })), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate(newTokenRoute, e), children: "New API Key" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(TokensTable, { tokensListRoute: tokensListRoute, showTitle: showTitle }) }) })] }));
|
|
85
|
+
return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [showTitle || showNewButton ? (_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [showTitle && (_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "API Keys" }) })), showNewButton && (_jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate(newTokenRoute, e), children: "New API Key" }) }))] }) })) : null, _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(TokensTable, { tokensListRoute: tokensListRoute, showTitle: showTitle }) }) })] }));
|
|
86
86
|
};
|
|
87
87
|
export default IAMTokens;
|
|
@@ -29,5 +29,10 @@ export interface OtelHeaderProps {
|
|
|
29
29
|
* where data is generated by agents, not manually).
|
|
30
30
|
*/
|
|
31
31
|
showGenerateButtons?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to show account controls (token badge + sign out).
|
|
34
|
+
* Defaults to `true`.
|
|
35
|
+
*/
|
|
36
|
+
showAccountControls?: boolean;
|
|
32
37
|
}
|
|
33
38
|
export declare const OtelHeader: React.FC<OtelHeaderProps>;
|
|
@@ -14,7 +14,7 @@ import { useState, useCallback, useRef } from 'react';
|
|
|
14
14
|
import { Box, Text, Button, Dialog } from '@primer/react';
|
|
15
15
|
import { TelescopeIcon, SignOutIcon } from '@primer/octicons-react';
|
|
16
16
|
import { UserBadge } from '../profile/index.js';
|
|
17
|
-
export const OtelHeader = ({ baseUrl = '', token, trailing, onNavigate, onSignOut, showGenerateButtons = true, }) => {
|
|
17
|
+
export const OtelHeader = ({ baseUrl = '', token, trailing, onNavigate, onSignOut, showGenerateButtons = true, showAccountControls = true, }) => {
|
|
18
18
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
19
19
|
const [dialogTitle, setDialogTitle] = useState('');
|
|
20
20
|
const [dialogRequest, setDialogRequest] = useState('');
|
|
@@ -33,7 +33,7 @@ export const OtelHeader = ({ baseUrl = '', token, trailing, onNavigate, onSignOu
|
|
|
33
33
|
onNavigate(signalMap[kind]);
|
|
34
34
|
}
|
|
35
35
|
setGenerating(true);
|
|
36
|
-
const url = `${baseUrl}/api/generate/${kind}?count=${count}`;
|
|
36
|
+
const url = `${baseUrl}/api/otel/v1/generate/${kind}?count=${count}`;
|
|
37
37
|
setDialogRequest(`POST ${url}`);
|
|
38
38
|
try {
|
|
39
39
|
const headers = {};
|
|
@@ -70,7 +70,7 @@ export const OtelHeader = ({ baseUrl = '', token, trailing, onNavigate, onSignOu
|
|
|
70
70
|
flexShrink: 0,
|
|
71
71
|
// Allow overflow visible so the JWT popover can extend below the header.
|
|
72
72
|
overflow: 'visible',
|
|
73
|
-
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(TelescopeIcon, { size: 20 }), _jsx(Text, { sx: { fontWeight: 'bold', fontSize: 2 }, children: "Datalayer OTEL" })] }), _jsx(Box, { sx: { flex: 1 } }), showGenerateButtons && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: returnFocusRef, size: "small", variant: "primary", disabled: generating, onClick: () => generate('traces', 3), children: "+ Traces" }), _jsx(Button, { size: "small", variant: "primary", disabled: generating, onClick: () => generate('ai-traces', 3), children: "+ AI Traces" }), _jsx(Button, { size: "small", variant: "primary", disabled: generating, onClick: () => generate('logs', 10), children: "+ Logs" }), _jsx(Button, { size: "small", variant: "primary", disabled: generating, onClick: () => generate('metrics', 5), children: "+ Metrics" })] })), trailing, token && _jsx(UserBadge, { token: token }), onSignOut && (_jsx(Button, { size: "small", variant: "invisible", onClick: onSignOut, sx: { color: 'fg.muted' }, leadingVisual: SignOutIcon, children: "Sign out" }))] }), dialogOpen && (_jsxs(Dialog, { title: dialogTitle, onClose: () => setDialogOpen(false), footerButtons: [
|
|
73
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(TelescopeIcon, { size: 20 }), _jsx(Text, { sx: { fontWeight: 'bold', fontSize: 2 }, children: "Datalayer OTEL" })] }), _jsx(Box, { sx: { flex: 1 } }), showGenerateButtons && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: returnFocusRef, size: "small", variant: "primary", disabled: generating, onClick: () => generate('traces', 3), children: "+ Traces" }), _jsx(Button, { size: "small", variant: "primary", disabled: generating, onClick: () => generate('ai-traces', 3), children: "+ AI Traces" }), _jsx(Button, { size: "small", variant: "primary", disabled: generating, onClick: () => generate('logs', 10), children: "+ Logs" }), _jsx(Button, { size: "small", variant: "primary", disabled: generating, onClick: () => generate('metrics', 5), children: "+ Metrics" })] })), trailing, showAccountControls && token && _jsx(UserBadge, { token: token }), showAccountControls && onSignOut && (_jsx(Button, { size: "small", variant: "invisible", onClick: onSignOut, sx: { color: 'fg.muted' }, leadingVisual: SignOutIcon, children: "Sign out" }))] }), dialogOpen && (_jsxs(Dialog, { title: dialogTitle, onClose: () => setDialogOpen(false), footerButtons: [
|
|
74
74
|
{
|
|
75
75
|
content: 'Close',
|
|
76
76
|
onClick: () => setDialogOpen(false),
|
|
@@ -27,10 +27,15 @@ export interface UserBadgeProps {
|
|
|
27
27
|
* Threshold (in milliseconds) below which the expiration timestamp is
|
|
28
28
|
* rendered in ``attention.fg`` (yellow) to warn that the token is about
|
|
29
29
|
* to expire. Tokens already past ``exp`` render in ``danger.fg`` (red);
|
|
30
|
-
* tokens further out than this threshold render in ``success.fg``
|
|
31
|
-
*
|
|
30
|
+
* tokens further out than this threshold render in ``success.fg`` (green).
|
|
31
|
+
* Defaults to ``10_800_000`` (3 hours).
|
|
32
32
|
*/
|
|
33
33
|
expirationWarningMs?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Optional callback fired when the claims popover is open and the token is
|
|
36
|
+
* already expired.
|
|
37
|
+
*/
|
|
38
|
+
onTokenExpired?: () => void;
|
|
34
39
|
}
|
|
35
40
|
export declare const UserBadge: React.FC<UserBadgeProps>;
|
|
36
41
|
export default UserBadge;
|
|
@@ -14,12 +14,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
*
|
|
15
15
|
* @module views/profile
|
|
16
16
|
*/
|
|
17
|
-
import { useState, useRef, useCallback } from 'react';
|
|
17
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
18
18
|
import { Box, Text } from '@primer/react';
|
|
19
19
|
import { parseJwtPayload, getDatalayerJwtUser, getDatalayerDisplayName, } from '../../utils/Jwt.js';
|
|
20
20
|
import { getRelativeTime } from '../../utils/Date.js';
|
|
21
21
|
// ── Component ─────────────────────────────────────────────────────
|
|
22
|
-
export const UserBadge = ({ token, variant = 'full', showExpandToggle = true, expirationWarningMs = 60 * 60 * 1000, }) => {
|
|
22
|
+
export const UserBadge = ({ token, variant = 'full', showExpandToggle = true, expirationWarningMs = 3 * 60 * 60 * 1000, onTokenExpired, }) => {
|
|
23
23
|
const [open, setOpen] = useState(false);
|
|
24
24
|
const [expanded, setExpanded] = useState(false);
|
|
25
25
|
const closeTimer = useRef(null);
|
|
@@ -52,6 +52,15 @@ export const UserBadge = ({ token, variant = 'full', showExpandToggle = true, ex
|
|
|
52
52
|
: expiringSoon
|
|
53
53
|
? 'attention.fg'
|
|
54
54
|
: 'fg.muted';
|
|
55
|
+
const expiredNotifiedForTokenRef = useRef(null);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!onTokenExpired || !open || !expired)
|
|
58
|
+
return;
|
|
59
|
+
if (expiredNotifiedForTokenRef.current === token)
|
|
60
|
+
return;
|
|
61
|
+
expiredNotifiedForTokenRef.current = token;
|
|
62
|
+
onTokenExpired();
|
|
63
|
+
}, [expired, onTokenExpired, open, token]);
|
|
55
64
|
return (_jsxs(Box, { sx: { position: 'relative' }, onMouseEnter: handleEnter, onMouseLeave: handleLeave, children: [_jsx(Text, { sx: {
|
|
56
65
|
fontSize: 1,
|
|
57
66
|
color: triggerColor,
|
|
@@ -19,27 +19,27 @@ const SecretsTable = () => {
|
|
|
19
19
|
setSecrets(secretsQuery.data || []);
|
|
20
20
|
}
|
|
21
21
|
}, [secretsQuery.data]);
|
|
22
|
-
return secrets.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "Secrets" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No Secrets found." }) })] })) : (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
return secrets.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "Secrets" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No Secrets found." }) })] })) : (_jsx(Table.Container, { children: _jsx(DataTable, { "aria-labelledby": "secrets", "aria-describedby": "secrets-subtitle", data: secrets, columns: [
|
|
23
|
+
{
|
|
24
|
+
header: 'Type',
|
|
25
|
+
field: 'variant',
|
|
26
|
+
renderCell: secret => _jsx(Label, { children: secret.variant }),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
header: 'Name',
|
|
30
|
+
field: 'name',
|
|
31
|
+
rowHeader: true,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
header: 'Description',
|
|
35
|
+
field: 'description',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
header: '',
|
|
39
|
+
field: 'id',
|
|
40
|
+
renderCell: secret => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(`${secret.id}`, e) })),
|
|
41
|
+
},
|
|
42
|
+
] }) }));
|
|
43
43
|
};
|
|
44
44
|
export const Secrets = () => {
|
|
45
45
|
const navigate = useNavigate();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
"rebuild:fresh": "npm run create:patches && npm install && npm run build && npm run clean:cache"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@datalayer/icons-react": "^1.0.
|
|
105
|
+
"@datalayer/icons-react": "^1.0.7",
|
|
106
106
|
"@datalayer/jupyter-lexical": "^1.0.16",
|
|
107
107
|
"@datalayer/jupyter-react": "^2.0.7",
|
|
108
|
-
"@datalayer/primer-addons": "^1.0.
|
|
109
|
-
"@datalayer/primer-rjsf": "^1.0.
|
|
108
|
+
"@datalayer/primer-addons": "^1.0.15",
|
|
109
|
+
"@datalayer/primer-rjsf": "^1.0.3",
|
|
110
110
|
"@fluentui/react": "^8.125.3",
|
|
111
111
|
"@jupyter-widgets/base-manager": "^1.0.12",
|
|
112
112
|
"@jupyter-widgets/schema": "^0.5.6",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"@primer/primitives": "^10.5.0",
|
|
134
134
|
"@primer/react": "^37.19.0",
|
|
135
135
|
"@primer/react-brand": "^0.58.0",
|
|
136
|
-
"@stripe/react-stripe-js": "^
|
|
137
|
-
"@stripe/stripe-js": "^4.0
|
|
136
|
+
"@stripe/react-stripe-js": "^6.3.0",
|
|
137
|
+
"@stripe/stripe-js": "^9.4.0",
|
|
138
138
|
"@styled-system/css": "^5.1.5",
|
|
139
139
|
"@tailwindcss/vite": "^4.1.13",
|
|
140
140
|
"@tanstack/react-query": "^5.90.6",
|
|
@@ -169,6 +169,7 @@
|
|
|
169
169
|
"ulid": "^2.3.0",
|
|
170
170
|
"unique-names-generator": "^4.7.1",
|
|
171
171
|
"usehooks-ts": "^2.9.1",
|
|
172
|
+
"user": "^0.0.0",
|
|
172
173
|
"uuid": "^13.0.0",
|
|
173
174
|
"validator": "^13.7.0",
|
|
174
175
|
"zod": "^4.1.13",
|
|
@@ -257,6 +258,6 @@
|
|
|
257
258
|
]
|
|
258
259
|
},
|
|
259
260
|
"optionalDependencies": {
|
|
260
|
-
"keytar": "^7.
|
|
261
|
+
"@github/keytar": "^7.10.6"
|
|
261
262
|
}
|
|
262
263
|
}
|