@cobaltcore-dev/aurora 0.19.0 → 0.20.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/dist/client/App.d.ts +12 -0
- package/dist/client/{DeletePcaModal-BU6kbKsw.mjs → DeletePcaModal-YUlNw8cw.mjs} +2 -2
- package/dist/client/{DeletePcaModal-BU6kbKsw.mjs.map → DeletePcaModal-YUlNw8cw.mjs.map} +1 -1
- package/dist/client/{DetailsInfo-BUyuYpJj.mjs → DetailsInfo-Cv3oke-R.mjs} +2 -2
- package/dist/client/{DetailsInfo-BUyuYpJj.mjs.map → DetailsInfo-Cv3oke-R.mjs.map} +1 -1
- package/dist/client/{FloatingIpActionModals-DAtZoYGS.mjs → FloatingIpActionModals-PLN6CWZ9.mjs} +2 -2
- package/dist/client/{FloatingIpActionModals-DAtZoYGS.mjs.map → FloatingIpActionModals-PLN6CWZ9.mjs.map} +1 -1
- package/dist/client/{ImageToastNotifications-BhjU1bfT.mjs → ImageToastNotifications-BQM7HOyE.mjs} +2 -2
- package/dist/client/{ImageToastNotifications-BhjU1bfT.mjs.map → ImageToastNotifications-BQM7HOyE.mjs.map} +1 -1
- package/dist/client/_auth-BtRCgHQe.mjs.map +1 -1
- package/dist/client/{_floatingIpId-BHZGh8U8.mjs → _floatingIpId-DFCaWI9K.mjs} +2 -2
- package/dist/client/{_floatingIpId-BHZGh8U8.mjs.map → _floatingIpId-DFCaWI9K.mjs.map} +1 -1
- package/dist/client/{_floatingIpId-CR3aD38l2.mjs → _floatingIpId-De0hCSSN2.mjs} +4 -4
- package/dist/client/{_floatingIpId-CR3aD38l2.mjs.map → _floatingIpId-De0hCSSN2.mjs.map} +1 -1
- package/dist/client/{_imageId-Cf-Xdksv.mjs → _imageId-D8HiDS3P.mjs} +2 -2
- package/dist/client/{_imageId-Cf-Xdksv.mjs.map → _imageId-D8HiDS3P.mjs.map} +1 -1
- package/dist/client/{_pcaId-B7j0sXnY.mjs → _pcaId-CNbmhUF8.mjs} +4 -4
- package/dist/client/{_pcaId-B7j0sXnY.mjs.map → _pcaId-CNbmhUF8.mjs.map} +1 -1
- package/dist/client/{_securityGroupId-BVSsCus9.mjs → _securityGroupId-a46ExjsA.mjs} +2 -2
- package/dist/client/{_securityGroupId-BVSsCus9.mjs.map → _securityGroupId-a46ExjsA.mjs.map} +1 -1
- package/dist/client/{_securityGroupId-gwV4eB0s.mjs → _securityGroupId-ju2ZSIYe.mjs} +3 -3
- package/dist/client/{_securityGroupId-gwV4eB0s.mjs.map → _securityGroupId-ju2ZSIYe.mjs.map} +1 -1
- package/dist/client/analytics/setupRouterAnalytics.d.ts +20 -0
- package/dist/client/assets/__mocks__/svgMock.d.ts +3 -0
- package/dist/client/components/Auth/SessionExpirationTimer.d.ts +4 -0
- package/dist/client/components/ClipboardText.d.ts +10 -0
- package/dist/client/components/ContentHeader/ContentHeader.d.ts +10 -0
- package/dist/client/components/Error/RouteError.d.ts +9 -0
- package/dist/client/components/Error/StatusError.d.ts +11 -0
- package/dist/client/components/JsonEditor.d.ts +39 -0
- package/dist/client/components/ListToolbar/FiltersInput.d.ts +6 -0
- package/dist/client/components/ListToolbar/SelectedFilters.d.ts +24 -0
- package/dist/client/components/ListToolbar/SortInput.d.ts +11 -0
- package/dist/client/components/ListToolbar/index.d.ts +26 -0
- package/dist/client/components/ListToolbar/types.d.ts +116 -0
- package/dist/client/components/ProjectView/ProjectInfoBox.d.ts +12 -0
- package/dist/client/components/Slot.d.ts +7 -0
- package/dist/client/components/navigation/LanguageSelect.d.ts +3 -0
- package/dist/client/components/navigation/MainNavigation.d.ts +10 -0
- package/dist/client/components/navigation/UserMenu.d.ts +1 -0
- package/dist/client/components/navigation/types.d.ts +4 -0
- package/dist/client/{floatingips-DyBEotB8.mjs → floatingips-D98DrjA0.mjs} +3 -3
- package/dist/client/{floatingips-DyBEotB8.mjs.map → floatingips-D98DrjA0.mjs.map} +1 -1
- package/dist/client/hooks/index.d.ts +18 -0
- package/dist/client/hooks/useDomainId.d.ts +21 -0
- package/dist/client/hooks/useModalTracking.d.ts +33 -0
- package/dist/client/hooks/useProjectId.d.ts +22 -0
- package/dist/client/hooks/useScope.d.ts +4 -0
- package/dist/client/{hooks-iGiEkLTp.mjs → hooks-BsbKkpZc.mjs} +13 -3
- package/dist/client/hooks-BsbKkpZc.mjs.map +1 -0
- package/dist/client/{images-C3voJ3B1.mjs → images-CkW8zNjs.mjs} +4 -4
- package/dist/client/{images-C3voJ3B1.mjs.map → images-CkW8zNjs.mjs.map} +1 -1
- package/dist/client/{images-BklbSacK.mjs → images-sNuJa6ce.mjs} +2 -2
- package/dist/client/{images-BklbSacK.mjs.map → images-sNuJa6ce.mjs.map} +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +254 -258
- package/dist/client/index.js.map +1 -1
- package/dist/client/{pca-72YR_Pk0.mjs → pca-B4_2DqT2.mjs} +2 -2
- package/dist/client/{pca-72YR_Pk0.mjs.map → pca-B4_2DqT2.mjs.map} +1 -1
- package/dist/client/{pca-CsBx_IDO.mjs → pca-BClYQElh.mjs} +4 -4
- package/dist/client/{pca-CsBx_IDO.mjs.map → pca-BClYQElh.mjs.map} +1 -1
- package/dist/client/router.d.ts +7 -0
- package/dist/client/{securitygroups-8vRbXmBL.mjs → securitygroups-BwhVyNmZ.mjs} +2 -2
- package/dist/client/{securitygroups-8vRbXmBL.mjs.map → securitygroups-BwhVyNmZ.mjs.map} +1 -1
- package/dist/client/store/AuthProvider.d.ts +23 -0
- package/dist/client/utils/buildFilterParams.d.ts +5 -0
- package/dist/client/utils/cn.d.ts +27 -0
- package/dist/client/utils/formatBytes.d.ts +40 -0
- package/dist/client/utils/formatFloatingIpStatus.d.ts +6 -0
- package/dist/client/utils/languageDetection.d.ts +11 -0
- package/dist/client/utils/trpcErrors.d.ts +13 -0
- package/dist/client/utils/useErrorTranslation.d.ts +4 -0
- package/dist/client/utils/useListWithFiltering.d.ts +84 -0
- package/dist/client/utils/useModal.d.ts +3 -0
- package/package.json +1 -1
- package/dist/client/hooks-iGiEkLTp.mjs.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { FilterSettings, SortOption, SortSettings } from '../components/ListToolbar/types';
|
|
2
|
+
/**
|
|
3
|
+
* Sort direction enumeration
|
|
4
|
+
* Used across all sort-enabled list views
|
|
5
|
+
*/
|
|
6
|
+
export type SortDirection = "asc" | "desc";
|
|
7
|
+
/**
|
|
8
|
+
* Generic required sort settings with guaranteed non-optional properties
|
|
9
|
+
* Used by components to maintain a fully-defined sort state
|
|
10
|
+
*
|
|
11
|
+
* Type parameter K is the sort key type (string literal union of allowed sort fields)
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // For floating IPs
|
|
15
|
+
* type FloatingIpListSortSettings = ListSortConfig<FloatingIpsSortKey>
|
|
16
|
+
*
|
|
17
|
+
* // For security groups
|
|
18
|
+
* type SecurityGroupListSortSettings = ListSortConfig<"name" | "project_id">
|
|
19
|
+
*/
|
|
20
|
+
export type ListSortConfig<T extends string = string> = {
|
|
21
|
+
/**
|
|
22
|
+
* Array of available sort options to display in the UI
|
|
23
|
+
*/
|
|
24
|
+
options: SortOption[];
|
|
25
|
+
/**
|
|
26
|
+
* The currently selected sort field (guaranteed to be one of the available options)
|
|
27
|
+
*/
|
|
28
|
+
sortBy: T;
|
|
29
|
+
/**
|
|
30
|
+
* The currently active sort direction (guaranteed to be either "asc" or "desc")
|
|
31
|
+
*/
|
|
32
|
+
sortDirection: SortDirection;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Configuration options for the useListWithFiltering hook
|
|
36
|
+
*/
|
|
37
|
+
export interface UseListWithFilteringOptions<T extends string> {
|
|
38
|
+
/** Default sort key to use on initial render */
|
|
39
|
+
defaultSortKey: T;
|
|
40
|
+
/** Default sort direction to use on initial render */
|
|
41
|
+
defaultSortDir: SortDirection;
|
|
42
|
+
/** Available sort options to display in the sort dropdown */
|
|
43
|
+
sortOptions: Array<{
|
|
44
|
+
label: string;
|
|
45
|
+
value: string;
|
|
46
|
+
}>;
|
|
47
|
+
/** Initial filter settings configuration */
|
|
48
|
+
filterSettings: FilterSettings;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Return value from the useListWithFiltering hook
|
|
52
|
+
*/
|
|
53
|
+
export interface UseListWithFilteringReturn<T extends string> {
|
|
54
|
+
searchTerm: string;
|
|
55
|
+
sortSettings: ListSortConfig<T>;
|
|
56
|
+
filterSettings: FilterSettings;
|
|
57
|
+
handleSearchChange: (term: string | number | string[] | undefined) => void;
|
|
58
|
+
handleSortChange: (newSortSettings: SortSettings) => void;
|
|
59
|
+
handleFilterChange: (newFilterSettings: FilterSettings) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Custom hook to manage common list view state: search, sort, and filter
|
|
63
|
+
*
|
|
64
|
+
* Extracts shared logic from list components to ensure consistent behavior
|
|
65
|
+
* across all list pages and reduce code duplication.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* const listState = useListWithFiltering({
|
|
70
|
+
* defaultSortKey: "name",
|
|
71
|
+
* defaultSortDir: "asc",
|
|
72
|
+
* sortOptions: [
|
|
73
|
+
* { label: t`Name`, value: "name" },
|
|
74
|
+
* { label: t`Created`, value: "created_at" },
|
|
75
|
+
* ],
|
|
76
|
+
* filterSettings: {
|
|
77
|
+
* filters: [
|
|
78
|
+
* { displayName: t`Status`, filterName: "status", values: ["active", "inactive"] }
|
|
79
|
+
* ]
|
|
80
|
+
* }
|
|
81
|
+
* })
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function useListWithFiltering<T extends string>({ defaultSortKey, defaultSortDir, sortOptions, filterSettings: initialFilterSettings, }: UseListWithFilteringOptions<T>): UseListWithFilteringReturn<T>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-iGiEkLTp.mjs","names":["useAuth","useDomainId","user","domainId","domain","id","Error"],"sources":["../../src/client/hooks/useDomainId.ts"],"sourcesContent":["import { useAuth } from \"@/client/store/AuthProvider\"\n\n/**\n * Get the current user's domain ID from the authentication context.\n *\n * This hook provides access to the domain ID of the currently authenticated user.\n * The domain ID is obtained from the user's session, not from URL parameters.\n *\n * @throws {Error} If user is not authenticated or domain ID is not available\n * @returns {string} The current domain ID from the user's session\n *\n * @example\n * ```tsx\n * function UsersList() {\n * const domainId = useDomainId()\n *\n * const { data } = trpc.identity.users.list.useQuery({\n * domain_id: domainId\n * })\n * }\n * ```\n */\nexport function useDomainId(): string {\n const { user } = useAuth()\n\n const domainId = user?.domain?.id\n\n if (!domainId) {\n throw new Error(\n \"useDomainId() requires an authenticated user with a domain. \" +\n \"This is likely an authentication error. \" +\n \"Ensure the user is logged in and has a domain assigned.\"\n )\n }\n\n return domainId\n}\n"],"mappings":";;;AAsBA,SAAgBC,IAAAA;CACd,IAAM,EAAEC,YAASF,EAAAA,GAEXG,IAAWD,GAAME,QAAQC;CAE/B,IAAI,CAACF,GACH,MAAUG,MACR,6JAEE;CAIN,OAAOH;AACT"}
|