@datalayer/core 0.0.3 → 0.0.5
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 +114 -3
- package/lib/App.css +2 -2
- package/lib/App.d.ts +1 -1
- package/lib/App.js +9 -9
- package/lib/__tests__/index.test.js +5 -5
- package/lib/api/DatalayerApi.d.ts +1 -1
- package/lib/api/DatalayerApi.js +3 -3
- package/lib/api/index.d.ts +3 -3
- package/lib/api/index.js +3 -3
- package/lib/api/runtimes/actions.js +22 -23
- package/lib/api/runtimes/settings.js +3 -3
- package/lib/api/runtimes/snapshots.d.ts +1 -1
- package/lib/api/runtimes/snapshots.js +8 -8
- package/lib/api/runtimes/utils.js +1 -4
- package/lib/collaboration/DatalayerCollaboration.d.ts +9 -0
- package/lib/collaboration/DatalayerCollaboration.js +28 -0
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +54 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +162 -0
- package/lib/collaboration/index.d.ts +2 -0
- package/lib/collaboration/index.js +6 -0
- package/lib/components/avatars/BoringAvatar.d.ts +1 -1
- package/lib/components/avatars/BoringAvatar.js +2 -2
- package/lib/components/avatars/UserProfileAvatar.js +2 -9
- package/lib/components/banners/NoAutomationBanner.js +4 -4
- package/lib/components/buttons/DownloadCSVButton.js +1 -1
- package/lib/components/buttons/UploadButton.js +1 -1
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/checkout/StripeCheckout.js +6 -6
- package/lib/components/confetti/ConfettiSuccess.js +1 -1
- package/lib/components/context/OrganizationSelect.js +5 -5
- package/lib/components/context/SpaceSelect.js +7 -7
- package/lib/components/display/AvatarSkeleton.js +1 -1
- package/lib/components/display/CenteredSpinner.js +4 -4
- package/lib/components/display/CodePreview.js +4 -4
- package/lib/components/display/DatalayerBox.js +13 -14
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/HorizontalCenter.js +1 -1
- package/lib/components/display/JupyterDialog.js +17 -15
- package/lib/components/display/NavLink.d.ts +4 -2
- package/lib/components/display/NavLink.js +6 -4
- package/lib/components/display/NotebookSkeleton.js +2 -2
- package/lib/components/display/Placeholder.js +1 -1
- package/lib/components/display/ToTopBranded.js +1 -1
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.js +1 -1
- package/lib/components/flashes/FlashClosable.js +11 -11
- package/lib/components/flashes/FlashDisclaimer.js +2 -3
- package/lib/components/flashes/FlashGuest.js +3 -4
- package/lib/components/flashes/FlashSurveys.js +3 -4
- package/lib/components/flashes/FlashUnauthorized.js +2 -2
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/flashes/surveys/Survey2025_1.js +62 -85
- package/lib/components/iam/ExternalTokenSilentLogin.js +6 -4
- package/lib/components/icons/ArtifactIcon.d.ts +2 -2
- package/lib/components/icons/ArtifactIcon.js +39 -39
- package/lib/components/labels/VisibilityLabel.js +2 -5
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/landings/StepBlock.js +1 -1
- package/lib/components/navbar/NavigationVisbilityObserver.js +2 -2
- package/lib/components/navbar/SubdomainNavBar.js +45 -23
- package/lib/components/navbar/SubdomainNavBar.module.css +33 -14
- package/lib/components/nbgrader/NbGradesDetails.d.ts +1 -1
- package/lib/components/nbgrader/NbGradesDetails.js +5 -8
- package/lib/components/notebooks/JupyterNotebook.js +5 -5
- package/lib/components/notebooks/JupyterNotebookToolbar.js +3 -3
- package/lib/components/primer/Helper.d.ts +1 -1
- package/lib/components/primer/Helper.js +5 -3
- package/lib/components/primer/Portals.d.ts +1 -1
- package/lib/components/primer/Portals.js +2 -2
- package/lib/components/primer/Styles.js +1 -1
- package/lib/components/progress/ConsumptionBar.js +2 -2
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/progress/CreditsIndicator.js +4 -7
- package/lib/components/progress/ProgressRing.js +2 -2
- package/lib/components/runtimes/RuntimeCellVariables.js +9 -9
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +3 -3
- package/lib/components/runtimes/RuntimeLauncherDialog.js +30 -34
- package/lib/components/runtimes/RuntimePickerBase.js +42 -31
- package/lib/components/runtimes/RuntimePickerCell.js +9 -12
- package/lib/components/runtimes/RuntimePickerNotebook.js +44 -44
- package/lib/components/runtimes/RuntimeReservationControl.js +10 -15
- package/lib/components/runtimes/RuntimeSimplePicker.js +9 -12
- package/lib/components/runtimes/RuntimeUtils.js +22 -12
- package/lib/components/runtimes/RuntimeVariables.js +7 -7
- package/lib/components/screenshot/ScreenCapture.js +9 -13
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +1 -1
- package/lib/components/screenshot/ScreenCaptureButton.js +14 -8
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +19 -17
- package/lib/components/snippets/SnippetDialog.js +5 -5
- package/lib/components/storage/ContentsBrowser.js +63 -56
- package/lib/components/storage/ContentsItems.js +10 -8
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentItemStatus.js +35 -16
- package/lib/components/subnav/SubNav.d.ts +1 -1
- package/lib/components/subnav/SubNav.js +30 -15
- package/lib/components/subnav/SubNav.module.css +55 -21
- package/lib/components/tables/DataTable.js +1 -4
- package/lib/components/text-reveal/TextRevealAnimation.js +7 -2
- package/lib/components/text-reveal/TextRevealAnimation.module.css +4 -2
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/components/tokens/SpaceVariantToken.js +5 -5
- package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -3
- package/lib/components/users/PeerIndicator.d.ts +1 -1
- package/lib/components/users/PeerIndicator.js +5 -5
- package/lib/config/Configuration.d.ts +48 -0
- package/lib/config/Configuration.js +42 -0
- package/lib/config/integrations/Loom.js +3 -3
- package/lib/examples/CellExample.d.ts +2 -2
- package/lib/examples/CellExample.js +34 -3
- package/lib/examples/DatalayerNotebookExample.d.ts +16 -0
- package/lib/examples/DatalayerNotebookExample.js +75 -0
- package/lib/examples/NativeNavigationExample.d.ts +8 -0
- package/lib/examples/NativeNavigationExample.js +97 -0
- package/lib/examples/NotebookExample.d.ts +1 -3
- package/lib/examples/NotebookExample.js +9 -7
- package/lib/examples/NotebookMutationsKernel.d.ts +2 -0
- package/lib/examples/NotebookMutationsKernel.js +115 -0
- package/lib/examples/NotebookMutationsServiceManager.d.ts +2 -0
- package/lib/examples/NotebookMutationsServiceManager.js +107 -0
- package/lib/examples/ReactRouterExample.d.ts +6 -0
- package/lib/examples/ReactRouterExample.js +175 -0
- package/lib/examples/example-selector.d.ts +22 -0
- package/lib/examples/example-selector.js +45 -0
- package/lib/examples/index.d.ts +2 -0
- package/lib/examples/index.js +6 -0
- package/lib/examples/main.js +153 -0
- package/lib/examples/notebooks/IPyWidgetsExample.ipynb.json +101 -0
- package/lib/examples/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
- package/lib/examples/{NotebookExample1.ipynb.json → notebooks/Lite.ipynb.json} +45 -53
- package/lib/examples/notebooks/Matplotlib.ipynb.json +137 -0
- package/lib/examples/notebooks/NotebookExample1.ipynb.json +126 -0
- package/lib/examples/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples/notebooks/NotebookOutputs.ipynb.json +49 -0
- package/lib/examples/notebooks/NotebookToCExample.ipynb.json +102 -0
- package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
- package/lib/examples/notebooks/OutputIPyWidgetsExample.js +153 -0
- package/lib/examples/notebooks/PyGWalker.ipynb.json +55 -0
- package/lib/hooks/assets/OutputshotPlaceholders.d.ts +10 -10
- package/lib/hooks/assets/OutputshotPlaceholders.js +10 -10
- package/lib/hooks/index.d.ts +29 -28
- package/lib/hooks/index.js +29 -28
- package/lib/hooks/layouts/LayoutBackdrop.js +3 -6
- package/lib/hooks/layouts/LayoutScreenshot.css +1 -1
- package/lib/hooks/layouts/LayoutScreenshot.js +6 -6
- package/lib/hooks/useAIAgents.d.ts +1 -1
- package/lib/hooks/useAIAgents.js +6 -6
- package/lib/hooks/useAuthorization.js +4 -4
- package/lib/hooks/useBackdrop.js +7 -7
- package/lib/hooks/useBackdropJupyterLab.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.js +4 -4
- package/lib/hooks/useCache.d.ts +6 -2
- package/lib/hooks/useCache.js +233 -179
- package/lib/hooks/useCellOutputshot.js +3 -6
- package/lib/hooks/useContainsFocus.js +2 -1
- package/lib/hooks/useDatalayer.js +5 -3
- package/lib/hooks/useError.d.ts +1 -1
- package/lib/hooks/useError.js +2 -2
- package/lib/hooks/useExternalScript.js +4 -4
- package/lib/hooks/useFocusTrap.js +2 -1
- package/lib/hooks/useIAM.js +4 -5
- package/lib/hooks/useId.js +3 -3
- package/lib/hooks/useJupyterLabTheme.js +3 -1
- package/lib/hooks/useLocation.d.ts +22 -0
- package/lib/hooks/useLocation.js +149 -0
- package/lib/hooks/useLocationHandles.d.ts +2 -2
- package/lib/hooks/useLocationHandles.js +6 -4
- package/lib/hooks/useNavigate.d.ts +5 -1
- package/lib/hooks/useNavigate.js +62 -7
- package/lib/hooks/useNotebookAIAgent.js +3 -1
- package/lib/hooks/useParams.d.ts +5 -0
- package/lib/hooks/useParams.js +112 -0
- package/lib/hooks/useRuntimes.js +2 -2
- package/lib/hooks/useScreenshot.js +5 -5
- package/lib/hooks/useToast.js +15 -13
- package/lib/hooks/useUpload.js +9 -9
- package/lib/hooks/useUser.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.js +7 -3
- package/lib/mocks/components/FlashMock.js +4 -4
- package/lib/mocks/hooks/rests/rests.js +15 -18
- package/lib/mocks/hooks/useDatalayerMock.d.ts +2 -2
- package/lib/mocks/hooks/useDatalayerMock.js +7 -7
- package/lib/mocks/models/CodeBlockMock.js +1 -1
- package/lib/mocks/models/CodelineMock.js +1 -1
- package/lib/mocks/models/CourseMock.d.ts +1 -1
- package/lib/mocks/models/CourseMock.js +10 -10
- package/lib/mocks/models/InviteMock.d.ts +1 -1
- package/lib/mocks/models/InviteMock.js +21 -6
- package/lib/mocks/models/JupyterLabUserMock.js +2 -2
- package/lib/mocks/models/OrganisationMock.d.ts +1 -1
- package/lib/mocks/models/OrganisationMock.js +11 -7
- package/lib/mocks/models/SchoolMock.d.ts +1 -1
- package/lib/mocks/models/SchoolMock.js +6 -6
- package/lib/mocks/models/SpaceMock.d.ts +1 -1
- package/lib/mocks/models/SpaceMock.js +9 -9
- package/lib/mocks/models/TeamMock.d.ts +1 -1
- package/lib/mocks/models/TeamMock.js +6 -6
- package/lib/mocks/models/UserMock.d.ts +1 -1
- package/lib/mocks/models/UserMock.js +4 -6
- package/lib/mocks/views/ActionMenuMock.js +1 -1
- package/lib/mocks/views/ChartMock.js +3 -3
- package/lib/mocks/views/ChartMockOptions.js +24 -24
- package/lib/mocks/views/DashboardMock.js +74 -74
- package/lib/mocks/views/FormMock.js +1 -1
- package/lib/mocks/views/TableMock.js +1 -1
- package/lib/models/Account.d.ts +2 -2
- package/lib/models/Assignment.d.ts +2 -2
- package/lib/models/Cell.d.ts +1 -1
- package/lib/models/CodeBlock.d.ts +1 -1
- package/lib/models/CodefeedBlocks.d.ts +2 -2
- package/lib/models/Contact.d.ts +1 -1
- package/lib/models/Contact.js +14 -14
- package/lib/models/ContactIAMProvider.js +2 -2
- package/lib/models/Course.d.ts +7 -7
- package/lib/models/Dataset.d.ts +1 -1
- package/lib/models/Dean.d.ts +1 -1
- package/lib/models/Document.d.ts +1 -1
- package/lib/models/Environment.d.ts +2 -2
- package/lib/models/Exercise.d.ts +1 -1
- package/lib/models/IAMProviderLinked.js +1 -1
- package/lib/models/Instructor.d.ts +1 -1
- package/lib/models/Invite.d.ts +2 -2
- package/lib/models/Invite.js +1 -1
- package/lib/models/Item.d.ts +5 -5
- package/lib/models/LandingRoles.js +18 -18
- package/lib/models/Lesson.d.ts +1 -1
- package/lib/models/Member.d.ts +1 -1
- package/lib/models/Notebook.d.ts +1 -1
- package/lib/models/Organization.d.ts +4 -4
- package/lib/models/Organization.js +2 -2
- package/lib/models/OrganizationMember.d.ts +2 -2
- package/lib/models/Page.js +4 -2
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/PageTag.js +56 -9
- package/lib/models/Profile.d.ts +1 -1
- package/lib/models/RolesOrganization.d.ts +1 -1
- package/lib/models/RolesOrganization.js +4 -12
- package/lib/models/RolesPlatform.d.ts +1 -1
- package/lib/models/RolesPlatform.js +12 -34
- package/lib/models/RolesTeam.d.ts +1 -1
- package/lib/models/RolesTeam.js +3 -10
- package/lib/models/Runtime.js +4 -4
- package/lib/models/RuntimeSnapshot.js +1 -1
- package/lib/models/School.d.ts +4 -4
- package/lib/models/Space.d.ts +5 -5
- package/lib/models/Space.js +3 -3
- package/lib/models/SpaceItem.d.ts +8 -8
- package/lib/models/SpaceMember.d.ts +2 -2
- package/lib/models/Student.d.ts +2 -2
- package/lib/models/StudentItem.d.ts +3 -3
- package/lib/models/Team.d.ts +3 -3
- package/lib/models/Team.js +2 -2
- package/lib/models/TeamMember.d.ts +2 -2
- package/lib/models/URN.js +1 -1
- package/lib/models/User.d.ts +2 -2
- package/lib/models/User.js +5 -3
- package/lib/models/UserOnboarding.d.ts +1 -1
- package/lib/models/UserOnboarding.js +7 -7
- package/lib/models/UserSettings.js +2 -2
- package/lib/models/index.d.ts +2 -2
- package/lib/models/index.js +2 -2
- package/lib/navigation/adapters/native.d.ts +11 -0
- package/lib/navigation/adapters/native.js +48 -0
- package/lib/navigation/adapters/nextjs.d.ts +9 -0
- package/lib/navigation/adapters/nextjs.js +35 -0
- package/lib/navigation/adapters/react-router.d.ts +4 -0
- package/lib/navigation/adapters/react-router.js +12 -0
- package/lib/navigation/components.d.ts +20 -0
- package/lib/navigation/components.js +36 -0
- package/lib/navigation/index.d.ts +4 -0
- package/lib/navigation/index.js +12 -0
- package/lib/routes/index.d.ts +1 -1
- package/lib/routes/index.js +1 -1
- package/lib/services/DatalayerServiceManager.d.ts +22 -0
- package/lib/services/DatalayerServiceManager.js +69 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +7 -0
- package/lib/services/reconnectToRuntime.d.ts +32 -0
- package/lib/services/reconnectToRuntime.js +59 -0
- package/lib/state/State.d.ts +1 -1
- package/lib/state/State.js +1 -1
- package/lib/state/index.d.ts +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/storage/IAMStorage.js +14 -2
- package/lib/state/storage/index.d.ts +1 -1
- package/lib/state/storage/index.js +1 -1
- package/lib/state/substates/AIAgentState.js +4 -2
- package/lib/state/substates/CellState.js +6 -5
- package/lib/state/substates/CoreState.d.ts +1 -1
- package/lib/state/substates/CoreState.js +26 -17
- package/lib/state/substates/DatasourceState.js +1 -1
- package/lib/state/substates/IAMState.d.ts +4 -0
- package/lib/state/substates/IAMState.js +39 -23
- package/lib/state/substates/JupyterLabState.js +1 -1
- package/lib/state/substates/LayoutState.d.ts +2 -2
- package/lib/state/substates/LayoutState.js +41 -28
- package/lib/state/substates/OrganizationState.js +1 -1
- package/lib/state/substates/RuntimesState.js +11 -6
- package/lib/state/substates/SpaceState.js +1 -1
- package/lib/state/substates/SurveysState.js +4 -4
- package/lib/state/substates/TeamState.js +1 -1
- package/lib/test-setup.js +25 -3
- package/lib/theme/DatalayerTheme.js +1 -1
- package/lib/theme/DatalayerThemeProvider.js +17 -14
- package/lib/theme/Palette.js +1 -1
- package/lib/utils/Avatar.js +2 -2
- package/lib/utils/Browser.js +6 -6
- package/lib/utils/Cells.d.ts +1 -1
- package/lib/utils/Cookie.js +1 -1
- package/lib/utils/Date.js +2 -2
- package/lib/utils/Download.js +5 -3
- package/lib/utils/DownloadFile.js +4 -2
- package/lib/utils/Env.js +2 -1
- package/lib/utils/Lazy.d.ts +1 -1
- package/lib/utils/Lazy.js +2 -2
- package/lib/utils/Name.js +10 -8
- package/lib/utils/Notebook.d.ts +1 -1
- package/lib/utils/Notebook.js +3 -3
- package/lib/utils/Number.js +13 -9
- package/lib/utils/Plots.js +4 -4
- package/lib/utils/Screenshot.js +1 -1
- package/lib/utils/Sleep.js +1 -1
- package/lib/utils/Snapshot.js +2 -2
- package/lib/utils/String.js +2 -2
- package/lib/utils/Uri.js +1 -1
- package/lib/utils/WithSuspense.js +3 -6
- package/lib/utils/logger.d.ts +16 -0
- package/lib/utils/logger.js +52 -0
- package/package.json +49 -5
- package/lib/__tests__/App.test.js +0 -17
- /package/lib/{__tests__/App.test.d.ts → examples/main.d.ts} +0 -0
package/lib/hooks/useToast.js
CHANGED
|
@@ -9,12 +9,12 @@ import { Notification } from '@jupyterlab/apputils';
|
|
|
9
9
|
import { Button } from '@primer/react';
|
|
10
10
|
import { isInsideJupyterLab } from '../utils';
|
|
11
11
|
import { DatalayerThemeProvider } from '../theme';
|
|
12
|
-
const TOAST_POSITION =
|
|
12
|
+
const TOAST_POSITION = 'bottom-right';
|
|
13
13
|
const displayType2Class = {
|
|
14
14
|
accent: 'primary',
|
|
15
15
|
link: 'invisible',
|
|
16
16
|
warn: 'danger',
|
|
17
|
-
default: 'default'
|
|
17
|
+
default: 'default',
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Create a button with customized callback in a toast
|
|
@@ -48,11 +48,10 @@ export const useToast = () => {
|
|
|
48
48
|
switch (options.variant) {
|
|
49
49
|
case 'info': {
|
|
50
50
|
return insideJupyterLab
|
|
51
|
-
?
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
51
|
+
? Notification.info(message, {
|
|
52
|
+
autoClose: autoClose ?? 5000,
|
|
53
|
+
actions,
|
|
54
|
+
})
|
|
56
55
|
: toast.info(({ closeToast }) => createContent(message, () => {
|
|
57
56
|
if (closeToast)
|
|
58
57
|
closeToast();
|
|
@@ -62,7 +61,7 @@ export const useToast = () => {
|
|
|
62
61
|
return insideJupyterLab
|
|
63
62
|
? Notification.success(message, {
|
|
64
63
|
autoClose: autoClose ?? 5000,
|
|
65
|
-
actions
|
|
64
|
+
actions,
|
|
66
65
|
})
|
|
67
66
|
: toast.success(({ closeToast }) => createContent(message, () => {
|
|
68
67
|
if (closeToast)
|
|
@@ -73,7 +72,7 @@ export const useToast = () => {
|
|
|
73
72
|
return insideJupyterLab
|
|
74
73
|
? Notification.warning(message, {
|
|
75
74
|
autoClose: autoClose ?? false,
|
|
76
|
-
actions
|
|
75
|
+
actions,
|
|
77
76
|
})
|
|
78
77
|
: toast.warning(({ closeToast }) => createContent(message, () => {
|
|
79
78
|
if (closeToast)
|
|
@@ -84,7 +83,7 @@ export const useToast = () => {
|
|
|
84
83
|
return insideJupyterLab
|
|
85
84
|
? Notification.error(message, {
|
|
86
85
|
autoClose: autoClose ?? false,
|
|
87
|
-
actions
|
|
86
|
+
actions,
|
|
88
87
|
})
|
|
89
88
|
: toast.error(({ closeToast }) => createContent(message, () => {
|
|
90
89
|
if (closeToast)
|
|
@@ -99,10 +98,13 @@ export const useToast = () => {
|
|
|
99
98
|
: toast.promise(promise, {
|
|
100
99
|
error: { render: options.error.message, ...options.error.options },
|
|
101
100
|
pending: options.pending.message,
|
|
102
|
-
success: {
|
|
101
|
+
success: {
|
|
102
|
+
render: options.success.message,
|
|
103
|
+
...options.success.options,
|
|
104
|
+
},
|
|
103
105
|
}, {
|
|
104
106
|
position: TOAST_POSITION,
|
|
105
|
-
...options.pending.options
|
|
107
|
+
...options.pending.options,
|
|
106
108
|
});
|
|
107
109
|
};
|
|
108
110
|
return Object.freeze({
|
|
@@ -135,7 +137,7 @@ export const useToast = () => {
|
|
|
135
137
|
* @param options Task progress options
|
|
136
138
|
* @returns Toast id
|
|
137
139
|
*/
|
|
138
|
-
trackAsyncTask
|
|
140
|
+
trackAsyncTask,
|
|
139
141
|
});
|
|
140
142
|
};
|
|
141
143
|
export default useToast;
|
package/lib/hooks/useUpload.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { useState } from
|
|
6
|
-
import axios from
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import axios from 'axios';
|
|
7
7
|
// import useRun from "./useRun";
|
|
8
|
-
import { useIAMStore } from
|
|
8
|
+
import { useIAMStore } from '../state';
|
|
9
9
|
// TODO reuse useRun hook.
|
|
10
10
|
export const useUploadForm = (url) => {
|
|
11
11
|
const [isSuccess, setIsSuccess] = useState(false);
|
|
@@ -22,21 +22,21 @@ export const useUploadForm = (url) => {
|
|
|
22
22
|
setIsLoading(true);
|
|
23
23
|
const { data } = await axios.post(url, formData, {
|
|
24
24
|
headers: {
|
|
25
|
-
|
|
26
|
-
Authorization: `Bearer ${token}
|
|
25
|
+
'Content-Type': 'multipart/form-data',
|
|
26
|
+
Authorization: `Bearer ${token}`,
|
|
27
27
|
},
|
|
28
|
-
onUploadProgress:
|
|
28
|
+
onUploadProgress: progressEvent => {
|
|
29
29
|
const progress = (progressEvent.loaded / progressEvent.total) * 50;
|
|
30
30
|
setProgress(progress);
|
|
31
31
|
},
|
|
32
|
-
onDownloadProgress:
|
|
32
|
+
onDownloadProgress: progressEvent => {
|
|
33
33
|
const progress = 50 + (progressEvent.loaded / progressEvent.total) * 50;
|
|
34
34
|
setProgress(progress);
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
setProgress(100);
|
|
38
|
-
await new Promise(
|
|
39
|
-
setTimeout(() => resolve(
|
|
38
|
+
await new Promise(resolve => {
|
|
39
|
+
setTimeout(() => resolve('success'), 500);
|
|
40
40
|
});
|
|
41
41
|
setIsSuccess(true);
|
|
42
42
|
setProgress(0);
|
package/lib/hooks/useUser.js
CHANGED
package/lib/index.css
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export * from './state';
|
|
7
|
+
export * from './collaboration';
|
|
8
|
+
export * from './services';
|
|
9
|
+
// Export navigation before hooks to avoid conflicts
|
|
10
|
+
export * from './navigation';
|
|
11
|
+
export * from './hooks';
|
|
@@ -3,11 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import { AlertIcon } from
|
|
7
|
-
import { Flash, Link } from
|
|
8
|
-
import { useNavigate } from
|
|
6
|
+
import { AlertIcon } from '@primer/octicons-react';
|
|
7
|
+
import { Flash, Link } from '@primer/react';
|
|
8
|
+
import { useNavigate } from '../../hooks';
|
|
9
9
|
export const FlashMock = () => {
|
|
10
10
|
const navigate = useNavigate();
|
|
11
|
-
return (_jsxs(Flash, { variant: "warning", style: { marginBottom: 10 }, children: [_jsx(AlertIcon, {}), " This is a mock content.
|
|
11
|
+
return (_jsxs(Flash, { variant: "warning", style: { marginBottom: 10 }, children: [_jsx(AlertIcon, {}), " This is a mock content.", ' ', _jsx(Link, { href: "#", onClick: e => navigate('/contact', e), children: "Contact us" }), ' ', "if you'd like to know more about this feature."] }));
|
|
12
12
|
};
|
|
13
13
|
export default FlashMock;
|
|
@@ -2,31 +2,28 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
const TOKEN =
|
|
5
|
+
const TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2Rldi5kYXRhbGF5ZXIuaW8iLCJpYXQiOjE3MTc1MDE1MjYsImV4cCI6MTcxNzU4NzkyNiwic3ViIjp7InVpZCI6IjRkODk2ZjI0LWM1MzEtNDljMS1iMjcyLTRlNTM2NjJjZDNkZSIsImhhbmRsZSI6ImVyaWMiLCJlbWFpbCI6ImVyaWNAZGF0YWxheWVyLmlvIiwiZmlyc3RfbmFtZSI6IkVyaWMiLCJsYXN0X25hbWUiOiJDaGFybGVzIiwicm9sZXMiOlsic3lzdGVtX2FkbWluIiwidXNlciJdfSwianRpIjoiZTAxYjIzMTYtYWJlMi00OTkyLWJjMmUtY2UyODIzZGJiOTdmIiwicm9sZXMiOlsic3lzdGVtX2FkbWluIiwidXNlciJdfQ.-cnEfJAUhet_nBLmxzx96zuv3PMEsGWLNCN6HV8PEso';
|
|
6
6
|
export const systemAdminLogin = (handle = 'hello') => {
|
|
7
7
|
return {
|
|
8
|
-
success:
|
|
9
|
-
message:
|
|
8
|
+
success: 'true',
|
|
9
|
+
message: 'User is logged in.',
|
|
10
10
|
token: TOKEN,
|
|
11
11
|
user: {
|
|
12
|
-
avatar_url_s:
|
|
13
|
-
creation_ts_dt:
|
|
14
|
-
id:
|
|
12
|
+
avatar_url_s: 'https://www.gravatar.com/avatar/f78b756a5c0eb7dd186b6622c0afed82',
|
|
13
|
+
creation_ts_dt: '2024-06-01T08:55:45.676Z',
|
|
14
|
+
id: 'b1db2810-9d2b-48fb-93d9-151c577e8b8e',
|
|
15
15
|
join_request_ts_dt: null,
|
|
16
|
-
join_ts_dt:
|
|
17
|
-
last_update_ts_dt:
|
|
16
|
+
join_ts_dt: '2024-06-01T08:55:45.139Z',
|
|
17
|
+
last_update_ts_dt: '2024-06-01T08:56:40.595Z',
|
|
18
18
|
new_password_confirmation_ts_dt: null,
|
|
19
19
|
new_password_request_ts_dt: null,
|
|
20
|
-
origin_s:
|
|
21
|
-
roles_ss: [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type_s: "user",
|
|
26
|
-
email_s: "hello@datalayer.io",
|
|
27
|
-
first_name_t: "Hello",
|
|
20
|
+
origin_s: 'cli',
|
|
21
|
+
roles_ss: ['platform_admin', 'user'],
|
|
22
|
+
type_s: 'user',
|
|
23
|
+
email_s: 'hello@datalayer.io',
|
|
24
|
+
first_name_t: 'Hello',
|
|
28
25
|
handle_s: handle,
|
|
29
|
-
last_name_t:
|
|
30
|
-
}
|
|
26
|
+
last_name_t: 'Datalayer',
|
|
27
|
+
},
|
|
31
28
|
};
|
|
32
29
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAMStateProps } from
|
|
2
|
-
import { DatalayerRequest } from
|
|
1
|
+
import { IAMStateProps } from './../../hooks';
|
|
2
|
+
import { DatalayerRequest } from './../../hooks';
|
|
3
3
|
export declare const useDatalayerMock: (props?: IAMStateProps) => {
|
|
4
4
|
requestRun: <T = any>(request: DatalayerRequest) => Promise<T>;
|
|
5
5
|
};
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { useLocation } from '
|
|
5
|
+
import { useLocation } from './../../hooks';
|
|
6
6
|
import { useNavigate } from './../../hooks';
|
|
7
7
|
import { useToast } from './../../hooks';
|
|
8
8
|
import { useIAMStore } from '../../state';
|
|
9
|
-
import { systemAdminLogin
|
|
9
|
+
import { systemAdminLogin } from './rests';
|
|
10
10
|
const getMockResponse = (request) => {
|
|
11
11
|
const { url, method, body } = request;
|
|
12
|
-
if (url.match('/api/iam/v1/login$') && method ===
|
|
12
|
+
if (url.match('/api/iam/v1/login$') && method === 'POST') {
|
|
13
13
|
return systemAdminLogin(body.handle);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -29,7 +29,7 @@ export const useDatalayerMock = (props = { user: undefined, token: undefined })
|
|
|
29
29
|
const token_ = request.token ?? iamStore.token;
|
|
30
30
|
const headers = {
|
|
31
31
|
Accept: 'application/json',
|
|
32
|
-
'Content-Type': 'application/json'
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
33
|
};
|
|
34
34
|
if (token_) {
|
|
35
35
|
headers['Authorization'] = `Bearer ${token_}`;
|
|
@@ -38,8 +38,8 @@ export const useDatalayerMock = (props = { user: undefined, token: undefined })
|
|
|
38
38
|
method: request.method,
|
|
39
39
|
headers,
|
|
40
40
|
body: request.body ? JSON.stringify(request.body) : undefined,
|
|
41
|
-
credentials: token_ ? 'include' : 'omit'
|
|
42
|
-
}).then(
|
|
41
|
+
credentials: token_ ? 'include' : 'omit',
|
|
42
|
+
}).then(resp => {
|
|
43
43
|
if (resp.status < 200 || resp.status >= 300) {
|
|
44
44
|
if (resp.status === 401) {
|
|
45
45
|
console.log('Datalayer RUN sent a 401 return code.');
|
|
@@ -49,7 +49,7 @@ export const useDatalayerMock = (props = { user: undefined, token: undefined })
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
resp.json().then(
|
|
52
|
+
resp.json().then(r => {
|
|
53
53
|
const message = r.message;
|
|
54
54
|
const errors = r.errors;
|
|
55
55
|
if (errors) {
|
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { uniqueNamesGenerator, names } from
|
|
6
|
-
import { newUlid } from
|
|
7
|
-
import { newSpaceMock } from
|
|
8
|
-
import { newUserMock } from
|
|
5
|
+
import { uniqueNamesGenerator, names } from 'unique-names-generator';
|
|
6
|
+
import { newUlid } from '../../utils';
|
|
7
|
+
import { newSpaceMock } from './SpaceMock';
|
|
8
|
+
import { newUserMock } from './UserMock';
|
|
9
9
|
export const newCourseMock = (name) => {
|
|
10
10
|
const course = {
|
|
11
11
|
id: newUlid(),
|
|
12
12
|
owner: newUserMock(uniqueNamesGenerator({ dictionaries: [names] }), uniqueNamesGenerator({ dictionaries: [names] })),
|
|
13
13
|
handle: newUlid(),
|
|
14
14
|
type: 'space',
|
|
15
|
-
variant:
|
|
15
|
+
variant: 'course',
|
|
16
16
|
name: name,
|
|
17
|
-
description: name +
|
|
17
|
+
description: name + ' description.',
|
|
18
18
|
public: false,
|
|
19
19
|
creationDate: new Date(),
|
|
20
20
|
items: [],
|
|
21
21
|
itemIds: [],
|
|
22
|
-
seedSpace: newSpaceMock(
|
|
22
|
+
seedSpace: newSpaceMock('space content'),
|
|
23
23
|
};
|
|
24
24
|
return course;
|
|
25
25
|
};
|
|
26
|
-
export const COURSE_1_MOCK = newCourseMock(
|
|
27
|
-
export const COURSE_2_MOCK = newCourseMock(
|
|
28
|
-
export const COURSE_3_MOCK = newCourseMock(
|
|
26
|
+
export const COURSE_1_MOCK = newCourseMock('Course 1');
|
|
27
|
+
export const COURSE_2_MOCK = newCourseMock('Course 2');
|
|
28
|
+
export const COURSE_3_MOCK = newCourseMock('Course 3');
|
|
29
29
|
export const COURSES_MOCK = [COURSE_1_MOCK, COURSE_2_MOCK, COURSE_3_MOCK];
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { uniqueNamesGenerator, names, colors, adjectives, animals } from
|
|
6
|
-
import { newUlid } from
|
|
7
|
-
import { newUserMock } from
|
|
5
|
+
import { uniqueNamesGenerator, names, colors, adjectives, animals, } from 'unique-names-generator';
|
|
6
|
+
import { newUlid } from '../../utils';
|
|
7
|
+
import { newUserMock } from './UserMock';
|
|
8
8
|
export const newInviteMock = (message) => {
|
|
9
9
|
const invite = {
|
|
10
10
|
id: newUlid(),
|
|
@@ -16,7 +16,22 @@ export const newInviteMock = (message) => {
|
|
|
16
16
|
};
|
|
17
17
|
return invite;
|
|
18
18
|
};
|
|
19
|
-
export const INVITE_1_MOCK = newInviteMock('A ' +
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export const INVITE_1_MOCK = newInviteMock('A ' +
|
|
20
|
+
uniqueNamesGenerator({
|
|
21
|
+
dictionaries: [colors, adjectives, animals],
|
|
22
|
+
separator: ' ',
|
|
23
|
+
}) +
|
|
24
|
+
'.');
|
|
25
|
+
export const INVITE_2_MOCK = newInviteMock('A ' +
|
|
26
|
+
uniqueNamesGenerator({
|
|
27
|
+
dictionaries: [colors, adjectives, animals],
|
|
28
|
+
separator: ' ',
|
|
29
|
+
}) +
|
|
30
|
+
'.');
|
|
31
|
+
export const INVITE_3_MOCK = newInviteMock('A ' +
|
|
32
|
+
uniqueNamesGenerator({
|
|
33
|
+
dictionaries: [colors, adjectives, animals],
|
|
34
|
+
separator: ' ',
|
|
35
|
+
}) +
|
|
36
|
+
'.');
|
|
22
37
|
export const INVITES_MOCK = [INVITE_1_MOCK, INVITE_2_MOCK, INVITE_3_MOCK];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IOrganization } from
|
|
1
|
+
import { IOrganization } from '../../models/Organization';
|
|
2
2
|
export declare const ORGANISATION_1_MOCK: IOrganization;
|
|
3
3
|
export declare const ORGANISATION_2_MOCK: IOrganization;
|
|
4
4
|
export declare const ORGANISATION_3_MOCK: IOrganization;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { newUlid } from
|
|
5
|
+
import { newUlid } from '../../utils';
|
|
6
6
|
const newOrganizationMock = (name) => {
|
|
7
7
|
const organization = {
|
|
8
8
|
id: newUlid(),
|
|
9
9
|
handle: newUlid(),
|
|
10
|
-
type:
|
|
10
|
+
type: 'organization',
|
|
11
11
|
name: name,
|
|
12
|
-
description: name +
|
|
12
|
+
description: name + ' description.',
|
|
13
13
|
public: false,
|
|
14
14
|
members: [],
|
|
15
15
|
teams: [],
|
|
@@ -18,7 +18,11 @@ const newOrganizationMock = (name) => {
|
|
|
18
18
|
};
|
|
19
19
|
return organization;
|
|
20
20
|
};
|
|
21
|
-
export const ORGANISATION_1_MOCK = newOrganizationMock(
|
|
22
|
-
export const ORGANISATION_2_MOCK = newOrganizationMock(
|
|
23
|
-
export const ORGANISATION_3_MOCK = newOrganizationMock(
|
|
24
|
-
export const ORGANISATIONS_MOCK = [
|
|
21
|
+
export const ORGANISATION_1_MOCK = newOrganizationMock('Organization 1');
|
|
22
|
+
export const ORGANISATION_2_MOCK = newOrganizationMock('Organization 2');
|
|
23
|
+
export const ORGANISATION_3_MOCK = newOrganizationMock('Organization 3');
|
|
24
|
+
export const ORGANISATIONS_MOCK = [
|
|
25
|
+
ORGANISATION_1_MOCK,
|
|
26
|
+
ORGANISATION_2_MOCK,
|
|
27
|
+
ORGANISATION_3_MOCK,
|
|
28
|
+
];
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { newUlid } from
|
|
5
|
+
import { newUlid } from '../../utils';
|
|
6
6
|
export const newSchoolMock = (name) => {
|
|
7
7
|
const school = {
|
|
8
8
|
id: newUlid(),
|
|
9
9
|
handle: newUlid(),
|
|
10
|
-
type:
|
|
10
|
+
type: 'school',
|
|
11
11
|
name: name,
|
|
12
|
-
description: name +
|
|
12
|
+
description: name + ' description.',
|
|
13
13
|
public: false,
|
|
14
14
|
members: [],
|
|
15
15
|
students: [],
|
|
@@ -19,7 +19,7 @@ export const newSchoolMock = (name) => {
|
|
|
19
19
|
};
|
|
20
20
|
return school;
|
|
21
21
|
};
|
|
22
|
-
export const SCHOOL_1_MOCK = newSchoolMock(
|
|
23
|
-
export const SCHOOL_2_MOCK = newSchoolMock(
|
|
24
|
-
export const SCHOOL_3_MOCK = newSchoolMock(
|
|
22
|
+
export const SCHOOL_1_MOCK = newSchoolMock('School 1');
|
|
23
|
+
export const SCHOOL_2_MOCK = newSchoolMock('School 2');
|
|
24
|
+
export const SCHOOL_3_MOCK = newSchoolMock('School 3');
|
|
25
25
|
export const SCHOOLS_MOCK = [SCHOOL_1_MOCK, SCHOOL_2_MOCK, SCHOOL_3_MOCK];
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { uniqueNamesGenerator, names } from
|
|
6
|
-
import { newUlid } from
|
|
7
|
-
import { newUserMock } from
|
|
5
|
+
import { uniqueNamesGenerator, names } from 'unique-names-generator';
|
|
6
|
+
import { newUlid } from '../../utils';
|
|
7
|
+
import { newUserMock } from './UserMock';
|
|
8
8
|
export const newSpaceMock = (name) => {
|
|
9
9
|
const space = {
|
|
10
10
|
id: newUlid(),
|
|
11
11
|
owner: newUserMock(uniqueNamesGenerator({ dictionaries: [names] }), uniqueNamesGenerator({ dictionaries: [names] })),
|
|
12
12
|
handle: newUlid(),
|
|
13
|
-
type:
|
|
14
|
-
variant:
|
|
13
|
+
type: 'space',
|
|
14
|
+
variant: 'default',
|
|
15
15
|
name: name,
|
|
16
|
-
description: name +
|
|
16
|
+
description: name + ' description.',
|
|
17
17
|
public: false,
|
|
18
18
|
creationDate: new Date(),
|
|
19
19
|
};
|
|
20
20
|
return space;
|
|
21
21
|
};
|
|
22
|
-
export const SPACE_1_MOCK = newSpaceMock(
|
|
23
|
-
export const SPACE_2_MOCK = newSpaceMock(
|
|
24
|
-
export const SPACE_3 = newSpaceMock(
|
|
22
|
+
export const SPACE_1_MOCK = newSpaceMock('Space 1');
|
|
23
|
+
export const SPACE_2_MOCK = newSpaceMock('Space 2');
|
|
24
|
+
export const SPACE_3 = newSpaceMock('Space 3');
|
|
25
25
|
export const SPACES_MOCK = [SPACE_1_MOCK, SPACE_2_MOCK, SPACE_3];
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { newUlid } from
|
|
5
|
+
import { newUlid } from '../../utils';
|
|
6
6
|
const newTeamMock = (name) => {
|
|
7
7
|
const team = {
|
|
8
8
|
id: newUlid(),
|
|
9
|
-
type:
|
|
9
|
+
type: 'team',
|
|
10
10
|
handle: name,
|
|
11
11
|
name: name,
|
|
12
|
-
description: name +
|
|
12
|
+
description: name + ' description.',
|
|
13
13
|
public: false,
|
|
14
14
|
members: [],
|
|
15
15
|
creationDate: new Date(),
|
|
@@ -20,7 +20,7 @@ const newTeamMock = (name) => {
|
|
|
20
20
|
};
|
|
21
21
|
return team;
|
|
22
22
|
};
|
|
23
|
-
export const TEAM_1_MOCK = newTeamMock(
|
|
24
|
-
export const TEAM_2_MOCK = newTeamMock(
|
|
25
|
-
export const TEAM_3_MOCK = newTeamMock(
|
|
23
|
+
export const TEAM_1_MOCK = newTeamMock('Team 1');
|
|
24
|
+
export const TEAM_2_MOCK = newTeamMock('Team 2');
|
|
25
|
+
export const TEAM_3_MOCK = newTeamMock('Team 3');
|
|
26
26
|
export const TEAMS_MOCK = [TEAM_1_MOCK, TEAM_2_MOCK, TEAM_3_MOCK];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IUser } from
|
|
1
|
+
import { IUser } from '../../models/User';
|
|
2
2
|
export declare const newUserMock: (firstName?: string, lastName?: string) => IUser;
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { uniqueNamesGenerator, animals, names } from
|
|
6
|
-
import { newUlid, asDisplayName, namesAsInitials } from
|
|
5
|
+
import { uniqueNamesGenerator, animals, names } from 'unique-names-generator';
|
|
6
|
+
import { newUlid, asDisplayName, namesAsInitials } from '../../utils';
|
|
7
7
|
export const newUserMock = (firstName, lastName) => {
|
|
8
8
|
const mockFistName = firstName ?? uniqueNamesGenerator({ dictionaries: [names] });
|
|
9
9
|
const mockLastName = lastName ?? uniqueNamesGenerator({ dictionaries: [names] });
|
|
10
10
|
const user = {
|
|
11
11
|
id: newUlid(),
|
|
12
12
|
handle: uniqueNamesGenerator({ dictionaries: [animals] }).toLowerCase(),
|
|
13
|
-
email: mockFistName +
|
|
13
|
+
email: mockFistName + '@datalayer.test',
|
|
14
14
|
firstName: mockFistName,
|
|
15
15
|
lastName: mockLastName,
|
|
16
16
|
initials: namesAsInitials(mockFistName, mockLastName),
|
|
17
17
|
displayName: asDisplayName(mockFistName, mockLastName),
|
|
18
|
-
roles: [
|
|
19
|
-
'mock_role',
|
|
20
|
-
],
|
|
18
|
+
roles: ['mock_role'],
|
|
21
19
|
iamProviders: [],
|
|
22
20
|
setRoles: (roles) => { },
|
|
23
21
|
unsubscribedFromOutbounds: false,
|
|
@@ -4,7 +4,7 @@ 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 { ActionMenu, ActionList } from '@primer/react';
|
|
7
|
-
import { WorkflowIcon, ArchiveIcon, GearIcon, RocketIcon, CopyIcon, CommentIcon, BookIcon } from '@primer/octicons-react';
|
|
7
|
+
import { WorkflowIcon, ArchiveIcon, GearIcon, RocketIcon, CopyIcon, CommentIcon, BookIcon, } from '@primer/octicons-react';
|
|
8
8
|
export const ActionMenuMock = (props) => {
|
|
9
9
|
const { title } = props;
|
|
10
10
|
return (_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { children: title }), _jsx(ActionMenu.Overlay, { width: "auto", children: _jsxs(ActionList, { children: [_jsxs(ActionList.Item, { onSelect: () => alert('Workflows clicked'), children: ["Workflows", _jsx(ActionList.LeadingVisual, { children: _jsx(WorkflowIcon, {}) })] }), _jsxs(ActionList.Item, { onSelect: () => alert('Archived items clicked'), children: ["Archived items", _jsx(ActionList.LeadingVisual, { children: _jsx(ArchiveIcon, {}) })] }), _jsxs(ActionList.LinkItem, { href: "/", children: ["Settings", _jsx(ActionList.LeadingVisual, { children: _jsx(GearIcon, {}) })] }), _jsxs(ActionList.Item, { onSelect: () => alert('Make a copy clicked'), children: ["Make a copy", _jsx(ActionList.LeadingVisual, { children: _jsx(CopyIcon, {}) })] }), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: "GitHub projects" }), _jsxs(ActionList.LinkItem, { href: "/", children: ["What's new", _jsx(ActionList.LeadingVisual, { children: _jsx(RocketIcon, {}) })] }), _jsxs(ActionList.LinkItem, { href: "/", children: ["Give feedback", _jsx(ActionList.LeadingVisual, { children: _jsx(CommentIcon, {}) })] }), _jsxs(ActionList.LinkItem, { href: "/", children: ["GitHub Docs", _jsx(ActionList.LeadingVisual, { children: _jsx(BookIcon, {}) })] })] })] }) })] }));
|
|
@@ -4,12 +4,12 @@ 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 { Heading } from '@primer/react-brand';
|
|
7
|
-
import { lazyWithPreload, WithSuspense } from
|
|
7
|
+
import { lazyWithPreload, WithSuspense } from '../../utils';
|
|
8
8
|
import { HorizontalCenter } from '../../components/display';
|
|
9
9
|
import { CHART_4 } from './ChartMockOptions';
|
|
10
|
-
const ReactEcharts = WithSuspense(lazyWithPreload(() => import(
|
|
10
|
+
const ReactEcharts = WithSuspense(lazyWithPreload(() => import('echarts-for-react')), true);
|
|
11
11
|
export const ChartMock = (props) => {
|
|
12
12
|
const { title } = props;
|
|
13
|
-
return (_jsxs(HorizontalCenter, { children: [_jsx(Heading, { size: "3", children: title }), _jsx(ReactEcharts, { option: CHART_4, style: { width:
|
|
13
|
+
return (_jsxs(HorizontalCenter, { children: [_jsx(Heading, { size: "3", children: title }), _jsx(ReactEcharts, { option: CHART_4, style: { width: '600px', height: '300px' } })] }));
|
|
14
14
|
};
|
|
15
15
|
export default ChartMock;
|