@manta-eu/react 0.11.0 → 0.13.0
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 +59 -0
- package/dist/components/AppErrorBoundary.d.ts.map +1 -1
- package/dist/components/AppErrorBoundary.js +14 -11
- package/dist/components/AppErrorBoundary.js.map +1 -1
- package/dist/components/app-gate/AppGate.d.ts +8 -0
- package/dist/components/app-gate/AppGate.d.ts.map +1 -0
- package/dist/components/app-gate/AppGate.js +68 -0
- package/dist/components/app-gate/AppGate.js.map +1 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.d.ts +7 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.d.ts.map +1 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.js +19 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.js.map +1 -0
- package/dist/components/app-gate/EnterDatastoreRoute.d.ts +2 -0
- package/dist/components/app-gate/EnterDatastoreRoute.d.ts.map +1 -0
- package/dist/components/app-gate/EnterDatastoreRoute.js +25 -0
- package/dist/components/app-gate/EnterDatastoreRoute.js.map +1 -0
- package/dist/components/app-gate/ErrorRoute.d.ts +2 -0
- package/dist/components/app-gate/ErrorRoute.d.ts.map +1 -0
- package/dist/components/app-gate/ErrorRoute.js +27 -0
- package/dist/components/app-gate/ErrorRoute.js.map +1 -0
- package/dist/components/app-gate/FailureAlert.d.ts +5 -0
- package/dist/components/app-gate/FailureAlert.d.ts.map +1 -0
- package/dist/components/app-gate/FailureAlert.js +9 -0
- package/dist/components/app-gate/FailureAlert.js.map +1 -0
- package/dist/components/app-gate/NoDatastoreAccess.d.ts +8 -0
- package/dist/components/app-gate/NoDatastoreAccess.d.ts.map +1 -0
- package/dist/components/app-gate/NoDatastoreAccess.js +9 -0
- package/dist/components/app-gate/NoDatastoreAccess.js.map +1 -0
- package/dist/components/app-gate/NotFoundRoute.d.ts +2 -0
- package/dist/components/app-gate/NotFoundRoute.d.ts.map +1 -0
- package/dist/components/app-gate/NotFoundRoute.js +9 -0
- package/dist/components/app-gate/NotFoundRoute.js.map +1 -0
- package/dist/components/app-gate/PendingInvitations.d.ts +5 -0
- package/dist/components/app-gate/PendingInvitations.d.ts.map +1 -0
- package/dist/components/app-gate/PendingInvitations.js +58 -0
- package/dist/components/app-gate/PendingInvitations.js.map +1 -0
- package/dist/components/app-gate/ServiceError.d.ts +8 -0
- package/dist/components/app-gate/ServiceError.d.ts.map +1 -0
- package/dist/components/app-gate/ServiceError.js +10 -0
- package/dist/components/app-gate/ServiceError.js.map +1 -0
- package/dist/components/app-gate/index.d.ts +3 -0
- package/dist/components/app-gate/index.d.ts.map +1 -0
- package/dist/components/app-gate/index.js +3 -0
- package/dist/components/app-gate/index.js.map +1 -0
- package/dist/components/app-gate/sdk-route-elements.d.ts +23 -0
- package/dist/components/app-gate/sdk-route-elements.d.ts.map +1 -0
- package/dist/components/app-gate/sdk-route-elements.js +35 -0
- package/dist/components/app-gate/sdk-route-elements.js.map +1 -0
- package/dist/components/app-shell/AppShell.d.ts +7 -0
- package/dist/components/app-shell/AppShell.d.ts.map +1 -0
- package/dist/components/app-shell/AppShell.js +10 -0
- package/dist/components/app-shell/AppShell.js.map +1 -0
- package/dist/components/app-shell/AppShellRoutes.d.ts +9 -0
- package/dist/components/app-shell/AppShellRoutes.d.ts.map +1 -0
- package/dist/components/app-shell/AppShellRoutes.js +20 -0
- package/dist/components/app-shell/AppShellRoutes.js.map +1 -0
- package/dist/components/app-shell/GroupDatastores.d.ts +8 -0
- package/dist/components/app-shell/GroupDatastores.d.ts.map +1 -0
- package/dist/components/app-shell/GroupDatastores.js +15 -0
- package/dist/components/app-shell/GroupDatastores.js.map +1 -0
- package/dist/components/app-shell/GroupRoute.d.ts +2 -0
- package/dist/components/app-shell/GroupRoute.d.ts.map +1 -0
- package/dist/components/app-shell/GroupRoute.js +22 -0
- package/dist/components/app-shell/GroupRoute.js.map +1 -0
- package/dist/components/app-shell/index.d.ts +3 -0
- package/dist/components/app-shell/index.d.ts.map +1 -0
- package/dist/components/app-shell/index.js +3 -0
- package/dist/components/app-shell/index.js.map +1 -0
- package/dist/components/authenticated-chat/index.d.ts +1 -2
- package/dist/components/authenticated-chat/index.d.ts.map +1 -1
- package/dist/components/authenticated-chat/index.js +1 -12
- package/dist/components/authenticated-chat/index.js.map +1 -1
- package/dist/components/chat-view/Chat.d.ts +2 -1
- package/dist/components/chat-view/Chat.d.ts.map +1 -1
- package/dist/components/chat-view/Chat.js +3 -2
- package/dist/components/chat-view/Chat.js.map +1 -1
- package/dist/components/chat-view/MessageItem.d.ts.map +1 -1
- package/dist/components/chat-view/MessageItem.js +4 -2
- package/dist/components/chat-view/MessageItem.js.map +1 -1
- package/dist/components/chat-view/tool-part-rendering.d.ts +1 -0
- package/dist/components/chat-view/tool-part-rendering.d.ts.map +1 -1
- package/dist/components/chat-view/tool-part-rendering.js +8 -1
- package/dist/components/chat-view/tool-part-rendering.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -0
- package/dist/components/chip/index.d.ts.map +1 -1
- package/dist/components/chip/index.js +2 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/embedded-chat/index.d.ts +1 -1
- package/dist/components/embedded-chat/index.d.ts.map +1 -1
- package/dist/components/embedded-chat/index.js +1 -1
- package/dist/components/embedded-chat/index.js.map +1 -1
- package/dist/components/input/input-date-time.d.ts +6 -0
- package/dist/components/input/input-date-time.d.ts.map +1 -1
- package/dist/components/input/input-date-time.js +2 -1
- package/dist/components/input/input-date-time.js.map +1 -1
- package/dist/components/input/input-date.d.ts +22 -0
- package/dist/components/input/input-date.d.ts.map +1 -1
- package/dist/components/input/input-date.js +28 -14
- package/dist/components/input/input-date.js.map +1 -1
- package/dist/components/input/input-time.d.ts +9 -0
- package/dist/components/input/input-time.d.ts.map +1 -1
- package/dist/components/input/input-time.js +29 -18
- package/dist/components/input/input-time.js.map +1 -1
- package/dist/components/layouts/RouteLayout.d.ts +0 -9
- package/dist/components/layouts/RouteLayout.d.ts.map +1 -1
- package/dist/components/layouts/RouteLayout.js +7 -4
- package/dist/components/layouts/RouteLayout.js.map +1 -1
- package/dist/components/layouts/Sidebar.d.ts +1 -8
- package/dist/components/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/layouts/Sidebar.js +7 -14
- package/dist/components/layouts/Sidebar.js.map +1 -1
- package/dist/components/plan-limits/PlanLimitsDialog.d.ts +20 -0
- package/dist/components/plan-limits/PlanLimitsDialog.d.ts.map +1 -0
- package/dist/components/plan-limits/PlanLimitsDialog.js +109 -0
- package/dist/components/plan-limits/PlanLimitsDialog.js.map +1 -0
- package/dist/components/plan-limits/index.d.ts +4 -0
- package/dist/components/plan-limits/index.d.ts.map +1 -0
- package/dist/components/plan-limits/index.js +2 -0
- package/dist/components/plan-limits/index.js.map +1 -0
- package/dist/components/plan-limits/plan-limits-client.d.ts +15 -0
- package/dist/components/plan-limits/plan-limits-client.d.ts.map +1 -0
- package/dist/components/plan-limits/plan-limits-client.js +44 -0
- package/dist/components/plan-limits/plan-limits-client.js.map +1 -0
- package/dist/components/plan-limits/plan-limits-model.d.ts +66 -0
- package/dist/components/plan-limits/plan-limits-model.d.ts.map +1 -0
- package/dist/components/plan-limits/plan-limits-model.js +123 -0
- package/dist/components/plan-limits/plan-limits-model.js.map +1 -0
- package/dist/components/plan-limits/plan-limits-save.d.ts +31 -0
- package/dist/components/plan-limits/plan-limits-save.d.ts.map +1 -0
- package/dist/components/plan-limits/plan-limits-save.js +43 -0
- package/dist/components/plan-limits/plan-limits-save.js.map +1 -0
- package/dist/components/planning/PlanLimitsAction.d.ts +6 -0
- package/dist/components/planning/PlanLimitsAction.d.ts.map +1 -0
- package/dist/components/planning/PlanLimitsAction.js +19 -0
- package/dist/components/planning/PlanLimitsAction.js.map +1 -0
- package/dist/components/slider/index.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/datastore-picker/datastore-picker-rows.d.ts +7 -0
- package/dist/datastore-picker/datastore-picker-rows.d.ts.map +1 -1
- package/dist/datastore-picker/datastore-picker-rows.js +26 -22
- package/dist/datastore-picker/datastore-picker-rows.js.map +1 -1
- package/dist/globals.css +85 -2
- package/dist/hooks/use-action-plans-list.d.ts +3 -0
- package/dist/hooks/use-action-plans-list.d.ts.map +1 -1
- package/dist/hooks/use-action-plans-list.js +8 -9
- package/dist/hooks/use-action-plans-list.js.map +1 -1
- package/dist/hooks/use-activity-feed.d.ts +10 -1
- package/dist/hooks/use-activity-feed.d.ts.map +1 -1
- package/dist/hooks/use-activity-feed.js +9 -11
- package/dist/hooks/use-activity-feed.js.map +1 -1
- package/dist/hooks/use-entity.d.ts +4 -3
- package/dist/hooks/use-entity.d.ts.map +1 -1
- package/dist/hooks/use-entity.js +4 -4
- package/dist/hooks/use-entity.js.map +1 -1
- package/dist/hooks/use-manual-actions.d.ts +1 -1
- package/dist/hooks/use-manual-actions.d.ts.map +1 -1
- package/dist/hooks/use-manual-actions.js +5 -5
- package/dist/hooks/use-manual-actions.js.map +1 -1
- package/dist/hooks/use-unsaved-changes-warning.d.ts +2 -0
- package/dist/hooks/use-unsaved-changes-warning.d.ts.map +1 -0
- package/dist/hooks/use-unsaved-changes-warning.js +13 -0
- package/dist/hooks/use-unsaved-changes-warning.js.map +1 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +4 -3
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/hooks/useChatPanelSync.d.ts.map +1 -1
- package/dist/hooks/useChatPanelSync.js +2 -3
- package/dist/hooks/useChatPanelSync.js.map +1 -1
- package/dist/hooks/useDatastoreSelection.d.ts.map +1 -1
- package/dist/hooks/useDatastoreSelection.js +11 -4
- package/dist/hooks/useDatastoreSelection.js.map +1 -1
- package/dist/hooks/useExecuteAction.d.ts +1 -0
- package/dist/hooks/useExecuteAction.d.ts.map +1 -1
- package/dist/hooks/useExecuteAction.js.map +1 -1
- package/dist/hooks/useLoginRedirect.d.ts +6 -0
- package/dist/hooks/useLoginRedirect.d.ts.map +1 -0
- package/dist/hooks/useLoginRedirect.js +51 -0
- package/dist/hooks/useLoginRedirect.js.map +1 -0
- package/dist/hooks/usePlanLimits.d.ts +18 -0
- package/dist/hooks/usePlanLimits.d.ts.map +1 -0
- package/dist/hooks/usePlanLimits.js +56 -0
- package/dist/hooks/usePlanLimits.js.map +1 -0
- package/dist/ldo-ui.d.ts +1 -1
- package/dist/ldo-ui.d.ts.map +1 -1
- package/dist/ldo-ui.js.map +1 -1
- package/dist/lib/app-tools.d.ts +18 -0
- package/dist/lib/app-tools.d.ts.map +1 -0
- package/dist/lib/app-tools.js +42 -0
- package/dist/lib/app-tools.js.map +1 -0
- package/dist/lib/chat-types.d.ts +3 -0
- package/dist/lib/chat-types.d.ts.map +1 -1
- package/dist/lib/chat-types.js.map +1 -1
- package/dist/lib/datastore-route-table.d.ts +3 -0
- package/dist/lib/datastore-route-table.d.ts.map +1 -1
- package/dist/lib/datastore-route-table.js +6 -0
- package/dist/lib/datastore-route-table.js.map +1 -1
- package/dist/lib/graphql-error.d.ts +2 -0
- package/dist/lib/graphql-error.d.ts.map +1 -0
- package/dist/lib/graphql-error.js +7 -0
- package/dist/lib/graphql-error.js.map +1 -0
- package/dist/lib/update-notice.d.ts +2 -1
- package/dist/lib/update-notice.d.ts.map +1 -1
- package/dist/lib/update-notice.js +8 -2
- package/dist/lib/update-notice.js.map +1 -1
- package/dist/providers/ActiveChatProvider.d.ts +2 -0
- package/dist/providers/ActiveChatProvider.d.ts.map +1 -1
- package/dist/providers/ActiveChatProvider.js +6 -3
- package/dist/providers/ActiveChatProvider.js.map +1 -1
- package/dist/providers/ActiveDatastoreProvider.d.ts +12 -0
- package/dist/providers/ActiveDatastoreProvider.d.ts.map +1 -1
- package/dist/providers/ActiveDatastoreProvider.js +114 -11
- package/dist/providers/ActiveDatastoreProvider.js.map +1 -1
- package/dist/providers/AuthContext.d.ts +1 -0
- package/dist/providers/AuthContext.d.ts.map +1 -1
- package/dist/providers/AuthContext.js.map +1 -1
- package/dist/providers/KnowledgeGraphStateContext.d.ts +2 -2
- package/dist/providers/KnowledgeGraphStateContext.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateProvider.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateProvider.js +8 -49
- package/dist/providers/KnowledgeGraphStateProvider.js.map +1 -1
- package/dist/providers/MantaClientProvider.d.ts.map +1 -1
- package/dist/providers/MantaClientProvider.js +3 -3
- package/dist/providers/MantaClientProvider.js.map +1 -1
- package/dist/providers/index.d.ts +3 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/routes/activity/detail/ActivityDetailRoute.d.ts.map +1 -1
- package/dist/routes/activity/detail/ActivityDetailRoute.js +1 -3
- package/dist/routes/activity/detail/ActivityDetailRoute.js.map +1 -1
- package/dist/routes/activity/index.d.ts.map +1 -1
- package/dist/routes/activity/index.js +1 -3
- package/dist/routes/activity/index.js.map +1 -1
- package/dist/routes/chat/index.d.ts +2 -21
- package/dist/routes/chat/index.d.ts.map +1 -1
- package/dist/routes/chat/index.js +4 -2
- package/dist/routes/chat/index.js.map +1 -1
- package/dist/routes/data-collection/index.d.ts.map +1 -1
- package/dist/routes/data-collection/index.js +1 -3
- package/dist/routes/data-collection/index.js.map +1 -1
- package/dist/routes/data-explorer/components/DataExplorerLayout.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/DataExplorerLayout.js +1 -3
- package/dist/routes/data-explorer/components/DataExplorerLayout.js.map +1 -1
- package/dist/routes/data-explorer/components/class-detail/UsedByRules.js +2 -2
- package/dist/routes/data-explorer/components/class-detail/UsedByRules.js.map +1 -1
- package/dist/routes/datastores/index.d.ts.map +1 -1
- package/dist/routes/datastores/index.js +2 -2
- package/dist/routes/datastores/index.js.map +1 -1
- package/dist/routes/explain/index.d.ts.map +1 -1
- package/dist/routes/explain/index.js +1 -3
- package/dist/routes/explain/index.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.d.ts +0 -1
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.js +3 -2
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.d.ts +0 -1
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.js +4 -3
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.js.map +1 -1
- package/dist/routes/integrations/types.d.ts +2 -1
- package/dist/routes/integrations/types.d.ts.map +1 -1
- package/dist/routes/integrations/types.js +16 -0
- package/dist/routes/integrations/types.js.map +1 -1
- package/dist/routes/memories/components/DateValueInput.d.ts +16 -0
- package/dist/routes/memories/components/DateValueInput.d.ts.map +1 -0
- package/dist/routes/memories/components/DateValueInput.js +35 -0
- package/dist/routes/memories/components/DateValueInput.js.map +1 -0
- package/dist/routes/memories/components/EntityValuePicker.d.ts +11 -0
- package/dist/routes/memories/components/EntityValuePicker.d.ts.map +1 -0
- package/dist/routes/memories/components/EntityValuePicker.js +61 -0
- package/dist/routes/memories/components/EntityValuePicker.js.map +1 -0
- package/dist/routes/memories/components/FieldLabel.d.ts +12 -0
- package/dist/routes/memories/components/FieldLabel.d.ts.map +1 -0
- package/dist/routes/memories/components/FieldLabel.js +12 -0
- package/dist/routes/memories/components/FieldLabel.js.map +1 -0
- package/dist/routes/memories/components/ImportanceSlider.d.ts +2 -0
- package/dist/routes/memories/components/ImportanceSlider.d.ts.map +1 -1
- package/dist/routes/memories/components/ImportanceSlider.js +4 -1
- package/dist/routes/memories/components/ImportanceSlider.js.map +1 -1
- package/dist/routes/memories/components/MemoriesFilters.d.ts +2 -2
- package/dist/routes/memories/components/MemoriesFilters.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoriesFilters.js.map +1 -1
- package/dist/routes/memories/components/MemoriesPanel.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoriesPanel.js +4 -0
- package/dist/routes/memories/components/MemoriesPanel.js.map +1 -1
- package/dist/routes/memories/components/MemoriesTabPanel.d.ts +2 -2
- package/dist/routes/memories/components/MemoriesTabPanel.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryActions.d.ts +2 -0
- package/dist/routes/memories/components/MemoryActions.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryActions.js +3 -3
- package/dist/routes/memories/components/MemoryActions.js.map +1 -1
- package/dist/routes/memories/components/MemoryFields.d.ts +15 -3
- package/dist/routes/memories/components/MemoryFields.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFields.js +34 -5
- package/dist/routes/memories/components/MemoryFields.js.map +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.d.ts +6 -3
- package/dist/routes/memories/components/MemoryFormDialog.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.js +105 -59
- package/dist/routes/memories/components/MemoryFormDialog.js.map +1 -1
- package/dist/routes/memories/components/MemoryPropertyFields.d.ts +10 -0
- package/dist/routes/memories/components/MemoryPropertyFields.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoryPropertyFields.js +67 -0
- package/dist/routes/memories/components/MemoryPropertyFields.js.map +1 -0
- package/dist/routes/memories/components/RuleDraftDialog.d.ts +7 -0
- package/dist/routes/memories/components/RuleDraftDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/RuleDraftDialog.js +20 -0
- package/dist/routes/memories/components/RuleDraftDialog.js.map +1 -0
- package/dist/routes/memories/components/SchemasTab.d.ts +17 -2
- package/dist/routes/memories/components/SchemasTab.d.ts.map +1 -1
- package/dist/routes/memories/components/SchemasTab.js +146 -28
- package/dist/routes/memories/components/SchemasTab.js.map +1 -1
- package/dist/routes/memories/components/badges.d.ts +7 -0
- package/dist/routes/memories/components/badges.d.ts.map +1 -1
- package/dist/routes/memories/components/badges.js +11 -3
- package/dist/routes/memories/components/badges.js.map +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts +4 -2
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts.map +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.js +31 -15
- package/dist/routes/memories/hooks/useMemoryColumns.js.map +1 -1
- package/dist/routes/memories/index.d.ts +2 -1
- package/dist/routes/memories/index.d.ts.map +1 -1
- package/dist/routes/memories/index.js +72 -30
- package/dist/routes/memories/index.js.map +1 -1
- package/dist/routes/memories/memory-mutation-input.d.ts.map +1 -1
- package/dist/routes/memories/memory-mutation-input.js +5 -2
- package/dist/routes/memories/memory-mutation-input.js.map +1 -1
- package/dist/routes/memories/memory-property-values.d.ts +13 -0
- package/dist/routes/memories/memory-property-values.d.ts.map +1 -0
- package/dist/routes/memories/memory-property-values.js +40 -0
- package/dist/routes/memories/memory-property-values.js.map +1 -0
- package/dist/routes/memories/schemas/AllowedValuesField.d.ts +14 -0
- package/dist/routes/memories/schemas/AllowedValuesField.d.ts.map +1 -0
- package/dist/routes/memories/schemas/AllowedValuesField.js +64 -0
- package/dist/routes/memories/schemas/AllowedValuesField.js.map +1 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.d.ts +127 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.d.ts.map +1 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.js +285 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.d.ts +20 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.js +54 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.d.ts +15 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.js +8 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.d.ts +15 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.js +74 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.d.ts +10 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.js +242 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.d.ts +13 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.js +13 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.js.map +1 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.d.ts +12 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.d.ts.map +1 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.js +10 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.js.map +1 -0
- package/dist/routes/memories/schemas/schema-form.d.ts +72 -0
- package/dist/routes/memories/schemas/schema-form.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-form.js +279 -0
- package/dist/routes/memories/schemas/schema-form.js.map +1 -0
- package/dist/routes/memories/schemas/schema-impact.d.ts +13 -0
- package/dist/routes/memories/schemas/schema-impact.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-impact.js +40 -0
- package/dist/routes/memories/schemas/schema-impact.js.map +1 -0
- package/dist/routes/memories/schemas/schema-route.d.ts +18 -0
- package/dist/routes/memories/schemas/schema-route.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-route.js +21 -0
- package/dist/routes/memories/schemas/schema-route.js.map +1 -0
- package/dist/routes/memories/schemas/schema-rule-context.d.ts +17 -0
- package/dist/routes/memories/schemas/schema-rule-context.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-rule-context.js +83 -0
- package/dist/routes/memories/schemas/schema-rule-context.js.map +1 -0
- package/dist/routes/memories/schemas/schema-table.d.ts +11 -0
- package/dist/routes/memories/schemas/schema-table.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-table.js +34 -0
- package/dist/routes/memories/schemas/schema-table.js.map +1 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.d.ts +32 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.js +31 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.js.map +1 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.d.ts +51 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.js +175 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.js.map +1 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.d.ts +46 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.js +93 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.js.map +1 -0
- package/dist/routes/memories/schemas/useSchemasTab.d.ts +18 -0
- package/dist/routes/memories/schemas/useSchemasTab.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useSchemasTab.js +92 -0
- package/dist/routes/memories/schemas/useSchemasTab.js.map +1 -0
- package/dist/routes/plans/index.d.ts.map +1 -1
- package/dist/routes/plans/index.js +2 -2
- package/dist/routes/plans/index.js.map +1 -1
- package/dist/routes/rules/components/CreateRuleChatModal.d.ts +7 -1
- package/dist/routes/rules/components/CreateRuleChatModal.d.ts.map +1 -1
- package/dist/routes/rules/components/CreateRuleChatModal.js +9 -4
- package/dist/routes/rules/components/CreateRuleChatModal.js.map +1 -1
- package/dist/routes/rules/components/RuleValueControls.d.ts.map +1 -1
- package/dist/routes/rules/components/RuleValueControls.js +3 -24
- package/dist/routes/rules/components/RuleValueControls.js.map +1 -1
- package/dist/routes/rules/components/rule-value-input.d.ts +11 -0
- package/dist/routes/rules/components/rule-value-input.d.ts.map +1 -0
- package/dist/routes/rules/components/rule-value-input.js +24 -0
- package/dist/routes/rules/components/rule-value-input.js.map +1 -0
- package/dist/routes/rules/components/rules.utils.d.ts +5 -0
- package/dist/routes/rules/components/rules.utils.d.ts.map +1 -1
- package/dist/routes/rules/components/rules.utils.js +18 -3
- package/dist/routes/rules/components/rules.utils.js.map +1 -1
- package/dist/routes/rules/pages.d.ts +1 -1
- package/dist/routes/rules/pages.d.ts.map +1 -1
- package/dist/routes/rules/pages.js +1 -1
- package/dist/routes/rules/pages.js.map +1 -1
- package/dist/shared/graph-derived-queries.d.ts.map +1 -1
- package/dist/shared/graph-derived-queries.js +4 -1
- package/dist/shared/graph-derived-queries.js.map +1 -1
- package/dist/worker/index.d.ts +22 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +110 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/policy.d.ts +21 -0
- package/dist/worker/policy.d.ts.map +1 -0
- package/dist/worker/policy.js +42 -0
- package/dist/worker/policy.js.map +1 -0
- package/dist/worker/proxy.d.ts +14 -0
- package/dist/worker/proxy.d.ts.map +1 -0
- package/dist/worker/proxy.js +58 -0
- package/dist/worker/proxy.js.map +1 -0
- package/dist/worker/session.d.ts +24 -0
- package/dist/worker/session.d.ts.map +1 -0
- package/dist/worker/session.js +72 -0
- package/dist/worker/session.js.map +1 -0
- package/package.json +52 -7
- package/src/app-subpaths.json +9 -1
- package/src/components/AppErrorBoundary.tsx +14 -11
- package/src/components/app-gate/AppGate.tsx +122 -0
- package/src/components/app-gate/AwaitingDatastoreStatus.tsx +35 -0
- package/src/components/app-gate/EnterDatastoreRoute.tsx +30 -0
- package/src/components/app-gate/ErrorRoute.tsx +43 -0
- package/src/components/app-gate/FailureAlert.tsx +15 -0
- package/src/components/app-gate/NoDatastoreAccess.tsx +26 -0
- package/src/components/app-gate/NotFoundRoute.tsx +20 -0
- package/src/components/app-gate/PendingInvitations.tsx +134 -0
- package/src/components/app-gate/ServiceError.tsx +27 -0
- package/src/components/app-gate/index.ts +2 -0
- package/src/components/app-gate/sdk-route-elements.tsx +46 -0
- package/src/components/app-shell/AppShell.tsx +22 -0
- package/src/components/app-shell/AppShellRoutes.tsx +34 -0
- package/src/components/app-shell/GroupDatastores.tsx +28 -0
- package/src/components/app-shell/GroupRoute.tsx +34 -0
- package/src/components/app-shell/index.ts +2 -0
- package/src/components/authenticated-chat/index.tsx +1 -34
- package/src/components/chat-view/Chat.tsx +9 -3
- package/src/components/chat-view/MessageItem.tsx +10 -2
- package/src/components/chat-view/tool-part-rendering.ts +10 -1
- package/src/components/chip/index.tsx +8 -1
- package/src/components/embedded-chat/index.tsx +2 -1
- package/src/components/input/input-date-time.tsx +10 -3
- package/src/components/input/input-date.tsx +93 -21
- package/src/components/input/input-time.tsx +59 -26
- package/src/components/layouts/RouteLayout.tsx +11 -50
- package/src/components/layouts/Sidebar.tsx +21 -23
- package/src/components/plan-limits/PlanLimitsDialog.tsx +331 -0
- package/src/components/plan-limits/index.tsx +3 -0
- package/src/components/plan-limits/plan-limits-client.ts +71 -0
- package/src/components/plan-limits/plan-limits-model.ts +180 -0
- package/src/components/plan-limits/plan-limits-save.ts +68 -0
- package/src/components/planning/PlanLimitsAction.tsx +44 -0
- package/src/components/slider/index.tsx +2 -1
- package/src/datastore-picker/datastore-picker-rows.ts +36 -20
- package/src/hooks/use-action-plans-list.ts +20 -12
- package/src/hooks/use-activity-feed.ts +30 -14
- package/src/hooks/use-entity.ts +11 -6
- package/src/hooks/use-manual-actions.ts +11 -6
- package/src/hooks/use-unsaved-changes-warning.ts +12 -0
- package/src/hooks/useAuth.ts +5 -3
- package/src/hooks/useChatPanelSync.ts +2 -3
- package/src/hooks/useDatastoreSelection.ts +10 -4
- package/src/hooks/useExecuteAction.ts +2 -0
- package/src/hooks/useLoginRedirect.ts +66 -0
- package/src/hooks/usePlanLimits.ts +97 -0
- package/src/ldo-ui.ts +1 -0
- package/src/lib/app-tools.ts +63 -0
- package/src/lib/chat-types.ts +5 -0
- package/src/lib/datastore-route-table.ts +9 -0
- package/src/lib/graphql-error.ts +7 -0
- package/src/lib/update-notice.ts +12 -2
- package/src/providers/ActiveChatProvider.tsx +8 -3
- package/src/providers/ActiveDatastoreProvider.tsx +179 -9
- package/src/providers/AuthContext.ts +1 -0
- package/src/providers/KnowledgeGraphStateContext.ts +2 -2
- package/src/providers/KnowledgeGraphStateProvider.tsx +13 -65
- package/src/providers/MantaClientProvider.tsx +8 -3
- package/src/providers/index.tsx +7 -4
- package/src/routes/activity/detail/ActivityDetailRoute.tsx +1 -10
- package/src/routes/activity/index.tsx +1 -10
- package/src/routes/chat/index.tsx +11 -47
- package/src/routes/data-collection/index.tsx +1 -11
- package/src/routes/data-explorer/components/DataExplorerLayout.tsx +1 -11
- package/src/routes/data-explorer/components/class-detail/UsedByRules.tsx +2 -2
- package/src/routes/datastores/index.tsx +3 -9
- package/src/routes/explain/index.tsx +1 -11
- package/src/routes/integrations/components/connect-forms/DashConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/GoogleAdsConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/InferalCredentialConnectForm.tsx +5 -3
- package/src/routes/integrations/components/connect-forms/KlaviyoConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/OAuthSetupConnectForm.tsx +7 -7
- package/src/routes/integrations/components/connect-forms/TriplewhaleConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/WoocommerceConnectForm.tsx +0 -1
- package/src/routes/integrations/types.ts +22 -6
- package/src/routes/memories/components/DateValueInput.tsx +72 -0
- package/src/routes/memories/components/EntityValuePicker.tsx +132 -0
- package/src/routes/memories/components/FieldLabel.tsx +49 -0
- package/src/routes/memories/components/ImportanceSlider.tsx +5 -1
- package/src/routes/memories/components/MemoriesFilters.tsx +2 -2
- package/src/routes/memories/components/MemoriesPanel.tsx +7 -3
- package/src/routes/memories/components/MemoriesTabPanel.tsx +2 -2
- package/src/routes/memories/components/MemoryActions.tsx +26 -2
- package/src/routes/memories/components/MemoryFields.tsx +75 -12
- package/src/routes/memories/components/MemoryFormDialog.tsx +305 -199
- package/src/routes/memories/components/MemoryPropertyFields.tsx +288 -0
- package/src/routes/memories/components/RuleDraftDialog.tsx +35 -0
- package/src/routes/memories/components/SchemasTab.tsx +481 -118
- package/src/routes/memories/components/badges.tsx +16 -4
- package/src/routes/memories/hooks/useMemoryColumns.tsx +69 -35
- package/src/routes/memories/index.tsx +125 -51
- package/src/routes/memories/memory-mutation-input.ts +5 -2
- package/src/routes/memories/memory-property-values.ts +83 -0
- package/src/routes/memories/schemas/AllowedValuesField.tsx +188 -0
- package/src/routes/memories/schemas/MemorySchemaPage.tsx +476 -0
- package/src/routes/memories/schemas/SchemaChangeReviewDialog.tsx +290 -0
- package/src/routes/memories/schemas/SchemaConfirmDialog.tsx +62 -0
- package/src/routes/memories/schemas/SchemaDetailPage.tsx +373 -0
- package/src/routes/memories/schemas/SchemaEditorForm.tsx +990 -0
- package/src/routes/memories/schemas/SchemaTemplatesDialog.tsx +81 -0
- package/src/routes/memories/schemas/ValueTypeSelect.tsx +37 -0
- package/src/routes/memories/schemas/schema-form.ts +360 -0
- package/src/routes/memories/schemas/schema-impact.ts +66 -0
- package/src/routes/memories/schemas/schema-route.ts +30 -0
- package/src/routes/memories/schemas/schema-rule-context.ts +103 -0
- package/src/routes/memories/schemas/schema-table.ts +54 -0
- package/src/routes/memories/schemas/useMemorySchemaMutations.ts +49 -0
- package/src/routes/memories/schemas/useSchemaChangeReview.ts +238 -0
- package/src/routes/memories/schemas/useSchemaLifecycle.tsx +151 -0
- package/src/routes/memories/schemas/useSchemasTab.ts +119 -0
- package/src/routes/plans/index.tsx +3 -14
- package/src/routes/rules/components/CreateRuleChatModal.tsx +46 -22
- package/src/routes/rules/components/RuleValueControls.tsx +3 -35
- package/src/routes/rules/components/rule-value-input.ts +34 -0
- package/src/routes/rules/components/rules.utils.ts +25 -3
- package/src/routes/rules/pages.ts +5 -1
- package/src/shared/graph-derived-queries.ts +6 -0
- package/src/themes/manta-dark.css +4 -0
- package/src/worker/index.ts +175 -0
- package/src/worker/policy.ts +62 -0
- package/src/worker/proxy.ts +101 -0
- package/src/worker/session.ts +111 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { GQLMemorySchemaFieldsFragment, GQLMemorySchemaRuleCountsQuery } from "@manta-eu/client";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
|
|
4
|
+
export function ruleCountsFrom(
|
|
5
|
+
response: GQLMemorySchemaRuleCountsQuery["memorySchemaRuleCounts"] | undefined,
|
|
6
|
+
): ReadonlyMap<string, number> | undefined {
|
|
7
|
+
if (!response || isPresent(response.error)) return undefined;
|
|
8
|
+
return new Map(response.counts.map(({ iri, ruleCount }) => [iri, ruleCount]));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type CountFilter = "ANY" | "NONE" | "SOME";
|
|
12
|
+
|
|
13
|
+
export type SchemaCountKey = "properties" | "rules" | "memories";
|
|
14
|
+
|
|
15
|
+
export type SchemaCountFilters = Record<SchemaCountKey, CountFilter>;
|
|
16
|
+
|
|
17
|
+
export const anyCount: SchemaCountFilters = { properties: "ANY", rules: "ANY", memories: "ANY" };
|
|
18
|
+
|
|
19
|
+
export type SchemaCounts = Record<SchemaCountKey, number | null>;
|
|
20
|
+
|
|
21
|
+
export function schemaCounts(
|
|
22
|
+
schema: GQLMemorySchemaFieldsFragment,
|
|
23
|
+
ruleCounts: ReadonlyMap<string, number> | undefined,
|
|
24
|
+
): SchemaCounts {
|
|
25
|
+
return {
|
|
26
|
+
properties: schema.properties.filter((property) => !property.computed).length,
|
|
27
|
+
rules: ruleCounts ? (ruleCounts.get(schema.iri) ?? 0) : null,
|
|
28
|
+
memories: schema.memoryCount ?? null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function countMatches(count: number | null, filter: CountFilter): boolean {
|
|
33
|
+
if (filter === "ANY") return true;
|
|
34
|
+
if (count === null) return false;
|
|
35
|
+
return filter === "NONE" ? count === 0 : count > 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function filterSchemas(
|
|
39
|
+
schemas: readonly GQLMemorySchemaFieldsFragment[],
|
|
40
|
+
search: string,
|
|
41
|
+
filters: SchemaCountFilters,
|
|
42
|
+
ruleCounts: ReadonlyMap<string, number> | undefined,
|
|
43
|
+
): GQLMemorySchemaFieldsFragment[] {
|
|
44
|
+
const needle = search.trim().toLowerCase();
|
|
45
|
+
return schemas.filter((schema) => {
|
|
46
|
+
const matchesSearch =
|
|
47
|
+
!isPresent(needle) ||
|
|
48
|
+
schema.label.toLowerCase().includes(needle) ||
|
|
49
|
+
(schema.description ?? "").toLowerCase().includes(needle);
|
|
50
|
+
if (!matchesSearch) return false;
|
|
51
|
+
const counts = schemaCounts(schema, ruleCounts);
|
|
52
|
+
return (Object.keys(filters) as SchemaCountKey[]).every((key) => countMatches(counts[key], filters[key]));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useAddMemorySchemaFromTemplateMutation,
|
|
3
|
+
useArchiveMemorySchemaMutation,
|
|
4
|
+
useClearMemorySchemaPropertyValuesMutation,
|
|
5
|
+
useCreateMemorySchemaMutation,
|
|
6
|
+
useDeleteMemorySchemaMutation,
|
|
7
|
+
useDismissMemorySchemaTemplateUpdateMutation,
|
|
8
|
+
useMemoriesQuery,
|
|
9
|
+
useMemorySchemasQuery,
|
|
10
|
+
useMemorySchemaTemplatesQuery,
|
|
11
|
+
useMemorySchemaUsageQuery,
|
|
12
|
+
useResetMemorySchemaToTemplateMutation,
|
|
13
|
+
useUnarchiveMemorySchemaMutation,
|
|
14
|
+
useUpdateMemorySchemaMutation,
|
|
15
|
+
} from "@manta-eu/client";
|
|
16
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
17
|
+
import { useCallback } from "react";
|
|
18
|
+
import { invalidateQueries } from "#lib/tanstack-query";
|
|
19
|
+
import { useMantaClient } from "#providers/index";
|
|
20
|
+
|
|
21
|
+
// A schema write can rewrite stored values, so the memories that hold them are refetched with it.
|
|
22
|
+
export function useMemorySchemaMutations() {
|
|
23
|
+
const { mantaClient } = useMantaClient();
|
|
24
|
+
const queryClient = useQueryClient();
|
|
25
|
+
|
|
26
|
+
const refresh = useCallback(async () => {
|
|
27
|
+
await invalidateQueries(queryClient, [
|
|
28
|
+
useMemorySchemasQuery,
|
|
29
|
+
useMemorySchemaUsageQuery,
|
|
30
|
+
useMemorySchemaTemplatesQuery,
|
|
31
|
+
useMemoriesQuery,
|
|
32
|
+
]);
|
|
33
|
+
}, [queryClient]);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
refresh,
|
|
37
|
+
create: useCreateMemorySchemaMutation(mantaClient),
|
|
38
|
+
update: useUpdateMemorySchemaMutation(mantaClient),
|
|
39
|
+
archive: useArchiveMemorySchemaMutation(mantaClient),
|
|
40
|
+
unarchive: useUnarchiveMemorySchemaMutation(mantaClient),
|
|
41
|
+
remove: useDeleteMemorySchemaMutation(mantaClient),
|
|
42
|
+
addFromTemplate: useAddMemorySchemaFromTemplateMutation(mantaClient),
|
|
43
|
+
resetToTemplate: useResetMemorySchemaToTemplateMutation(mantaClient),
|
|
44
|
+
dismissTemplateUpdate: useDismissMemorySchemaTemplateUpdateMutation(mantaClient),
|
|
45
|
+
clearValues: useClearMemorySchemaPropertyValuesMutation(mantaClient),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type MemorySchemaMutations = ReturnType<typeof useMemorySchemaMutations>;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GQLMemorySchemaMutationStatus,
|
|
3
|
+
type GQLMemorySchemaMutationResultFragment,
|
|
4
|
+
type GQLMemorySchemaOptionRemapInput,
|
|
5
|
+
} from "@manta-eu/client";
|
|
6
|
+
import { parseError } from "@manta-eu/client/shared/error-utils";
|
|
7
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
8
|
+
import { useCallback, useRef, useState } from "react";
|
|
9
|
+
import { toast } from "sonner";
|
|
10
|
+
import { match, P } from "ts-pattern";
|
|
11
|
+
import {
|
|
12
|
+
impactNeedsReview,
|
|
13
|
+
optionRemapsInput,
|
|
14
|
+
type MemorySchemaImpact,
|
|
15
|
+
type OptionRemapChoices,
|
|
16
|
+
} from "./schema-impact";
|
|
17
|
+
|
|
18
|
+
export type SchemaChangeRequest = {
|
|
19
|
+
expectedRevision: number;
|
|
20
|
+
optionRemaps: GQLMemorySchemaOptionRemapInput[];
|
|
21
|
+
clearUnconvertibleValues: boolean;
|
|
22
|
+
dryRun: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type SchemaChangeResult = GQLMemorySchemaMutationResultFragment;
|
|
26
|
+
|
|
27
|
+
export type SchemaChangeRun = (request: SchemaChangeRequest) => Promise<SchemaChangeResult>;
|
|
28
|
+
|
|
29
|
+
export type SchemaClearRun = (path: string, expectedRevision: number) => Promise<SchemaChangeResult>;
|
|
30
|
+
|
|
31
|
+
export type SchemaChangeCallbacks = {
|
|
32
|
+
onApplied: (result: SchemaChangeResult) => void | Promise<void>;
|
|
33
|
+
onInvalid?: (result: SchemaChangeResult) => void;
|
|
34
|
+
onStale: () => void | Promise<void>;
|
|
35
|
+
onRevisionChange?: (revision: number) => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type ReviewState = {
|
|
39
|
+
session: number;
|
|
40
|
+
title: string;
|
|
41
|
+
run: SchemaChangeRun;
|
|
42
|
+
callbacks: SchemaChangeCallbacks;
|
|
43
|
+
revision: number;
|
|
44
|
+
impact: MemorySchemaImpact | null;
|
|
45
|
+
proposed: SchemaChangeResult["schema"];
|
|
46
|
+
choices: OptionRemapChoices;
|
|
47
|
+
clearUnconvertible: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type Outcome = "open" | "closed";
|
|
51
|
+
|
|
52
|
+
export function refusalMessage(result: SchemaChangeResult): string {
|
|
53
|
+
const validation = result.validationErrors.map((error) => error.message).join("; ");
|
|
54
|
+
return result.error ?? (isPresent(validation) ? validation : "The schema could not be changed");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function requestFor(state: ReviewState, dryRun: boolean): SchemaChangeRequest {
|
|
58
|
+
return {
|
|
59
|
+
expectedRevision: state.revision,
|
|
60
|
+
optionRemaps: state.impact ? optionRemapsInput(state.impact, state.choices) : [],
|
|
61
|
+
clearUnconvertibleValues: state.clearUnconvertible,
|
|
62
|
+
dryRun,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function reportFailure(error: unknown, fallback: string) {
|
|
67
|
+
const parsed = parseError(error, fallback);
|
|
68
|
+
toast.error(parsed.message, { description: parsed.description });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Every check is a dry run against the server, so the review shows exactly what applying would do. Each review is a
|
|
72
|
+
// session: closing it ends the session, so a check still in flight cannot open the dialog again. Only the latest check
|
|
73
|
+
// settles, so a slower earlier one cannot bring back choices the person has since changed.
|
|
74
|
+
export function useSchemaChangeReview() {
|
|
75
|
+
const session = useRef(0);
|
|
76
|
+
const latestCheck = useRef(0);
|
|
77
|
+
const [state, setState] = useState<ReviewState | null>(null);
|
|
78
|
+
const [isChecking, setChecking] = useState(false);
|
|
79
|
+
const [isApplying, setApplying] = useState(false);
|
|
80
|
+
const [clearingPath, setClearingPath] = useState<string | null>(null);
|
|
81
|
+
|
|
82
|
+
const settle = useCallback(async (result: SchemaChangeResult, next: ReviewState, show = true): Promise<Outcome> => {
|
|
83
|
+
const { onApplied, onInvalid, onStale } = next.callbacks;
|
|
84
|
+
const current = next.session === session.current;
|
|
85
|
+
return match(result.status)
|
|
86
|
+
.with(GQLMemorySchemaMutationStatus.Ok, async (): Promise<Outcome> => {
|
|
87
|
+
setState(null);
|
|
88
|
+
await onApplied(result);
|
|
89
|
+
return "closed";
|
|
90
|
+
})
|
|
91
|
+
.with(
|
|
92
|
+
P.union(GQLMemorySchemaMutationStatus.Preview, GQLMemorySchemaMutationStatus.Blocked),
|
|
93
|
+
async (): Promise<Outcome> => {
|
|
94
|
+
if (show && current) setState({ ...next, impact: result.impact ?? null, proposed: result.schema });
|
|
95
|
+
return current ? "open" : "closed";
|
|
96
|
+
},
|
|
97
|
+
)
|
|
98
|
+
.with(GQLMemorySchemaMutationStatus.Invalid, async (): Promise<Outcome> => {
|
|
99
|
+
setState(null);
|
|
100
|
+
if (onInvalid) onInvalid(result);
|
|
101
|
+
else toast.error(refusalMessage(result));
|
|
102
|
+
return "closed";
|
|
103
|
+
})
|
|
104
|
+
.with(
|
|
105
|
+
P.union(GQLMemorySchemaMutationStatus.Conflict, GQLMemorySchemaMutationStatus.NotFound),
|
|
106
|
+
async (): Promise<Outcome> => {
|
|
107
|
+
setState(null);
|
|
108
|
+
toast.error(refusalMessage(result));
|
|
109
|
+
await onStale();
|
|
110
|
+
return "closed";
|
|
111
|
+
},
|
|
112
|
+
)
|
|
113
|
+
.with(GQLMemorySchemaMutationStatus.Limit, async (): Promise<Outcome> => {
|
|
114
|
+
setState(null);
|
|
115
|
+
toast.error(refusalMessage(result));
|
|
116
|
+
return "closed";
|
|
117
|
+
})
|
|
118
|
+
.exhaustive();
|
|
119
|
+
}, []);
|
|
120
|
+
|
|
121
|
+
const check = useCallback(
|
|
122
|
+
async (next: ReviewState, show = true) => {
|
|
123
|
+
const ticket = ++latestCheck.current;
|
|
124
|
+
const superseded = () => ticket !== latestCheck.current;
|
|
125
|
+
setChecking(true);
|
|
126
|
+
try {
|
|
127
|
+
const result = await next.run(requestFor(next, true));
|
|
128
|
+
if (superseded()) return null;
|
|
129
|
+
return { result, outcome: await settle(result, next, show) };
|
|
130
|
+
} catch (error) {
|
|
131
|
+
if (superseded()) return null;
|
|
132
|
+
setState(null);
|
|
133
|
+
reportFailure(error, "Failed to check the change");
|
|
134
|
+
return null;
|
|
135
|
+
} finally {
|
|
136
|
+
if (!superseded()) setChecking(false);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
[settle],
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const applyState = useCallback(
|
|
143
|
+
async (current: ReviewState) => {
|
|
144
|
+
setApplying(true);
|
|
145
|
+
try {
|
|
146
|
+
await settle(await current.run(requestFor(current, false)), current);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
reportFailure(error, "Failed to save the schema");
|
|
149
|
+
} finally {
|
|
150
|
+
setApplying(false);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
[settle],
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// `alwaysReview` shows the dialog even when no stored value moves, for a change the person did not author.
|
|
157
|
+
const start = useCallback(
|
|
158
|
+
async (options: {
|
|
159
|
+
title: string;
|
|
160
|
+
run: SchemaChangeRun;
|
|
161
|
+
revision: number;
|
|
162
|
+
callbacks: SchemaChangeCallbacks;
|
|
163
|
+
alwaysReview?: boolean;
|
|
164
|
+
}) => {
|
|
165
|
+
session.current += 1;
|
|
166
|
+
const initial: ReviewState = {
|
|
167
|
+
session: session.current,
|
|
168
|
+
title: options.title,
|
|
169
|
+
run: options.run,
|
|
170
|
+
callbacks: options.callbacks,
|
|
171
|
+
revision: options.revision,
|
|
172
|
+
impact: null,
|
|
173
|
+
proposed: null,
|
|
174
|
+
choices: {},
|
|
175
|
+
clearUnconvertible: false,
|
|
176
|
+
};
|
|
177
|
+
const alwaysReview = options.alwaysReview === true;
|
|
178
|
+
if (alwaysReview) setState(initial);
|
|
179
|
+
const checked = await check(initial, alwaysReview);
|
|
180
|
+
if (checked === null || checked.outcome === "closed" || alwaysReview) return;
|
|
181
|
+
if (initial.session !== session.current) return;
|
|
182
|
+
const reviewed = { ...initial, impact: checked.result.impact ?? null, proposed: checked.result.schema };
|
|
183
|
+
if (reviewed.impact && !impactNeedsReview(reviewed.impact)) await applyState(reviewed);
|
|
184
|
+
else setState(reviewed);
|
|
185
|
+
},
|
|
186
|
+
[check, applyState],
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const recheck = useCallback(
|
|
190
|
+
(patch: Partial<Pick<ReviewState, "choices" | "clearUnconvertible">>) => {
|
|
191
|
+
if (state === null) return;
|
|
192
|
+
const next = { ...state, ...patch };
|
|
193
|
+
setState(next);
|
|
194
|
+
void check(next);
|
|
195
|
+
},
|
|
196
|
+
[state, check],
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const clearValues = useCallback(
|
|
200
|
+
async (path: string, clear: SchemaClearRun) => {
|
|
201
|
+
if (state === null) return;
|
|
202
|
+
setClearingPath(path);
|
|
203
|
+
try {
|
|
204
|
+
const result = await clear(path, state.revision);
|
|
205
|
+
if (result.status !== GQLMemorySchemaMutationStatus.Ok || !result.schema) {
|
|
206
|
+
toast.error(refusalMessage(result));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
toast.success("Values cleared");
|
|
210
|
+
state.callbacks.onRevisionChange?.(result.schema.revision);
|
|
211
|
+
await check({ ...state, revision: result.schema.revision });
|
|
212
|
+
} catch (error) {
|
|
213
|
+
reportFailure(error, "Failed to clear the values");
|
|
214
|
+
} finally {
|
|
215
|
+
setClearingPath(null);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
[state, check],
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
state,
|
|
223
|
+
isChecking,
|
|
224
|
+
isApplying,
|
|
225
|
+
clearingPath,
|
|
226
|
+
start,
|
|
227
|
+
close: () => {
|
|
228
|
+
session.current += 1;
|
|
229
|
+
setState(null);
|
|
230
|
+
},
|
|
231
|
+
apply: () => (state ? applyState(state) : Promise.resolve()),
|
|
232
|
+
setRemapChoice: (key: string, choice: string) => recheck({ choices: { ...(state?.choices ?? {}), [key]: choice } }),
|
|
233
|
+
setClearUnconvertible: (clearUnconvertible: boolean) => recheck({ clearUnconvertible }),
|
|
234
|
+
clearValues,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type SchemaChangeReview = ReturnType<typeof useSchemaChangeReview>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { GQLMemorySchemaMutationStatus, type GQLMemorySchemaFieldsFragment } from "@manta-eu/client";
|
|
2
|
+
import { humanCount } from "@manta-eu/lib/humanize";
|
|
3
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
4
|
+
import { useCallback, useState } from "react";
|
|
5
|
+
import { toast } from "sonner";
|
|
6
|
+
import { match, P } from "ts-pattern";
|
|
7
|
+
import { readableBlockers } from "./schema-impact";
|
|
8
|
+
import { SchemaConfirmDialog } from "./SchemaConfirmDialog";
|
|
9
|
+
import { useMemorySchemaMutations } from "./useMemorySchemaMutations";
|
|
10
|
+
import { refusalMessage, reportFailure, type SchemaChangeResult } from "./useSchemaChangeReview";
|
|
11
|
+
|
|
12
|
+
export function reportResult(result: SchemaChangeResult, success: string): boolean {
|
|
13
|
+
return match(result)
|
|
14
|
+
.with({ status: GQLMemorySchemaMutationStatus.Ok }, () => {
|
|
15
|
+
toast.success(success);
|
|
16
|
+
return true;
|
|
17
|
+
})
|
|
18
|
+
.with({ status: GQLMemorySchemaMutationStatus.Blocked, impact: { blockers: P.when(isPresent) } }, ({ impact }) => {
|
|
19
|
+
toast.error("This cannot be done yet", { description: readableBlockers(impact).join(" ") });
|
|
20
|
+
return false;
|
|
21
|
+
})
|
|
22
|
+
.otherwise(() => {
|
|
23
|
+
toast.error(refusalMessage(result));
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function archiveBlockedReason(ruleCount: number | null | undefined): string | null {
|
|
29
|
+
if (!ruleCount) return null;
|
|
30
|
+
return ruleCount === 1
|
|
31
|
+
? "1 rule uses this schema. Change that rule first."
|
|
32
|
+
: `${humanCount(ruleCount, "rule")} use this schema. Change those rules first.`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function deleteBlockedReason(memoryCount: number | null | undefined, ruleCount?: number | null): string | null {
|
|
36
|
+
const rulesBlock = archiveBlockedReason(ruleCount);
|
|
37
|
+
if (rulesBlock !== null) return rulesBlock;
|
|
38
|
+
if (!memoryCount) return null;
|
|
39
|
+
return `${humanCount(memoryCount, "memory")} ${memoryCount === 1 ? "uses" : "use"} this schema, so it can only be archived`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type Confirming = { action: "archive" | "delete"; schema: GQLMemorySchemaFieldsFragment };
|
|
43
|
+
|
|
44
|
+
export function useSchemaLifecycle(options: { onDeleted?: () => void } = {}) {
|
|
45
|
+
const { onDeleted } = options;
|
|
46
|
+
const mutations = useMemorySchemaMutations();
|
|
47
|
+
const [confirming, setConfirming] = useState<Confirming | null>(null);
|
|
48
|
+
const isPending = mutations.archive.isPending || mutations.unarchive.isPending || mutations.remove.isPending;
|
|
49
|
+
|
|
50
|
+
const { refresh } = mutations;
|
|
51
|
+
const runStatus = useCallback(
|
|
52
|
+
async (
|
|
53
|
+
action: () => Promise<SchemaChangeResult>,
|
|
54
|
+
success: string,
|
|
55
|
+
after?: (result: SchemaChangeResult) => void,
|
|
56
|
+
) => {
|
|
57
|
+
try {
|
|
58
|
+
const result = await action();
|
|
59
|
+
if (reportResult(result, success)) after?.(result);
|
|
60
|
+
await refresh();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
reportFailure(error, "The schema could not be changed");
|
|
63
|
+
} finally {
|
|
64
|
+
setConfirming(null);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[refresh],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const unarchive = mutations.unarchive.mutateAsync;
|
|
71
|
+
const restore = useCallback(
|
|
72
|
+
(schema: GQLMemorySchemaFieldsFragment) => {
|
|
73
|
+
void runStatus(
|
|
74
|
+
async () =>
|
|
75
|
+
(await unarchive({ input: { iri: schema.iri, expectedRevision: schema.revision } })).unarchiveMemorySchema,
|
|
76
|
+
`Restored ${schema.label}`,
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
[runStatus, unarchive],
|
|
80
|
+
);
|
|
81
|
+
const askToArchive = useCallback(
|
|
82
|
+
(schema: GQLMemorySchemaFieldsFragment) => setConfirming({ action: "archive", schema }),
|
|
83
|
+
[],
|
|
84
|
+
);
|
|
85
|
+
const askToDelete = useCallback(
|
|
86
|
+
(schema: GQLMemorySchemaFieldsFragment) => setConfirming({ action: "delete", schema }),
|
|
87
|
+
[],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const archiving = confirming?.action === "archive" ? confirming.schema : null;
|
|
91
|
+
const deleting = confirming?.action === "delete" ? confirming.schema : null;
|
|
92
|
+
|
|
93
|
+
const dialogs = (
|
|
94
|
+
<>
|
|
95
|
+
<SchemaConfirmDialog
|
|
96
|
+
open={archiving !== null}
|
|
97
|
+
title={`Archive ${archiving?.label ?? "this schema"}?`}
|
|
98
|
+
description="No new memory can use it. Memories that already use it keep their values, and you can restore it later."
|
|
99
|
+
confirmLabel="Archive"
|
|
100
|
+
pendingLabel="Archiving…"
|
|
101
|
+
isPending={mutations.archive.isPending}
|
|
102
|
+
onCancel={() => setConfirming(null)}
|
|
103
|
+
onConfirm={() => {
|
|
104
|
+
if (archiving === null) return;
|
|
105
|
+
void runStatus(
|
|
106
|
+
async () =>
|
|
107
|
+
(
|
|
108
|
+
await mutations.archive.mutateAsync({
|
|
109
|
+
input: { iri: archiving.iri, expectedRevision: archiving.revision },
|
|
110
|
+
})
|
|
111
|
+
).archiveMemorySchema,
|
|
112
|
+
`Archived ${archiving.label}`,
|
|
113
|
+
);
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
<SchemaConfirmDialog
|
|
117
|
+
open={deleting !== null}
|
|
118
|
+
title={`Delete ${deleting?.label ?? "this schema"}?`}
|
|
119
|
+
description="This removes the schema for good. No memory uses it."
|
|
120
|
+
confirmLabel="Delete"
|
|
121
|
+
pendingLabel="Deleting…"
|
|
122
|
+
destructive
|
|
123
|
+
isPending={mutations.remove.isPending}
|
|
124
|
+
onCancel={() => setConfirming(null)}
|
|
125
|
+
onConfirm={() => {
|
|
126
|
+
if (deleting === null) return;
|
|
127
|
+
void runStatus(
|
|
128
|
+
async () =>
|
|
129
|
+
(
|
|
130
|
+
await mutations.remove.mutateAsync({
|
|
131
|
+
input: { iri: deleting.iri, expectedRevision: deleting.revision },
|
|
132
|
+
})
|
|
133
|
+
).deleteMemorySchema,
|
|
134
|
+
`Deleted ${deleting.label}`,
|
|
135
|
+
onDeleted,
|
|
136
|
+
);
|
|
137
|
+
}}
|
|
138
|
+
/>
|
|
139
|
+
</>
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
mutations,
|
|
144
|
+
isPending,
|
|
145
|
+
runStatus,
|
|
146
|
+
askToArchive,
|
|
147
|
+
askToDelete,
|
|
148
|
+
restore,
|
|
149
|
+
dialogs,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GQLMemorySchemaMutationStatus,
|
|
3
|
+
GQLMemorySchemaStatus,
|
|
4
|
+
useMemorySchemasQuery,
|
|
5
|
+
useMemorySchemaTemplatesQuery,
|
|
6
|
+
type GQLMemorySchemaFieldsFragment,
|
|
7
|
+
} from "@manta-eu/client";
|
|
8
|
+
import { parseError } from "@manta-eu/client/shared/error-utils";
|
|
9
|
+
import { Archive, EyeOff, LayoutTemplate, Plus } from "lucide-react";
|
|
10
|
+
import { useCallback, useMemo, useState } from "react";
|
|
11
|
+
import { useLocation, useNavigate, useParams } from "react-router";
|
|
12
|
+
import { toast } from "sonner";
|
|
13
|
+
import { memorySchemaView, newMemorySchemaPath } from "./schema-route";
|
|
14
|
+
import type { SchemaTemplatesDialogProps } from "./SchemaTemplatesDialog";
|
|
15
|
+
import { useMemorySchemaMutations } from "./useMemorySchemaMutations";
|
|
16
|
+
import type { PageHeaderAction } from "#components/layouts/page/index";
|
|
17
|
+
import { useMantaClient } from "#providers/index";
|
|
18
|
+
|
|
19
|
+
const emptySchemas: GQLMemorySchemaFieldsFragment[] = [];
|
|
20
|
+
|
|
21
|
+
// Everything the memories route needs for its Schemas tab, the schema pages under it, and the defaults dialog.
|
|
22
|
+
export function useSchemasTab(options: { canManage: boolean }) {
|
|
23
|
+
const { canManage } = options;
|
|
24
|
+
const { mantaClient } = useMantaClient();
|
|
25
|
+
const navigate = useNavigate();
|
|
26
|
+
const { schemaName } = useParams<{ schemaName?: string }>();
|
|
27
|
+
const { pathname } = useLocation();
|
|
28
|
+
|
|
29
|
+
const { data, isLoading, error } = useMemorySchemasQuery(mantaClient, { includeArchived: true });
|
|
30
|
+
const schemas = data?.memorySchemas.schemas ?? emptySchemas;
|
|
31
|
+
const errorMessage =
|
|
32
|
+
data?.memorySchemas.error ?? (error ? parseError(error, "Failed to load schemas").message : null);
|
|
33
|
+
const mutations = useMemorySchemaMutations();
|
|
34
|
+
|
|
35
|
+
const [query, setQuery] = useState("");
|
|
36
|
+
const [showArchived, setShowArchived] = useState(false);
|
|
37
|
+
const [showTemplates, setShowTemplates] = useState(false);
|
|
38
|
+
const [addingTemplateIri, setAddingTemplateIri] = useState<string | null>(null);
|
|
39
|
+
const {
|
|
40
|
+
data: templatesData,
|
|
41
|
+
isLoading: templatesLoading,
|
|
42
|
+
error: templatesError,
|
|
43
|
+
} = useMemorySchemaTemplatesQuery(mantaClient, undefined, { enabled: showTemplates && canManage });
|
|
44
|
+
|
|
45
|
+
const listedSchemas = useMemo(
|
|
46
|
+
() => (showArchived ? schemas : schemas.filter((schema) => schema.status === GQLMemorySchemaStatus.Active)),
|
|
47
|
+
[schemas, showArchived],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const addTemplate = useCallback(
|
|
51
|
+
async (templateIri: string) => {
|
|
52
|
+
setAddingTemplateIri(templateIri);
|
|
53
|
+
try {
|
|
54
|
+
const result = (await mutations.addFromTemplate.mutateAsync({ templateIri })).addMemorySchemaFromTemplate;
|
|
55
|
+
if (result.status !== GQLMemorySchemaMutationStatus.Ok) {
|
|
56
|
+
throw new Error(result.error ?? "The default schema could not be restored");
|
|
57
|
+
}
|
|
58
|
+
toast.success(`Restored ${result.schema?.label ?? "the default schema"}`);
|
|
59
|
+
await mutations.refresh();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
const err = parseError(e, "Failed to restore the default schema");
|
|
62
|
+
toast.error(err.message, { description: err.description });
|
|
63
|
+
} finally {
|
|
64
|
+
setAddingTemplateIri(null);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[mutations],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const openNew = useCallback(() => void navigate(newMemorySchemaPath), [navigate]);
|
|
71
|
+
|
|
72
|
+
const headerActions: PageHeaderAction[] = [
|
|
73
|
+
{
|
|
74
|
+
key: "archived-schemas",
|
|
75
|
+
label: showArchived ? "Hide archived" : "Show archived",
|
|
76
|
+
icon: showArchived ? EyeOff : Archive,
|
|
77
|
+
variant: "secondary",
|
|
78
|
+
active: showArchived,
|
|
79
|
+
onClick: () => setShowArchived((v) => !v),
|
|
80
|
+
},
|
|
81
|
+
...(canManage
|
|
82
|
+
? [
|
|
83
|
+
{
|
|
84
|
+
key: "templates",
|
|
85
|
+
label: "Restore defaults",
|
|
86
|
+
icon: LayoutTemplate,
|
|
87
|
+
variant: "secondary",
|
|
88
|
+
onClick: () => setShowTemplates(true),
|
|
89
|
+
} satisfies PageHeaderAction,
|
|
90
|
+
{ key: "new-schema", label: "New schema", icon: Plus, onClick: openNew } satisfies PageHeaderAction,
|
|
91
|
+
]
|
|
92
|
+
: []),
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const templatesDialog: SchemaTemplatesDialogProps = {
|
|
96
|
+
open: showTemplates,
|
|
97
|
+
templates: templatesData?.memorySchemaTemplates.templates ?? [],
|
|
98
|
+
isLoading: templatesLoading,
|
|
99
|
+
errorMessage:
|
|
100
|
+
templatesData?.memorySchemaTemplates.error ??
|
|
101
|
+
(templatesError ? parseError(templatesError, "Failed to load the default schemas").message : null),
|
|
102
|
+
addingIri: addingTemplateIri,
|
|
103
|
+
onAdd: (iri) => void addTemplate(iri),
|
|
104
|
+
onClose: () => setShowTemplates(false),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
view: memorySchemaView(pathname, schemaName),
|
|
109
|
+
schemas,
|
|
110
|
+
listedSchemas,
|
|
111
|
+
isLoading,
|
|
112
|
+
errorMessage,
|
|
113
|
+
query,
|
|
114
|
+
setQuery,
|
|
115
|
+
openNew,
|
|
116
|
+
headerActions,
|
|
117
|
+
templatesDialog,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -30,7 +30,8 @@ function renderActionPlansRouteLayout(props: ActionPlansFrameProps) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function PlansRoute() {
|
|
33
|
-
const { datastore,
|
|
33
|
+
const { datastore, user } = useAuthContext();
|
|
34
|
+
|
|
34
35
|
const { planName } = useActionPlanRouteState();
|
|
35
36
|
|
|
36
37
|
const routeContent = useMemo(() => {
|
|
@@ -41,19 +42,7 @@ export function PlansRoute() {
|
|
|
41
42
|
return <StandalonePlanDetailRoute planName={planName} datastoreId={datastore?.id} userId={user.id} />;
|
|
42
43
|
}, [planName, datastore?.id, user.id]);
|
|
43
44
|
|
|
44
|
-
return
|
|
45
|
-
<RouteLayout
|
|
46
|
-
user={user}
|
|
47
|
-
datastore={datastore}
|
|
48
|
-
datastores={datastores}
|
|
49
|
-
isOperator={isOperator}
|
|
50
|
-
canSwitchDatastore={canSwitchDatastore}
|
|
51
|
-
logout={logout}
|
|
52
|
-
allowedModels={allowedModels}
|
|
53
|
-
>
|
|
54
|
-
{routeContent}
|
|
55
|
-
</RouteLayout>
|
|
56
|
-
);
|
|
45
|
+
return <RouteLayout>{routeContent}</RouteLayout>;
|
|
57
46
|
}
|
|
58
47
|
|
|
59
48
|
function StandalonePlanDetailRoute(props: { planName: string; datastoreId?: string; userId?: string }) {
|