@kong-ui-public/entities-vaults 4.0.14 → 4.0.15-pr.2781.b1238e65f.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.
Files changed (46) hide show
  1. package/package.json +3 -3
  2. package/dist/entities-vaults.es.js +0 -2877
  3. package/dist/entities-vaults.umd.js +0 -1
  4. package/dist/style.css +0 -1
  5. package/dist/types/components/SecretForm.vue.d.ts +0 -54
  6. package/dist/types/components/SecretForm.vue.d.ts.map +0 -1
  7. package/dist/types/components/SecretFormInner.vue.d.ts +0 -54
  8. package/dist/types/components/SecretFormInner.vue.d.ts.map +0 -1
  9. package/dist/types/components/SecretList.vue.d.ts +0 -85
  10. package/dist/types/components/SecretList.vue.d.ts.map +0 -1
  11. package/dist/types/components/SecretListInner.vue.d.ts +0 -85
  12. package/dist/types/components/SecretListInner.vue.d.ts.map +0 -1
  13. package/dist/types/components/VaultConfigCard.vue.d.ts +0 -63
  14. package/dist/types/components/VaultConfigCard.vue.d.ts.map +0 -1
  15. package/dist/types/components/VaultForm.vue.d.ts +0 -44
  16. package/dist/types/components/VaultForm.vue.d.ts.map +0 -1
  17. package/dist/types/components/VaultList.vue.d.ts +0 -107
  18. package/dist/types/components/VaultList.vue.d.ts.map +0 -1
  19. package/dist/types/components/VaultSecretPicker.vue.d.ts +0 -81
  20. package/dist/types/components/VaultSecretPicker.vue.d.ts.map +0 -1
  21. package/dist/types/components/VaultSecretPickerProvider.vue.d.ts +0 -13
  22. package/dist/types/components/VaultSecretPickerProvider.vue.d.ts.map +0 -1
  23. package/dist/types/composables/index.d.ts +0 -6
  24. package/dist/types/composables/index.d.ts.map +0 -1
  25. package/dist/types/composables/useI18n.d.ts +0 -9
  26. package/dist/types/composables/useI18n.d.ts.map +0 -1
  27. package/dist/types/index.d.ts +0 -14
  28. package/dist/types/index.d.ts.map +0 -1
  29. package/dist/types/secrets-endpoints.d.ts +0 -16
  30. package/dist/types/secrets-endpoints.d.ts.map +0 -1
  31. package/dist/types/types/index.d.ts +0 -6
  32. package/dist/types/types/index.d.ts.map +0 -1
  33. package/dist/types/types/secret-form.d.ts +0 -19
  34. package/dist/types/types/secret-form.d.ts.map +0 -1
  35. package/dist/types/types/secret-list.d.ts +0 -15
  36. package/dist/types/types/secret-list.d.ts.map +0 -1
  37. package/dist/types/types/vault-config.d.ts +0 -16
  38. package/dist/types/types/vault-config.d.ts.map +0 -1
  39. package/dist/types/types/vault-form.d.ts +0 -174
  40. package/dist/types/types/vault-form.d.ts.map +0 -1
  41. package/dist/types/types/vault-list.d.ts +0 -33
  42. package/dist/types/types/vault-list.d.ts.map +0 -1
  43. package/dist/types/utils.d.ts +0 -37
  44. package/dist/types/utils.d.ts.map +0 -1
  45. package/dist/types/vaults-endpoints.d.ts +0 -24
  46. package/dist/types/vaults-endpoints.d.ts.map +0 -1
@@ -1,2877 +0,0 @@
1
- import { defineComponent as ce, ref as $, computed as w, watch as ke, onBeforeMount as we, resolveComponent as J, createElementBlock as W, openBlock as V, createVNode as u, unref as e, createSlots as Ke, withCtx as m, createTextVNode as ue, toDisplayString as H, createElementVNode as x, createBlock as D, Teleport as Ye, createCommentVNode as B, reactive as ye, resolveDynamicComponent as Pe, TransitionGroup as Xe, Fragment as qe, renderList as et, mergeProps as je, normalizeClass as tt, nextTick as lt, renderSlot as ot } from "vue";
2
- import { useRouter as Ee } from "vue-router";
3
- import { BookIcon as Me, AddIcon as Re, SecurityIcon as at, ConjourIcon as rt, AzureIcon as it, HashicorpIcon as nt, GoogleCloudIcon as st, AwsIcon as dt, CodeIcon as ut, KongIcon as ct } from "@kong/icons";
4
- import { useAxios as _e, useTableState as ft, useFetcher as We, useDeleteUrlBuilder as De, FetcherStatus as Be, EntityBaseTable as Je, PermissionsWrapper as ge, TableTags as pt, EntityFilter as Le, EntityDeleteModal as ze, EntityTypes as Ge, useErrors as Ze, EntityBaseFormType as Ve, useGatewayFeatureSupported as mt, EntityBaseForm as Qe, SupportedEntityType as Ue, EntityFormSection as Ae, useStringHelpers as vt, useHelpers as gt, ConfigurationSchemaType as Se, ConfigurationSchemaSection as Ne, EntityBaseConfigCard as bt, ConfigCardItem as _t, useDebouncedFilter as Fe } from "@kong-ui-public/entities-shared";
5
- import { createI18n as ht, i18nTComponent as yt } from "@kong-ui-public/i18n";
6
- const Vt = {
7
- create: "New vault",
8
- copy_id: "Copy ID",
9
- copy_json: "Copy JSON",
10
- edit: "Edit",
11
- delete: "Delete",
12
- view: "View Details",
13
- loading: "Loading..."
14
- }, kt = {
15
- general: "Vaults could not be retrieved",
16
- delete: "The vault could not be deleted at this time.",
17
- copy: "Failed to copy to clipboard"
18
- }, Ct = {
19
- placeholder_for_vaults: {
20
- konnect: "Filter by exact prefix or ID"
21
- },
22
- placeholder_for_secrets: {
23
- konnect: "Filter by exact key"
24
- }
25
- }, wt = {
26
- title: "Vaults",
27
- list: {
28
- toolbar_actions: {
29
- new_vault: "New vault"
30
- },
31
- table_headers: {
32
- prefix: "Prefix",
33
- name: "Vault Type",
34
- description: "Description",
35
- tags: "Tags",
36
- id: "ID"
37
- },
38
- empty_state: {
39
- title: "Configure a New Vault",
40
- description: "Improve the security of your Kong Gateway deployment with centralized secrets."
41
- },
42
- empty_state_v2: {
43
- title: "Configure your first vault",
44
- group: "Vaults created in gateways within this group will automatically appear here.",
45
- description: "Vaults securely and centrally store sensitive information, such as credentials, tokens, and keys, to simplify secrets management.",
46
- create_cta: "New vault",
47
- learn_more: "Learn more"
48
- }
49
- }
50
- }, St = {
51
- title: "Secrets",
52
- list: {
53
- toolbar_actions: {
54
- new_secret: "Store New Secret"
55
- },
56
- table_headers: {
57
- key: "Secret Key",
58
- updated_at: "Updated At"
59
- },
60
- empty_state: {
61
- title: "No Secrets Stored",
62
- description: "Improve the security of your Kong Gateway deployment with centralized secrets."
63
- }
64
- },
65
- form: {
66
- info: {
67
- title: "Secret",
68
- description: "Enter the secret key and secret value to be stored in Konnect vault"
69
- },
70
- fields: {
71
- key: {
72
- label: "Key",
73
- placeholder: "Enter key"
74
- },
75
- value: {
76
- label: "Value",
77
- placeholder: "Enter value here, can be simple values or multi-line"
78
- }
79
- },
80
- hint: "Once saved, the secret value will not be visible"
81
- }
82
- }, It = {
83
- success: "Copied {val} to clipboard",
84
- success_brief: "Successfully copied to clipboard"
85
- }, xt = {
86
- vault_type: "Vault Type"
87
- }, Rt = {
88
- sections: {
89
- general: {
90
- title: "General Information",
91
- description: "General information helps identify and manage this Vault instance."
92
- },
93
- config: {
94
- title: "Vault Configuration",
95
- description: "Select a type of Vault and configure properties specific to each type of Vault."
96
- }
97
- },
98
- fields: {
99
- prefix: {
100
- label: "Prefix",
101
- placeholder: "Enter a unique prefix for this vault",
102
- help: "e.g. my-vault",
103
- tooltip: "The reference prefix. You need this prefix to access secrets stored in this vault. For example, {vault://<your-prefix>/<some-secret>}."
104
- },
105
- description: {
106
- label: "Description",
107
- placeholder: "Enter some description for this vault"
108
- },
109
- tags: {
110
- label: "Tags",
111
- placeholder: "Enter a list of tags separated by comma",
112
- help: "e.g. tag1, tag2, tag3"
113
- }
114
- },
115
- config: {
116
- konnect: {
117
- label: "Konnect",
118
- description: "Access secrets stored directly in Konnect's unified platform to easily reference in Kong Gateway configuration."
119
- },
120
- env: {
121
- label: "Environment Variables",
122
- description: "Access secrets stored via variables to be made available in Kong Gateway at runtime.",
123
- fields: {
124
- prefix: {
125
- label: "Environment Variable Prefix",
126
- placeholder: "Enter your environment variable vault prefix",
127
- tooltip: "Data plane will access all the environment variables starting with this prefix."
128
- }
129
- }
130
- },
131
- aws: {
132
- label: "AWS Secrets Manager",
133
- description: "Access secrets stored in AWS Secrets Manager for Kong Gateway configuration.",
134
- fields: {
135
- region: {
136
- label: "Region",
137
- placeholder: "Select an AWS region",
138
- tooltip: "The AWS region your vault is located in",
139
- locations: {
140
- "us-east-1": {
141
- location: "N. Virginia"
142
- },
143
- "us-east-2": {
144
- location: "Ohio"
145
- },
146
- "us-west-1": {
147
- location: "N. California"
148
- },
149
- "us-west-2": {
150
- location: "Oregon"
151
- },
152
- "af-south-1": {
153
- location: "Cape Town"
154
- },
155
- "ap-east-1": {
156
- location: "Hong Kong"
157
- },
158
- "ap-southeast-3": {
159
- location: "Jakarta"
160
- },
161
- "ap-south-1": {
162
- location: "Mumbai"
163
- },
164
- "ap-northeast-1": {
165
- location: "Tokyo"
166
- },
167
- "ap-northeast-2": {
168
- location: "Seoul"
169
- },
170
- "ap-northeast-3": {
171
- location: "Osaka"
172
- },
173
- "ap-southeast-1": {
174
- location: "Singapore"
175
- },
176
- "ap-southeast-2": {
177
- location: "Sydney"
178
- },
179
- "ca-central-1": {
180
- location: "Canada"
181
- },
182
- "eu-central-1": {
183
- location: "Frankfurt"
184
- },
185
- "eu-west-1": {
186
- location: "Ireland"
187
- },
188
- "eu-west-2": {
189
- location: "London"
190
- },
191
- "eu-west-3": {
192
- location: "Paris"
193
- },
194
- "eu-south-1": {
195
- location: "Milan"
196
- },
197
- "eu-north-1": {
198
- location: "Stockholm"
199
- },
200
- "me-south-1": {
201
- location: "Bahrain"
202
- },
203
- "sa-east-1": {
204
- location: "São Paulo"
205
- },
206
- "us-gov-east-1": {
207
- location: "US East"
208
- },
209
- "us-gov-west-1": {
210
- location: "US West"
211
- }
212
- }
213
- },
214
- endpoint_url: {
215
- label: "Endpoint URL",
216
- tooltip: 'The AWS SecretsManager service endpoint url. If not specified, the value used by vault will be the official AWS SecretsManager service url which is `https://secretsmanager.<region>.amazonaws.com`. You can specify a complete URL(including the "http/https" scheme) to override the endpoint that vault will connect to.'
217
- },
218
- assume_role_arn: {
219
- label: "Assume Role ARN",
220
- tooltip: "The target AWS IAM role ARN that will be assumed. Typically this is used for operating between multiple roles or cross-accounts. If you are not using assume role you should not specify this value."
221
- },
222
- role_session_name: {
223
- label: "Role Session Name",
224
- tooltip: "The role session name used for role assuming."
225
- },
226
- sts_endpoint_url: {
227
- label: "STS Endpoint URL",
228
- tooltip: "The custom STS endpoint URL used for role assuming in AWS Vault. Note that this value will override the default STS endpoint URL(which should be `https: //sts.amazonaws.com`, or `https: //sts.<region>.amazonaws.com` if you have `AWS_STS_REGIONAL_ENDPOINTS` set to `regional`). If you are not using private VPC endpoint for STS service, you should not specify this value."
229
- }
230
- }
231
- },
232
- gcp: {
233
- label: "Google Secret Manager",
234
- description: "Access secrets stored in Google Secret Manager for Kong Gateway configuration.",
235
- fields: {
236
- project_id: {
237
- label: "Project ID",
238
- placeholder: "Enter your Google Cloud Project ID",
239
- tooltip: {
240
- text: "Visit your Google API Console and select {italic-text} in the projects list to see your project ID",
241
- italicText: "Manage all projects"
242
- }
243
- }
244
- }
245
- },
246
- hcv: {
247
- label: "HashiCorp Vault",
248
- description: "Access secrets stored in HashiCorp Vault for Kong Gateway configuration.",
249
- fields: {
250
- protocol: {
251
- label: "Protocol"
252
- },
253
- host: {
254
- label: "Host"
255
- },
256
- port: {
257
- label: "Port"
258
- },
259
- mount: {
260
- label: "Mount"
261
- },
262
- kv: {
263
- label: "Kv"
264
- },
265
- namespace: {
266
- label: "Namespace"
267
- },
268
- auth_method: {
269
- label: "Authentication Method"
270
- },
271
- token: {
272
- label: "Token"
273
- },
274
- kube_role: {
275
- label: "Kubernetes Role"
276
- },
277
- kube_auth_path: {
278
- label: "Kubernetes Auth Path"
279
- },
280
- kube_api_token_file: {
281
- label: "Kubernetes API Token File"
282
- },
283
- approle_auth_path: {
284
- label: "App Role Auth Path"
285
- },
286
- approle_role_id: {
287
- label: "App Role Role ID"
288
- },
289
- approle_secret_id: {
290
- label: "App Role Secret ID"
291
- },
292
- approle_secret_id_file: {
293
- label: "App Role Secret ID File"
294
- },
295
- approle_response_wrapping: {
296
- label: "App Role Response Wrapping"
297
- },
298
- cert_auth_cert: {
299
- label: "Cert"
300
- },
301
- cert_auth_cert_key: {
302
- label: "Cert Key"
303
- },
304
- cert_auth_role_name: {
305
- label: "Role Name"
306
- },
307
- oauth2_audiences: {
308
- label: "OAuth2 Audiences",
309
- tooltip: "Comma-separated list of OAuth2 audiences."
310
- },
311
- oauth2_client_id: {
312
- label: "OAuth2 Client ID"
313
- },
314
- oauth2_client_secret: {
315
- label: "OAuth2 Client Secret"
316
- },
317
- jwt_role: {
318
- label: "JWT Role",
319
- tooltip: "The configured role name in HashiCorp Vault for JWT auth. When creating the role in HashiCorp Vault, make sure that the `role_type` is `jwt` and the `token_policies` have permissions to read the secrets."
320
- },
321
- oauth2_token_endpoint: {
322
- label: "OAuth2 Token Endpoint"
323
- }
324
- }
325
- },
326
- azure: {
327
- label: "Azure Vault",
328
- description: "Access secrets stored in Azure Key Vault for Kong Gateway configuration.",
329
- fields: {
330
- location: {
331
- label: "Location"
332
- },
333
- vault_uri: {
334
- label: "Vault URI"
335
- },
336
- credential_prefix: {
337
- label: "Credential Prefix"
338
- },
339
- type: {
340
- label: "Type",
341
- placeholder: "Select a type"
342
- },
343
- client_id: {
344
- label: "Client ID"
345
- },
346
- tenant_id: {
347
- label: "Tenant ID"
348
- }
349
- }
350
- },
351
- conjur: {
352
- label: "Conjur Vault",
353
- description: "Access secrets stored in Conjur Key Vault for Kong Gateway configuration.",
354
- fields: {
355
- endpoint_url: {
356
- label: "Conjur Server",
357
- tooltip: "The CyberArk Conjur backend url. Accepts http or https."
358
- },
359
- login: {
360
- label: "Workload Identity",
361
- tooltip: "Identity of the workload or host authenticating to Conjur. In this case Kong is the workload/host."
362
- },
363
- api_key: {
364
- label: "API Key",
365
- tooltip: "The API key issued to the workload."
366
- },
367
- account: {
368
- label: "Conjur Account",
369
- tooltip: "The Conjur account for which the token will be issued. This is the identifier provided during conjur configuration."
370
- }
371
- }
372
- },
373
- advancedFields: {
374
- title: "View Advanced Fields",
375
- ttl: "TTL",
376
- ttlTooltip: `Time-to-live (in seconds) of a secret from the vault when it's cached. The special value of 0 means "no rotation" and it's the default. When using non-zero values, it is recommended that they're at least 1 minute.`,
377
- negTtl: "Negative TTL",
378
- negTtlTooltip: "Time-to-live (in seconds) of a vault miss (no secret). Negatively cached secrets will remain valid until neg_ttl is reached, after which Kong will attempt to refresh the secret again. The default value for neg_ttl is 0, meaning no negative caching occurs.",
379
- resurrectTtl: "Resurrect TTL",
380
- resurrectTtlTooltip: "Time (in seconds) for how long secrets will remain in use after they are expired (config.ttl is over). This is useful when a vault becomes unreachable, or when a secret is deleted from the Vault and isn't replaced immediately. On both cases, the Gateway will keep trying to refresh the secret for resurrect_ttl seconds. After that, it will stop trying to refresh. We recommend assigning a sufficiently high value to this configuration option to ensure a seamless transition in case there are unexpected issues with the Vault. The default value for resurrect_ttl is 1e8 seconds, which is about 3 years."
381
- },
382
- commonFields: {
383
- base64_decode: {
384
- label: "Base64 Decode",
385
- tooltip: "Decode all secrets in this vault as base64, useful for binary data. If some of the secrets are not base64 encoded, an error will occur when using them. It's recommended to create a separate vault for base64 secrets."
386
- }
387
- }
388
- },
389
- unavailable: "This vault provider is available on Enterprise."
390
- }, At = {
391
- title: "Look up Key in Vault",
392
- vault: {
393
- label: "Vault",
394
- placeholder: "Select a vault"
395
- },
396
- secret_id: {
397
- label: "Secret ID",
398
- input_placeholder: "Enter a secret ID",
399
- select_placeholder: "Select or enter a complete secret ID"
400
- },
401
- optional_secret_key: {
402
- label: "Secret Key",
403
- placeholder: "Enter the key or key path to access a nested secret value",
404
- help: "Optional. e.g. tokens, tokens/refresh_token"
405
- },
406
- fetch_error: {
407
- vaults: "Could not fetch available vaults",
408
- secrets: "Could not fetch available secrets",
409
- vaults_and_secrets: "Could not fetch available vaults and secrets"
410
- },
411
- no_results: "No results found",
412
- actions: {
413
- use_key: "Use Key"
414
- },
415
- provider: {
416
- complete_action: "Look up {cta}",
417
- cta: "key in vault"
418
- }
419
- }, Et = {
420
- actions: Vt,
421
- delete: {
422
- title: "Delete a Vault",
423
- title_for_secret: "Delete a Secret",
424
- description: "This action cannot be reversed."
425
- },
426
- errors: kt,
427
- search: Ct,
428
- vaults: wt,
429
- secrets: St,
430
- copy: It,
431
- labels: xt,
432
- form: Rt,
433
- vault_secret_picker: At
434
- };
435
- function Ut() {
436
- const o = ht("en-us", Et);
437
- return {
438
- i18n: o,
439
- i18nT: yt(o)
440
- // Translation component <i18n-t>
441
- };
442
- }
443
- const he = {
444
- useI18n: Ut
445
- }, Ie = "/v2/control-planes/{controlPlaneId}/core-entities", Oe = "/v2/control-planes/{controlPlaneId}/config-stores", xe = "/{workspace}", pe = {
446
- list: {
447
- konnect: {
448
- getAll: `${Ie}/vaults`,
449
- deleteConfigStore: `${Oe}/{id}?force=true`
450
- },
451
- kongManager: {
452
- getAll: `${xe}/vaults`
453
- }
454
- },
455
- form: {
456
- konnect: {
457
- create: `${Ie}/vaults`,
458
- createConfigStore: Oe,
459
- edit: `${Ie}/vaults/{id}`
460
- },
461
- kongManager: {
462
- create: `${xe}/vaults`,
463
- edit: `${xe}/vaults/{id}`
464
- }
465
- }
466
- }, Tt = { class: "kong-ui-entities-vaults-list" }, Ht = { class: "button-row" }, $t = { class: "table-content-overflow-wrapper" }, Kt = { class: "table-content-overflow-wrapper" }, Pt = /* @__PURE__ */ ce({
467
- __name: "VaultList",
468
- props: {
469
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
470
- config: {
471
- type: Object,
472
- required: !0,
473
- validator: (o) => !(!o || !["konnect", "kongManager"].includes(o == null ? void 0 : o.app) || !o.createRoute || !o.getViewRoute || !o.getEditRoute || o.app === "kongManager" && !o.isExactMatch && !o.filterSchema)
474
- },
475
- // used to override the default identifier for the cache entry
476
- cacheIdentifier: {
477
- type: String,
478
- default: ""
479
- },
480
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
481
- canCreate: {
482
- type: Function,
483
- required: !1,
484
- default: async () => !0
485
- },
486
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
487
- canDelete: {
488
- type: Function,
489
- required: !1,
490
- default: async () => !0
491
- },
492
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
493
- canEdit: {
494
- type: Function,
495
- required: !1,
496
- default: async () => !0
497
- },
498
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
499
- canRetrieve: {
500
- type: Function,
501
- required: !1,
502
- default: async () => !0
503
- },
504
- /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
505
- useActionOutside: {
506
- type: Boolean,
507
- default: !1
508
- }
509
- },
510
- emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success"],
511
- setup(o, { emit: S }) {
512
- var fe;
513
- const c = S, d = o, { i18n: { t: p } } = he.useI18n(), a = Ee(), { axiosInstance: K } = _e((fe = d.config) == null ? void 0 : fe.axiosRequestConfig), { hasRecords: I, handleStateChange: h } = ft(() => Q.value), n = w(() => I.value && d.config.app === "konnect"), g = w(() => d.config.app !== "kongManager" || !!d.config.disableSorting), f = {
514
- // the Prefix column is non-hidable
515
- prefix: { label: p("vaults.list.table_headers.prefix"), searchable: !0, sortable: !0, hidable: !1 },
516
- // it's "Vault Type" on display, but we still use "name" to fit API schema
517
- name: { label: p("vaults.list.table_headers.name"), searchable: !0, sortable: !0 },
518
- description: { label: p("vaults.list.table_headers.description"), sortable: !1 },
519
- tags: { label: p("vaults.list.table_headers.tags"), sortable: !1 }
520
- }, N = f, X = w(() => {
521
- var E, U;
522
- let k = `${d.config.apiBaseUrl}${pe.list[d.config.app].getAll}`;
523
- return d.config.app === "konnect" ? k = k.replace(/{controlPlaneId}/gi, ((E = d.config) == null ? void 0 : E.controlPlaneId) || "") : d.config.app === "kongManager" && (k = k.replace(/\/{workspace}/gi, (U = d.config) != null && U.workspace ? `/${d.config.workspace}` : "")), k;
524
- }), Q = $(""), Y = w(() => {
525
- if (d.config.app === "konnect" || d.config.isExactMatch)
526
- return {
527
- isExactMatch: !0,
528
- placeholder: p("search.placeholder_for_vaults.konnect")
529
- };
530
- const { prefix: E, name: U } = f;
531
- return {
532
- isExactMatch: !1,
533
- fields: { name: U, prefix: E },
534
- schema: d.config.filterSchema
535
- };
536
- }), {
537
- fetcher: O,
538
- fetcherState: l,
539
- fetcherCacheKey: ae
540
- } = We(w(() => ({ ...d.config, cacheIdentifier: d.cacheIdentifier })), X), z = () => {
541
- Q.value = "";
542
- }, ee = () => {
543
- ae.value++;
544
- }, G = $(null), y = async (k, E) => {
545
- const U = k.id;
546
- if (!await E(U)) {
547
- c("copy:error", {
548
- entity: k,
549
- field: "id",
550
- message: p("errors.copy")
551
- });
552
- return;
553
- }
554
- c("copy:success", {
555
- entity: k,
556
- field: "id",
557
- message: p("copy.success", { val: U })
558
- });
559
- }, F = async (k, E) => {
560
- const U = JSON.stringify(k);
561
- if (!await E(U)) {
562
- c("copy:error", {
563
- entity: k,
564
- message: p("errors.copy")
565
- });
566
- return;
567
- }
568
- c("copy:success", {
569
- entity: k,
570
- message: p("copy.success_brief")
571
- });
572
- }, re = async (k) => {
573
- var U;
574
- await ((U = d.canRetrieve) == null ? void 0 : U.call(d, k)) && a.push(d.config.getViewRoute(k.id));
575
- }, ne = (k) => ({
576
- label: p("actions.view"),
577
- to: d.config.getViewRoute(k)
578
- }), le = (k) => ({
579
- label: p("actions.edit"),
580
- to: d.config.getEditRoute(k)
581
- }), q = $(void 0), ie = $(!1), T = $(!1), Z = $(""), te = De(d.config, X.value), b = (k) => {
582
- q.value = k, ie.value = !0;
583
- }, v = () => {
584
- ie.value = !1;
585
- }, P = async (k) => {
586
- const { apiBaseUrl: E, app: U, controlPlaneId: s } = d.config, r = `${E}${pe.list[U].deleteConfigStore}`.replace(/{controlPlaneId}/gi, s || "").replace(/{id}/gi, k);
587
- try {
588
- await K.delete(r);
589
- } catch {
590
- }
591
- }, M = async () => {
592
- var k, E, U, s;
593
- if ((k = q.value) != null && k.id) {
594
- T.value = !0;
595
- try {
596
- await K.delete(te(q.value.id)), d.config.app === "konnect" && ((E = q.value.config) != null && E.config_store_id) && P(q.value.config.config_store_id), T.value = !1, ie.value = !1, ae.value++, c("delete:success", q.value);
597
- } catch (r) {
598
- Z.value = ((s = (U = r.response) == null ? void 0 : U.data) == null ? void 0 : s.message) || r.message || p("errors.delete"), c("error", r);
599
- } finally {
600
- T.value = !1;
601
- }
602
- }
603
- }, se = () => {
604
- a.push(d.config.createRoute);
605
- };
606
- ke(l, (k) => {
607
- var E, U, s;
608
- if (k.status === Be.Error) {
609
- G.value = {
610
- title: p("errors.general")
611
- }, (s = (U = (E = k.error) == null ? void 0 : E.response) == null ? void 0 : U.data) != null && s.message && (G.value.message = k.error.response.data.message), c("error", k.error);
612
- return;
613
- }
614
- G.value = null;
615
- });
616
- const j = $({
617
- ctaPath: d.config.createRoute,
618
- ctaText: void 0,
619
- message: `${p("vaults.list.empty_state.description")}${d.config.additionMessageForEmptyState ? ` ${d.config.additionMessageForEmptyState}` : ""}`,
620
- title: p("vaults.title")
621
- }), R = $(!1);
622
- return we(async () => {
623
- R.value = await d.canCreate(), R.value && (j.value.title = p("vaults.list.empty_state.title"), j.value.ctaText = p("actions.create"));
624
- }), (k, E) => {
625
- const U = J("KButton"), s = J("KEmptyState"), r = J("KDropdownItem"), L = J("KClipboardProvider");
626
- return V(), W("div", Tt, [
627
- u(e(Je), {
628
- "cache-identifier": o.cacheIdentifier,
629
- "disable-sorting": g.value,
630
- "empty-state-options": j.value,
631
- "enable-entity-actions": "",
632
- "error-message": G.value,
633
- fetcher: e(O),
634
- "fetcher-cache-key": e(ae),
635
- "pagination-type": "offset",
636
- "preferences-storage-key": "kong-ui-entities-vaults-list",
637
- query: Q.value,
638
- "table-headers": e(N),
639
- onClearSearchInput: z,
640
- "onClick:row": E[3] || (E[3] = (C) => re(C)),
641
- onSort: ee,
642
- onState: e(h)
643
- }, Ke({
644
- "toolbar-filter": m(() => [
645
- u(e(Le), {
646
- modelValue: Q.value,
647
- "onUpdate:modelValue": E[0] || (E[0] = (C) => Q.value = C),
648
- config: Y.value
649
- }, null, 8, ["modelValue", "config"])
650
- ]),
651
- "toolbar-button": m(() => [
652
- (V(), D(Ye, {
653
- disabled: !o.useActionOutside,
654
- to: "#kong-ui-app-page-header-action-button"
655
- }, [
656
- x("div", Ht, [
657
- n.value ? (V(), D(U, {
658
- key: 0,
659
- appearance: "secondary",
660
- class: "open-learning-hub",
661
- "data-testid": "vault-learn-more-button",
662
- icon: "",
663
- onClick: E[1] || (E[1] = (C) => k.$emit("click:learn-more"))
664
- }, {
665
- default: m(() => [
666
- u(e(Me), { decorative: "" })
667
- ]),
668
- _: 1
669
- })) : B("", !0),
670
- u(e(ge), {
671
- "auth-function": () => o.canCreate()
672
- }, {
673
- default: m(() => [
674
- u(U, {
675
- appearance: "primary",
676
- "data-testid": "toolbar-add-vault",
677
- size: o.useActionOutside ? "medium" : "large",
678
- to: o.config.createRoute
679
- }, {
680
- default: m(() => [
681
- u(e(Re)),
682
- ue(" " + H(e(p)("vaults.list.toolbar_actions.new_vault")), 1)
683
- ]),
684
- _: 1
685
- }, 8, ["size", "to"])
686
- ]),
687
- _: 1
688
- }, 8, ["auth-function"])
689
- ])
690
- ], 8, ["disabled"]))
691
- ]),
692
- prefix: m(({ rowValue: C }) => [
693
- x("div", $t, [
694
- x("b", null, H(C ?? "-"), 1)
695
- ])
696
- ]),
697
- name: m(({ rowValue: C }) => [
698
- x("b", null, H(C ?? "-"), 1)
699
- ]),
700
- description: m(({ rowValue: C }) => [
701
- x("div", Kt, H(C ?? "-"), 1)
702
- ]),
703
- tags: m(({ rowValue: C }) => [
704
- u(e(pt), { tags: C }, null, 8, ["tags"])
705
- ]),
706
- actions: m(({ row: C }) => [
707
- u(L, null, {
708
- default: m(({ copyToClipboard: _ }) => [
709
- u(r, {
710
- "data-testid": "action-entity-copy-id",
711
- onClick: (oe) => y(C, _)
712
- }, {
713
- default: m(() => [
714
- ue(H(e(p)("actions.copy_id")), 1)
715
- ]),
716
- _: 1
717
- }, 8, ["onClick"])
718
- ]),
719
- _: 2
720
- }, 1024),
721
- u(L, null, {
722
- default: m(({ copyToClipboard: _ }) => [
723
- u(r, {
724
- "data-testid": "action-entity-copy-json",
725
- onClick: (oe) => F(C, _)
726
- }, {
727
- default: m(() => [
728
- ue(H(e(p)("actions.copy_json")), 1)
729
- ]),
730
- _: 1
731
- }, 8, ["onClick"])
732
- ]),
733
- _: 2
734
- }, 1024),
735
- u(e(ge), {
736
- "auth-function": () => o.canRetrieve(C)
737
- }, {
738
- default: m(() => [
739
- u(r, {
740
- "data-testid": "action-entity-view",
741
- "has-divider": "",
742
- item: ne(C.id)
743
- }, null, 8, ["item"])
744
- ]),
745
- _: 2
746
- }, 1032, ["auth-function"]),
747
- u(e(ge), {
748
- "auth-function": () => o.canEdit(C)
749
- }, {
750
- default: m(() => [
751
- u(r, {
752
- "data-testid": "action-entity-edit",
753
- item: le(C.id)
754
- }, null, 8, ["item"])
755
- ]),
756
- _: 2
757
- }, 1032, ["auth-function"]),
758
- u(e(ge), {
759
- "auth-function": () => o.canDelete(C)
760
- }, {
761
- default: m(() => [
762
- u(r, {
763
- danger: "",
764
- "data-testid": "action-entity-delete",
765
- "has-divider": "",
766
- onClick: (_) => b(C)
767
- }, {
768
- default: m(() => [
769
- ue(H(e(p)("actions.delete")), 1)
770
- ]),
771
- _: 1
772
- }, 8, ["onClick"])
773
- ]),
774
- _: 2
775
- }, 1032, ["auth-function"])
776
- ]),
777
- _: 2
778
- }, [
779
- !Q.value && o.config.app === "konnect" ? {
780
- name: "empty-state",
781
- fn: m(() => {
782
- var C;
783
- return [
784
- u(s, {
785
- "data-testid": "vaults-entity-empty-state",
786
- "icon-background": "",
787
- message: e(p)("vaults.list.empty_state_v2.description"),
788
- title: e(p)("vaults.list.empty_state_v2.title")
789
- }, Ke({
790
- icon: m(() => [
791
- u(e(at), { decorative: "" })
792
- ]),
793
- action: m(() => [
794
- R.value ? (V(), D(U, {
795
- key: 0,
796
- "data-testid": "entity-create-button",
797
- onClick: se
798
- }, {
799
- default: m(() => [
800
- u(e(Re), { decorative: "" }),
801
- ue(" " + H(e(p)("vaults.list.empty_state_v2.create_cta")), 1)
802
- ]),
803
- _: 1
804
- })) : B("", !0),
805
- u(U, {
806
- appearance: "secondary",
807
- "data-testid": "entity-learn-more-button",
808
- onClick: E[2] || (E[2] = (_) => k.$emit("click:learn-more"))
809
- }, {
810
- default: m(() => [
811
- u(e(Me), { decorative: "" }),
812
- ue(" " + H(e(p)("vaults.list.empty_state_v2.learn_more")), 1)
813
- ]),
814
- _: 1
815
- })
816
- ]),
817
- _: 2
818
- }, [
819
- (C = o.config) != null && C.isControlPlaneGroup ? {
820
- name: "default",
821
- fn: m(() => [
822
- ue(H(e(p)("vaults.list.empty_state_v2.group")), 1)
823
- ]),
824
- key: "0"
825
- } : void 0
826
- ]), 1032, ["message", "title"])
827
- ];
828
- }),
829
- key: "0"
830
- } : void 0
831
- ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "onState"]),
832
- u(e(ze), {
833
- "action-pending": T.value,
834
- description: e(p)("delete.description"),
835
- "entity-name": q.value && (q.value.prefix || q.value.id),
836
- "entity-type": e(Ge).Vault,
837
- error: Z.value,
838
- title: e(p)("delete.title"),
839
- visible: ie.value,
840
- onCancel: v,
841
- onProceed: M
842
- }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
843
- ]);
844
- };
845
- }
846
- }), me = (o, S) => {
847
- const c = o.__vccOpts || o;
848
- for (const [d, p] of S)
849
- c[d] = p;
850
- return c;
851
- }, El = /* @__PURE__ */ me(Pt, [["__scopeId", "data-v-0f7e9fff"]]);
852
- var t = /* @__PURE__ */ ((o) => (o.AWS = "aws", o.GCP = "gcp", o.HCV = "hcv", o.ENV = "env", o.AZURE = "azure", o.KONNECT = "konnect", o.CONJUR = "conjur", o))(t || {}), A = /* @__PURE__ */ ((o) => (o.TOKEN = "token", o.K8S = "kubernetes", o.APP_ROLE = "approle", o.CERT = "cert", o.JWT = "jwt", o))(A || {});
853
- const Mt = { class: "kong-ui-entities-vault-form" }, Nt = { class: "vault-form-provider-cards-container" }, Ft = ["data-testid"], Ot = { class: "provider-item-title-container" }, qt = { class: "provider-item-title" }, jt = { class: "provider-item-description" }, Wt = {
854
- key: "kong-vault-config-fields",
855
- class: "vault-form-config-fields-container"
856
- }, Dt = {
857
- key: 0,
858
- class: "vault-form-config-auth-method-container"
859
- }, Bt = {
860
- key: 1,
861
- class: "vault-form-config-auth-method-container"
862
- }, Jt = {
863
- key: 2,
864
- class: "vault-form-config-auth-method-container"
865
- }, Lt = {
866
- key: 3,
867
- class: "vault-form-config-auth-method-container"
868
- }, zt = {
869
- key: 4,
870
- class: "vault-form-config-auth-method-container"
871
- }, Gt = { key: 6 }, Zt = { class: "wrapper" }, Qt = { class: "item-50" }, Yt = { class: "item-50" }, Xt = { class: "wrapper" }, el = { class: "item-100" }, tl = /* @__PURE__ */ ce({
872
- __name: "VaultForm",
873
- props: {
874
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
875
- config: {
876
- type: Object,
877
- required: !0,
878
- validator: (o) => !(!o || !["konnect", "kongManager"].includes(o == null ? void 0 : o.app) || (o == null ? void 0 : o.app) === "konnect" && !(o != null && o.controlPlaneId) || (o == null ? void 0 : o.app) === "kongManager" && typeof (o == null ? void 0 : o.workspace) != "string" || !(o != null && o.cancelRoute))
879
- },
880
- /** If a valid vaultId is provided, it will put the form in Edit mode instead of Create */
881
- vaultId: {
882
- type: String,
883
- required: !1,
884
- default: ""
885
- }
886
- },
887
- emits: ["update", "error", "loading"],
888
- setup(o, { emit: S }) {
889
- var U;
890
- const c = o, d = S, { i18nT: p, i18n: { t: a } } = he.useI18n(), K = Ee(), { axiosInstance: I } = _e((U = c.config) == null ? void 0 : U.axiosRequestConfig), { getMessageFromError: h } = Ze(), n = ye({
891
- fields: {
892
- prefix: "",
893
- description: "",
894
- tags: ""
895
- },
896
- isReadonly: !1,
897
- errorMessage: ""
898
- }), g = ye({
899
- prefix: "",
900
- description: "",
901
- tags: ""
902
- }), f = $(c.config.app === "konnect" ? t.KONNECT : t.ENV), N = $(null), X = $(), Q = w(() => [t.AWS, t.GCP, t.HCV, t.AZURE, t.CONJUR].includes(f.value)), Y = w(() => [
903
- ...c.config.app === "konnect" ? [{
904
- label: a("form.config.konnect.label"),
905
- value: t.KONNECT
906
- }] : [],
907
- {
908
- label: a("form.config.env.label"),
909
- value: t.ENV
910
- },
911
- {
912
- label: a("form.config.aws.label"),
913
- value: t.AWS,
914
- disabled: !le.value
915
- },
916
- {
917
- label: a("form.config.gcp.label"),
918
- value: t.GCP,
919
- disabled: !le.value
920
- },
921
- {
922
- label: a("form.config.hcv.label"),
923
- value: t.HCV,
924
- disabled: !le.value
925
- },
926
- ...c.config.azureVaultProviderAvailable ? [{
927
- label: a("form.config.azure.label"),
928
- value: t.AZURE,
929
- disabled: !le.value
930
- }] : [],
931
- ...c.config.conjurVaultProviderAvailable ? [{
932
- label: a("form.config.conjur.label"),
933
- value: t.CONJUR,
934
- disabled: !le.value
935
- }] : []
936
- ]), O = c.config.base64FieldAvailable ? { base64_decode: !1 } : {}, l = ye({
937
- [t.KONNECT]: {},
938
- [t.ENV]: {
939
- prefix: "",
940
- ...O
941
- },
942
- [t.AWS]: {
943
- region: "",
944
- endpoint_url: "",
945
- assume_role_arn: "",
946
- role_session_name: "KongVault",
947
- ...O
948
- },
949
- [t.GCP]: {
950
- project_id: "",
951
- ...O
952
- },
953
- [t.HCV]: {
954
- protocol: "http",
955
- host: "127.0.0.1",
956
- port: 8200,
957
- mount: "secret",
958
- kv: "v1",
959
- namespace: "",
960
- auth_method: A.TOKEN,
961
- token: "",
962
- kube_role: "",
963
- kube_auth_path: "",
964
- kube_api_token_file: "",
965
- approle_auth_path: "",
966
- approle_role_id: "",
967
- approle_secret_id: "",
968
- approle_secret_id_file: "",
969
- approle_response_wrapping: !1,
970
- cert_auth_cert: "",
971
- cert_auth_cert_key: "",
972
- cert_auth_role_name: "",
973
- oauth2_client_id: "",
974
- oauth2_client_secret: "",
975
- jwt_role: "",
976
- oauth2_token_endpoint: "",
977
- oauth2_audiences: "",
978
- ...O
979
- },
980
- [t.AZURE]: {
981
- location: "",
982
- vault_uri: "",
983
- type: "secrets",
984
- credentials_prefix: "AZURE",
985
- client_id: "",
986
- tenant_id: "",
987
- ...O
988
- },
989
- [t.CONJUR]: {
990
- endpoint_url: "",
991
- auth_method: "api_key",
992
- ...O
993
- }
994
- }), ae = ye({
995
- [t.KONNECT]: {},
996
- [t.ENV]: {
997
- prefix: "",
998
- ...O
999
- },
1000
- [t.AWS]: {
1001
- region: "",
1002
- endpoint_url: "",
1003
- assume_role_arn: "",
1004
- role_session_name: "KongVault",
1005
- ...O
1006
- },
1007
- [t.GCP]: {
1008
- project_id: "",
1009
- ...O
1010
- },
1011
- [t.HCV]: {
1012
- protocol: "http",
1013
- host: "127.0.0.1",
1014
- port: 8200,
1015
- mount: "secret",
1016
- kv: "v1",
1017
- namespace: "",
1018
- auth_method: A.TOKEN,
1019
- token: "",
1020
- kube_role: "",
1021
- kube_auth_path: "",
1022
- kube_api_token_file: "",
1023
- approle_auth_path: "",
1024
- approle_role_id: "",
1025
- approle_secret_id: "",
1026
- approle_secret_id_file: "",
1027
- approle_response_wrapping: !1,
1028
- ...O
1029
- },
1030
- [t.AZURE]: {
1031
- location: "",
1032
- vault_uri: "",
1033
- type: "secrets",
1034
- credentials_prefix: "AZURE",
1035
- client_id: "",
1036
- tenant_id: "",
1037
- ...O
1038
- },
1039
- [t.CONJUR]: {
1040
- endpoint_url: "",
1041
- auth_method: "api_key",
1042
- ...O
1043
- }
1044
- }), z = [
1045
- { label: `${a("form.config.aws.fields.region.locations.us-east-1.location")} (us-east-1)`, value: "us-east-1" },
1046
- { label: `${a("form.config.aws.fields.region.locations.us-east-2.location")} (us-east-2)`, value: "us-east-2" },
1047
- { label: `${a("form.config.aws.fields.region.locations.us-west-1.location")} (us-west-1)`, value: "us-west-1" },
1048
- { label: `${a("form.config.aws.fields.region.locations.us-west-2.location")} (us-west-2)`, value: "us-west-2" },
1049
- { label: `${a("form.config.aws.fields.region.locations.af-south-1.location")} (af-south-1)`, value: "af-south-1" },
1050
- { label: `${a("form.config.aws.fields.region.locations.ap-east-1.location")} (ap-east-1)`, value: "ap-east-1" },
1051
- { label: `${a("form.config.aws.fields.region.locations.ap-southeast-3.location")} (ap-southeast-3)`, value: "ap-southeast-3" },
1052
- { label: `${a("form.config.aws.fields.region.locations.ap-south-1.location")} (ap-south-1)`, value: "ap-south-1" },
1053
- { label: `${a("form.config.aws.fields.region.locations.ap-northeast-1.location")} (ap-northeast-1)`, value: "ap-northeast-1" },
1054
- { label: `${a("form.config.aws.fields.region.locations.ap-northeast-2.location")} (ap-northeast-2)`, value: "ap-northeast-2" },
1055
- { label: `${a("form.config.aws.fields.region.locations.ap-northeast-3.location")} (ap-northeast-3)`, value: "ap-northeast-3" },
1056
- { label: `${a("form.config.aws.fields.region.locations.ap-southeast-1.location")} (ap-southeast-1)`, value: "ap-southeast-1" },
1057
- { label: `${a("form.config.aws.fields.region.locations.ap-southeast-2.location")} (ap-southeast-2)`, value: "ap-southeast-2" },
1058
- { label: `${a("form.config.aws.fields.region.locations.ca-central-1.location")} (ca-central-1)`, value: "ca-central-1" },
1059
- { label: `${a("form.config.aws.fields.region.locations.eu-central-1.location")} (eu-central-1)`, value: "eu-central-1" },
1060
- { label: `${a("form.config.aws.fields.region.locations.eu-west-1.location")} (eu-west-1)`, value: "eu-west-1" },
1061
- { label: `${a("form.config.aws.fields.region.locations.eu-west-2.location")} (eu-west-2)`, value: "eu-west-2" },
1062
- { label: `${a("form.config.aws.fields.region.locations.eu-west-3.location")} (eu-west-3)`, value: "eu-west-3" },
1063
- { label: `${a("form.config.aws.fields.region.locations.eu-south-1.location")} (eu-south-1)`, value: "eu-south-1" },
1064
- { label: `${a("form.config.aws.fields.region.locations.eu-north-1.location")} (eu-north-1)`, value: "eu-north-1" },
1065
- { label: `${a("form.config.aws.fields.region.locations.me-south-1.location")} (me-south-1)`, value: "me-south-1" },
1066
- { label: `${a("form.config.aws.fields.region.locations.sa-east-1.location")} (sa-east-1)`, value: "sa-east-1" },
1067
- { label: `${a("form.config.aws.fields.region.locations.us-gov-east-1.location")} (us-gov-east-1)`, value: "us-gov-east-1" },
1068
- { label: `${a("form.config.aws.fields.region.locations.us-gov-west-1.location")} (us-gov-west-1)`, value: "us-gov-west-1" }
1069
- ], ee = [{ label: "secrets", value: "secrets" }], G = [{ label: "http", value: "http" }, { label: "https", value: "https" }], y = [{ label: "v1", value: "v1" }, { label: "v2", value: "v2" }], F = w(() => c.vaultId ? Ve.Edit : Ve.Create), re = w(() => {
1070
- var s, r;
1071
- return (r = pe.form[(s = c.config) == null ? void 0 : s.app]) == null ? void 0 : r.edit;
1072
- }), ne = w(() => F.value === Ve.Edit && c.config.app === "kongManager"), le = w(() => c.config.app === "konnect" || mt({
1073
- gatewayInfo: c.config.gatewayInfo,
1074
- // vault name can only be `env` in Gateway Community Edition
1075
- supportedRange: {
1076
- enterprise: []
1077
- }
1078
- })), q = () => {
1079
- var s;
1080
- K.push(((s = c.config) == null ? void 0 : s.cancelRoute) || { name: "vault-list" });
1081
- }, ie = (s) => {
1082
- d("loading", s);
1083
- }, T = (s) => {
1084
- d("error", s);
1085
- }, Z = (s) => {
1086
- switch (s) {
1087
- case t.KONNECT:
1088
- return ct;
1089
- case t.ENV:
1090
- return ut;
1091
- case t.AWS:
1092
- return dt;
1093
- case t.GCP:
1094
- return st;
1095
- case t.HCV:
1096
- return nt;
1097
- case t.AZURE:
1098
- return it;
1099
- case t.CONJUR:
1100
- return rt;
1101
- }
1102
- }, te = (s) => {
1103
- switch (s) {
1104
- case t.KONNECT:
1105
- return a("form.config.konnect.description");
1106
- case t.ENV:
1107
- return a("form.config.env.description");
1108
- case t.AWS:
1109
- return a("form.config.aws.description");
1110
- case t.GCP:
1111
- return a("form.config.gcp.description");
1112
- case t.HCV:
1113
- return a("form.config.hcv.description");
1114
- case t.AZURE:
1115
- return a("form.config.azure.description");
1116
- case t.CONJUR:
1117
- return a("form.config.conjur.description");
1118
- }
1119
- }, b = (s) => {
1120
- var C, _, oe, de, ve, i;
1121
- n.fields.prefix = ((C = s == null ? void 0 : s.item) == null ? void 0 : C.prefix) || (s == null ? void 0 : s.prefix) || "", n.fields.description = ((_ = s == null ? void 0 : s.item) == null ? void 0 : _.description) || (s == null ? void 0 : s.description) || "";
1122
- const r = ((oe = s == null ? void 0 : s.item) == null ? void 0 : oe.tags) || (s == null ? void 0 : s.tags) || [];
1123
- n.fields.tags = (r == null ? void 0 : r.join(", ")) || "", Object.assign(g, n.fields);
1124
- const L = ((de = s == null ? void 0 : s.item) == null ? void 0 : de.config) || (s == null ? void 0 : s.config) || null;
1125
- L && (Object.keys(L).length || (s == null ? void 0 : s.name) === t.KONNECT) ? (f.value = ((ve = s == null ? void 0 : s.item) == null ? void 0 : ve.name) || (s == null ? void 0 : s.name) || "", N.value = f.value, X.value = ((i = s == null ? void 0 : s.config) == null ? void 0 : i.config_store_id) || void 0, Object.assign(l[f.value], L), Object.assign(ae[f.value], L)) : n.errorMessage = "Error loading vault config";
1126
- }, v = (s) => s === "" || s == null, P = w(() => f.value === t.HCV ? !Object.keys(l[t.HCV]).filter((s) => [
1127
- "namespace",
1128
- "ttl",
1129
- "neg_ttl",
1130
- "resurrect_ttl",
1131
- "kube_auth_path",
1132
- "approle_auth_path",
1133
- "approle_secret_id",
1134
- "approle_secret_id_file",
1135
- "oauth2_audiences"
1136
- ].includes(s) || l[t.HCV].auth_method !== A.K8S && (s === "kube_role" || s === "kube_api_token_file") || l[t.HCV].auth_method !== A.TOKEN && s === "token" || l[t.HCV].auth_method !== A.APP_ROLE && (s === "approle_role_id" || s === "approle_response_wrapping") || l[t.HCV].auth_method === A.APP_ROLE && s === "approle_response_wrapping" && typeof l[f.value][s] == "boolean" || l[t.HCV].auth_method !== A.CERT && ["cert_auth_role_name", "cert_auth_cert", "cert_auth_cert_key"].includes(s) || l[t.HCV].auth_method !== A.JWT && ["oauth2_client_id", "oauth2_client_secret", "jwt_role", "oauth2_token_endpoint"].includes(s) ? !1 : v(l[f.value][s])).length : f.value === t.AZURE ? !Object.keys(l[t.AZURE]).filter((s) => ["client_id", "tenant_id", "ttl", "neg_ttl", "resurrect_ttl"].includes(s) ? !1 : v(l[f.value][s])).length : f.value === t.AWS ? !Object.keys(l[t.AWS]).filter((s) => ["endpoint_url", "assume_role_arn", "ttl", "neg_ttl", "resurrect_ttl", "sts_endpoint_url"].includes(s) ? !1 : v(l[f.value][s])).length : !Object.keys(l[f.value]).filter((s) => ["ttl", "neg_ttl", "resurrect_ttl"].includes(s) ? !1 : v(l[f.value][s])).length), M = w(() => !!n.fields.prefix && P.value), se = w(() => JSON.stringify(n.fields) !== JSON.stringify(g) || f.value !== N.value || JSON.stringify(l[f.value]) !== JSON.stringify(ae[f.value])), j = w(() => {
1137
- var r, L;
1138
- let s = `${c.config.apiBaseUrl}${pe.form[c.config.app][F.value]}`;
1139
- return c.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((r = c.config) == null ? void 0 : r.controlPlaneId) || "") : c.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, (L = c.config) != null && L.workspace ? `/${c.config.workspace}` : "")), s = s.replace(/{id}/gi, c.vaultId), s;
1140
- }), R = w(() => {
1141
- var de, ve;
1142
- const s = {
1143
- protocol: l[t.HCV].protocol,
1144
- host: l[t.HCV].host,
1145
- port: parseInt(l[t.HCV].port.toString()),
1146
- mount: l[t.HCV].mount,
1147
- kv: l[t.HCV].kv,
1148
- namespace: l[t.HCV].namespace || null,
1149
- auth_method: l[t.HCV].auth_method,
1150
- ...c.config.base64FieldAvailable && { base64_decode: l[t.HCV].base64_decode },
1151
- ...l[t.HCV].auth_method === A.TOKEN && { token: l[t.HCV].token },
1152
- // For Kong Admin API, when auth_method is kubernetes, token must be in the request body and its value has to be null
1153
- ...l[t.HCV].auth_method === A.K8S && {
1154
- kube_role: l[t.HCV].kube_role,
1155
- kube_auth_path: l[t.HCV].kube_auth_path || void 0,
1156
- kube_api_token_file: l[t.HCV].kube_api_token_file,
1157
- token: null
1158
- },
1159
- ...l[t.HCV].auth_method === A.APP_ROLE && {
1160
- approle_auth_path: l[t.HCV].approle_auth_path || void 0,
1161
- approle_role_id: l[t.HCV].approle_role_id,
1162
- approle_secret_id: l[t.HCV].approle_secret_id || void 0,
1163
- approle_secret_id_file: l[t.HCV].approle_secret_id_file || void 0,
1164
- approle_response_wrapping: l[t.HCV].approle_response_wrapping ?? !1
1165
- },
1166
- ...l[t.HCV].auth_method === A.CERT && {
1167
- cert_auth_role_name: l[t.HCV].cert_auth_role_name,
1168
- cert_auth_cert: l[t.HCV].cert_auth_cert,
1169
- cert_auth_cert_key: l[t.HCV].cert_auth_cert_key
1170
- },
1171
- ...l[t.HCV].auth_method === A.JWT && {
1172
- oauth2_audiences: l[t.HCV].oauth2_audiences || null,
1173
- oauth2_client_id: l[t.HCV].oauth2_client_id,
1174
- oauth2_client_secret: l[t.HCV].oauth2_client_secret,
1175
- jwt_role: l[t.HCV].jwt_role,
1176
- oauth2_token_endpoint: l[t.HCV].oauth2_token_endpoint
1177
- }
1178
- }, r = {
1179
- ...l[f.value],
1180
- client_id: l[f.value].client_id || null,
1181
- tenant_id: l[f.value].tenant_id || null
1182
- }, L = {
1183
- ...l[f.value],
1184
- endpoint_url: l[f.value].endpoint_url || null,
1185
- assume_role_arn: l[f.value].assume_role_arn || null,
1186
- ...c.config.awsStsEndpointUrlAvailable ? { sts_endpoint_url: l[f.value].sts_endpoint_url || null } : {}
1187
- };
1188
- let C = l[f.value];
1189
- f.value === t.HCV ? C = s : f.value === t.AZURE ? C = r : f.value === t.AWS && (C = L);
1190
- let _ = {};
1191
- if (![t.KONNECT, t.ENV].includes(f.value)) {
1192
- const i = l[f.value], Te = i.ttl, He = i.neg_ttl, $e = i.resurrect_ttl;
1193
- _ = {
1194
- ttl: Te ? parseInt(Te.toString(), 10) : null,
1195
- neg_ttl: He ? parseInt(He.toString(), 10) : null,
1196
- resurrect_ttl: $e ? parseInt($e.toString(), 10) : null
1197
- };
1198
- }
1199
- return {
1200
- prefix: n.fields.prefix,
1201
- description: n.fields.description || null,
1202
- tags: (ve = (de = n.fields.tags.split(",")) == null ? void 0 : de.map((i) => String(i || "").trim())) == null ? void 0 : ve.filter((i) => i !== ""),
1203
- name: f.value,
1204
- config: {
1205
- ...C,
1206
- ..._
1207
- }
1208
- };
1209
- }), fe = w(() => ({
1210
- ...R.value,
1211
- config: {
1212
- ...R.value.config,
1213
- config_store_id: X.value
1214
- }
1215
- })), k = async () => {
1216
- var s;
1217
- try {
1218
- n.isReadonly = !0;
1219
- const r = `${c.config.apiBaseUrl}${pe.form.konnect.createConfigStore}`.replace(/{controlPlaneId}/gi, ((s = c.config) == null ? void 0 : s.controlPlaneId) || ""), L = await I.post(r);
1220
- return L == null ? void 0 : L.data.id;
1221
- } catch (r) {
1222
- n.errorMessage = h(r), d("error", r);
1223
- } finally {
1224
- n.isReadonly = !1;
1225
- }
1226
- }, E = async () => {
1227
- var s;
1228
- try {
1229
- n.isReadonly = !0;
1230
- let r;
1231
- F.value === "create" ? f.value === t.KONNECT ? (X.value = await k(), r = await I.post(j.value, fe.value)) : r = await I.post(j.value, R.value) : F.value === "edit" && (f.value === t.KONNECT && !X.value ? (X.value = await k(), r = await I.put(j.value, fe.value)) : r = ((s = c.config) == null ? void 0 : s.app) === "konnect" ? await I.put(j.value, fe.value) : await I.patch(j.value, R.value)), b(r == null ? void 0 : r.data), d("update", r == null ? void 0 : r.data);
1232
- } catch (r) {
1233
- n.errorMessage = h(r), d("error", r);
1234
- } finally {
1235
- n.isReadonly = !1;
1236
- }
1237
- };
1238
- return (s, r) => {
1239
- const L = J("KTooltip"), C = J("KSelect"), _ = J("KInput"), oe = J("KCheckbox"), de = J("KTextArea"), ve = J("KCollapse");
1240
- return V(), W("div", Mt, [
1241
- u(e(Qe), {
1242
- "can-submit": M.value && se.value,
1243
- config: o.config,
1244
- "edit-id": o.vaultId,
1245
- "entity-type": e(Ue).Vault,
1246
- "error-message": n.errorMessage,
1247
- "fetch-url": re.value,
1248
- "form-fields": R.value,
1249
- "is-readonly": n.isReadonly,
1250
- onCancel: q,
1251
- "onFetch:error": T,
1252
- "onFetch:success": b,
1253
- onLoading: ie,
1254
- onSubmit: E
1255
- }, {
1256
- default: m(() => [
1257
- u(e(Ae), {
1258
- description: e(a)("form.sections.config.description"),
1259
- title: e(a)("form.sections.config.title")
1260
- }, {
1261
- default: m(() => [
1262
- x("div", Nt, [
1263
- u(C, {
1264
- modelValue: f.value,
1265
- "onUpdate:modelValue": r[0] || (r[0] = (i) => f.value = i),
1266
- "data-testid": "provider-select",
1267
- disabled: ne.value,
1268
- "dropdown-max-height": "500",
1269
- items: Y.value,
1270
- readonly: n.isReadonly
1271
- }, {
1272
- "selected-item-template": m(({ item: i }) => [
1273
- (V(), D(Pe(Z(i.value)))),
1274
- x("span", null, H(i == null ? void 0 : i.label), 1)
1275
- ]),
1276
- "item-template": m(({ item: i }) => [
1277
- u(L, {
1278
- placement: "top",
1279
- text: i.disabled ? e(a)("form.unavailable") : ""
1280
- }, {
1281
- default: m(() => [
1282
- x("div", {
1283
- class: "provider-item",
1284
- "data-testid": `vault-form-provider-${i.value}`
1285
- }, [
1286
- (V(), D(Pe(Z(i.value)))),
1287
- x("div", Ot, [
1288
- x("span", qt, H(i == null ? void 0 : i.label), 1),
1289
- x("span", jt, H(te(i.value)), 1)
1290
- ])
1291
- ], 8, Ft)
1292
- ]),
1293
- _: 2
1294
- }, 1032, ["text"])
1295
- ]),
1296
- _: 1
1297
- }, 8, ["modelValue", "disabled", "items", "readonly"])
1298
- ]),
1299
- u(Xe, { name: "appear" }, {
1300
- default: m(() => [
1301
- f.value === e(t).ENV ? (V(), W("div", Wt, [
1302
- u(_, {
1303
- modelValue: l[e(t).ENV].prefix,
1304
- "onUpdate:modelValue": r[1] || (r[1] = (i) => l[e(t).ENV].prefix = i),
1305
- modelModifiers: { trim: !0 },
1306
- autocomplete: "off",
1307
- "data-testid": "vault-form-config-kong-prefix",
1308
- label: e(a)("form.config.env.fields.prefix.label"),
1309
- "label-attributes": {
1310
- info: e(a)("form.config.env.fields.prefix.tooltip"),
1311
- tooltipAttributes: { maxWidth: "400" }
1312
- },
1313
- placeholder: e(a)("form.config.env.fields.prefix.placeholder"),
1314
- readonly: n.isReadonly,
1315
- required: "",
1316
- type: "text"
1317
- }, null, 8, ["modelValue", "label", "label-attributes", "placeholder", "readonly"]),
1318
- o.config.base64FieldAvailable ? (V(), D(oe, {
1319
- key: 0,
1320
- modelValue: l[e(t).ENV].base64_decode,
1321
- "onUpdate:modelValue": r[2] || (r[2] = (i) => l[e(t).ENV].base64_decode = i),
1322
- "data-testid": "vault-form-config-env-base64_decode",
1323
- label: e(a)("form.config.commonFields.base64_decode.label"),
1324
- "label-attributes": {
1325
- info: e(a)("form.config.commonFields.base64_decode.tooltip"),
1326
- tooltipAttributes: { maxWidth: "400" }
1327
- },
1328
- readonly: n.isReadonly
1329
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0)
1330
- ])) : B("", !0),
1331
- f.value === e(t).AWS ? (V(), W("div", {
1332
- key: `${e(t).AWS}-vault-config-fields`,
1333
- class: "vault-form-config-fields-container"
1334
- }, [
1335
- u(C, {
1336
- modelValue: l[e(t).AWS].region,
1337
- "onUpdate:modelValue": r[3] || (r[3] = (i) => l[e(t).AWS].region = i),
1338
- "data-testid": "vault-form-config-aws-region",
1339
- items: z,
1340
- label: e(a)("form.config.aws.fields.region.label"),
1341
- "label-attributes": { info: e(a)("form.config.aws.fields.region.tooltip") },
1342
- placeholder: e(a)("form.config.aws.fields.region.placeholder"),
1343
- readonly: n.isReadonly,
1344
- required: "",
1345
- width: "100%"
1346
- }, null, 8, ["modelValue", "label", "label-attributes", "placeholder", "readonly"]),
1347
- u(_, {
1348
- modelValue: l[e(t).AWS].endpoint_url,
1349
- "onUpdate:modelValue": r[4] || (r[4] = (i) => l[e(t).AWS].endpoint_url = i),
1350
- modelModifiers: { trim: !0 },
1351
- autocomplete: "off",
1352
- "data-testid": "vault-form-config-aws-endpoint_url",
1353
- label: e(a)("form.config.aws.fields.endpoint_url.label"),
1354
- "label-attributes": {
1355
- info: e(a)("form.config.aws.fields.endpoint_url.tooltip"),
1356
- tooltipAttributes: { maxWidth: "400" }
1357
- },
1358
- readonly: n.isReadonly,
1359
- type: "text"
1360
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1361
- u(_, {
1362
- modelValue: l[e(t).AWS].assume_role_arn,
1363
- "onUpdate:modelValue": r[5] || (r[5] = (i) => l[e(t).AWS].assume_role_arn = i),
1364
- modelModifiers: { trim: !0 },
1365
- autocomplete: "off",
1366
- "data-testid": "vault-form-config-aws-assume_role_arn",
1367
- label: e(a)("form.config.aws.fields.assume_role_arn.label"),
1368
- "label-attributes": {
1369
- info: e(a)("form.config.aws.fields.assume_role_arn.tooltip"),
1370
- tooltipAttributes: { maxWidth: "400" }
1371
- },
1372
- readonly: n.isReadonly,
1373
- type: "text"
1374
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1375
- u(_, {
1376
- modelValue: l[e(t).AWS].role_session_name,
1377
- "onUpdate:modelValue": r[6] || (r[6] = (i) => l[e(t).AWS].role_session_name = i),
1378
- modelModifiers: { trim: !0 },
1379
- autocomplete: "off",
1380
- "data-testid": "vault-form-config-aws-role_session_name",
1381
- label: e(a)("form.config.aws.fields.role_session_name.label"),
1382
- "label-attributes": {
1383
- info: e(a)("form.config.aws.fields.role_session_name.tooltip"),
1384
- tooltipAttributes: { maxWidth: "400" }
1385
- },
1386
- readonly: n.isReadonly,
1387
- required: "",
1388
- type: "text"
1389
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1390
- o.config.awsStsEndpointUrlAvailable ? (V(), D(_, {
1391
- key: 0,
1392
- modelValue: l[e(t).AWS].sts_endpoint_url,
1393
- "onUpdate:modelValue": r[7] || (r[7] = (i) => l[e(t).AWS].sts_endpoint_url = i),
1394
- modelModifiers: { trim: !0 },
1395
- autocomplete: "off",
1396
- "data-testid": "vault-form-config-aws-sts_endpoint_url",
1397
- label: e(a)("form.config.aws.fields.sts_endpoint_url.label"),
1398
- "label-attributes": {
1399
- info: e(a)("form.config.aws.fields.sts_endpoint_url.tooltip"),
1400
- tooltipAttributes: { maxWidth: "400" }
1401
- },
1402
- readonly: n.isReadonly,
1403
- type: "text"
1404
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0),
1405
- o.config.base64FieldAvailable ? (V(), D(oe, {
1406
- key: 1,
1407
- modelValue: l[e(t).AWS].base64_decode,
1408
- "onUpdate:modelValue": r[8] || (r[8] = (i) => l[e(t).AWS].base64_decode = i),
1409
- "data-testid": "vault-form-config-aws-base64_decode",
1410
- label: e(a)("form.config.commonFields.base64_decode.label"),
1411
- "label-attributes": {
1412
- info: e(a)("form.config.commonFields.base64_decode.tooltip"),
1413
- tooltipAttributes: { maxWidth: "400" }
1414
- },
1415
- readonly: n.isReadonly
1416
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0)
1417
- ])) : B("", !0),
1418
- f.value === e(t).GCP ? (V(), W("div", {
1419
- key: `${e(t).GCP}-vault-config-fields`,
1420
- class: "vault-form-config-fields-container"
1421
- }, [
1422
- u(_, {
1423
- modelValue: l[e(t).GCP].project_id,
1424
- "onUpdate:modelValue": r[9] || (r[9] = (i) => l[e(t).GCP].project_id = i),
1425
- modelModifiers: { trim: !0 },
1426
- autocomplete: "off",
1427
- "data-testid": "vault-form-config-gcp-project-id",
1428
- label: e(a)("form.config.gcp.fields.project_id.label"),
1429
- placeholder: e(a)("form.config.gcp.fields.project_id.placeholder"),
1430
- readonly: n.isReadonly,
1431
- required: "",
1432
- type: "text"
1433
- }, {
1434
- "label-tooltip": m(() => [
1435
- u(e(p), {
1436
- keypath: "form.config.gcp.fields.project_id.tooltip.text",
1437
- scope: "global"
1438
- }, {
1439
- "italic-text": m(() => [
1440
- x("em", null, H(e(a)("form.config.gcp.fields.project_id.tooltip.italicText")), 1)
1441
- ]),
1442
- _: 1
1443
- })
1444
- ]),
1445
- _: 1
1446
- }, 8, ["modelValue", "label", "placeholder", "readonly"]),
1447
- o.config.base64FieldAvailable ? (V(), D(oe, {
1448
- key: 0,
1449
- modelValue: l[e(t).GCP].base64_decode,
1450
- "onUpdate:modelValue": r[10] || (r[10] = (i) => l[e(t).GCP].base64_decode = i),
1451
- "data-testid": "vault-form-config-gcp-base64_decode",
1452
- label: e(a)("form.config.commonFields.base64_decode.label"),
1453
- "label-attributes": {
1454
- info: e(a)("form.config.commonFields.base64_decode.tooltip"),
1455
- tooltipAttributes: { maxWidth: "400" }
1456
- },
1457
- readonly: n.isReadonly
1458
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0)
1459
- ])) : B("", !0),
1460
- f.value === e(t).HCV ? (V(), W("div", {
1461
- key: `${e(t).HCV}-vault-config-fields`,
1462
- class: "vault-form-config-fields-container"
1463
- }, [
1464
- u(C, {
1465
- modelValue: l[e(t).HCV].protocol,
1466
- "onUpdate:modelValue": r[11] || (r[11] = (i) => l[e(t).HCV].protocol = i),
1467
- "data-testid": "vault-form-config-hcv-protocol",
1468
- items: G,
1469
- label: e(a)("form.config.hcv.fields.protocol.label"),
1470
- readonly: n.isReadonly,
1471
- required: "",
1472
- width: "100%"
1473
- }, null, 8, ["modelValue", "label", "readonly"]),
1474
- u(_, {
1475
- modelValue: l[e(t).HCV].host,
1476
- "onUpdate:modelValue": r[12] || (r[12] = (i) => l[e(t).HCV].host = i),
1477
- modelModifiers: { trim: !0 },
1478
- autocomplete: "off",
1479
- "data-testid": "vault-form-config-hcv-host",
1480
- label: e(a)("form.config.hcv.fields.host.label"),
1481
- readonly: n.isReadonly,
1482
- required: "",
1483
- type: "text"
1484
- }, null, 8, ["modelValue", "label", "readonly"]),
1485
- u(_, {
1486
- modelValue: l[e(t).HCV].port,
1487
- "onUpdate:modelValue": r[13] || (r[13] = (i) => l[e(t).HCV].port = i),
1488
- autocomplete: "off",
1489
- "data-testid": "vault-form-config-hcv-port",
1490
- label: e(a)("form.config.hcv.fields.port.label"),
1491
- min: "0",
1492
- readonly: n.isReadonly,
1493
- required: "",
1494
- type: "number"
1495
- }, null, 8, ["modelValue", "label", "readonly"]),
1496
- u(_, {
1497
- modelValue: l[e(t).HCV].mount,
1498
- "onUpdate:modelValue": r[14] || (r[14] = (i) => l[e(t).HCV].mount = i),
1499
- modelModifiers: { trim: !0 },
1500
- autocomplete: "off",
1501
- "data-testid": "vault-form-config-hcv-mount",
1502
- label: e(a)("form.config.hcv.fields.mount.label"),
1503
- readonly: n.isReadonly,
1504
- required: "",
1505
- type: "text"
1506
- }, null, 8, ["modelValue", "label", "readonly"]),
1507
- u(C, {
1508
- modelValue: l[e(t).HCV].kv,
1509
- "onUpdate:modelValue": r[15] || (r[15] = (i) => l[e(t).HCV].kv = i),
1510
- "data-testid": "vault-form-config-hcv-kv",
1511
- items: y,
1512
- label: e(a)("form.config.hcv.fields.kv.label"),
1513
- readonly: n.isReadonly,
1514
- required: "",
1515
- width: "100%"
1516
- }, null, 8, ["modelValue", "label", "readonly"]),
1517
- u(_, {
1518
- modelValue: l[e(t).HCV].namespace,
1519
- "onUpdate:modelValue": r[16] || (r[16] = (i) => l[e(t).HCV].namespace = i),
1520
- modelModifiers: { trim: !0 },
1521
- autocomplete: "off",
1522
- "data-testid": "vault-form-config-hcv-namespace",
1523
- label: e(a)("form.config.hcv.fields.namespace.label"),
1524
- readonly: n.isReadonly,
1525
- type: "text"
1526
- }, null, 8, ["modelValue", "label", "readonly"]),
1527
- u(C, {
1528
- modelValue: l[e(t).HCV].auth_method,
1529
- "onUpdate:modelValue": r[17] || (r[17] = (i) => l[e(t).HCV].auth_method = i),
1530
- "data-testid": "vault-form-config-hcv-auth_method",
1531
- items: [
1532
- { label: e(A).TOKEN, value: e(A).TOKEN },
1533
- { label: e(A).K8S, value: e(A).K8S },
1534
- ...o.config.hcvAppRoleMethodAvailable ? [{ label: e(A).APP_ROLE, value: e(A).APP_ROLE }] : [],
1535
- ...o.config.hcvCertMethodAvailable ? [{ label: e(A).CERT, value: e(A).CERT }] : [],
1536
- ...o.config.hcvJwtMethodAvailable ? [{ label: e(A).JWT, value: e(A).JWT }] : []
1537
- ],
1538
- label: e(a)("form.config.hcv.fields.auth_method.label"),
1539
- readonly: n.isReadonly,
1540
- required: "",
1541
- width: "100%"
1542
- }, null, 8, ["modelValue", "items", "label", "readonly"]),
1543
- l[e(t).HCV].auth_method === e(A).TOKEN ? (V(), W("div", Dt, [
1544
- u(_, {
1545
- modelValue: l[e(t).HCV].token,
1546
- "onUpdate:modelValue": r[18] || (r[18] = (i) => l[e(t).HCV].token = i),
1547
- modelModifiers: { trim: !0 },
1548
- autocomplete: "off",
1549
- "data-testid": "vault-form-config-hcv-token",
1550
- label: e(a)("form.config.hcv.fields.token.label"),
1551
- readonly: n.isReadonly,
1552
- required: "",
1553
- "show-password-mask-toggle": "",
1554
- type: "password"
1555
- }, null, 8, ["modelValue", "label", "readonly"])
1556
- ])) : l[e(t).HCV].auth_method === e(A).K8S ? (V(), W("div", Bt, [
1557
- u(_, {
1558
- modelValue: l[e(t).HCV].kube_role,
1559
- "onUpdate:modelValue": r[19] || (r[19] = (i) => l[e(t).HCV].kube_role = i),
1560
- modelModifiers: { trim: !0 },
1561
- autocomplete: "off",
1562
- "data-testid": "vault-form-config-hcv-kube_role",
1563
- label: e(a)("form.config.hcv.fields.kube_role.label"),
1564
- readonly: n.isReadonly,
1565
- required: "",
1566
- type: "text"
1567
- }, null, 8, ["modelValue", "label", "readonly"]),
1568
- u(_, {
1569
- modelValue: l[e(t).HCV].kube_auth_path,
1570
- "onUpdate:modelValue": r[20] || (r[20] = (i) => l[e(t).HCV].kube_auth_path = i),
1571
- modelModifiers: { trim: !0 },
1572
- autocomplete: "off",
1573
- "data-testid": "vault-form-config-hcv-kube_auth_path",
1574
- label: e(a)("form.config.hcv.fields.kube_auth_path.label"),
1575
- readonly: n.isReadonly,
1576
- type: "text"
1577
- }, null, 8, ["modelValue", "label", "readonly"]),
1578
- u(_, {
1579
- modelValue: l[e(t).HCV].kube_api_token_file,
1580
- "onUpdate:modelValue": r[21] || (r[21] = (i) => l[e(t).HCV].kube_api_token_file = i),
1581
- modelModifiers: { trim: !0 },
1582
- autocomplete: "off",
1583
- "data-testid": "vault-form-config-hcv-kube_api_token_file",
1584
- label: e(a)("form.config.hcv.fields.kube_api_token_file.label"),
1585
- readonly: n.isReadonly,
1586
- required: "",
1587
- type: "text"
1588
- }, null, 8, ["modelValue", "label", "readonly"])
1589
- ])) : l[e(t).HCV].auth_method === e(A).APP_ROLE ? (V(), W("div", Jt, [
1590
- u(_, {
1591
- modelValue: l[e(t).HCV].approle_auth_path,
1592
- "onUpdate:modelValue": r[22] || (r[22] = (i) => l[e(t).HCV].approle_auth_path = i),
1593
- modelModifiers: { trim: !0 },
1594
- autocomplete: "off",
1595
- "data-testid": "vault-form-config-hcv-approle_auth_path",
1596
- label: e(a)("form.config.hcv.fields.approle_auth_path.label"),
1597
- readonly: n.isReadonly,
1598
- type: "text"
1599
- }, null, 8, ["modelValue", "label", "readonly"]),
1600
- u(_, {
1601
- modelValue: l[e(t).HCV].approle_role_id,
1602
- "onUpdate:modelValue": r[23] || (r[23] = (i) => l[e(t).HCV].approle_role_id = i),
1603
- modelModifiers: { trim: !0 },
1604
- autocomplete: "off",
1605
- "data-testid": "vault-form-config-hcv-approle_role_id",
1606
- label: e(a)("form.config.hcv.fields.approle_role_id.label"),
1607
- readonly: n.isReadonly,
1608
- required: "",
1609
- type: "text"
1610
- }, null, 8, ["modelValue", "label", "readonly"]),
1611
- u(_, {
1612
- modelValue: l[e(t).HCV].approle_secret_id,
1613
- "onUpdate:modelValue": r[24] || (r[24] = (i) => l[e(t).HCV].approle_secret_id = i),
1614
- modelModifiers: { trim: !0 },
1615
- autocomplete: "off",
1616
- "data-testid": "vault-form-config-hcv-approle_secret_id",
1617
- label: e(a)("form.config.hcv.fields.approle_secret_id.label"),
1618
- readonly: n.isReadonly,
1619
- "show-password-mask-toggle": "",
1620
- type: "password"
1621
- }, null, 8, ["modelValue", "label", "readonly"]),
1622
- u(_, {
1623
- modelValue: l[e(t).HCV].approle_secret_id_file,
1624
- "onUpdate:modelValue": r[25] || (r[25] = (i) => l[e(t).HCV].approle_secret_id_file = i),
1625
- modelModifiers: { trim: !0 },
1626
- autocomplete: "off",
1627
- "data-testid": "vault-form-config-hcv-approle_secret_id_file",
1628
- label: e(a)("form.config.hcv.fields.approle_secret_id_file.label"),
1629
- readonly: n.isReadonly,
1630
- type: "text"
1631
- }, null, 8, ["modelValue", "label", "readonly"]),
1632
- u(oe, {
1633
- modelValue: l[e(t).HCV].approle_response_wrapping,
1634
- "onUpdate:modelValue": r[26] || (r[26] = (i) => l[e(t).HCV].approle_response_wrapping = i),
1635
- "data-testid": "vault-form-config-hcv-approle_response_wrapping",
1636
- label: e(a)("form.config.hcv.fields.approle_response_wrapping.label")
1637
- }, null, 8, ["modelValue", "label"])
1638
- ])) : l[e(t).HCV].auth_method === e(A).CERT ? (V(), W("div", Lt, [
1639
- u(_, {
1640
- modelValue: l[e(t).HCV].cert_auth_role_name,
1641
- "onUpdate:modelValue": r[27] || (r[27] = (i) => l[e(t).HCV].cert_auth_role_name = i),
1642
- modelModifiers: { trim: !0 },
1643
- autocomplete: "off",
1644
- "data-testid": "vault-form-config-hcv-cert_auth_role_name",
1645
- label: e(a)("form.config.hcv.fields.cert_auth_role_name.label"),
1646
- readonly: n.isReadonly,
1647
- required: ""
1648
- }, null, 8, ["modelValue", "label", "readonly"]),
1649
- u(de, {
1650
- modelValue: l[e(t).HCV].cert_auth_cert,
1651
- "onUpdate:modelValue": r[28] || (r[28] = (i) => l[e(t).HCV].cert_auth_cert = i),
1652
- modelModifiers: { trim: !0 },
1653
- autocomplete: "off",
1654
- "data-testid": "vault-form-config-hcv-cert_auth_cert",
1655
- label: e(a)("form.config.hcv.fields.cert_auth_cert.label"),
1656
- readonly: n.isReadonly,
1657
- required: ""
1658
- }, null, 8, ["modelValue", "label", "readonly"]),
1659
- u(de, {
1660
- modelValue: l[e(t).HCV].cert_auth_cert_key,
1661
- "onUpdate:modelValue": r[29] || (r[29] = (i) => l[e(t).HCV].cert_auth_cert_key = i),
1662
- modelModifiers: { trim: !0 },
1663
- autocomplete: "off",
1664
- "data-testid": "vault-form-config-hcv-cert_auth_cert_key",
1665
- label: e(a)("form.config.hcv.fields.cert_auth_cert_key.label"),
1666
- readonly: n.isReadonly,
1667
- required: ""
1668
- }, null, 8, ["modelValue", "label", "readonly"])
1669
- ])) : l[e(t).HCV].auth_method === e(A).JWT ? (V(), W("div", zt, [
1670
- u(_, {
1671
- modelValue: l[e(t).HCV].oauth2_client_id,
1672
- "onUpdate:modelValue": r[30] || (r[30] = (i) => l[e(t).HCV].oauth2_client_id = i),
1673
- modelModifiers: { trim: !0 },
1674
- autocomplete: "off",
1675
- "data-testid": "vault-form-config-hcv-oauth2_client_id",
1676
- label: e(a)("form.config.hcv.fields.oauth2_client_id.label"),
1677
- readonly: n.isReadonly,
1678
- required: ""
1679
- }, null, 8, ["modelValue", "label", "readonly"]),
1680
- u(_, {
1681
- modelValue: l[e(t).HCV].oauth2_client_secret,
1682
- "onUpdate:modelValue": r[31] || (r[31] = (i) => l[e(t).HCV].oauth2_client_secret = i),
1683
- modelModifiers: { trim: !0 },
1684
- autocomplete: "off",
1685
- "data-testid": "vault-form-config-hcv-oauth2_client_secret",
1686
- label: e(a)("form.config.hcv.fields.oauth2_client_secret.label"),
1687
- readonly: n.isReadonly,
1688
- required: "",
1689
- "show-password-mask-toggle": "",
1690
- type: "password"
1691
- }, null, 8, ["modelValue", "label", "readonly"]),
1692
- u(_, {
1693
- modelValue: l[e(t).HCV].jwt_role,
1694
- "onUpdate:modelValue": r[32] || (r[32] = (i) => l[e(t).HCV].jwt_role = i),
1695
- modelModifiers: { trim: !0 },
1696
- autocomplete: "off",
1697
- "data-testid": "vault-form-config-hcv-jwt_role",
1698
- label: e(a)("form.config.hcv.fields.jwt_role.label"),
1699
- "label-attributes": {
1700
- info: e(a)("form.config.hcv.fields.jwt_role.tooltip"),
1701
- tooltipAttributes: { maxWidth: "400" }
1702
- },
1703
- readonly: n.isReadonly,
1704
- required: ""
1705
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1706
- u(_, {
1707
- modelValue: l[e(t).HCV].oauth2_token_endpoint,
1708
- "onUpdate:modelValue": r[33] || (r[33] = (i) => l[e(t).HCV].oauth2_token_endpoint = i),
1709
- modelModifiers: { trim: !0 },
1710
- autocomplete: "off",
1711
- "data-testid": "vault-form-config-hcv-oauth2_token_endpoint",
1712
- label: e(a)("form.config.hcv.fields.oauth2_token_endpoint.label"),
1713
- readonly: n.isReadonly,
1714
- required: ""
1715
- }, null, 8, ["modelValue", "label", "readonly"]),
1716
- u(_, {
1717
- modelValue: l[e(t).HCV].oauth2_audiences,
1718
- "onUpdate:modelValue": r[34] || (r[34] = (i) => l[e(t).HCV].oauth2_audiences = i),
1719
- modelModifiers: { trim: !0 },
1720
- autocomplete: "off",
1721
- "data-testid": "vault-form-config-hcv-oauth2_audiences",
1722
- label: e(a)("form.config.hcv.fields.oauth2_audiences.label"),
1723
- "label-attributes": {
1724
- info: e(a)("form.config.hcv.fields.oauth2_audiences.tooltip"),
1725
- tooltipAttributes: { maxWidth: "400" }
1726
- },
1727
- readonly: n.isReadonly
1728
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])
1729
- ])) : B("", !0),
1730
- o.config.base64FieldAvailable ? (V(), D(oe, {
1731
- key: 5,
1732
- modelValue: l[e(t).HCV].base64_decode,
1733
- "onUpdate:modelValue": r[35] || (r[35] = (i) => l[e(t).HCV].base64_decode = i),
1734
- "data-testid": "vault-form-config-hcv-base64_decode",
1735
- label: e(a)("form.config.commonFields.base64_decode.label"),
1736
- "label-attributes": {
1737
- info: e(a)("form.config.commonFields.base64_decode.tooltip"),
1738
- tooltipAttributes: { maxWidth: "400" }
1739
- },
1740
- readonly: n.isReadonly
1741
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0)
1742
- ])) : B("", !0),
1743
- f.value === e(t).AZURE ? (V(), W("div", {
1744
- key: `${e(t).AZURE}-vault-config-fields`,
1745
- class: "vault-form-config-fields-container"
1746
- }, [
1747
- u(_, {
1748
- modelValue: l[e(t).AZURE].location,
1749
- "onUpdate:modelValue": r[36] || (r[36] = (i) => l[e(t).AZURE].location = i),
1750
- modelModifiers: { trim: !0 },
1751
- autocomplete: "off",
1752
- "data-testid": "vault-form-config-azure-location",
1753
- label: e(a)("form.config.azure.fields.location.label"),
1754
- readonly: n.isReadonly,
1755
- required: "",
1756
- type: "text"
1757
- }, null, 8, ["modelValue", "label", "readonly"]),
1758
- u(_, {
1759
- modelValue: l[e(t).AZURE].vault_uri,
1760
- "onUpdate:modelValue": r[37] || (r[37] = (i) => l[e(t).AZURE].vault_uri = i),
1761
- modelModifiers: { trim: !0 },
1762
- autocomplete: "off",
1763
- "data-testid": "vault-form-config-azure-uri",
1764
- label: e(a)("form.config.azure.fields.vault_uri.label"),
1765
- readonly: n.isReadonly,
1766
- required: "",
1767
- type: "text"
1768
- }, null, 8, ["modelValue", "label", "readonly"]),
1769
- u(_, {
1770
- modelValue: l[e(t).AZURE].credentials_prefix,
1771
- "onUpdate:modelValue": r[38] || (r[38] = (i) => l[e(t).AZURE].credentials_prefix = i),
1772
- modelModifiers: { trim: !0 },
1773
- autocomplete: "off",
1774
- "data-testid": "vault-form-config-azure-prefix",
1775
- label: e(a)("form.config.azure.fields.credential_prefix.label"),
1776
- readonly: n.isReadonly,
1777
- required: "",
1778
- type: "text"
1779
- }, null, 8, ["modelValue", "label", "readonly"]),
1780
- u(C, {
1781
- modelValue: l[e(t).AZURE].type,
1782
- "onUpdate:modelValue": r[39] || (r[39] = (i) => l[e(t).AZURE].type = i),
1783
- "data-testid": "vault-form-config-azure-type",
1784
- items: ee,
1785
- label: e(a)("form.config.azure.fields.type.label"),
1786
- placeholder: e(a)("form.config.azure.fields.type.placeholder"),
1787
- readonly: n.isReadonly,
1788
- required: "",
1789
- width: "100%"
1790
- }, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
1791
- u(_, {
1792
- modelValue: l[e(t).AZURE].client_id,
1793
- "onUpdate:modelValue": r[40] || (r[40] = (i) => l[e(t).AZURE].client_id = i),
1794
- modelModifiers: { trim: !0 },
1795
- autocomplete: "off",
1796
- "data-testid": "vault-form-config-azure-client-id",
1797
- label: e(a)("form.config.azure.fields.client_id.label"),
1798
- readonly: n.isReadonly,
1799
- type: "text"
1800
- }, null, 8, ["modelValue", "label", "readonly"]),
1801
- u(_, {
1802
- modelValue: l[e(t).AZURE].tenant_id,
1803
- "onUpdate:modelValue": r[41] || (r[41] = (i) => l[e(t).AZURE].tenant_id = i),
1804
- modelModifiers: { trim: !0 },
1805
- autocomplete: "off",
1806
- "data-testid": "vault-form-config-azure-tenant-id",
1807
- label: e(a)("form.config.azure.fields.tenant_id.label"),
1808
- readonly: n.isReadonly,
1809
- type: "text"
1810
- }, null, 8, ["modelValue", "label", "readonly"]),
1811
- o.config.base64FieldAvailable ? (V(), D(oe, {
1812
- key: 0,
1813
- modelValue: l[e(t).AZURE].base64_decode,
1814
- "onUpdate:modelValue": r[42] || (r[42] = (i) => l[e(t).AZURE].base64_decode = i),
1815
- "data-testid": "vault-form-config-azure-base64_decode",
1816
- label: e(a)("form.config.commonFields.base64_decode.label"),
1817
- "label-attributes": {
1818
- info: e(a)("form.config.commonFields.base64_decode.tooltip"),
1819
- tooltipAttributes: { maxWidth: "400" }
1820
- },
1821
- readonly: n.isReadonly
1822
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0)
1823
- ])) : B("", !0),
1824
- f.value === e(t).CONJUR ? (V(), W("div", {
1825
- key: `${e(t).CONJUR}-vault-config-fields`,
1826
- class: "vault-form-config-fields-container"
1827
- }, [
1828
- u(_, {
1829
- modelValue: l[e(t).CONJUR].endpoint_url,
1830
- "onUpdate:modelValue": r[43] || (r[43] = (i) => l[e(t).CONJUR].endpoint_url = i),
1831
- modelModifiers: { trim: !0 },
1832
- autocomplete: "off",
1833
- "data-testid": "vault-form-config-conjur-endpoint_url",
1834
- label: e(a)("form.config.conjur.fields.endpoint_url.label"),
1835
- "label-attributes": {
1836
- info: e(a)("form.config.conjur.fields.endpoint_url.tooltip"),
1837
- tooltipAttributes: { maxWidth: "400" }
1838
- },
1839
- readonly: n.isReadonly,
1840
- required: "",
1841
- type: "text"
1842
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1843
- u(_, {
1844
- modelValue: l[e(t).CONJUR].login,
1845
- "onUpdate:modelValue": r[44] || (r[44] = (i) => l[e(t).CONJUR].login = i),
1846
- modelModifiers: { trim: !0 },
1847
- autocomplete: "off",
1848
- "data-testid": "vault-form-config-conjur-login",
1849
- label: e(a)("form.config.conjur.fields.login.label"),
1850
- "label-attributes": {
1851
- info: e(a)("form.config.conjur.fields.login.tooltip"),
1852
- tooltipAttributes: { maxWidth: "400" }
1853
- },
1854
- readonly: n.isReadonly,
1855
- required: "",
1856
- type: "text"
1857
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1858
- u(_, {
1859
- modelValue: l[e(t).CONJUR].account,
1860
- "onUpdate:modelValue": r[45] || (r[45] = (i) => l[e(t).CONJUR].account = i),
1861
- modelModifiers: { trim: !0 },
1862
- autocomplete: "off",
1863
- "data-testid": "vault-form-config-conjur-account",
1864
- label: e(a)("form.config.conjur.fields.account.label"),
1865
- "label-attributes": {
1866
- info: e(a)("form.config.conjur.fields.account.tooltip"),
1867
- tooltipAttributes: { maxWidth: "400" }
1868
- },
1869
- readonly: n.isReadonly,
1870
- required: "",
1871
- type: "text"
1872
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1873
- u(_, {
1874
- modelValue: l[e(t).CONJUR].api_key,
1875
- "onUpdate:modelValue": r[46] || (r[46] = (i) => l[e(t).CONJUR].api_key = i),
1876
- modelModifiers: { trim: !0 },
1877
- autocomplete: "off",
1878
- "data-testid": "vault-form-config-conjur-api_key",
1879
- label: e(a)("form.config.conjur.fields.api_key.label"),
1880
- "label-attributes": {
1881
- info: e(a)("form.config.conjur.fields.api_key.tooltip"),
1882
- tooltipAttributes: { maxWidth: "400" }
1883
- },
1884
- readonly: n.isReadonly,
1885
- required: "",
1886
- "show-password-mask-toggle": "",
1887
- type: "password"
1888
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1889
- o.config.base64FieldAvailable ? (V(), D(oe, {
1890
- key: 0,
1891
- modelValue: l[e(t).CONJUR].base64_decode,
1892
- "onUpdate:modelValue": r[47] || (r[47] = (i) => l[e(t).CONJUR].base64_decode = i),
1893
- "data-testid": "vault-form-config-env-base64_decode",
1894
- label: e(a)("form.config.commonFields.base64_decode.label"),
1895
- "label-attributes": {
1896
- info: e(a)("form.config.commonFields.base64_decode.tooltip"),
1897
- tooltipAttributes: { maxWidth: "400" }
1898
- },
1899
- readonly: n.isReadonly
1900
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])) : B("", !0)
1901
- ])) : B("", !0),
1902
- o.config.ttl ? (V(), W("div", Gt, [
1903
- Q.value ? (V(), D(ve, {
1904
- key: 0,
1905
- class: "advanced-fields-collapse",
1906
- "data-testid": "advanced-fields-collapse",
1907
- "trigger-alignment": "leading",
1908
- "trigger-label": e(a)("form.config.advancedFields.title")
1909
- }, {
1910
- default: m(() => [
1911
- x("div", Zt, [
1912
- x("div", Qt, [
1913
- u(_, {
1914
- modelValue: l[f.value].ttl,
1915
- "onUpdate:modelValue": r[48] || (r[48] = (i) => l[f.value].ttl = i),
1916
- "data-testid": "vault-ttl-input",
1917
- label: e(a)("form.config.advancedFields.ttl"),
1918
- "label-attributes": {
1919
- info: e(a)("form.config.advancedFields.ttlTooltip"),
1920
- tooltipAttributes: { maxWidth: "400" }
1921
- },
1922
- type: "number"
1923
- }, null, 8, ["modelValue", "label", "label-attributes"])
1924
- ]),
1925
- x("div", Yt, [
1926
- u(_, {
1927
- modelValue: l[f.value].neg_ttl,
1928
- "onUpdate:modelValue": r[49] || (r[49] = (i) => l[f.value].neg_ttl = i),
1929
- "data-testid": "vault-neg-ttl-input",
1930
- label: e(a)("form.config.advancedFields.negTtl"),
1931
- "label-attributes": {
1932
- info: e(a)("form.config.advancedFields.negTtlTooltip"),
1933
- tooltipAttributes: { maxWidth: "400" }
1934
- },
1935
- type: "number"
1936
- }, null, 8, ["modelValue", "label", "label-attributes"])
1937
- ])
1938
- ]),
1939
- x("div", Xt, [
1940
- x("div", el, [
1941
- u(_, {
1942
- modelValue: l[f.value].resurrect_ttl,
1943
- "onUpdate:modelValue": r[50] || (r[50] = (i) => l[f.value].resurrect_ttl = i),
1944
- "data-testid": "vault-resurrect-ttl-input",
1945
- label: e(a)("form.config.advancedFields.resurrectTtl"),
1946
- "label-attributes": {
1947
- info: e(a)("form.config.advancedFields.resurrectTtlTooltip"),
1948
- tooltipAttributes: { maxWidth: "400" }
1949
- },
1950
- type: "number"
1951
- }, null, 8, ["modelValue", "label", "label-attributes"])
1952
- ])
1953
- ])
1954
- ]),
1955
- _: 1
1956
- }, 8, ["trigger-label"])) : B("", !0)
1957
- ])) : B("", !0)
1958
- ]),
1959
- _: 1
1960
- })
1961
- ]),
1962
- _: 1
1963
- }, 8, ["description", "title"]),
1964
- u(e(Ae), {
1965
- description: e(a)("form.sections.general.description"),
1966
- title: e(a)("form.sections.general.title")
1967
- }, {
1968
- default: m(() => [
1969
- u(_, {
1970
- modelValue: n.fields.prefix,
1971
- "onUpdate:modelValue": r[51] || (r[51] = (i) => n.fields.prefix = i),
1972
- modelModifiers: { trim: !0 },
1973
- autocomplete: "off",
1974
- "data-testid": "vault-form-prefix",
1975
- help: e(a)("form.fields.prefix.help"),
1976
- label: e(a)("form.fields.prefix.label"),
1977
- "label-attributes": {
1978
- info: e(a)("form.fields.prefix.tooltip"),
1979
- tooltipAttributes: { maxWidth: "400" }
1980
- },
1981
- placeholder: e(a)("form.fields.prefix.placeholder"),
1982
- readonly: n.isReadonly,
1983
- required: "",
1984
- type: "text"
1985
- }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"]),
1986
- u(de, {
1987
- modelValue: n.fields.description,
1988
- "onUpdate:modelValue": r[52] || (r[52] = (i) => n.fields.description = i),
1989
- modelModifiers: { trim: !0 },
1990
- "character-limit": 1e3,
1991
- class: "vault-form-textarea",
1992
- "data-testid": "vault-form-description",
1993
- label: e(a)("form.fields.description.label"),
1994
- placeholder: e(a)("form.fields.description.placeholder"),
1995
- readonly: n.isReadonly
1996
- }, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
1997
- u(_, {
1998
- modelValue: n.fields.tags,
1999
- "onUpdate:modelValue": r[53] || (r[53] = (i) => n.fields.tags = i),
2000
- modelModifiers: { trim: !0 },
2001
- autocomplete: "off",
2002
- "data-testid": "vault-form-tags",
2003
- help: e(a)("form.fields.tags.help"),
2004
- label: e(a)("form.fields.tags.label"),
2005
- placeholder: e(a)("form.fields.tags.placeholder"),
2006
- readonly: n.isReadonly,
2007
- type: "text"
2008
- }, null, 8, ["modelValue", "help", "label", "placeholder", "readonly"])
2009
- ]),
2010
- _: 1
2011
- }, 8, ["description", "title"])
2012
- ]),
2013
- _: 1
2014
- }, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"])
2015
- ]);
2016
- };
2017
- }
2018
- }), Ul = /* @__PURE__ */ me(tl, [["__scopeId", "data-v-69c9b94d"]]), ll = { class: "kong-ui-vault-entity-config-card" }, Tl = /* @__PURE__ */ ce({
2019
- __name: "VaultConfigCard",
2020
- props: {
2021
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
2022
- config: {
2023
- type: Object,
2024
- required: !0,
2025
- validator: (o) => !(!o || !["konnect", "kongManager"].includes(o == null ? void 0 : o.app) || o.app === "konnect" && !o.controlPlaneId || o.app === "kongManager" && typeof o.workspace != "string" || !o.entityId)
2026
- },
2027
- /**
2028
- * External link for documentation that determines visibility of Documentation button
2029
- */
2030
- configCardDoc: {
2031
- type: String,
2032
- default: "",
2033
- required: !1
2034
- },
2035
- /**
2036
- * Control visibility of card title content
2037
- */
2038
- hideTitle: {
2039
- type: Boolean,
2040
- default: !1
2041
- }
2042
- },
2043
- emits: ["loading", "fetch:error", "fetch:success"],
2044
- setup(o) {
2045
- const S = o, c = ["token", "approle_secret_id", "api_key"], d = w(() => {
2046
- var n, g;
2047
- return (g = pe.form[(n = S.config) == null ? void 0 : n.app]) == null ? void 0 : g.edit;
2048
- }), { i18n: { t: p } } = he.useI18n(), { convertKeyToTitle: a } = vt(), { getPropValue: K } = gt(), I = $({
2049
- id: {},
2050
- name: {
2051
- label: p("labels.vault_type")
2052
- },
2053
- updated_at: {},
2054
- created_at: {},
2055
- prefix: {
2056
- order: 5,
2057
- section: Ne.Basic
2058
- },
2059
- description: {
2060
- order: 6,
2061
- section: Ne.Basic
2062
- },
2063
- tags: {
2064
- order: 7
2065
- },
2066
- config: {
2067
- order: 8,
2068
- type: Se.Json
2069
- }
2070
- }), h = (n) => {
2071
- var g, f;
2072
- return ((f = (g = I.value) == null ? void 0 : g[n]) == null ? void 0 : f.label) || a(n);
2073
- };
2074
- return (n, g) => (V(), W("div", ll, [
2075
- u(e(bt), {
2076
- config: o.config,
2077
- "config-card-doc": o.configCardDoc,
2078
- "config-schema": I.value,
2079
- "entity-type": e(Ue).Vault,
2080
- "fetch-url": d.value,
2081
- "hide-title": o.hideTitle,
2082
- "onFetch:error": g[0] || (g[0] = (f) => n.$emit("fetch:error", f)),
2083
- "onFetch:success": g[1] || (g[1] = (f) => n.$emit("fetch:success", f)),
2084
- onLoading: g[2] || (g[2] = (f) => n.$emit("loading", f))
2085
- }, {
2086
- config: m(({ rowValue: f }) => [
2087
- (V(!0), W(qe, null, et(Object.keys(f).sort(), (N) => (V(), D(e(_t), {
2088
- key: N,
2089
- item: {
2090
- key: N,
2091
- value: e(K)(N, f),
2092
- label: h(N),
2093
- type: c.includes(N) ? e(Se).Redacted : e(Se).Text
2094
- }
2095
- }, null, 8, ["item"]))), 128))
2096
- ]),
2097
- _: 1
2098
- }, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
2099
- ]));
2100
- }
2101
- }), Ce = "/v2/control-planes/{controlPlaneId}", be = {
2102
- getVault: {
2103
- konnect: `${Ce}/core-entities/vaults/{id}`
2104
- },
2105
- list: {
2106
- konnect: `${Ce}/config-stores/{id}/secrets`
2107
- },
2108
- form: {
2109
- konnect: {
2110
- create: `${Ce}/config-stores/{id}/secrets`,
2111
- edit: `${Ce}/config-stores/{id}/secrets/{secretId}`
2112
- }
2113
- }
2114
- }, ol = { class: "table-content-overflow-wrapper" }, al = /* @__PURE__ */ ce({
2115
- inheritAttrs: !1,
2116
- __name: "SecretListInner",
2117
- props: {
2118
- /** The base konnect config. Pass additional config props in the shared entity component as needed. */
2119
- config: {
2120
- type: Object,
2121
- required: !0,
2122
- validator: (o) => !(!o || (o == null ? void 0 : o.app) !== "konnect" || !o.createRoute || !o.getEditRoute)
2123
- },
2124
- // The config store id for the secrets
2125
- configStoreId: {
2126
- type: String,
2127
- required: !0
2128
- },
2129
- // used to override the default identifier for the cache entry
2130
- cacheIdentifier: {
2131
- type: String,
2132
- default: ""
2133
- },
2134
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
2135
- canCreate: {
2136
- type: Function,
2137
- required: !1,
2138
- default: async () => !0
2139
- },
2140
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
2141
- canDelete: {
2142
- type: Function,
2143
- required: !1,
2144
- default: async () => !0
2145
- },
2146
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
2147
- canEdit: {
2148
- type: Function,
2149
- required: !1,
2150
- default: async () => !0
2151
- }
2152
- },
2153
- emits: ["error", "delete:success"],
2154
- setup(o, { emit: S }) {
2155
- var ie;
2156
- const c = S, d = o, { i18n: { t: p, formatUnixTimeStamp: a } } = he.useI18n(), { axiosInstance: K } = _e((ie = d.config) == null ? void 0 : ie.axiosRequestConfig), h = {
2157
- // the Secret Key column is non-hidable
2158
- key: { label: p("secrets.list.table_headers.key"), sortable: !1, hidable: !1 },
2159
- updated_at: { label: p("secrets.list.table_headers.updated_at"), sortable: !1 }
2160
- }, n = (T) => ({
2161
- "data-testid": T.key
2162
- }), g = w(() => {
2163
- var T;
2164
- return `${d.config.apiBaseUrl}${be.list[d.config.app]}`.replace(/{controlPlaneId}/gi, ((T = d.config) == null ? void 0 : T.controlPlaneId) || "").replace(/{id}/gi, d.configStoreId || "");
2165
- }), f = $(""), N = {
2166
- isExactMatch: !0,
2167
- placeholder: p("search.placeholder_for_secrets.konnect")
2168
- }, {
2169
- fetcher: X,
2170
- fetcherState: Q,
2171
- fetcherCacheKey: Y
2172
- } = We(w(() => ({ ...d.config, cacheIdentifier: d.cacheIdentifier })), g), O = () => {
2173
- f.value = "";
2174
- }, l = $(null), ae = (T) => ({
2175
- label: p("actions.edit"),
2176
- to: d.config.getEditRoute(T)
2177
- }), z = $(void 0), ee = $(!1), G = $(!1), y = $(""), F = De(d.config, g.value), re = (T) => {
2178
- z.value = T, ee.value = !0;
2179
- }, ne = () => {
2180
- ee.value = !1;
2181
- }, le = async () => {
2182
- var T, Z, te;
2183
- if ((T = z.value) != null && T.key) {
2184
- G.value = !0;
2185
- try {
2186
- await K.delete(F(z.value.key)), G.value = !1, ee.value = !1, Y.value++, c("delete:success", z.value);
2187
- } catch (b) {
2188
- y.value = ((te = (Z = b.response) == null ? void 0 : Z.data) == null ? void 0 : te.message) || b.message || p("errors.delete"), c("error", b);
2189
- } finally {
2190
- G.value = !1;
2191
- }
2192
- }
2193
- };
2194
- ke(Q, (T) => {
2195
- var Z, te, b;
2196
- if (T.status === Be.Error) {
2197
- l.value = {
2198
- title: p("errors.general")
2199
- }, (b = (te = (Z = T.error) == null ? void 0 : Z.response) == null ? void 0 : te.data) != null && b.message && (l.value.message = T.error.response.data.message), c("error", T.error);
2200
- return;
2201
- }
2202
- l.value = null;
2203
- });
2204
- const q = $({
2205
- ctaPath: d.config.createRoute,
2206
- ctaText: void 0,
2207
- message: `${p("secrets.list.empty_state.description")}${d.config.additionMessageForEmptyState ? ` ${d.config.additionMessageForEmptyState}` : ""}`,
2208
- title: p("secrets.title")
2209
- });
2210
- return we(async () => {
2211
- await d.canCreate() && (q.value.title = p("secrets.list.empty_state.title"), q.value.ctaText = p("secrets.list.toolbar_actions.new_secret"));
2212
- }), (T, Z) => {
2213
- const te = J("KButton"), b = J("KDropdownItem");
2214
- return V(), W(qe, null, [
2215
- u(e(Je), {
2216
- "cache-identifier": o.cacheIdentifier,
2217
- "disable-sorting": "",
2218
- "empty-state-options": q.value,
2219
- "enable-entity-actions": "",
2220
- "error-message": l.value,
2221
- fetcher: e(X),
2222
- "fetcher-cache-key": e(Y),
2223
- "pagination-type": "offset",
2224
- "preferences-storage-key": "kong-ui-entities-secrets-list",
2225
- query: f.value,
2226
- "row-attributes": n,
2227
- "table-headers": e(h),
2228
- onClearSearchInput: O
2229
- }, {
2230
- "toolbar-filter": m(() => [
2231
- u(e(Le), {
2232
- modelValue: f.value,
2233
- "onUpdate:modelValue": Z[0] || (Z[0] = (v) => f.value = v),
2234
- config: N
2235
- }, null, 8, ["modelValue"])
2236
- ]),
2237
- "toolbar-button": m(() => [
2238
- u(e(ge), {
2239
- "auth-function": () => o.canCreate()
2240
- }, {
2241
- default: m(() => [
2242
- u(te, {
2243
- appearance: "primary",
2244
- "data-testid": "toolbar-add-secret",
2245
- size: "large",
2246
- to: o.config.createRoute
2247
- }, {
2248
- default: m(() => [
2249
- u(e(Re)),
2250
- ue(" " + H(e(p)("secrets.list.toolbar_actions.new_secret")), 1)
2251
- ]),
2252
- _: 1
2253
- }, 8, ["to"])
2254
- ]),
2255
- _: 1
2256
- }, 8, ["auth-function"])
2257
- ]),
2258
- key: m(({ rowValue: v }) => [
2259
- x("div", ol, [
2260
- x("b", null, H(v ?? "-"), 1)
2261
- ])
2262
- ]),
2263
- updated_at: m(({ rowValue: v }) => [
2264
- x("span", null, H(v ? e(a)(new Date(v).getTime() / 1e3) : "-"), 1)
2265
- ]),
2266
- actions: m(({ row: v }) => [
2267
- u(e(ge), {
2268
- "auth-function": () => o.canEdit(v)
2269
- }, {
2270
- default: m(() => [
2271
- u(b, {
2272
- "data-testid": "action-entity-edit",
2273
- item: ae(v.key)
2274
- }, null, 8, ["item"])
2275
- ]),
2276
- _: 2
2277
- }, 1032, ["auth-function"]),
2278
- u(e(ge), {
2279
- "auth-function": () => o.canDelete(v)
2280
- }, {
2281
- default: m(() => [
2282
- u(b, {
2283
- danger: "",
2284
- "data-testid": "action-entity-delete",
2285
- "has-divider": "",
2286
- onClick: (P) => re(v)
2287
- }, {
2288
- default: m(() => [
2289
- ue(H(e(p)("actions.delete")), 1)
2290
- ]),
2291
- _: 1
2292
- }, 8, ["onClick"])
2293
- ]),
2294
- _: 2
2295
- }, 1032, ["auth-function"])
2296
- ]),
2297
- _: 1
2298
- }, 8, ["cache-identifier", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers"]),
2299
- u(e(ze), {
2300
- "action-pending": G.value,
2301
- description: e(p)("delete.description"),
2302
- "entity-name": z.value && z.value.key,
2303
- "entity-type": e(Ge).Secret,
2304
- error: y.value,
2305
- title: e(p)("delete.title_for_secret"),
2306
- visible: ee.value,
2307
- onCancel: ne,
2308
- onProceed: le
2309
- }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
2310
- ], 64);
2311
- };
2312
- }
2313
- }), rl = /* @__PURE__ */ me(al, [["__scopeId", "data-v-904390fc"]]), il = { class: "kong-ui-entities-secrets-list" }, nl = /* @__PURE__ */ ce({
2314
- __name: "SecretList",
2315
- props: {
2316
- /** The base konnect config. Pass additional config props in the shared entity component as needed. */
2317
- config: {
2318
- type: Object,
2319
- required: !0,
2320
- validator: (o) => !(!o || (o == null ? void 0 : o.app) !== "konnect" || !o.createRoute || !o.getEditRoute)
2321
- },
2322
- // The vault id for the secrets
2323
- vaultId: {
2324
- type: String,
2325
- required: !0
2326
- },
2327
- // used to override the default identifier for the cache entry
2328
- cacheIdentifier: {
2329
- type: String,
2330
- default: ""
2331
- },
2332
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
2333
- canCreate: {
2334
- type: Function,
2335
- required: !1,
2336
- default: async () => !0
2337
- },
2338
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
2339
- canDelete: {
2340
- type: Function,
2341
- required: !1,
2342
- default: async () => !0
2343
- },
2344
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
2345
- canEdit: {
2346
- type: Function,
2347
- required: !1,
2348
- default: async () => !0
2349
- }
2350
- },
2351
- emits: ["error", "delete:success"],
2352
- setup(o, { emit: S }) {
2353
- var n;
2354
- const c = S, d = o, p = (g) => {
2355
- c("error", g);
2356
- }, a = (g) => {
2357
- c("delete:success", g);
2358
- }, { axiosInstance: K } = _e((n = d.config) == null ? void 0 : n.axiosRequestConfig), I = $(""), h = w(() => {
2359
- var g;
2360
- return `${d.config.apiBaseUrl}${be.getVault[d.config.app]}`.replace(/{controlPlaneId}/gi, ((g = d.config) == null ? void 0 : g.controlPlaneId) || "").replace(/{id}/gi, d.vaultId);
2361
- });
2362
- return we(async () => {
2363
- var g;
2364
- try {
2365
- const { data: f } = await K.get(h.value);
2366
- I.value = (g = f == null ? void 0 : f.config) == null ? void 0 : g.config_store_id;
2367
- } catch (f) {
2368
- c("error", f);
2369
- }
2370
- }), (g, f) => (V(), W("div", il, [
2371
- I.value ? (V(), D(rl, je({ key: 0 }, d, {
2372
- "config-store-id": I.value,
2373
- "onDelete:success": a,
2374
- onError: p
2375
- }), null, 16, ["config-store-id"])) : B("", !0)
2376
- ]));
2377
- }
2378
- }), Hl = /* @__PURE__ */ me(nl, [["__scopeId", "data-v-f5aa5636"]]), sl = /* @__PURE__ */ ce({
2379
- inheritAttrs: !1,
2380
- __name: "SecretFormInner",
2381
- props: {
2382
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
2383
- config: {
2384
- type: Object,
2385
- required: !0,
2386
- validator: (o) => !(!o || o.app !== "konnect" || !o.controlPlaneId || !o.cancelRoute)
2387
- },
2388
- /** Current config store ID */
2389
- configStoreId: {
2390
- type: String,
2391
- required: !0
2392
- },
2393
- /** If a valid secretId is provided, it will put the form in Edit mode instead of Create */
2394
- secretId: {
2395
- type: String,
2396
- required: !1,
2397
- default: ""
2398
- }
2399
- },
2400
- emits: ["update", "error", "loading"],
2401
- setup(o, { emit: S }) {
2402
- var G;
2403
- const c = o, d = S, { i18n: { t: p } } = he.useI18n(), a = Ee(), { axiosInstance: K } = _e((G = c.config) == null ? void 0 : G.axiosRequestConfig), { getMessageFromError: I } = Ze(), h = ye({
2404
- fields: {
2405
- key: "",
2406
- value: ""
2407
- },
2408
- readonly: !1,
2409
- errorMessage: ""
2410
- }), n = ye({
2411
- key: "",
2412
- value: ""
2413
- }), g = w(
2414
- () => {
2415
- var y, F;
2416
- return (F = be.form[(y = c.config) == null ? void 0 : y.app]) == null ? void 0 : F.edit.replace(/{id}/gi, c.configStoreId).replace(/{secretId}/gi, c.secretId);
2417
- }
2418
- ), f = () => {
2419
- var y;
2420
- a.push(((y = c.config) == null ? void 0 : y.cancelRoute) || { name: "secret-list" });
2421
- }, N = (y) => {
2422
- d("loading", y);
2423
- }, X = (y) => {
2424
- d("error", y);
2425
- }, Q = (y) => {
2426
- var F, re;
2427
- h.fields.key = ((F = y == null ? void 0 : y.item) == null ? void 0 : F.key) || (y == null ? void 0 : y.key) || "", h.fields.value = ((re = y == null ? void 0 : y.item) == null ? void 0 : re.value) || (y == null ? void 0 : y.value) || "", Object.assign(n, h.fields);
2428
- }, Y = w(() => c.secretId ? Ve.Edit : Ve.Create), O = w(() => {
2429
- var y;
2430
- return `${c.config.apiBaseUrl}${be.form[c.config.app][Y.value]}`.replace(/{controlPlaneId}/gi, ((y = c.config) == null ? void 0 : y.controlPlaneId) || "").replace(/{id}/gi, c.configStoreId).replace(/{secretId}/gi, c.secretId);
2431
- }), l = w(() => !!h.fields.key && !!h.fields.value), ae = w(() => JSON.stringify(h.fields) !== JSON.stringify(n)), z = w(() => ({
2432
- key: h.fields.key,
2433
- value: h.fields.value
2434
- })), ee = async () => {
2435
- try {
2436
- h.readonly = !0;
2437
- let y;
2438
- Y.value === "create" ? y = await K.post(O.value, z.value) : Y.value === "edit" && (y = await K.put(O.value, z.value)), Q(y == null ? void 0 : y.data), d("update", y == null ? void 0 : y.data);
2439
- } catch (y) {
2440
- h.errorMessage = I(y), d("error", y);
2441
- } finally {
2442
- h.readonly = !1;
2443
- }
2444
- };
2445
- return (y, F) => {
2446
- const re = J("KInput"), ne = J("KTextArea"), le = J("KAlert");
2447
- return V(), D(e(Qe), {
2448
- "can-submit": l.value && ae.value,
2449
- config: o.config,
2450
- "edit-id": o.secretId,
2451
- "entity-type": e(Ue).Other,
2452
- "error-message": h.errorMessage,
2453
- "fetch-url": g.value,
2454
- "form-fields": z.value,
2455
- "is-readonly": h.readonly,
2456
- onCancel: f,
2457
- "onFetch:error": X,
2458
- "onFetch:success": Q,
2459
- onLoading: N,
2460
- onSubmit: ee
2461
- }, {
2462
- default: m(() => [
2463
- x("div", null, [
2464
- u(e(Ae), {
2465
- description: e(p)("secrets.form.info.description"),
2466
- "has-divider": "",
2467
- title: e(p)("secrets.form.info.title")
2468
- }, {
2469
- default: m(() => [
2470
- u(re, {
2471
- modelValue: h.fields.key,
2472
- "onUpdate:modelValue": F[0] || (F[0] = (q) => h.fields.key = q),
2473
- modelModifiers: { trim: !0 },
2474
- autocomplete: "off",
2475
- class: "key-field",
2476
- "data-testid": "secret-form-key",
2477
- disabled: Y.value === e(Ve).Edit,
2478
- label: e(p)("secrets.form.fields.key.label"),
2479
- placeholder: e(p)("secrets.form.fields.key.placeholder"),
2480
- readonly: h.readonly,
2481
- required: "",
2482
- type: "text"
2483
- }, null, 8, ["modelValue", "disabled", "label", "placeholder", "readonly"]),
2484
- u(ne, {
2485
- modelValue: h.fields.value,
2486
- "onUpdate:modelValue": F[1] || (F[1] = (q) => h.fields.value = q),
2487
- modelModifiers: { trim: !0 },
2488
- autocomplete: "off",
2489
- "data-testid": "secret-form-value",
2490
- label: e(p)("secrets.form.fields.value.label"),
2491
- placeholder: e(p)("secrets.form.fields.value.placeholder"),
2492
- readonly: h.readonly,
2493
- required: "",
2494
- resizable: "",
2495
- type: "text"
2496
- }, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
2497
- u(le, {
2498
- appearance: "warning",
2499
- message: e(p)("secrets.form.hint")
2500
- }, null, 8, ["message"])
2501
- ]),
2502
- _: 1
2503
- }, 8, ["description", "title"])
2504
- ])
2505
- ]),
2506
- _: 1
2507
- }, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"]);
2508
- };
2509
- }
2510
- }), dl = /* @__PURE__ */ me(sl, [["__scopeId", "data-v-5ee165bf"]]), ul = { class: "kong-ui-entities-secret-form" }, cl = /* @__PURE__ */ ce({
2511
- __name: "SecretForm",
2512
- props: {
2513
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
2514
- config: {
2515
- type: Object,
2516
- required: !0,
2517
- validator: (o) => !(!o || o.app !== "konnect" || !o.controlPlaneId || !o.cancelRoute)
2518
- },
2519
- /** Current vault ID */
2520
- vaultId: {
2521
- type: String,
2522
- required: !0
2523
- },
2524
- /** If a valid secretId is provided, it will put the form in Edit mode instead of Create */
2525
- secretId: {
2526
- type: String,
2527
- required: !1,
2528
- default: ""
2529
- }
2530
- },
2531
- emits: ["update", "error", "loading"],
2532
- setup(o, { emit: S }) {
2533
- var g;
2534
- const c = o, d = S, p = (f) => {
2535
- d("update", f);
2536
- }, a = (f) => {
2537
- d("error", f);
2538
- }, K = (f) => {
2539
- d("loading", f);
2540
- }, { axiosInstance: I } = _e((g = c.config) == null ? void 0 : g.axiosRequestConfig), h = $(""), n = w(() => {
2541
- var f;
2542
- return `${c.config.apiBaseUrl}${be.getVault[c.config.app]}`.replace(/{controlPlaneId}/gi, ((f = c.config) == null ? void 0 : f.controlPlaneId) || "").replace(/{id}/gi, c.vaultId);
2543
- });
2544
- return we(async () => {
2545
- var f;
2546
- try {
2547
- const { data: N } = await I.get(n.value);
2548
- h.value = (f = N == null ? void 0 : N.config) == null ? void 0 : f.config_store_id;
2549
- } catch (N) {
2550
- d("error", N);
2551
- }
2552
- }), (f, N) => (V(), W("div", ul, [
2553
- h.value ? (V(), D(dl, je({ key: 0 }, c, {
2554
- "config-store-id": h.value,
2555
- onError: a,
2556
- onLoading: K,
2557
- onUpdate: p
2558
- }), null, 16, ["config-store-id"])) : B("", !0)
2559
- ]));
2560
- }
2561
- }), $l = /* @__PURE__ */ me(cl, [["__scopeId", "data-v-754ddb2f"]]), fl = {
2562
- class: "vault-secret-picker-provider"
2563
- }, pl = /* @__PURE__ */ ce({
2564
- __name: "VaultSecretPickerProvider",
2565
- props: {
2566
- value: {},
2567
- disabled: {
2568
- type: Boolean
2569
- },
2570
- update: {
2571
- type: Function
2572
- }
2573
- },
2574
- emits: ["open"],
2575
- setup(o, {
2576
- emit: S
2577
- }) {
2578
- const c = o, d = S, {
2579
- i18n: {
2580
- t: p
2581
- },
2582
- i18nT: a
2583
- } = he.useI18n();
2584
- return (K, I) => (V(), W("div", fl, [u(e(a), {
2585
- keypath: "vault_secret_picker.provider.complete_action",
2586
- scope: "global"
2587
- }, {
2588
- cta: m(() => [x("span", {
2589
- class: tt({
2590
- "vault-secret-picker-provider-action": !0,
2591
- disabled: c.disabled
2592
- }),
2593
- onClick: I[0] || (I[0] = () => !c.disabled && d("open", c.value, c.update))
2594
- }, H(e(p)("vault_secret_picker.provider.cta")), 3)]),
2595
- _: 1
2596
- })]));
2597
- }
2598
- }), Kl = /* @__PURE__ */ me(pl, [["__scopeId", "data-v-66a1e406"]]), ml = (o) => {
2599
- let S = o.trim();
2600
- if (!S.startsWith("{") || !S.endsWith("}"))
2601
- throw new Error("Invalid secret reference: must be enclosed in curly braces");
2602
- if (S = S.substring(1, S.length - 1).trim(), !S.startsWith("vault://"))
2603
- throw new Error("Invalid secret reference: must start with vault://");
2604
- const c = new URL(`http://${S.substring(8)}`);
2605
- if (!c)
2606
- throw new Error("Invalid secret reference: must have a vault prefix");
2607
- const d = c.host, [, p, ...a] = c.pathname.split("/");
2608
- if (!d)
2609
- throw new Error("Invalid secret reference: must have a vault prefix");
2610
- return {
2611
- vaultPrefix: d,
2612
- secretId: p || void 0,
2613
- // Non-empty string or undefined
2614
- optionalSecretKey: a == null ? void 0 : a.join("/")
2615
- // Non-empty string or undefined
2616
- };
2617
- }, vl = (o) => {
2618
- if (!o.vaultPrefix)
2619
- throw new Error("Invalid secret reference: must have a vault prefix");
2620
- let S = `vault://${o.vaultPrefix}`;
2621
- return o.secretId && (S = `${S}/${o.secretId}`), o.optionalSecretKey && (S = `${S}/${o.optionalSecretKey}`), `{${S}}`;
2622
- }, gl = {
2623
- key: 1,
2624
- class: "inputs-wrapper"
2625
- }, bl = { "data-testid": "no-search-results" }, _l = { class: "k-select-selected-item-label" }, hl = { class: "vault-secret-picker-vault-dropdown-item" }, yl = { class: "select-item-label" }, Vl = { class: "select-item-description" }, kl = { class: "select-item-description" }, Cl = { "data-testid": "no-search-results" }, wl = /* @__PURE__ */ ce({
2626
- __name: "VaultSecretPicker",
2627
- props: {
2628
- config: {
2629
- type: Object,
2630
- required: !0,
2631
- validator: (o) => !(!o || !["konnect", "kongManager"].includes(o == null ? void 0 : o.app) || o.app === "konnect" && !o.controlPlaneId || o.app === "kongManager" && typeof o.workspace != "string")
2632
- },
2633
- setup: {
2634
- type: null,
2635
- required: !1,
2636
- default: !1
2637
- },
2638
- title: {
2639
- type: String,
2640
- required: !1,
2641
- default: void 0
2642
- },
2643
- proceedButtonText: {
2644
- type: String,
2645
- required: !1,
2646
- default: void 0
2647
- },
2648
- additionalDisabled: {
2649
- type: Boolean,
2650
- required: !1,
2651
- default: !1
2652
- }
2653
- },
2654
- emits: ["proceed", "cancel"],
2655
- setup(o, { emit: S }) {
2656
- var te;
2657
- const { i18n: { t: c } } = he.useI18n(), d = o, p = S, { axiosInstance: a } = _e({
2658
- // 404 errors are allowed in this components
2659
- validateStatus: (b) => b === 404 || b >= 200 && b < 300,
2660
- // Spread the passed-in config later to allow overriding
2661
- ...(te = d.config) == null ? void 0 : te.axiosRequestConfig
2662
- }), K = $(!1), I = $(""), h = $(""), n = $(""), g = $(), f = w(() => {
2663
- var b, v;
2664
- return d.config.app === "konnect" ? be.list[d.config.app].replace(/{id}/gi, ((v = (b = g.value) == null ? void 0 : b.config) == null ? void 0 : v.config_store_id) ?? "") : "<not_applicable>";
2665
- }), N = w(() => {
2666
- if (Y && ee)
2667
- return c("vault_secret_picker.fetch_error.vaults_and_secrets");
2668
- if (Y)
2669
- return c("vault_secret_picker.fetch_error.vaults");
2670
- if (ee)
2671
- return c("vault_secret_picker.fetch_error.secrets");
2672
- }), {
2673
- debouncedQueryChange: X,
2674
- loading: Q,
2675
- error: Y,
2676
- loadItems: O,
2677
- results: l
2678
- } = Fe(d.config, pe.list[d.config.app].getAll, void 0, {
2679
- fetchedItemsKey: "data",
2680
- searchKeys: ["prefix"]
2681
- }), {
2682
- debouncedQueryChange: ae,
2683
- loading: z,
2684
- error: ee,
2685
- loadItems: G,
2686
- results: y
2687
- } = Fe(d.config, f, void 0, {
2688
- fetchedItemsKey: "data",
2689
- searchKeys: ["key"],
2690
- exactMatchKey: "key"
2691
- }), F = w(() => {
2692
- var P;
2693
- let b = !1;
2694
- const v = ((P = l.value) == null ? void 0 : P.map((M) => (M.prefix === I.value && (b = !0), { label: M.prefix, value: M.prefix, vault: M }))) ?? [];
2695
- return !b && g.value && v.push({
2696
- label: g.value.prefix,
2697
- value: g.value.prefix,
2698
- vault: g.value
2699
- }), v;
2700
- }), re = w(() => {
2701
- var P;
2702
- let b = !1;
2703
- const v = ((P = y.value) == null ? void 0 : P.map((M) => (M.key === h.value && (b = !0), { label: M.key, value: M.key }))) ?? [];
2704
- return !b && h.value && v.push({ label: h.value, value: h.value }), v;
2705
- }), ne = w(() => {
2706
- var b;
2707
- return ((b = g == null ? void 0 : g.value) == null ? void 0 : b.name) === "konnect";
2708
- }), le = w(() => !!g.value && !!h.value && !d.additionalDisabled), q = (b) => b.label ? `${b.label} - (${b.vault.name} - ${b.vault.id})` : b.value, ie = (b) => {
2709
- var P, M;
2710
- let v = `${d.config.apiBaseUrl}${pe.form[d.config.app].edit}`;
2711
- return d.config.app === "konnect" ? v = v.replace(/{controlPlaneId}/gi, ((P = d.config) == null ? void 0 : P.controlPlaneId) || "") : d.config.app === "kongManager" && (v = v.replace(/\/{workspace}/gi, (M = d.config) != null && M.workspace ? `/${d.config.workspace}` : "")), v.replace(/{id}/gi, b);
2712
- }, T = (b, v) => {
2713
- var P;
2714
- return d.config.app !== "konnect" ? "<not_applicable>" : `${d.config.apiBaseUrl}${be.form[d.config.app].edit}`.replace(/{controlPlaneId}/gi, ((P = d.config) == null ? void 0 : P.controlPlaneId) || "").replace(/{id}/gi, v).replace(/{secretId}/gi, b);
2715
- }, Z = () => {
2716
- p("proceed", vl({
2717
- vaultPrefix: I.value,
2718
- secretId: h.value || void 0,
2719
- // Either a non-empty string or undefined
2720
- optionalSecretKey: n.value || void 0
2721
- // Either a non-empty string or undefined
2722
- }));
2723
- };
2724
- return ke(() => d.setup, async (b) => {
2725
- if (b !== !1) {
2726
- if (K.value = !0, I.value = "", g.value = void 0, h.value = "", n.value = "", typeof b == "string" && b.trim().length > 0)
2727
- try {
2728
- let v, P = "", M = "", se = "";
2729
- const j = ml(b), { data: R } = await a.get(ie(j.vaultPrefix));
2730
- if (R != null && R.name)
2731
- if (v = R, P = j.vaultPrefix, v.name === "konnect") {
2732
- if (j.secretId) {
2733
- const { data: fe } = await a.get(T(j.secretId, R.config.config_store_id));
2734
- fe.key === j.secretId && (M = j.secretId, se = j.optionalSecretKey ?? "");
2735
- }
2736
- } else
2737
- M = j.secretId ?? "", se = j.optionalSecretKey ?? "";
2738
- await lt(() => {
2739
- I.value = P, g.value = v, h.value = M, n.value = se;
2740
- });
2741
- } catch (v) {
2742
- console.debug(v);
2743
- }
2744
- K.value = !1, await O();
2745
- }
2746
- }, { immediate: !0 }), ke(I, async (b, v) => {
2747
- var P;
2748
- K.value || b === v || (g.value = (P = F.value.find((M) => M.value === b)) == null ? void 0 : P.vault, h.value = "", n.value = "");
2749
- }), ke(f, async () => {
2750
- ne.value && await G();
2751
- }, { immediate: !0 }), (b, v) => {
2752
- const P = J("KEmptyState"), M = J("KSelect"), se = J("KInput"), j = J("KModal");
2753
- return V(), D(j, {
2754
- "action-button-disabled": !le.value,
2755
- "action-button-text": o.proceedButtonText || e(c)("vault_secret_picker.actions.use_key"),
2756
- class: "vault-secret-picker",
2757
- "data-testid": "vault-secret-picker-modal",
2758
- title: o.title || e(c)("vault_secret_picker.title"),
2759
- visible: d.setup !== !1,
2760
- onCancel: v[4] || (v[4] = () => p("cancel")),
2761
- onProceed: Z
2762
- }, {
2763
- default: m(() => [
2764
- e(Y) || e(ee) ? (V(), D(P, {
2765
- key: 0,
2766
- "data-testid": "vault-secret-picker-fetch-error",
2767
- "icon-variant": "error",
2768
- message: N.value
2769
- }, null, 8, ["message"])) : (V(), W("div", gl, [
2770
- ot(b.$slots, "form-prefix", {}, void 0, !0),
2771
- u(M, {
2772
- modelValue: I.value,
2773
- "onUpdate:modelValue": v[0] || (v[0] = (R) => I.value = R),
2774
- clearable: "",
2775
- "data-testid": "vault-secret-picker-vault-select",
2776
- disabled: K.value,
2777
- "enable-filtering": "",
2778
- "filter-function": () => !0,
2779
- items: F.value,
2780
- "kpop-attributes": { "data-testid": "vault-secret-picker-vault-popover" },
2781
- label: e(c)("vault_secret_picker.vault.label"),
2782
- loading: e(Q),
2783
- placeholder: e(c)("vault_secret_picker.vault.placeholder"),
2784
- required: "",
2785
- "reuse-item-template": "",
2786
- width: "100%",
2787
- onQueryChange: e(X)
2788
- }, {
2789
- loading: m(() => [
2790
- x("div", null, H(e(c)("actions.loading")), 1)
2791
- ]),
2792
- empty: m(() => [
2793
- x("div", bl, H(e(c)("vault_secret_picker.no_results")), 1)
2794
- ]),
2795
- "selected-item-template": m(({ item: R }) => [
2796
- x("span", _l, H(q(R)), 1)
2797
- ]),
2798
- "item-template": m(({ item: R }) => [
2799
- x("div", hl, [
2800
- x("span", yl, H(R.label), 1),
2801
- x("span", Vl, H(R.vault.name), 1),
2802
- x("span", kl, H(R.vault.id), 1)
2803
- ])
2804
- ]),
2805
- _: 1
2806
- }, 8, ["modelValue", "disabled", "items", "label", "loading", "placeholder", "onQueryChange"]),
2807
- ne.value ? (V(), D(M, {
2808
- key: 0,
2809
- modelValue: h.value,
2810
- "onUpdate:modelValue": v[1] || (v[1] = (R) => h.value = R),
2811
- clearable: "",
2812
- "data-testid": "vault-secret-picker-secret-id-select",
2813
- disabled: K.value || !g.value,
2814
- "enable-filtering": "",
2815
- "filter-function": () => !0,
2816
- items: re.value,
2817
- "kpop-attributes": { "data-testid": "vault-secret-picker-secret-id-popover" },
2818
- label: e(c)("vault_secret_picker.secret_id.label"),
2819
- loading: e(z),
2820
- placeholder: e(c)("vault_secret_picker.secret_id.select_placeholder"),
2821
- required: "",
2822
- "reuse-item-template": "",
2823
- width: "100%",
2824
- onQueryChange: e(ae)
2825
- }, {
2826
- loading: m(() => [
2827
- x("div", null, H(e(c)("actions.loading")), 1)
2828
- ]),
2829
- empty: m(() => [
2830
- x("div", Cl, H(e(c)("vault_secret_picker.no_results")), 1)
2831
- ]),
2832
- _: 1
2833
- }, 8, ["modelValue", "disabled", "items", "label", "loading", "placeholder", "onQueryChange"])) : (V(), D(se, {
2834
- key: 1,
2835
- modelValue: h.value,
2836
- "onUpdate:modelValue": v[2] || (v[2] = (R) => h.value = R),
2837
- modelModifiers: { trim: !0 },
2838
- autocomplete: "off",
2839
- "data-testid": "vault-secret-picker-secret-id-input",
2840
- disabled: K.value || !g.value,
2841
- label: e(c)("vault_secret_picker.secret_id.label"),
2842
- placeholder: e(c)("vault_secret_picker.secret_id.input_placeholder"),
2843
- required: "",
2844
- type: "text"
2845
- }, null, 8, ["modelValue", "disabled", "label", "placeholder"])),
2846
- u(se, {
2847
- modelValue: n.value,
2848
- "onUpdate:modelValue": v[3] || (v[3] = (R) => n.value = R),
2849
- modelModifiers: { trim: !0 },
2850
- autocomplete: "off",
2851
- "data-testid": "vault-secret-picker-secret-key-input",
2852
- disabled: K.value || !g.value,
2853
- help: e(c)("vault_secret_picker.optional_secret_key.help"),
2854
- label: e(c)("vault_secret_picker.optional_secret_key.label"),
2855
- placeholder: e(c)("vault_secret_picker.optional_secret_key.placeholder"),
2856
- type: "text"
2857
- }, null, 8, ["modelValue", "disabled", "help", "label", "placeholder"])
2858
- ]))
2859
- ]),
2860
- _: 3
2861
- }, 8, ["action-button-disabled", "action-button-text", "title", "visible"]);
2862
- };
2863
- }
2864
- }), Pl = /* @__PURE__ */ me(wl, [["__scopeId", "data-v-9ee12676"]]);
2865
- export {
2866
- $l as SecretForm,
2867
- Hl as SecretList,
2868
- A as VaultAuthMethods,
2869
- Tl as VaultConfigCard,
2870
- Ul as VaultForm,
2871
- El as VaultList,
2872
- t as VaultProviders,
2873
- Pl as VaultSecretPicker,
2874
- Kl as VaultSecretPickerProvider,
2875
- be as secretsEndpoints,
2876
- pe as vaultsEndpoints
2877
- };