@terreno/admin-frontend 57.1.0 → 57.3.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/.ai/guidelines/core.md +10 -7
- package/README.md +2 -0
- package/dist/AdminModelForm.js +14 -7
- package/dist/AdminModelForm.js.map +1 -1
- package/dist/AdminModelList.js +3 -1
- package/dist/AdminModelList.js.map +1 -1
- package/dist/AdminModelTable.js +2 -1
- package/dist/AdminModelTable.js.map +1 -1
- package/dist/AdminRolesList.js +67 -6
- package/dist/AdminRolesList.js.map +1 -1
- package/dist/AdminScreenPage.d.ts +18 -0
- package/dist/AdminScreenPage.js +35 -0
- package/dist/AdminScreenPage.js.map +1 -0
- package/dist/AdminScreenRouter.js +4 -3
- package/dist/AdminScreenRouter.js.map +1 -1
- package/dist/AdminScriptList.js +12 -10
- package/dist/AdminScriptList.js.map +1 -1
- package/dist/AdminShell.js +24 -11
- package/dist/AdminShell.js.map +1 -1
- package/dist/DocumentStorageBrowser.js +4 -3
- package/dist/DocumentStorageBrowser.js.map +1 -1
- package/dist/adminPageAccess.d.ts +5 -0
- package/dist/adminPageAccess.js +19 -0
- package/dist/adminPageAccess.js.map +1 -0
- package/dist/comms/CommsDashboardScreen.d.ts +10 -0
- package/dist/comms/CommsDashboardScreen.js +183 -0
- package/dist/comms/CommsDashboardScreen.js.map +1 -0
- package/dist/comms/CommsDashboardScreenWidget.d.ts +4 -0
- package/dist/comms/CommsDashboardScreenWidget.js +11 -0
- package/dist/comms/CommsDashboardScreenWidget.js.map +1 -0
- package/dist/comms/CommsMessageDetail.d.ts +8 -0
- package/dist/comms/CommsMessageDetail.js +50 -0
- package/dist/comms/CommsMessageDetail.js.map +1 -0
- package/dist/comms/CommsStatCard.d.ts +17 -0
- package/dist/comms/CommsStatCard.js +14 -0
- package/dist/comms/CommsStatCard.js.map +1 -0
- package/dist/comms/CommsStatusBadge.d.ts +5 -0
- package/dist/comms/CommsStatusBadge.js +14 -0
- package/dist/comms/CommsStatusBadge.js.map +1 -0
- package/dist/comms/commsDashboardParams.d.ts +17 -0
- package/dist/comms/commsDashboardParams.js +71 -0
- package/dist/comms/commsDashboardParams.js.map +1 -0
- package/dist/comms/commsMessagePayload.d.ts +49 -0
- package/dist/comms/commsMessagePayload.js +43 -0
- package/dist/comms/commsMessagePayload.js.map +1 -0
- package/dist/comms/commsRetrySummary.d.ts +4 -0
- package/dist/comms/commsRetrySummary.js +12 -0
- package/dist/comms/commsRetrySummary.js.map +1 -0
- package/dist/comms/useCommsDashboardApi.d.ts +78 -0
- package/dist/comms/useCommsDashboardApi.js +60 -0
- package/dist/comms/useCommsDashboardApi.js.map +1 -0
- package/dist/comms/useCommsDashboardUrlFilters.d.ts +5 -0
- package/dist/comms/useCommsDashboardUrlFilters.js +16 -0
- package/dist/comms/useCommsDashboardUrlFilters.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.js.map +1 -1
- package/dist/useAdminBackgroundTask.d.ts +10 -2
- package/dist/useAdminBackgroundTask.js.map +1 -1
- package/dist/useConfigurationApi.d.ts +13 -15
- package/dist/useConfigurationApi.js.map +1 -1
- package/dist/widgets/AIRequestsScreenWidget.js +4 -3
- package/dist/widgets/AIRequestsScreenWidget.js.map +1 -1
- package/dist/widgets/DocumentsScreenWidget.js +2 -2
- package/dist/widgets/DocumentsScreenWidget.js.map +1 -1
- package/dist/widgets/builtInWidgets.js +2 -1
- package/dist/widgets/builtInWidgets.js.map +1 -1
- package/package.json +17 -3
- package/src/AdminActionMenu.test.tsx +1 -1
- package/src/AdminBreadcrumbs.test.tsx +1 -1
- package/src/AdminFieldRenderer.test.tsx +6 -1
- package/src/AdminHome.test.tsx +1 -1
- package/src/AdminModelForm.test.tsx +34 -1
- package/src/AdminModelForm.tsx +25 -9
- package/src/AdminModelList.test.tsx +1 -1
- package/src/AdminModelList.tsx +3 -1
- package/src/AdminModelTable.test.tsx +1 -1
- package/src/AdminModelTable.tsx +3 -1
- package/src/AdminPrimitiveArrayField.test.tsx +1 -1
- package/src/AdminRolesList.test.tsx +85 -3
- package/src/AdminRolesList.tsx +147 -24
- package/src/AdminScreenPage.test.tsx +81 -0
- package/src/AdminScreenPage.tsx +37 -0
- package/src/AdminScreenRouter.test.tsx +2 -1
- package/src/AdminScreenRouter.tsx +18 -5
- package/src/AdminScriptList.test.tsx +1 -1
- package/src/AdminScriptList.tsx +42 -30
- package/src/AdminShell.test.tsx +90 -1
- package/src/AdminShell.tsx +31 -10
- package/src/AdminVersionConfig.test.tsx +1 -1
- package/src/CheckboxListEditor.test.tsx +1 -1
- package/src/ConfigurationScreen.test.tsx +1 -1
- package/src/ConsentFormEditor.test.tsx +1 -1
- package/src/ConsentFormList.test.tsx +1 -1
- package/src/ConsentHistory.test.tsx +1 -1
- package/src/ConsentResponseViewer.test.tsx +1 -1
- package/src/DocumentStorageBrowser.test.tsx +1 -1
- package/src/DocumentStorageBrowser.tsx +10 -3
- package/src/LocaleContentEditor.test.tsx +1 -1
- package/src/adminModelListQueryParams.test.ts +59 -0
- package/src/adminPageAccess.test.ts +18 -0
- package/src/adminPageAccess.ts +18 -0
- package/src/comms/CommsDashboardScreen.test.tsx +397 -0
- package/src/comms/CommsDashboardScreen.tsx +500 -0
- package/src/comms/CommsDashboardScreenWidget.test.tsx +62 -0
- package/src/comms/CommsDashboardScreenWidget.tsx +20 -0
- package/src/comms/CommsMessageDetail.test.tsx +245 -0
- package/src/comms/CommsMessageDetail.tsx +239 -0
- package/src/comms/CommsStatCard.test.tsx +69 -0
- package/src/comms/CommsStatCard.tsx +60 -0
- package/src/comms/CommsStatusBadge.tsx +14 -0
- package/src/comms/commsDashboardParams.test.ts +75 -0
- package/src/comms/commsDashboardParams.ts +91 -0
- package/src/comms/commsMessagePayload.test.ts +22 -0
- package/src/comms/commsMessagePayload.ts +83 -0
- package/src/comms/commsRetrySummary.ts +10 -0
- package/src/comms/useCommsDashboardApi.test.tsx +144 -0
- package/src/comms/useCommsDashboardApi.tsx +128 -0
- package/src/comms/useCommsDashboardUrlFilters.test.tsx +58 -0
- package/src/comms/useCommsDashboardUrlFilters.tsx +31 -0
- package/src/dynamicHookApi.ts +1 -1
- package/src/index.tsx +15 -0
- package/src/isolated/AdminFieldRenderer.isolated.tsx +1 -1
- package/src/{AdminFilterDrawer.test.tsx → isolated/AdminFilterDrawer.isolated.tsx} +8 -2
- package/src/isolated/AdminNestedArrayField.isolated.tsx +1 -1
- package/src/isolated/AdminObjectPicker.isolated.tsx +1 -1
- package/src/isolated/AdminRefField.isolated.tsx +1 -1
- package/src/isolated/AdminScriptRunModal.isolated.tsx +1 -1
- package/src/isolated/DocumentStorageBrowser.isolated.tsx +1 -1
- package/src/isolated/hooks.isolated.tsx +1 -1
- package/src/types.ts +16 -0
- package/src/useAdminBackgroundTask.ts +7 -5
- package/src/useConfigurationApi.ts +13 -16
- package/src/widgets/AIRequestsScreenWidget.tsx +5 -4
- package/src/widgets/DocumentsScreenWidget.tsx +9 -2
- package/src/widgets/builtInWidgets.ts +2 -0
- package/src/widgets/pluginWidgets.test.tsx +3 -1
package/src/index.tsx
CHANGED
|
@@ -22,12 +22,14 @@ export {
|
|
|
22
22
|
export {AdminRefField, type AdminRefFieldProps} from "./AdminRefField";
|
|
23
23
|
export {AdminRolesField} from "./AdminRolesField";
|
|
24
24
|
export {AdminRolesList} from "./AdminRolesList";
|
|
25
|
+
export {AdminScreenPage, type AdminScreenPageProps} from "./AdminScreenPage";
|
|
25
26
|
export {AdminScreenRouter, type AdminScreenRouterProps} from "./AdminScreenRouter";
|
|
26
27
|
export {AdminScriptList} from "./AdminScriptList";
|
|
27
28
|
export {AdminScriptRunModal} from "./AdminScriptRunModal";
|
|
28
29
|
export {AdminShell, type AdminShellProps, type AdminShellSidebarVariant} from "./AdminShell";
|
|
29
30
|
export {AdminShellLayout, type AdminShellLayoutProps} from "./AdminShellLayout";
|
|
30
31
|
export {AdminVersionConfig} from "./AdminVersionConfig";
|
|
32
|
+
export {isAdminPageForbiddenError} from "./adminPageAccess";
|
|
31
33
|
export {groupAdminModelsByGroup} from "./adminShellNav";
|
|
32
34
|
export {CheckboxListEditor} from "./CheckboxListEditor";
|
|
33
35
|
export {ConfigurationScreen} from "./ConfigurationScreen";
|
|
@@ -36,6 +38,19 @@ export {ConsentFormList} from "./ConsentFormList";
|
|
|
36
38
|
export {ConsentHistory} from "./ConsentHistory";
|
|
37
39
|
export {ConsentResponseViewer} from "./ConsentResponseViewer";
|
|
38
40
|
export {ADMIN_FILTER_MOBILE_BREAKPOINT, ADMIN_SEARCH_DEBOUNCE_MS} from "./Constants";
|
|
41
|
+
export {CommsDashboardScreen, type CommsDashboardScreenProps} from "./comms/CommsDashboardScreen";
|
|
42
|
+
export {
|
|
43
|
+
COMMS_ADMIN_WIDGETS,
|
|
44
|
+
CommsDashboardScreenWidget,
|
|
45
|
+
} from "./comms/CommsDashboardScreenWidget";
|
|
46
|
+
export {CommsMessageDetail, type CommsMessageDetailProps} from "./comms/CommsMessageDetail";
|
|
47
|
+
export {CommsStatCard, type CommsStatCardProps} from "./comms/CommsStatCard";
|
|
48
|
+
export {CommsStatusBadge} from "./comms/CommsStatusBadge";
|
|
49
|
+
export {
|
|
50
|
+
type CommsDashboardFilters,
|
|
51
|
+
parseCommsDashboardSearchParams,
|
|
52
|
+
serializeCommsDashboardSearchParams,
|
|
53
|
+
} from "./comms/commsDashboardParams";
|
|
39
54
|
export {DocumentStorageBrowser} from "./DocumentStorageBrowser";
|
|
40
55
|
export {generateConsentHistoryPdf} from "./generateConsentHistoryPdf";
|
|
41
56
|
export {LocaleContentEditor} from "./LocaleContentEditor";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// noExplicitAny: test mocks use type-erased UI component stubs and field config literals
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {describe, expect, it, mock} from "bun:test";
|
|
4
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
4
|
import {fireEvent} from "@testing-library/react-native";
|
|
6
5
|
import React from "react";
|
|
6
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
7
7
|
|
|
8
8
|
mock.module("../AdminNestedArrayField", () => ({
|
|
9
9
|
AdminNestedArrayField: ({title}: {title: string}) =>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
// noExplicitAny: test mock typing
|
|
1
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
|
+
/**
|
|
4
|
+
* Isolated because the whole `react-native` module is replaced below. `mock.module` is
|
|
5
|
+
* process-wide and permanent, so running this alongside other files leaves every later
|
|
6
|
+
* suite on `Platform.OS === "web"`, where `@terreno/ui` `Modal` reaches for `document`.
|
|
7
|
+
*/
|
|
2
8
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
3
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
4
9
|
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
10
|
import React from "react";
|
|
6
|
-
import {
|
|
11
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
12
|
+
import {AdminFilterDrawer} from "../AdminFilterDrawer";
|
|
7
13
|
|
|
8
14
|
let mockWindowWidth = 1200;
|
|
9
15
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// noExplicitAny: test mocks use type-erased UI component stubs and mock field renderers
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {describe, expect, it, mock} from "bun:test";
|
|
4
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
4
|
import {fireEvent} from "@testing-library/react-native";
|
|
6
5
|
import React from "react";
|
|
7
6
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
8
8
|
import type {AdminApi, AdminFieldConfig} from "../types";
|
|
9
9
|
|
|
10
10
|
mock.module("../AdminFieldRendererCore", () => ({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// noExplicitAny: test mocks use type-erased RTK Query API doubles and dynamic endpoint injection
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
4
|
import {act, fireEvent} from "@testing-library/react-native";
|
|
6
5
|
import React from "react";
|
|
6
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
7
7
|
import {AdminObjectPicker as BaseAdminObjectPicker} from "../AdminObjectPicker";
|
|
8
8
|
import type {AdminApi} from "../types";
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// noExplicitAny: test mocks use type-erased RTK Query API doubles
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {describe, expect, it, mock} from "bun:test";
|
|
4
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
4
|
import React from "react";
|
|
5
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
6
6
|
|
|
7
7
|
mock.module("../AdminObjectPicker", () => ({
|
|
8
8
|
AdminObjectPicker: ({title, refModelName}: {title: string; refModelName: string}) =>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// noExplicitAny: test mocks use type-erased RTK Query API doubles and UNSAFE_root traversal
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
4
|
import {act, fireEvent} from "@testing-library/react-native";
|
|
6
5
|
import React from "react";
|
|
7
6
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
8
8
|
import type {AdminApi} from "../types";
|
|
9
9
|
|
|
10
10
|
// Mock @terreno/ui so the Modal renders its children inline. The real Modal
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// noExplicitAny: test mocks use type-erased RTK Query API doubles and UNSAFE_root traversal
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
4
|
import {act, fireEvent} from "@testing-library/react-native";
|
|
6
5
|
import React from "react";
|
|
7
6
|
import {Platform} from "react-native";
|
|
8
7
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
8
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
9
9
|
import type {AdminApi} from "../types";
|
|
10
10
|
|
|
11
11
|
mock.module("react-native-webview", () => ({
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* - the returned hook functions correspond to the generated hook names
|
|
11
11
|
*/
|
|
12
12
|
import {describe, expect, it, mock} from "bun:test";
|
|
13
|
-
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
14
13
|
import React from "react";
|
|
14
|
+
import {renderWithTheme} from "../../../ui/src/test-utils";
|
|
15
15
|
import {useAdminApi} from "../useAdminApi";
|
|
16
16
|
import {useAdminConfig} from "../useAdminConfig";
|
|
17
17
|
import {useAdminScripts} from "../useAdminScripts";
|
package/src/types.ts
CHANGED
|
@@ -29,6 +29,11 @@ export type AdminApi = Api<
|
|
|
29
29
|
*/
|
|
30
30
|
export type AdminFieldValue = unknown;
|
|
31
31
|
|
|
32
|
+
export interface AdminRecordCapabilities {
|
|
33
|
+
delete: boolean;
|
|
34
|
+
update: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
/**
|
|
33
38
|
* RTK Query's `build` argument from `api.injectEndpoints({ endpoints: (build) => ... })`.
|
|
34
39
|
*
|
|
@@ -151,6 +156,15 @@ export interface AdminConfigResponse {
|
|
|
151
156
|
customScreens?: AdminCustomScreen[];
|
|
152
157
|
home?: AdminHome;
|
|
153
158
|
models: AdminModelConfig[];
|
|
159
|
+
/** Server-authorized visibility for built-in Platform sidebar tools. */
|
|
160
|
+
platformTools?: {
|
|
161
|
+
configuration: boolean;
|
|
162
|
+
roles: boolean;
|
|
163
|
+
runScripts?: boolean;
|
|
164
|
+
scripts: boolean;
|
|
165
|
+
version: boolean;
|
|
166
|
+
viewScripts?: boolean;
|
|
167
|
+
};
|
|
154
168
|
schemaVersion?: number;
|
|
155
169
|
scripts: AdminScriptConfig[];
|
|
156
170
|
/** Plugin home widget ids merged from admin contributions (informational). */
|
|
@@ -348,6 +362,8 @@ export interface DocumentListResponse {
|
|
|
348
362
|
export interface DocumentStorageBrowserProps {
|
|
349
363
|
api: AdminApi;
|
|
350
364
|
basePath: string;
|
|
365
|
+
/** Route opened by the standard admin screen back arrow. */
|
|
366
|
+
backHref?: string;
|
|
351
367
|
title?: string;
|
|
352
368
|
allowDelete?: boolean;
|
|
353
369
|
allowUpload?: boolean;
|
|
@@ -10,16 +10,18 @@ export interface AdminBackgroundTaskBody {
|
|
|
10
10
|
resourceRoute?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
type AdminBackgroundTaskMutation = readonly [
|
|
14
|
+
(body: AdminBackgroundTaskBody) => {unwrap: () => Promise<unknown>},
|
|
15
|
+
{isLoading: boolean},
|
|
16
|
+
];
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* RTK Query mutation hook for `POST {adminApiRoot}/background-tasks` (admin enqueue).
|
|
15
20
|
*/
|
|
16
21
|
export const useAdminBackgroundTaskMutation = (
|
|
17
22
|
api: AdminApi,
|
|
18
23
|
adminApiRoot: string
|
|
19
|
-
):
|
|
20
|
-
// noExplicitAny: dynamic hook lookup on RTK Query enhanced API
|
|
21
|
-
// biome-ignore lint/suspicious/noExplicitAny: dynamic hook lookup on RTK Query enhanced API
|
|
22
|
-
any> => {
|
|
24
|
+
): AdminBackgroundTaskMutation => {
|
|
23
25
|
const enhancedApi = useMemo(() => {
|
|
24
26
|
const root = adminApiRoot.replace(/\/$/, "");
|
|
25
27
|
return api.enhanceEndpoints({addTagTypes: ["AdminBackgroundTask"]}).injectEndpoints({
|
|
@@ -38,5 +40,5 @@ any> => {
|
|
|
38
40
|
}, [api, adminApiRoot]);
|
|
39
41
|
|
|
40
42
|
const enhanced = asDynamicHookApi(enhancedApi);
|
|
41
|
-
return enhanced.useAdminPostBackgroundTaskMutation();
|
|
43
|
+
return enhanced.useAdminPostBackgroundTaskMutation() as AdminBackgroundTaskMutation;
|
|
42
44
|
};
|
|
@@ -4,18 +4,15 @@ import type {AdminApi, EndpointBuilder} from "./types";
|
|
|
4
4
|
|
|
5
5
|
// The configuration document shape varies per consumer — different apps register different
|
|
6
6
|
// configuration sections via @terreno/api's Configuration model.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type RtkMutationTrigger =
|
|
16
|
-
// noExplicitAny: RTK Query's error union type erases at the hook boundary
|
|
17
|
-
// biome-ignore lint/suspicious/noExplicitAny: RTK Query's error union type erases at the hook boundary
|
|
18
|
-
type RtkError = any;
|
|
7
|
+
type ConfigBody = Record<string, unknown>;
|
|
8
|
+
|
|
9
|
+
interface RtkQueryHookResult {
|
|
10
|
+
data?: unknown;
|
|
11
|
+
error?: unknown;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type RtkMutationTrigger = (body: ConfigBody) => {unwrap: () => Promise<unknown>};
|
|
19
16
|
|
|
20
17
|
interface UseConfigurationApiOptions {
|
|
21
18
|
api: AdminApi;
|
|
@@ -23,10 +20,10 @@ interface UseConfigurationApiOptions {
|
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
interface UseConfigurationApiResult {
|
|
26
|
-
useMetaQuery: () =>
|
|
27
|
-
useRefreshSecretsMutation: () => [RtkMutationTrigger, {isLoading: boolean}];
|
|
28
|
-
useUpdateMutation: () => [RtkMutationTrigger, {isLoading: boolean}];
|
|
29
|
-
useValuesQuery: () =>
|
|
23
|
+
useMetaQuery: () => RtkQueryHookResult;
|
|
24
|
+
useRefreshSecretsMutation: () => readonly [RtkMutationTrigger, {isLoading: boolean}];
|
|
25
|
+
useUpdateMutation: () => readonly [RtkMutationTrigger, {isLoading: boolean}];
|
|
26
|
+
useValuesQuery: () => RtkQueryHookResult;
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {AIRequestExplorer, type AIRequestExplorerData
|
|
1
|
+
import {AIRequestExplorer, type AIRequestExplorerData} from "@terreno/ui";
|
|
2
2
|
import React, {useCallback, useMemo, useState} from "react";
|
|
3
|
+
import {AdminScreenPage} from "../AdminScreenPage";
|
|
3
4
|
import {asDynamicHookApi} from "../dynamicHookApi";
|
|
4
5
|
import type {AdminScreenWidgetProps, EndpointBuilder, ScreenWidgetComponent} from "../types";
|
|
5
6
|
|
|
@@ -14,7 +15,7 @@ interface AIRequestsResponse {
|
|
|
14
15
|
total: number;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export const AIRequestsScreenWidget: React.FC<AdminScreenWidgetProps> = ({api}) => {
|
|
18
|
+
export const AIRequestsScreenWidget: React.FC<AdminScreenWidgetProps> = ({api, routeBase}) => {
|
|
18
19
|
const [page, setPage] = useState(1);
|
|
19
20
|
const [requestTypeFilter, setRequestTypeFilter] = useState<string[]>([]);
|
|
20
21
|
const [startDate, setStartDate] = useState("");
|
|
@@ -68,7 +69,7 @@ export const AIRequestsScreenWidget: React.FC<AdminScreenWidgetProps> = ({api})
|
|
|
68
69
|
const total = data?.total ?? 0;
|
|
69
70
|
|
|
70
71
|
return (
|
|
71
|
-
<
|
|
72
|
+
<AdminScreenPage backHref={routeBase} maxWidth="100%" scroll title="AI Request Explorer">
|
|
72
73
|
<AIRequestExplorer
|
|
73
74
|
data={data?.data ?? []}
|
|
74
75
|
endDate={endDate}
|
|
@@ -84,7 +85,7 @@ export const AIRequestsScreenWidget: React.FC<AdminScreenWidgetProps> = ({api})
|
|
|
84
85
|
totalCount={total}
|
|
85
86
|
totalPages={Math.ceil(total / EXPLORER_LIMIT)}
|
|
86
87
|
/>
|
|
87
|
-
</
|
|
88
|
+
</AdminScreenPage>
|
|
88
89
|
);
|
|
89
90
|
};
|
|
90
91
|
|
|
@@ -2,8 +2,15 @@ import React from "react";
|
|
|
2
2
|
import {DocumentStorageBrowser} from "../DocumentStorageBrowser";
|
|
3
3
|
import type {AdminScreenWidgetProps, ScreenWidgetComponent} from "../types";
|
|
4
4
|
|
|
5
|
-
export const DocumentsScreenWidget: React.FC<AdminScreenWidgetProps> = ({api}) => {
|
|
6
|
-
return
|
|
5
|
+
export const DocumentsScreenWidget: React.FC<AdminScreenWidgetProps> = ({api, routeBase}) => {
|
|
6
|
+
return (
|
|
7
|
+
<DocumentStorageBrowser
|
|
8
|
+
api={api}
|
|
9
|
+
backHref={routeBase}
|
|
10
|
+
basePath="/documents"
|
|
11
|
+
title="Documents"
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
7
14
|
};
|
|
8
15
|
|
|
9
16
|
export const DOCUMENT_STORAGE_ADMIN_WIDGETS: Record<string, ScreenWidgetComponent> = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {COMMS_ADMIN_WIDGETS} from "../comms/CommsDashboardScreenWidget";
|
|
1
2
|
import type {
|
|
2
3
|
AdminWidgetRegistry,
|
|
3
4
|
FieldWidgetComponent,
|
|
@@ -26,6 +27,7 @@ export const BUILT_IN_HOME_WIDGETS: Record<string, HomeWidgetComponent> = {
|
|
|
26
27
|
|
|
27
28
|
export const BUILT_IN_SCREEN_WIDGETS: Record<string, ScreenWidgetComponent> = {
|
|
28
29
|
...AI_ADMIN_WIDGETS,
|
|
30
|
+
...COMMS_ADMIN_WIDGETS,
|
|
29
31
|
...DOCUMENT_STORAGE_ADMIN_WIDGETS,
|
|
30
32
|
"version-config": VersionConfigScreenWidget,
|
|
31
33
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {describe, expect, it} from "bun:test";
|
|
2
|
+
import {COMMS_ADMIN_WIDGETS} from "../comms/CommsDashboardScreenWidget";
|
|
2
3
|
import {AI_ADMIN_WIDGETS} from "./AIRequestsScreenWidget";
|
|
3
4
|
import {CONSENT_ADMIN_WIDGETS} from "./consentWidgets";
|
|
4
5
|
import {DOCUMENT_STORAGE_ADMIN_WIDGETS} from "./DocumentsScreenWidget";
|
|
@@ -22,8 +23,9 @@ describe("plugin admin widget registries", () => {
|
|
|
22
23
|
]);
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
it("exports documents
|
|
26
|
+
it("exports documents, AI request, and comms screen widgets by custom screen name", () => {
|
|
26
27
|
expect(DOCUMENT_STORAGE_ADMIN_WIDGETS.documents).toBeDefined();
|
|
27
28
|
expect(AI_ADMIN_WIDGETS["ai-requests"]).toBeDefined();
|
|
29
|
+
expect(COMMS_ADMIN_WIDGETS.comms).toBeDefined();
|
|
28
30
|
});
|
|
29
31
|
});
|