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