@cobaltcore-dev/aurora 0.18.0 → 0.19.1

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.
Files changed (119) hide show
  1. package/dist/client/App.d.ts +12 -0
  2. package/dist/client/{BucketToastNotifications-D2Cq2VrV.mjs → BucketToastNotifications-BGd2wVmh.mjs} +2 -2
  3. package/dist/client/{BucketToastNotifications-D2Cq2VrV.mjs.map → BucketToastNotifications-BGd2wVmh.mjs.map} +1 -1
  4. package/dist/client/DeletePcaModal-BU6kbKsw.mjs +80 -0
  5. package/dist/client/DeletePcaModal-BU6kbKsw.mjs.map +1 -0
  6. package/dist/client/DetailsInfo-BUyuYpJj.mjs +52 -0
  7. package/dist/client/DetailsInfo-BUyuYpJj.mjs.map +1 -0
  8. package/dist/client/{FloatingIpActionModals-sJlSFIsK.mjs → FloatingIpActionModals-DAtZoYGS.mjs} +22 -22
  9. package/dist/client/{FloatingIpActionModals-sJlSFIsK.mjs.map → FloatingIpActionModals-DAtZoYGS.mjs.map} +1 -1
  10. package/dist/client/{ImageToastNotifications-CISH3c_d.mjs → ImageToastNotifications-BhjU1bfT.mjs} +7 -7
  11. package/dist/client/{ImageToastNotifications-CISH3c_d.mjs.map → ImageToastNotifications-BhjU1bfT.mjs.map} +1 -1
  12. package/dist/client/{_flavorId-Cx5tf2KQ.mjs → _flavorId-BQY7YhNx.mjs} +2 -2
  13. package/dist/client/{_flavorId-Cx5tf2KQ.mjs.map → _flavorId-BQY7YhNx.mjs.map} +1 -1
  14. package/dist/client/{_flavorId-C6RJfhh8.mjs → _flavorId-sS1sg_DZ.mjs} +3 -3
  15. package/dist/client/{_flavorId-C6RJfhh8.mjs.map → _flavorId-sS1sg_DZ.mjs.map} +1 -1
  16. package/dist/client/{_floatingIpId-C4Sa8tMa.mjs → _floatingIpId-BHZGh8U8.mjs} +2 -2
  17. package/dist/client/{_floatingIpId-C4Sa8tMa.mjs.map → _floatingIpId-BHZGh8U8.mjs.map} +1 -1
  18. package/dist/client/{_floatingIpId-CAUBZ5WD2.mjs → _floatingIpId-CR3aD38l2.mjs} +5 -5
  19. package/dist/client/{_floatingIpId-CAUBZ5WD2.mjs.map → _floatingIpId-CR3aD38l2.mjs.map} +1 -1
  20. package/dist/client/{_imageId-DpXNAIbD.mjs → _imageId-Cf-Xdksv.mjs} +3 -3
  21. package/dist/client/{_imageId-DpXNAIbD.mjs.map → _imageId-Cf-Xdksv.mjs.map} +1 -1
  22. package/dist/client/_pcaId-B7j0sXnY.mjs +545 -0
  23. package/dist/client/_pcaId-B7j0sXnY.mjs.map +1 -0
  24. package/dist/client/{_projectId-fEA6fnFQ.mjs → _projectId-Cq9JnhRj.mjs} +3 -3
  25. package/dist/client/{_projectId-fEA6fnFQ.mjs.map → _projectId-Cq9JnhRj.mjs.map} +1 -1
  26. package/dist/client/{_projectId-w-tZz0FI.mjs → _projectId-D8FHe0gr.mjs} +2 -2
  27. package/dist/client/{_projectId-w-tZz0FI.mjs.map → _projectId-D8FHe0gr.mjs.map} +1 -1
  28. package/dist/client/{_projectId-qvINx3Dx.mjs → _projectId-Ig3QqYzt.mjs} +2 -2
  29. package/dist/client/{_projectId-qvINx3Dx.mjs.map → _projectId-Ig3QqYzt.mjs.map} +1 -1
  30. package/dist/client/{_projectId-BOaPmCuz.mjs → _projectId-b4NGeECR.mjs} +3 -3
  31. package/dist/client/{_projectId-BOaPmCuz.mjs.map → _projectId-b4NGeECR.mjs.map} +1 -1
  32. package/dist/client/{_securityGroupId-B6_lD8ry.mjs → _securityGroupId-BVSsCus9.mjs} +2 -2
  33. package/dist/client/{_securityGroupId-B6_lD8ry.mjs.map → _securityGroupId-BVSsCus9.mjs.map} +1 -1
  34. package/dist/client/{_securityGroupId-D9FHSkNU.mjs → _securityGroupId-gwV4eB0s.mjs} +16 -16
  35. package/dist/client/{_securityGroupId-D9FHSkNU.mjs.map → _securityGroupId-gwV4eB0s.mjs.map} +1 -1
  36. package/dist/client/{_storageType-ZFnIALny.mjs → _storageType-CH2khFcZ.mjs} +2 -2
  37. package/dist/client/{_storageType-ZFnIALny.mjs.map → _storageType-CH2khFcZ.mjs.map} +1 -1
  38. package/dist/client/{_storageType-MgntkZb6.mjs → _storageType-D-1H6SX1.mjs} +856 -856
  39. package/dist/client/{_storageType-MgntkZb6.mjs.map → _storageType-D-1H6SX1.mjs.map} +1 -1
  40. package/dist/client/analytics/setupRouterAnalytics.d.ts +20 -0
  41. package/dist/client/assets/__mocks__/svgMock.d.ts +3 -0
  42. package/dist/client/build-DgeVmENN.mjs.map +1 -1
  43. package/dist/client/components/Auth/SessionExpirationTimer.d.ts +4 -0
  44. package/dist/client/components/ClipboardText.d.ts +10 -0
  45. package/dist/client/components/ContentHeader/ContentHeader.d.ts +10 -0
  46. package/dist/client/components/Error/RouteError.d.ts +9 -0
  47. package/dist/client/components/Error/StatusError.d.ts +11 -0
  48. package/dist/client/components/JsonEditor.d.ts +39 -0
  49. package/dist/client/components/ListToolbar/FiltersInput.d.ts +6 -0
  50. package/dist/client/components/ListToolbar/SelectedFilters.d.ts +24 -0
  51. package/dist/client/components/ListToolbar/SortInput.d.ts +11 -0
  52. package/dist/client/components/ListToolbar/index.d.ts +26 -0
  53. package/dist/client/components/ListToolbar/types.d.ts +116 -0
  54. package/dist/client/components/ProjectView/ProjectInfoBox.d.ts +12 -0
  55. package/dist/client/components/Slot.d.ts +7 -0
  56. package/dist/client/components/navigation/LanguageSelect.d.ts +3 -0
  57. package/dist/client/components/navigation/MainNavigation.d.ts +10 -0
  58. package/dist/client/components/navigation/UserMenu.d.ts +1 -0
  59. package/dist/client/components/navigation/types.d.ts +4 -0
  60. package/dist/client/{floatingips-DOGKGGkC.mjs → floatingips-DyBEotB8.mjs} +10 -10
  61. package/dist/client/{floatingips-DOGKGGkC.mjs.map → floatingips-DyBEotB8.mjs.map} +1 -1
  62. package/dist/client/hooks/index.d.ts +15 -0
  63. package/dist/client/hooks/useDomainId.d.ts +21 -0
  64. package/dist/client/hooks/useModalTracking.d.ts +33 -0
  65. package/dist/client/hooks/useProjectId.d.ts +22 -0
  66. package/dist/client/hooks-iGiEkLTp.mjs +12 -0
  67. package/dist/client/hooks-iGiEkLTp.mjs.map +1 -0
  68. package/dist/client/{images-B1wqMKYw.mjs → images-BklbSacK.mjs} +2 -2
  69. package/dist/client/{images-B1wqMKYw.mjs.map → images-BklbSacK.mjs.map} +1 -1
  70. package/dist/client/{images-D5UsQi8i.mjs → images-C3voJ3B1.mjs} +259 -259
  71. package/dist/client/{images-D5UsQi8i.mjs.map → images-C3voJ3B1.mjs.map} +1 -1
  72. package/dist/client/index.d.ts +2 -0
  73. package/dist/client/index.js +337 -344
  74. package/dist/client/index.js.map +1 -1
  75. package/dist/client/md-CyCflQee.mjs.map +1 -1
  76. package/dist/client/{objects-DpgXMFrG.mjs → objects-B3Z8h4RU.mjs} +2 -2
  77. package/dist/client/{objects-DpgXMFrG.mjs.map → objects-B3Z8h4RU.mjs.map} +1 -1
  78. package/dist/client/{objects-Deo1Ic1A.mjs → objects-CGOfO00N.mjs} +499 -475
  79. package/dist/client/objects-CGOfO00N.mjs.map +1 -0
  80. package/dist/client/{pca-DztTIs18.mjs → pca-72YR_Pk0.mjs} +3 -3
  81. package/dist/client/pca-72YR_Pk0.mjs.map +1 -0
  82. package/dist/client/pca-CsBx_IDO.mjs +251 -0
  83. package/dist/client/pca-CsBx_IDO.mjs.map +1 -0
  84. package/dist/client/pcaAccess-Br4kVjLQ.mjs +9 -0
  85. package/dist/client/pcaAccess-Br4kVjLQ.mjs.map +1 -0
  86. package/dist/client/router.d.ts +7 -0
  87. package/dist/client/{securitygroups-BRtHaTLm.mjs → securitygroups-8vRbXmBL.mjs} +3 -3
  88. package/dist/client/{securitygroups-BRtHaTLm.mjs.map → securitygroups-8vRbXmBL.mjs.map} +1 -1
  89. package/dist/client/store/AuthProvider.d.ts +23 -0
  90. package/dist/client/trpcClient-BxcNKnhv.mjs +65 -0
  91. package/dist/client/trpcClient-BxcNKnhv.mjs.map +1 -0
  92. package/dist/client/trpcClient.d.ts +56 -49
  93. package/dist/client/utils/buildFilterParams.d.ts +5 -0
  94. package/dist/client/utils/cn.d.ts +27 -0
  95. package/dist/client/utils/formatBytes.d.ts +40 -0
  96. package/dist/client/utils/formatFloatingIpStatus.d.ts +6 -0
  97. package/dist/client/utils/languageDetection.d.ts +11 -0
  98. package/dist/client/utils/trpcErrors.d.ts +13 -0
  99. package/dist/client/utils/useErrorTranslation.d.ts +4 -0
  100. package/dist/client/utils/useListWithFiltering.d.ts +84 -0
  101. package/dist/client/utils/useModal.d.ts +3 -0
  102. package/dist/server/index.d.ts +51 -49
  103. package/dist/server/index.js +53 -23
  104. package/package.json +4 -2
  105. package/dist/client/_pcaId-DY9GPV7t.mjs +0 -479
  106. package/dist/client/_pcaId-DY9GPV7t.mjs.map +0 -1
  107. package/dist/client/_pcaId-ldtkXsbp.mjs +0 -36
  108. package/dist/client/_pcaId-ldtkXsbp.mjs.map +0 -1
  109. package/dist/client/constants-COPE2ktv.mjs +0 -153
  110. package/dist/client/constants-COPE2ktv.mjs.map +0 -1
  111. package/dist/client/hooks-DvdvErNv.mjs +0 -2
  112. package/dist/client/objects-Deo1Ic1A.mjs.map +0 -1
  113. package/dist/client/pca-B7WldCGw.mjs +0 -202
  114. package/dist/client/pca-B7WldCGw.mjs.map +0 -1
  115. package/dist/client/pca-DztTIs18.mjs.map +0 -1
  116. package/dist/client/pcaAccess-BYUY700H.mjs +0 -9
  117. package/dist/client/pcaAccess-BYUY700H.mjs.map +0 -1
  118. package/dist/client/trpcClient-Dy_MP_Pv.mjs +0 -57
  119. package/dist/client/trpcClient-Dy_MP_Pv.mjs.map +0 -1
@@ -34673,10 +34673,20 @@ var objectRouter = {
34673
34673
  throw mappedError;
34674
34674
  }
34675
34675
  }, "emitMappedError");
34676
- const response = await s3.send(new import_client_s33.GetObjectCommand({
34677
- Bucket: containerName,
34678
- Key: objectKey
34679
- })).catch(emitMappedError);
34676
+ const response = await s3.send(
34677
+ new import_client_s33.GetObjectCommand({
34678
+ Bucket: containerName,
34679
+ Key: objectKey
34680
+ }),
34681
+ // AWS SDK v3's per-call cancellation option — the equivalent of passing
34682
+ // `{ signal }` to a raw fetch() (see 0010_abort_signal_propagation.md).
34683
+ // ctx.req.signal is aborted automatically when the client disconnects
34684
+ // (tab closed, navigated away) or explicitly via the cancel button,
34685
+ // which calls AbortController.abort() on the frontend.
34686
+ {
34687
+ abortSignal: ctx.req.signal
34688
+ }
34689
+ ).catch(emitMappedError);
34680
34690
  const body = response.Body;
34681
34691
  if (!body) {
34682
34692
  emitMappedError(new import_server13.TRPCError({
@@ -34695,8 +34705,13 @@ var objectRouter = {
34695
34705
  });
34696
34706
  let isFirst = true;
34697
34707
  let downloaded = 0;
34708
+ let aborted = false;
34698
34709
  try {
34699
34710
  for await (const value of body) {
34711
+ if (ctx.req.signal?.aborted) {
34712
+ aborted = true;
34713
+ break;
34714
+ }
34700
34715
  downloaded += value.byteLength;
34701
34716
  const progress = downloadProgressMap2.get(scopedDownloadId);
34702
34717
  progress.downloaded = downloaded;
@@ -34716,7 +34731,9 @@ var objectRouter = {
34716
34731
  };
34717
34732
  isFirst = false;
34718
34733
  }
34719
- downloadProgressEmitter2.emit(`progress:${scopedDownloadId}:complete`);
34734
+ if (!aborted) {
34735
+ downloadProgressEmitter2.emit(`progress:${scopedDownloadId}:complete`);
34736
+ }
34720
34737
  } catch (error) {
34721
34738
  emitMappedError(error);
34722
34739
  } finally {
@@ -37559,24 +37576,31 @@ var CertificateAuthorityAdditionalAttributeSchema = import_zod25.z.object({
37559
37576
  key: import_zod25.z.array(import_zod25.z.number().int()),
37560
37577
  value: import_zod25.z.string()
37561
37578
  });
37579
+ var stringOrStringArray = import_zod25.z.union([
37580
+ import_zod25.z.array(import_zod25.z.string()),
37581
+ import_zod25.z.string().transform((s) => [
37582
+ s
37583
+ ])
37584
+ ]);
37562
37585
  var CertificateAuthoritySubjectSchema = import_zod25.z.object({
37563
37586
  additional_attribute: import_zod25.z.array(CertificateAuthorityAdditionalAttributeSchema).optional(),
37564
- /** Typically domain name */
37565
- common_name: import_zod25.z.string(),
37566
- /** Country codes (ISO 3166-1 alpha-2). */
37567
- country: import_zod25.z.array(import_zod25.z.string()).optional(),
37568
- /** Locality/city names. */
37569
- locality: import_zod25.z.array(import_zod25.z.string()).optional(),
37570
- /** Organization names. */
37571
- organization: import_zod25.z.array(import_zod25.z.string()).optional(),
37572
- /** Organizational unit names. */
37573
- organizational_unit: import_zod25.z.array(import_zod25.z.string()).optional(),
37574
- /** Postal/ZIP codes. */
37575
- postal_code: import_zod25.z.array(import_zod25.z.string()).optional(),
37576
- /** State or province names. */
37577
- province: import_zod25.z.array(import_zod25.z.string()).optional(),
37578
- serial_number: import_zod25.z.string().optional(),
37579
- street_address: import_zod25.z.array(import_zod25.z.string()).optional()
37587
+ named_attributes: import_zod25.z.object({
37588
+ cn: import_zod25.z.string(),
37589
+ /** Country codes (ISO 3166-1 alpha-2). */
37590
+ c: stringOrStringArray.optional(),
37591
+ /** Locality/city names. */
37592
+ l: stringOrStringArray.optional(),
37593
+ /** Organization names. */
37594
+ o: stringOrStringArray.optional(),
37595
+ /** Organizational unit names. */
37596
+ ou: stringOrStringArray.optional(),
37597
+ /** Postal/ZIP codes. */
37598
+ postal_code: stringOrStringArray.optional(),
37599
+ /** State or province names. */
37600
+ st: stringOrStringArray.optional(),
37601
+ serial_number: import_zod25.z.string().optional(),
37602
+ street: stringOrStringArray.optional()
37603
+ })
37580
37604
  });
37581
37605
  var CertificateAuthorityStateSchema = import_zod25.z.enum([
37582
37606
  "CREATING",
@@ -37594,6 +37618,8 @@ var CertificateAuthoritySchema = import_zod25.z.object({
37594
37618
  subject: CertificateAuthoritySubjectSchema
37595
37619
  }).optional(),
37596
37620
  csr: import_zod25.z.string().optional(),
37621
+ /** Human-readable subject string, e.g. "CN=demo-ca.test.sci". */
37622
+ display_subject: import_zod25.z.string().optional(),
37597
37623
  id: import_zod25.z.string(),
37598
37624
  /**
37599
37625
  * Required on import certificate operation.
@@ -37622,7 +37648,11 @@ var CertificateAuthoritiesListInputSchema = projectScopedInputSchema.extend({
37622
37648
  });
37623
37649
  var CertificateAuthorityCreateSchema = import_zod25.z.object({
37624
37650
  configuration: import_zod25.z.object({
37625
- subject: CertificateAuthoritySubjectSchema
37651
+ subject: import_zod25.z.object({
37652
+ named_attributes: import_zod25.z.object({
37653
+ cn: import_zod25.z.string().trim().min(1)
37654
+ })
37655
+ })
37626
37656
  })
37627
37657
  });
37628
37658
  var CertificateAuthorityIdInputSchema = projectScopedInputSchema.extend({
@@ -37662,7 +37692,7 @@ var CertificatesListSchema = import_zod25.z.object({
37662
37692
  });
37663
37693
 
37664
37694
  // src/server/Services/routers/pcaRouter.ts
37665
- var PCA_BASE_URL = "certificate-authorities";
37695
+ var PCA_BASE_URL = "v1/certificate-authorities";
37666
37696
  var pcaRouter = {
37667
37697
  list: projectScopedProcedure.input(CertificateAuthoritiesListInputSchema).query(async ({ input, ctx }) => {
37668
37698
  return withErrorHandling3(async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltcore-dev/aurora",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "private": false,
5
5
  "description": "Aurora OpenStack dashboard — server and client library",
6
6
  "license": "Apache-2.0",
@@ -51,6 +51,7 @@
51
51
  "@headlessui/react": "^2.2.2",
52
52
  "@lingui/core": "^5.9.5",
53
53
  "@lingui/react": "^5.9.5",
54
+ "@peculiar/x509": "^2.0.0",
54
55
  "@tanstack/react-form": "^1.28.5",
55
56
  "@tanstack/react-query": "^5.95.2",
56
57
  "@tanstack/react-router": "^1.168.4",
@@ -65,6 +66,7 @@
65
66
  "node-fetch": "^3.3.2",
66
67
  "react-error-boundary": "^6.1.0",
67
68
  "react-icons": "^5.6.0",
69
+ "reflect-metadata": "^0.2.2",
68
70
  "tailwind-merge": "^3.2.0",
69
71
  "zod": "^4.0.0"
70
72
  },
@@ -106,8 +108,8 @@
106
108
  "vite-plugin-svgr": "^5.0.0",
107
109
  "vite-tsconfig-paths": "^6.1.1",
108
110
  "vitest": "^4.1.2",
109
- "@cobaltcore-dev/policy-engine": "2.0.0",
110
111
  "@cobaltcore-dev/aurora-config": "0.0.1",
112
+ "@cobaltcore-dev/policy-engine": "2.0.0",
111
113
  "@cobaltcore-dev/signal-openstack": "1.0.0"
112
114
  },
113
115
  "scripts": {
@@ -1,479 +0,0 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, K as c, P as l, R as u, W as d, Y as f, at as p, et as m, o as h, q as g, r as _, rt as v, tt as y, y as b } from "./build-DgeVmENN.mjs";
2
- import { r as x } from "./trpcClient-Dy_MP_Pv.mjs";
3
- import { t as S } from "./_pcaId-ldtkXsbp.mjs";
4
- import { t as C } from "./useModal-DCs1OJh7.mjs";
5
- import { t as w } from "./useProjectId-DBc5lpoU.mjs";
6
- import "./hooks-DvdvErNv.mjs";
7
- import { r as T, t as E } from "./constants-COPE2ktv.mjs";
8
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
9
- import { Fragment as A, useRef as j, useState as M } from "react";
10
- import { useNavigate as N } from "@tanstack/react-router";
11
- import { Trans as P, useLingui as F } from "@lingui/react";
12
- import { z as I } from "zod";
13
- import { useForm as L, useStore as R } from "@tanstack/react-form";
14
- //#region src/client/routes/_auth/projects/$projectId/services/pca/$pcaId/-components/-table/PcaCertificatesTableRow.tsx
15
- var z = ({ certificate: t }) => {
16
- let { i18n: n, _: r } = F(), a = N(), s = () => a({
17
- from: "/projects/$projectId/services/pca/$pcaId/",
18
- to: "$certificateId",
19
- params: (e) => ({
20
- ...e,
21
- certificateId: t.id
22
- })
23
- });
24
- return /*#__PURE__*/ k(i, {
25
- "data-testid": `pca-certificate-row-${t.id}`,
26
- onClick: s,
27
- children: [
28
- /*#__PURE__*/ O(o, { children: t.certificate_authority_id }),
29
- /*#__PURE__*/ O(o, { children: t.id }),
30
- /*#__PURE__*/ O(o, {
31
- onClick: (e) => e.stopPropagation(),
32
- className: "items-end pr-0",
33
- children: /*#__PURE__*/ O(v, { children: /*#__PURE__*/ O(e, { children: /*#__PURE__*/ O(p, {
34
- label: n._({ id: "v0hPHE" }),
35
- onClick: s
36
- }) }) })
37
- })
38
- ]
39
- }, t.id);
40
- }, B = ({ open: e, onClose: n, pcaId: r }) => {
41
- let { i18n: i, _: a } = F(), o = N(), l = w(), u = x.useUtils(), { isPending: d, ...f } = x.services.pca.createCertificate.useMutation({ onSettled: () => u.services.pca.listCertificates.invalidate() }), p = L({
42
- defaultValues: { csr: "" },
43
- validators: { onSubmit: I.object({ csr: I.string().trim().min(1) }) },
44
- onSubmit: async ({ value: e }) => {
45
- if (d) return;
46
- let t = await f.mutateAsync({
47
- project_id: l,
48
- certificate_authority_id: r,
49
- csr: e.csr.replace(/\\n/g, "\n"),
50
- configuration: { validity: { not_after: Math.floor(Date.now() / 1e3) + 480 * 60 } }
51
- });
52
- g(), await o({
53
- to: "/projects/$projectId/services/pca/$pcaId/$certificateId",
54
- params: {
55
- projectId: l,
56
- pcaId: r,
57
- certificateId: t.id
58
- }
59
- });
60
- }
61
- }), g = () => {
62
- d || (p.reset(), f.reset(), n());
63
- }, v = R(p.store, (e) => e.values.csr);
64
- return /*#__PURE__*/ k(_, {
65
- open: e,
66
- size: "large",
67
- title: i._({ id: "9kDPaB" }),
68
- onCancel: g,
69
- cancelButtonLabel: i._({ id: "dEgA5A" }),
70
- confirmButtonLabel: i._({ id: "tfDRzk" }),
71
- onConfirm: p.handleSubmit,
72
- disableConfirmButton: d || !(v.trim().length > 0),
73
- children: [
74
- f.error && /*#__PURE__*/ O(t, {
75
- dismissible: !1,
76
- variant: "error",
77
- className: "mb-4",
78
- children: f.error?.message
79
- }),
80
- d && /*#__PURE__*/ k("div", {
81
- className: "mb-4 flex items-center justify-center gap-2",
82
- children: [/*#__PURE__*/ O(c, { variant: "primary" }), /*#__PURE__*/ O("span", {
83
- className: "text-theme-high text-sm",
84
- children: /*#__PURE__*/ O(P, { id: "NG+FZC" })
85
- })]
86
- }),
87
- !d && /*#__PURE__*/ O(h, {
88
- className: "mb-0",
89
- id: "issue-end-entity-certificate-form",
90
- onSubmit: (e) => {
91
- e.preventDefault(), p.handleSubmit();
92
- },
93
- children: /*#__PURE__*/ O(s, { children: /*#__PURE__*/ O(p.Field, {
94
- name: "csr",
95
- children: (e) => /*#__PURE__*/ O(m, {
96
- id: e.name,
97
- name: e.name,
98
- value: e.state.value,
99
- onBlur: e.handleBlur,
100
- onChange: (t) => e.handleChange(t.target.value),
101
- placeholder: i._({ id: "h6JDtI" }),
102
- errortext: e.state.meta.errors.map((e) => e?.message).join(", "),
103
- disabled: d
104
- })
105
- }) })
106
- })
107
- ]
108
- });
109
- }, V = 50, H = ({ pcaId: e, pcaState: t }) => {
110
- let { i18n: r, _: a } = F(), s = w(), [d, p] = C(!1), [m, h] = M([void 0]), [g, _] = M(1), v = () => [
111
- r._({ id: "c1OE1x" }),
112
- r._({ id: "S0kLOH" }),
113
- ""
114
- ], S = v().length, T = m[g - 1], { data: E, isLoading: A, isError: j, error: N } = x.services.pca.listCertificates.useQuery({
115
- project_id: s,
116
- certificate_authority_id: e,
117
- limit: V,
118
- next_page_marker: T
119
- }), I = E?.certificates ?? [], L = E?.next_page_marker, R = L ? g + 1 : g, H = Math.max(R, m.length), U = (e) => {
120
- e < 1 || e > H || (e > g && L && h((t) => {
121
- let n = [...t];
122
- return n[e - 1] = L, n;
123
- }), _(e));
124
- };
125
- return A ? /*#__PURE__*/ k(y, {
126
- className: "py-8",
127
- distribution: "center",
128
- alignment: "center",
129
- direction: "vertical",
130
- children: [/*#__PURE__*/ O(c, {
131
- variant: "primary",
132
- size: "large",
133
- className: "mb-2"
134
- }), /*#__PURE__*/ O(P, { id: "T9o/az" })]
135
- }) : j ? /*#__PURE__*/ O(y, {
136
- className: "py-8",
137
- distribution: "center",
138
- alignment: "center",
139
- direction: "vertical",
140
- children: N?.message ?? r._({ id: "hz9da7" })
141
- }) : /*#__PURE__*/ k("div", {
142
- className: "relative",
143
- children: [
144
- t === "READY" && /*#__PURE__*/ k(D, { children: [/*#__PURE__*/ O(y, {
145
- className: "pt-3 pb-2",
146
- distribution: "end",
147
- children: /*#__PURE__*/ O(b, {
148
- variant: "primary",
149
- label: r._({ id: "9kDPaB" }),
150
- onClick: p
151
- })
152
- }), d && /*#__PURE__*/ O(B, {
153
- open: d,
154
- onClose: p,
155
- pcaId: e
156
- })] }),
157
- I.length === 0 && g === 1 ? /*#__PURE__*/ O(l, {
158
- columns: S,
159
- className: "pca-certificates",
160
- "data-testid": "no-pcas-certificates",
161
- children: /*#__PURE__*/ O(i, { children: /*#__PURE__*/ k(o, {
162
- colSpan: S,
163
- children: [/*#__PURE__*/ O(f, { children: /*#__PURE__*/ O(P, { id: "kNeZrV" }) }), /*#__PURE__*/ O("p", { children: /*#__PURE__*/ O(P, { id: "7huC4O" }) })]
164
- }) })
165
- }) : /*#__PURE__*/ k(l, {
166
- columns: S,
167
- children: [/*#__PURE__*/ O(i, { children: v().map((e) => /*#__PURE__*/ O(u, { children: e }, e)) }), I.map((e) => /*#__PURE__*/ O(z, { certificate: e }, e.id))]
168
- }),
169
- H > 1 && /*#__PURE__*/ O("div", {
170
- className: "flex justify-center py-4",
171
- children: /*#__PURE__*/ O(n, {
172
- variant: "input",
173
- currentPage: g,
174
- pages: H,
175
- onPressPrevious: () => U(g - 1),
176
- onPressNext: () => U(g + 1)
177
- })
178
- })
179
- ]
180
- });
181
- }, U = 86400, W = ({ open: e, onClose: n, pca: r }) => {
182
- let { i18n: i, _: a } = F(), o = w(), s = x.useUtils(), { isPending: l, ...u } = x.services.pca.createCertificate.useMutation({ onSettled: () => s.services.pca.listCertificates.invalidate() });
183
- return /*#__PURE__*/ k(_, {
184
- open: e,
185
- title: i._({ id: "AirKNZ" }),
186
- onCancel: () => {
187
- l || (u.reset(), n());
188
- },
189
- cancelButtonLabel: i._({ id: "dEgA5A" }),
190
- confirmButtonLabel: i._({ id: "rx4T2i" }),
191
- onConfirm: async () => {
192
- l || !r.csr || (await u.mutateAsync({
193
- project_id: o,
194
- certificate_authority_id: r.id,
195
- csr: r.csr,
196
- configuration: { validity: { not_after: Math.floor(Date.now() / 1e3) + U } }
197
- }), n());
198
- },
199
- disableConfirmButton: l || !r.csr,
200
- children: [u.error && /*#__PURE__*/ O(t, {
201
- dismissible: !1,
202
- variant: "error",
203
- className: "mb-4",
204
- children: u.error?.message
205
- }), l ? /*#__PURE__*/ k("div", {
206
- className: "flex items-center justify-center gap-2",
207
- children: [/*#__PURE__*/ O(c, { variant: "primary" }), /*#__PURE__*/ O("span", {
208
- className: "text-theme-high text-sm",
209
- children: /*#__PURE__*/ O(P, { id: "1DbiGM" })
210
- })]
211
- }) : /*#__PURE__*/ O(P, { id: "MI6aae" })]
212
- });
213
- }, G = ({ open: e, onClose: n, pcaId: r }) => {
214
- let { i18n: i, _: a } = F(), o = w(), l = x.useUtils(), { isPending: u, ...d } = x.services.pca.import.useMutation({ onSettled: () => l.services.pca.getById.invalidate() }), f = L({
215
- defaultValues: { imported_certificate_chain: "" },
216
- validators: { onSubmit: I.object({ imported_certificate_chain: I.string().trim().min(1) }) },
217
- onSubmit: async () => {
218
- u || (await d.mutateAsync({
219
- project_id: o,
220
- certificate_authority_id: r,
221
- imported_certificate_chain: f.state.values.imported_certificate_chain
222
- }), p());
223
- }
224
- }), p = () => {
225
- u || (f.reset(), d.reset(), n());
226
- }, g = j(null), v = R(f.store, (e) => e.values.imported_certificate_chain);
227
- return /*#__PURE__*/ k(_, {
228
- open: e,
229
- size: "large",
230
- title: i._({ id: "+1rTEL" }),
231
- onCancel: p,
232
- cancelButtonLabel: i._({ id: "dEgA5A" }),
233
- confirmButtonLabel: i._({ id: "tfDRzk" }),
234
- onConfirm: f.handleSubmit,
235
- disableConfirmButton: u || !v.trim(),
236
- children: [
237
- d.error && /*#__PURE__*/ O(t, {
238
- dismissible: !1,
239
- variant: "error",
240
- className: "mb-4",
241
- children: d.error?.message
242
- }),
243
- u && /*#__PURE__*/ k("div", {
244
- className: "mb-4 flex items-center justify-center gap-2",
245
- children: [/*#__PURE__*/ O(c, { variant: "primary" }), /*#__PURE__*/ O("span", {
246
- className: "text-theme-high text-sm",
247
- children: /*#__PURE__*/ O(P, { id: "pYR76U" })
248
- })]
249
- }),
250
- !u && /*#__PURE__*/ O(h, {
251
- className: "mb-0",
252
- id: "import-externally-signed-certificate-form",
253
- onSubmit: (e) => {
254
- e.preventDefault(), f.handleSubmit();
255
- },
256
- children: /*#__PURE__*/ k(s, { children: [/*#__PURE__*/ k("div", {
257
- className: "mb-2",
258
- children: [/*#__PURE__*/ O(b, {
259
- onClick: () => g.current?.click(),
260
- children: i._({ id: "E7kdtm" })
261
- }), /*#__PURE__*/ O("input", {
262
- ref: g,
263
- type: "file",
264
- accept: ".pem,.crt,.cer,.json",
265
- className: "sr-only",
266
- onChange: (e) => {
267
- let t = e.target.files?.[0];
268
- if (!t) return;
269
- let n = new FileReader();
270
- n.onload = (e) => {
271
- try {
272
- let n = e.target?.result, r = n;
273
- if (t.name.endsWith(".json")) try {
274
- let e = JSON.parse(n);
275
- r = typeof e.imported_certificate_chain == "string" ? e.imported_certificate_chain : n;
276
- } catch {
277
- r = n;
278
- }
279
- f.setFieldValue("imported_certificate_chain", r);
280
- } catch (e) {
281
- console.error("Failed to read certificate file:", e);
282
- }
283
- }, n.readAsText(t);
284
- }
285
- })]
286
- }), /*#__PURE__*/ O(f.Field, {
287
- name: "imported_certificate_chain",
288
- children: (e) => /*#__PURE__*/ O(m, {
289
- id: e.name,
290
- name: e.name,
291
- value: e.state.value,
292
- onBlur: e.handleBlur,
293
- onChange: (t) => e.handleChange(t.target.value),
294
- placeholder: i._({ id: "FAA/qW" }),
295
- errortext: e.state.meta.errors.map((e) => e?.message).join(", "),
296
- disabled: u
297
- })
298
- })] })
299
- })
300
- ]
301
- });
302
- }, K = ({ pca: e }) => {
303
- let { i18n: t, _: n } = F(), i = N(), o = w(), s = e.configuration?.subject?.common_name ?? "", c = t._({
304
- id: "NZVIMV",
305
- values: { subjectCommonName: s }
306
- }), [l, u] = C(!1), [f, p] = C(!1), [m, h] = C(!1), _ = () => i({
307
- to: "/projects/$projectId/services/pca",
308
- params: { projectId: o }
309
- }), v = [
310
- {
311
- label: t._({ id: "c1OE1x" }),
312
- value: e.id
313
- },
314
- {
315
- label: t._({ id: "mSfwLL" }),
316
- value: e.project_id
317
- },
318
- {
319
- label: t._({ id: "UJmAAK" }),
320
- value: e.configuration?.subject?.common_name
321
- },
322
- {
323
- label: t._({ id: "UbWeJA" }),
324
- value: e.certificate?.validity.not_before !== void 0 && e.certificate?.validity.not_after !== void 0 ? `${Math.round((e.certificate.validity.not_after - e.certificate.validity.not_before) / (3600 * 24))} days` : void 0
325
- }
326
- ];
327
- return /*#__PURE__*/ k(D, { children: [
328
- /*#__PURE__*/ k(y, {
329
- direction: "vertical",
330
- gap: "3",
331
- children: [
332
- /*#__PURE__*/ k(y, {
333
- direction: "horizontal",
334
- distribution: "between",
335
- children: [/*#__PURE__*/ k(y, {
336
- gap: "2",
337
- alignment: "center",
338
- children: [/*#__PURE__*/ O("div", {
339
- className: "text-theme-default text-2xl font-semibold",
340
- children: `${e.configuration?.subject?.common_name} Certificate Authority Details`
341
- }), E[e.state].badge]
342
- }), /*#__PURE__*/ O(b, {
343
- onClick: h,
344
- children: /*#__PURE__*/ O(P, { id: "Blsc/x" })
345
- })]
346
- }),
347
- /*#__PURE__*/ O("p", {
348
- className: "text-theme-highest text-sm",
349
- children: /*#__PURE__*/ O(P, { id: "dxMaZH" })
350
- }),
351
- e.state === "AWAITING_CERTIFICATE" && /*#__PURE__*/ k(y, {
352
- direction: "vertical",
353
- gap: "1",
354
- className: "bg-dt-background mb-1 rounded-sm p-2",
355
- children: [/*#__PURE__*/ k(y, {
356
- direction: "vertical",
357
- gap: "1",
358
- children: [/*#__PURE__*/ O("div", {
359
- className: "text-base font-bold",
360
- children: /*#__PURE__*/ O(P, { id: "cUKFby" })
361
- }), /*#__PURE__*/ O("div", { children: /*#__PURE__*/ O(P, { id: "+HVj+D" }) })]
362
- }), /*#__PURE__*/ k(y, {
363
- direction: "horizontal",
364
- gap: "2",
365
- distribution: "end",
366
- children: [/*#__PURE__*/ O(b, {
367
- onClick: u,
368
- children: /*#__PURE__*/ O(P, { id: "AirKNZ" })
369
- }), /*#__PURE__*/ O(b, {
370
- onClick: p,
371
- children: /*#__PURE__*/ O(P, { id: "3uDz8n" })
372
- })]
373
- })]
374
- }),
375
- /*#__PURE__*/ k(y, {
376
- gap: "4",
377
- className: "grid grid-cols-2 items-start",
378
- children: [/*#__PURE__*/ O(a, {
379
- alignTerms: "right",
380
- className: "w-full",
381
- children: v.map(({ label: e, value: t }) => /*#__PURE__*/ k(A, { children: [/*#__PURE__*/ O(g, { children: e }), /*#__PURE__*/ O(r, { children: t || "—" })] }, e))
382
- }), /*#__PURE__*/ O(d, {
383
- heading: c,
384
- content: e?.csr ?? "",
385
- className: "w-full [&_pre_code]:block [&_pre_code]:w-full",
386
- wrap: !0
387
- })]
388
- })
389
- ]
390
- }),
391
- f && /*#__PURE__*/ O(G, {
392
- pcaId: e.id,
393
- open: f,
394
- onClose: p
395
- }),
396
- l && /*#__PURE__*/ O(W, {
397
- pca: e,
398
- open: l,
399
- onClose: u
400
- }),
401
- m && /*#__PURE__*/ O(T, {
402
- pca: e,
403
- open: m,
404
- onClose: h,
405
- onSuccess: _
406
- }),
407
- /*#__PURE__*/ O(H, {
408
- pcaId: e.id,
409
- pcaState: e.state
410
- })
411
- ] });
412
- };
413
- //#endregion
414
- //#region src/client/routes/_auth/projects/$projectId/services/pca/$pcaId/index.tsx?tsr-split=component
415
- function q() {
416
- let e = N(), t = w(), { pcaId: n } = S.useParams(), { isLoading: r, isError: i, error: a, data: o } = x.services.pca.getById.useQuery({
417
- project_id: t,
418
- certificate_authority_id: n
419
- });
420
- if (r) return /*#__PURE__*/ k(y, {
421
- className: "fixed inset-0",
422
- distribution: "center",
423
- alignment: "center",
424
- direction: "vertical",
425
- children: [/*#__PURE__*/ O(c, {
426
- variant: "primary",
427
- size: "large",
428
- className: "mb-2"
429
- }), /*#__PURE__*/ O(P, { id: "og1m+J" })]
430
- });
431
- let s = () => e({
432
- to: "/projects/$projectId/services/pca",
433
- params: { projectId: t }
434
- });
435
- if (i) {
436
- let e = a?.message || "Unknown error";
437
- return /*#__PURE__*/ k(y, {
438
- className: "fixed inset-0",
439
- distribution: "center",
440
- alignment: "center",
441
- direction: "vertical",
442
- gap: "5",
443
- children: [
444
- /*#__PURE__*/ O("p", {
445
- className: "text-theme-error font-semibold",
446
- children: /*#__PURE__*/ O(P, { id: "IQSLN+" })
447
- }),
448
- /*#__PURE__*/ O("p", {
449
- className: "text-theme-highest",
450
- children: e
451
- }),
452
- /*#__PURE__*/ O(b, {
453
- onClick: s,
454
- variant: "primary",
455
- children: /*#__PURE__*/ O(P, { id: "HG0uMz" })
456
- })
457
- ]
458
- });
459
- }
460
- return o ? /*#__PURE__*/ O(K, { pca: o }) : /*#__PURE__*/ k(y, {
461
- className: "fixed inset-0",
462
- distribution: "center",
463
- alignment: "center",
464
- direction: "vertical",
465
- gap: "5",
466
- children: [/*#__PURE__*/ O("p", {
467
- className: "text-theme-secondary",
468
- children: /*#__PURE__*/ O(P, { id: "Io2Dvq" })
469
- }), /*#__PURE__*/ O(b, {
470
- onClick: s,
471
- variant: "primary",
472
- children: /*#__PURE__*/ O(P, { id: "HG0uMz" })
473
- })]
474
- });
475
- }
476
- //#endregion
477
- export { q as component };
478
-
479
- //# sourceMappingURL=_pcaId-DY9GPV7t.mjs.map