@iblai/iblai-js 2.67.3 → 2.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-containers/source/_virtual/index2.js +2 -2
- package/dist/web-containers/source/_virtual/index3.js +2 -2
- package/dist/web-containers/source/account-sheet.js +2 -2
- package/dist/web-containers/source/account-sheet.js.map +1 -1
- package/dist/web-containers/source/account.js +39 -21
- package/dist/web-containers/source/account.js.map +1 -1
- package/dist/web-containers/source/api/api-field-label.js +14 -0
- package/dist/web-containers/source/api/api-field-label.js.map +1 -0
- package/dist/web-containers/source/{profile/integration/api-tab → api}/api-key-modal.js +8 -8
- package/dist/web-containers/source/api/api-key-modal.js.map +1 -0
- package/dist/web-containers/source/api/api-keys-table.js +61 -0
- package/dist/web-containers/source/api/api-keys-table.js.map +1 -0
- package/dist/web-containers/source/{api-tab → api}/api-token-utils.js +34 -1
- package/dist/web-containers/source/api/api-token-utils.js.map +1 -0
- package/dist/web-containers/source/{integration/api-tab → api}/constants.js +0 -1
- package/dist/web-containers/source/api/constants.js.map +1 -0
- package/dist/web-containers/source/{profile/integration/api-tab → api}/create-api-modal.js +19 -26
- package/dist/web-containers/source/api/create-api-modal.js.map +1 -0
- package/dist/web-containers/source/api/delete-api-modal.js +31 -0
- package/dist/web-containers/source/api/delete-api-modal.js.map +1 -0
- package/dist/web-containers/source/{api-tab → api}/edit-api-modal.js +34 -28
- package/dist/web-containers/source/api/edit-api-modal.js.map +1 -0
- package/dist/web-containers/source/api/expiration-date-field.js +35 -0
- package/dist/web-containers/source/api/expiration-date-field.js.map +1 -0
- package/dist/web-containers/source/api/index.js +30 -0
- package/dist/web-containers/source/api/index.js.map +1 -0
- package/dist/web-containers/source/{integration/api-tab → api}/token-policy-fields.js +6 -6
- package/dist/web-containers/source/api/token-policy-fields.js.map +1 -0
- package/dist/web-containers/source/api-field-label.js +14 -0
- package/dist/web-containers/source/api-field-label.js.map +1 -0
- package/dist/web-containers/source/api-keys-table.js +61 -0
- package/dist/web-containers/source/api-keys-table.js.map +1 -0
- package/dist/web-containers/source/api-tab/create-api-modal.js +4 -4
- package/dist/web-containers/source/api-tab/labels.js +23 -19
- package/dist/web-containers/source/api-tab/labels.js.map +1 -1
- package/dist/web-containers/source/api-tab.js +15 -20
- package/dist/web-containers/source/api-tab.js.map +1 -1
- package/dist/web-containers/source/api-token-utils.js +34 -1
- package/dist/web-containers/source/api-token-utils.js.map +1 -1
- package/dist/web-containers/source/azure-config.js +37 -0
- package/dist/web-containers/source/azure-config.js.map +1 -0
- package/dist/web-containers/source/azure-model-fields.js +118 -0
- package/dist/web-containers/source/azure-model-fields.js.map +1 -0
- package/dist/web-containers/source/claw-sandbox/virtual-machine-network-section.js +147 -24
- package/dist/web-containers/source/claw-sandbox/virtual-machine-network-section.js.map +1 -1
- package/dist/web-containers/source/components/claw-sandbox/virtual-machine-network-section.js +147 -24
- package/dist/web-containers/source/components/claw-sandbox/virtual-machine-network-section.js.map +1 -1
- package/dist/web-containers/source/components/field-info.js +18 -0
- package/dist/web-containers/source/components/field-info.js.map +1 -0
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/api-tab/create-api-modal.js +4 -4
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/api-tab/labels.js +23 -19
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/api-tab/labels.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/api-tab.js +15 -20
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/api-tab.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/mcp-tab/connector-dialogs.js +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/mcp-tab/oauth-app-fields.js +2 -2
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/mcp-tab/oauth-app-fields.js.map +1 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/skills-tab/index.js +1 -1
- package/dist/web-containers/source/components/modals/user-profile-modal.js +4 -4
- package/dist/web-containers/source/components/modals/user-profile-modal.js.map +1 -1
- package/dist/web-containers/source/components/platform-sidebar/account-sheet.js +2 -2
- package/dist/web-containers/source/components/platform-sidebar/account-sheet.js.map +1 -1
- package/dist/web-containers/source/components/platform-sidebar/footer.js +15 -14
- package/dist/web-containers/source/components/platform-sidebar/footer.js.map +1 -1
- package/dist/web-containers/source/components/platform-sidebar/index.js +0 -2
- package/dist/web-containers/source/components/platform-sidebar/index.js.map +1 -1
- package/dist/web-containers/source/components/profile/account.js +39 -21
- package/dist/web-containers/source/components/profile/account.js.map +1 -1
- package/dist/web-containers/source/components/profile/api/api-field-label.js +14 -0
- package/dist/web-containers/source/components/profile/api/api-field-label.js.map +1 -0
- package/dist/web-containers/source/{integration/api-tab → components/profile/api}/api-key-modal.js +8 -8
- package/dist/web-containers/source/components/profile/api/api-key-modal.js.map +1 -0
- package/dist/web-containers/source/components/profile/api/api-keys-table.js +61 -0
- package/dist/web-containers/source/components/profile/api/api-keys-table.js.map +1 -0
- package/dist/web-containers/source/{integration/api-tab → components/profile/api}/api-token-utils.js +34 -1
- package/dist/web-containers/source/components/profile/api/api-token-utils.js.map +1 -0
- package/dist/web-containers/source/components/profile/{integration/api-tab → api}/constants.js +0 -1
- package/dist/web-containers/source/components/profile/api/constants.js.map +1 -0
- package/dist/web-containers/source/{integration/api-tab → components/profile/api}/create-api-modal.js +19 -26
- package/dist/web-containers/source/components/profile/api/create-api-modal.js.map +1 -0
- package/dist/web-containers/source/components/profile/api/delete-api-modal.js +31 -0
- package/dist/web-containers/source/components/profile/api/delete-api-modal.js.map +1 -0
- package/dist/web-containers/source/components/profile/{integration/api-tab → api}/edit-api-modal.js +34 -28
- package/dist/web-containers/source/components/profile/api/edit-api-modal.js.map +1 -0
- package/dist/web-containers/source/components/profile/api/expiration-date-field.js +35 -0
- package/dist/web-containers/source/components/profile/api/expiration-date-field.js.map +1 -0
- package/dist/web-containers/source/components/profile/api/index.js +30 -0
- package/dist/web-containers/source/components/profile/api/index.js.map +1 -0
- package/dist/web-containers/source/{profile/integration/api-tab → components/profile/api}/token-policy-fields.js +6 -6
- package/dist/web-containers/source/components/profile/api/token-policy-fields.js.map +1 -0
- package/dist/web-containers/source/components/profile/info-banner.js +3 -1
- package/dist/web-containers/source/components/profile/info-banner.js.map +1 -1
- package/dist/web-containers/source/components/profile/integration/index.js +17 -38
- package/dist/web-containers/source/components/profile/integration/index.js.map +1 -1
- package/dist/web-containers/source/components/profile/secrets/index.js +106 -0
- package/dist/web-containers/source/components/profile/secrets/index.js.map +1 -0
- package/dist/web-containers/source/components/profile/secrets/secrets-list.js +237 -0
- package/dist/web-containers/source/components/profile/secrets/secrets-list.js.map +1 -0
- package/dist/web-containers/source/components/profile/virtual-machine-admin/index.js +12 -18
- package/dist/web-containers/source/components/profile/virtual-machine-admin/index.js.map +1 -1
- package/dist/web-containers/source/components/profile/virtual-machine-admin/network-policies-section.js +5 -4
- package/dist/web-containers/source/components/profile/virtual-machine-admin/network-policies-section.js.map +1 -1
- package/dist/web-containers/source/components/tooltip-icon-button.js +15 -0
- package/dist/web-containers/source/components/tooltip-icon-button.js.map +1 -0
- package/dist/web-containers/source/components/user-profile-dropdown/index.js +2 -0
- package/dist/web-containers/source/components/user-profile-dropdown/index.js.map +1 -1
- package/dist/web-containers/source/components/virtual-machine/azure-config.js +37 -0
- package/dist/web-containers/source/components/virtual-machine/azure-config.js.map +1 -0
- package/dist/web-containers/source/components/virtual-machine/azure-model-fields.js +118 -0
- package/dist/web-containers/source/components/virtual-machine/azure-model-fields.js.map +1 -0
- package/dist/web-containers/source/components/virtual-machine/credential-options.js +268 -22
- package/dist/web-containers/source/components/virtual-machine/credential-options.js.map +1 -1
- package/dist/web-containers/source/components/virtual-machine/host-port-chip-input.js +14 -8
- package/dist/web-containers/source/components/virtual-machine/host-port-chip-input.js.map +1 -1
- package/dist/web-containers/source/components/virtual-machine/network-policy-dialog.js +30 -6
- package/dist/web-containers/source/components/virtual-machine/network-policy-dialog.js.map +1 -1
- package/dist/web-containers/source/components/virtual-machine/secret-rows.js +66 -0
- package/dist/web-containers/source/components/virtual-machine/secret-rows.js.map +1 -0
- package/dist/web-containers/source/components/virtual-machine/vm-secret-dialog.js +848 -158
- package/dist/web-containers/source/components/virtual-machine/vm-secret-dialog.js.map +1 -1
- package/dist/web-containers/source/connector-dialogs.js +1 -1
- package/dist/web-containers/source/constants.js +55 -22
- package/dist/web-containers/source/constants.js.map +1 -1
- package/dist/web-containers/source/create-api-modal.js +4 -4
- package/dist/web-containers/source/credential-options.js +268 -22
- package/dist/web-containers/source/credential-options.js.map +1 -1
- package/dist/web-containers/source/edit-api-modal.js +34 -28
- package/dist/web-containers/source/edit-api-modal.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/api-tab/create-api-modal.js +4 -4
- package/dist/web-containers/source/edit-mentor-modal/tabs/api-tab/labels.js +23 -19
- package/dist/web-containers/source/edit-mentor-modal/tabs/api-tab/labels.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/api-tab.js +15 -20
- package/dist/web-containers/source/edit-mentor-modal/tabs/api-tab.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/mcp-tab/connector-dialogs.js +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/mcp-tab/oauth-app-fields.js +2 -2
- package/dist/web-containers/source/edit-mentor-modal/tabs/mcp-tab/oauth-app-fields.js.map +1 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/skills-tab/index.js +1 -1
- package/dist/web-containers/source/en.json.js +278 -227
- package/dist/web-containers/source/en.json.js.map +1 -1
- package/dist/web-containers/source/es.json.js +449 -398
- package/dist/web-containers/source/es.json.js.map +1 -1
- package/dist/web-containers/source/expiration-date-field.js +16 -10
- package/dist/web-containers/source/expiration-date-field.js.map +1 -1
- package/dist/web-containers/source/field-info.js +11 -7
- package/dist/web-containers/source/field-info.js.map +1 -1
- package/dist/web-containers/source/footer.js +15 -14
- package/dist/web-containers/source/footer.js.map +1 -1
- package/dist/web-containers/source/fr.json.js +457 -406
- package/dist/web-containers/source/fr.json.js.map +1 -1
- package/dist/web-containers/source/host-port-chip-input.js +14 -8
- package/dist/web-containers/source/host-port-chip-input.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/en.json.js +278 -227
- package/dist/web-containers/source/i18n/messages/en.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/es.json.js +449 -398
- package/dist/web-containers/source/i18n/messages/es.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/fr.json.js +457 -406
- package/dist/web-containers/source/i18n/messages/fr.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/zh.json.js +456 -405
- package/dist/web-containers/source/i18n/messages/zh.json.js.map +1 -1
- package/dist/web-containers/source/index2.js +2 -2
- package/dist/web-containers/source/index3.js +2 -2
- package/dist/web-containers/source/info-banner.js +3 -1
- package/dist/web-containers/source/info-banner.js.map +1 -1
- package/dist/web-containers/source/integration/index.js +17 -38
- package/dist/web-containers/source/integration/index.js.map +1 -1
- package/dist/web-containers/source/mcp-tab/connector-dialogs.js +1 -1
- package/dist/web-containers/source/mcp-tab/oauth-app-fields.js +2 -2
- package/dist/web-containers/source/mcp-tab/oauth-app-fields.js.map +1 -1
- package/dist/web-containers/source/messages/en.json.js +278 -227
- package/dist/web-containers/source/messages/en.json.js.map +1 -1
- package/dist/web-containers/source/messages/es.json.js +449 -398
- package/dist/web-containers/source/messages/es.json.js.map +1 -1
- package/dist/web-containers/source/messages/fr.json.js +457 -406
- package/dist/web-containers/source/messages/fr.json.js.map +1 -1
- package/dist/web-containers/source/messages/zh.json.js +456 -405
- package/dist/web-containers/source/messages/zh.json.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/api-tab/create-api-modal.js +4 -4
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/api-tab/labels.js +23 -19
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/api-tab/labels.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/api-tab.js +15 -20
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/api-tab.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/mcp-tab/connector-dialogs.js +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/mcp-tab/oauth-app-fields.js +2 -2
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/mcp-tab/oauth-app-fields.js.map +1 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/skills-tab/index.js +1 -1
- package/dist/web-containers/source/modals/user-profile-modal.js +4 -4
- package/dist/web-containers/source/modals/user-profile-modal.js.map +1 -1
- package/dist/web-containers/source/network-policies-section.js +5 -4
- package/dist/web-containers/source/network-policies-section.js.map +1 -1
- package/dist/web-containers/source/network-policy-dialog.js +30 -6
- package/dist/web-containers/source/network-policy-dialog.js.map +1 -1
- package/dist/web-containers/source/node_modules/.pnpm/css-mediaquery@0.1.2/node_modules/css-mediaquery/index.js +1 -1
- package/dist/web-containers/source/node_modules/.pnpm/matchmediaquery@0.4.2/node_modules/matchmediaquery/index.js +1 -1
- package/dist/web-containers/source/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
- package/dist/web-containers/source/oauth-app-fields.js +2 -2
- package/dist/web-containers/source/oauth-app-fields.js.map +1 -1
- package/dist/web-containers/source/platform-sidebar/account-sheet.js +2 -2
- package/dist/web-containers/source/platform-sidebar/account-sheet.js.map +1 -1
- package/dist/web-containers/source/platform-sidebar/footer.js +15 -14
- package/dist/web-containers/source/platform-sidebar/footer.js.map +1 -1
- package/dist/web-containers/source/platform-sidebar/index.js +0 -2
- package/dist/web-containers/source/platform-sidebar/index.js.map +1 -1
- package/dist/web-containers/source/profile/account.js +39 -21
- package/dist/web-containers/source/profile/account.js.map +1 -1
- package/dist/web-containers/source/profile/api/api-field-label.js +14 -0
- package/dist/web-containers/source/profile/api/api-field-label.js.map +1 -0
- package/dist/web-containers/source/{components/profile/integration/api-tab → profile/api}/api-key-modal.js +8 -8
- package/dist/web-containers/source/profile/api/api-key-modal.js.map +1 -0
- package/dist/web-containers/source/profile/api/api-keys-table.js +61 -0
- package/dist/web-containers/source/profile/api/api-keys-table.js.map +1 -0
- package/dist/web-containers/source/profile/{integration/api-tab → api}/api-token-utils.js +34 -1
- package/dist/web-containers/source/profile/api/api-token-utils.js.map +1 -0
- package/dist/web-containers/source/{api-tab → profile/api}/constants.js +0 -1
- package/dist/web-containers/source/profile/api/constants.js.map +1 -0
- package/dist/web-containers/source/{components/profile/integration/api-tab → profile/api}/create-api-modal.js +19 -26
- package/dist/web-containers/source/profile/api/create-api-modal.js.map +1 -0
- package/dist/web-containers/source/profile/api/delete-api-modal.js +31 -0
- package/dist/web-containers/source/profile/api/delete-api-modal.js.map +1 -0
- package/dist/web-containers/source/{integration/api-tab → profile/api}/edit-api-modal.js +34 -28
- package/dist/web-containers/source/profile/api/edit-api-modal.js.map +1 -0
- package/dist/web-containers/source/profile/api/expiration-date-field.js +35 -0
- package/dist/web-containers/source/profile/api/expiration-date-field.js.map +1 -0
- package/dist/web-containers/source/profile/api/index.js +30 -0
- package/dist/web-containers/source/profile/api/index.js.map +1 -0
- package/dist/web-containers/source/{api-tab → profile/api}/token-policy-fields.js +6 -6
- package/dist/web-containers/source/profile/api/token-policy-fields.js.map +1 -0
- package/dist/web-containers/source/profile/info-banner.js +3 -1
- package/dist/web-containers/source/profile/info-banner.js.map +1 -1
- package/dist/web-containers/source/profile/integration/index.js +17 -38
- package/dist/web-containers/source/profile/integration/index.js.map +1 -1
- package/dist/web-containers/source/profile/secrets/index.js +106 -0
- package/dist/web-containers/source/profile/secrets/index.js.map +1 -0
- package/dist/web-containers/source/profile/secrets/secrets-list.js +237 -0
- package/dist/web-containers/source/profile/secrets/secrets-list.js.map +1 -0
- package/dist/web-containers/source/profile/virtual-machine-admin/index.js +12 -18
- package/dist/web-containers/source/profile/virtual-machine-admin/index.js.map +1 -1
- package/dist/web-containers/source/profile/virtual-machine-admin/network-policies-section.js +5 -4
- package/dist/web-containers/source/profile/virtual-machine-admin/network-policies-section.js.map +1 -1
- package/dist/web-containers/source/secret-rows.js +66 -0
- package/dist/web-containers/source/secret-rows.js.map +1 -0
- package/dist/web-containers/source/secrets/index.js +106 -0
- package/dist/web-containers/source/secrets/index.js.map +1 -0
- package/dist/web-containers/source/secrets/secrets-list.js +237 -0
- package/dist/web-containers/source/secrets/secrets-list.js.map +1 -0
- package/dist/web-containers/source/secrets-list.js +237 -0
- package/dist/web-containers/source/secrets-list.js.map +1 -0
- package/dist/web-containers/source/skills-tab/index.js +1 -1
- package/dist/web-containers/source/tabs/api-tab/create-api-modal.js +4 -4
- package/dist/web-containers/source/tabs/api-tab/labels.js +23 -19
- package/dist/web-containers/source/tabs/api-tab/labels.js.map +1 -1
- package/dist/web-containers/source/tabs/api-tab.js +15 -20
- package/dist/web-containers/source/tabs/api-tab.js.map +1 -1
- package/dist/web-containers/source/tabs/mcp-tab/connector-dialogs.js +1 -1
- package/dist/web-containers/source/tabs/mcp-tab/oauth-app-fields.js +2 -2
- package/dist/web-containers/source/tabs/mcp-tab/oauth-app-fields.js.map +1 -1
- package/dist/web-containers/source/tabs/skills-tab/index.js +1 -1
- package/dist/web-containers/source/token-policy-fields.js +6 -6
- package/dist/web-containers/source/token-policy-fields.js.map +1 -1
- package/dist/web-containers/source/tooltip-icon-button.js +15 -0
- package/dist/web-containers/source/tooltip-icon-button.js.map +1 -0
- package/dist/web-containers/source/tsconfig.build.tsbuildinfo +1 -1
- package/dist/web-containers/source/user-profile-dropdown/index.js +2 -0
- package/dist/web-containers/source/user-profile-dropdown/index.js.map +1 -1
- package/dist/web-containers/source/user-profile-modal.js +4 -4
- package/dist/web-containers/source/user-profile-modal.js.map +1 -1
- package/dist/web-containers/source/virtual-machine/azure-config.js +37 -0
- package/dist/web-containers/source/virtual-machine/azure-config.js.map +1 -0
- package/dist/web-containers/source/virtual-machine/azure-model-fields.js +118 -0
- package/dist/web-containers/source/virtual-machine/azure-model-fields.js.map +1 -0
- package/dist/web-containers/source/virtual-machine/credential-options.js +268 -22
- package/dist/web-containers/source/virtual-machine/credential-options.js.map +1 -1
- package/dist/web-containers/source/virtual-machine/host-port-chip-input.js +14 -8
- package/dist/web-containers/source/virtual-machine/host-port-chip-input.js.map +1 -1
- package/dist/web-containers/source/virtual-machine/network-policy-dialog.js +30 -6
- package/dist/web-containers/source/virtual-machine/network-policy-dialog.js.map +1 -1
- package/dist/web-containers/source/virtual-machine/secret-rows.js +66 -0
- package/dist/web-containers/source/virtual-machine/secret-rows.js.map +1 -0
- package/dist/web-containers/source/virtual-machine/vm-secret-dialog.js +848 -158
- package/dist/web-containers/source/virtual-machine/vm-secret-dialog.js.map +1 -1
- package/dist/web-containers/source/virtual-machine-admin/index.js +12 -18
- package/dist/web-containers/source/virtual-machine-admin/index.js.map +1 -1
- package/dist/web-containers/source/virtual-machine-admin/network-policies-section.js +5 -4
- package/dist/web-containers/source/virtual-machine-admin/network-policies-section.js.map +1 -1
- package/dist/web-containers/source/virtual-machine-network-section.js +147 -24
- package/dist/web-containers/source/virtual-machine-network-section.js.map +1 -1
- package/dist/web-containers/source/vm-secret-dialog.js +848 -158
- package/dist/web-containers/source/vm-secret-dialog.js.map +1 -1
- package/dist/web-containers/source/web-containers/tsconfig.build.tsbuildinfo +1 -1
- package/dist/web-containers/source/zh.json.js +456 -405
- package/dist/web-containers/source/zh.json.js.map +1 -1
- package/package.json +5 -5
- package/dist/web-containers/source/api-tab/api-token-utils.js.map +0 -1
- package/dist/web-containers/source/api-tab/constants.js.map +0 -1
- package/dist/web-containers/source/api-tab/edit-api-modal.js.map +0 -1
- package/dist/web-containers/source/api-tab/expiration-date-field.js +0 -29
- package/dist/web-containers/source/api-tab/expiration-date-field.js.map +0 -1
- package/dist/web-containers/source/api-tab/integration-autogenerated-table.js +0 -42
- package/dist/web-containers/source/api-tab/integration-autogenerated-table.js.map +0 -1
- package/dist/web-containers/source/api-tab/token-policy-fields.js.map +0 -1
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/mcp-tab/field-info.js +0 -14
- package/dist/web-containers/source/components/modals/edit-mentor-modal/tabs/mcp-tab/field-info.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/api-key-modal.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/api-token-utils.js +0 -57
- package/dist/web-containers/source/components/profile/integration/api-tab/api-token-utils.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/constants.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/create-api-modal.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/delete-api-modal.js +0 -31
- package/dist/web-containers/source/components/profile/integration/api-tab/delete-api-modal.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/edit-api-modal.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/expiration-date-field.js +0 -29
- package/dist/web-containers/source/components/profile/integration/api-tab/expiration-date-field.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/integration-autogenerated-table.js +0 -42
- package/dist/web-containers/source/components/profile/integration/api-tab/integration-autogenerated-table.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/api-tab/token-policy-fields.js +0 -101
- package/dist/web-containers/source/components/profile/integration/api-tab/token-policy-fields.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/data-sources-tab/create-data-source-modal.js +0 -143
- package/dist/web-containers/source/components/profile/integration/data-sources-tab/create-data-source-modal.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/data-sources-tab/integration-data-sources-tab.js +0 -46
- package/dist/web-containers/source/components/profile/integration/data-sources-tab/integration-data-sources-tab.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/llms-tab/create-llm-modal.js +0 -287
- package/dist/web-containers/source/components/profile/integration/llms-tab/create-llm-modal.js.map +0 -1
- package/dist/web-containers/source/components/profile/integration/llms-tab/integration-llms-tab.js +0 -83
- package/dist/web-containers/source/components/profile/integration/llms-tab/integration-llms-tab.js.map +0 -1
- package/dist/web-containers/source/components/profile/virtual-machine-admin/vm-secrets-section.js +0 -109
- package/dist/web-containers/source/components/profile/virtual-machine-admin/vm-secrets-section.js.map +0 -1
- package/dist/web-containers/source/create-data-source-modal.js +0 -143
- package/dist/web-containers/source/create-data-source-modal.js.map +0 -1
- package/dist/web-containers/source/create-llm-modal.js +0 -287
- package/dist/web-containers/source/create-llm-modal.js.map +0 -1
- package/dist/web-containers/source/data-sources-tab/create-data-source-modal.js +0 -143
- package/dist/web-containers/source/data-sources-tab/create-data-source-modal.js.map +0 -1
- package/dist/web-containers/source/data-sources-tab/integration-data-sources-tab.js +0 -46
- package/dist/web-containers/source/data-sources-tab/integration-data-sources-tab.js.map +0 -1
- package/dist/web-containers/source/edit-mentor-modal/tabs/mcp-tab/field-info.js +0 -14
- package/dist/web-containers/source/edit-mentor-modal/tabs/mcp-tab/field-info.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/api-key-modal.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/api-token-utils.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/constants.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/create-api-modal.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/delete-api-modal.js +0 -31
- package/dist/web-containers/source/integration/api-tab/delete-api-modal.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/edit-api-modal.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/expiration-date-field.js +0 -29
- package/dist/web-containers/source/integration/api-tab/expiration-date-field.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/integration-autogenerated-table.js +0 -42
- package/dist/web-containers/source/integration/api-tab/integration-autogenerated-table.js.map +0 -1
- package/dist/web-containers/source/integration/api-tab/token-policy-fields.js.map +0 -1
- package/dist/web-containers/source/integration/data-sources-tab/create-data-source-modal.js +0 -143
- package/dist/web-containers/source/integration/data-sources-tab/create-data-source-modal.js.map +0 -1
- package/dist/web-containers/source/integration/data-sources-tab/integration-data-sources-tab.js +0 -46
- package/dist/web-containers/source/integration/data-sources-tab/integration-data-sources-tab.js.map +0 -1
- package/dist/web-containers/source/integration/llms-tab/create-llm-modal.js +0 -287
- package/dist/web-containers/source/integration/llms-tab/create-llm-modal.js.map +0 -1
- package/dist/web-containers/source/integration/llms-tab/integration-llms-tab.js +0 -83
- package/dist/web-containers/source/integration/llms-tab/integration-llms-tab.js.map +0 -1
- package/dist/web-containers/source/integration-autogenerated-table.js +0 -42
- package/dist/web-containers/source/integration-autogenerated-table.js.map +0 -1
- package/dist/web-containers/source/integration-data-sources-tab.js +0 -46
- package/dist/web-containers/source/integration-data-sources-tab.js.map +0 -1
- package/dist/web-containers/source/integration-llms-tab.js +0 -83
- package/dist/web-containers/source/integration-llms-tab.js.map +0 -1
- package/dist/web-containers/source/llms-tab/create-llm-modal.js +0 -287
- package/dist/web-containers/source/llms-tab/create-llm-modal.js.map +0 -1
- package/dist/web-containers/source/llms-tab/integration-llms-tab.js +0 -83
- package/dist/web-containers/source/llms-tab/integration-llms-tab.js.map +0 -1
- package/dist/web-containers/source/mcp-tab/field-info.js +0 -14
- package/dist/web-containers/source/mcp-tab/field-info.js.map +0 -1
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/mcp-tab/field-info.js +0 -14
- package/dist/web-containers/source/modals/edit-mentor-modal/tabs/mcp-tab/field-info.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/api-key-modal.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/api-token-utils.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/constants.js +0 -24
- package/dist/web-containers/source/profile/integration/api-tab/constants.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/create-api-modal.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/delete-api-modal.js +0 -31
- package/dist/web-containers/source/profile/integration/api-tab/delete-api-modal.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/edit-api-modal.js +0 -113
- package/dist/web-containers/source/profile/integration/api-tab/edit-api-modal.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/expiration-date-field.js +0 -29
- package/dist/web-containers/source/profile/integration/api-tab/expiration-date-field.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/integration-autogenerated-table.js +0 -42
- package/dist/web-containers/source/profile/integration/api-tab/integration-autogenerated-table.js.map +0 -1
- package/dist/web-containers/source/profile/integration/api-tab/token-policy-fields.js.map +0 -1
- package/dist/web-containers/source/profile/integration/data-sources-tab/create-data-source-modal.js +0 -143
- package/dist/web-containers/source/profile/integration/data-sources-tab/create-data-source-modal.js.map +0 -1
- package/dist/web-containers/source/profile/integration/data-sources-tab/integration-data-sources-tab.js +0 -46
- package/dist/web-containers/source/profile/integration/data-sources-tab/integration-data-sources-tab.js.map +0 -1
- package/dist/web-containers/source/profile/integration/llms-tab/create-llm-modal.js +0 -287
- package/dist/web-containers/source/profile/integration/llms-tab/create-llm-modal.js.map +0 -1
- package/dist/web-containers/source/profile/integration/llms-tab/integration-llms-tab.js +0 -83
- package/dist/web-containers/source/profile/integration/llms-tab/integration-llms-tab.js.map +0 -1
- package/dist/web-containers/source/profile/virtual-machine-admin/vm-secrets-section.js +0 -109
- package/dist/web-containers/source/profile/virtual-machine-admin/vm-secrets-section.js.map +0 -1
- package/dist/web-containers/source/tabs/mcp-tab/field-info.js +0 -14
- package/dist/web-containers/source/tabs/mcp-tab/field-info.js.map +0 -1
- package/dist/web-containers/source/virtual-machine-admin/vm-secrets-section.js +0 -109
- package/dist/web-containers/source/virtual-machine-admin/vm-secrets-section.js.map +0 -1
- package/dist/web-containers/source/vm-secrets-section.js +0 -109
- package/dist/web-containers/source/vm-secrets-section.js.map +0 -1
|
@@ -1,222 +1,912 @@
|
|
|
1
|
-
import { jsx,
|
|
2
|
-
import { useId, useState, useEffect } from 'react';
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useId, useRef, useState, useMemo, useEffect } from 'react';
|
|
3
3
|
import { toast } from 'sonner';
|
|
4
|
-
import { useCreateVirtualMachineSecretMutation, useUpdateVirtualMachineSecretMutation,
|
|
4
|
+
import { useCreateVirtualMachineSecretMutation, useUpdateVirtualMachineSecretMutation, useCreateIntegrationCredentialMutation, useUpdateIntegrationCredentialMutation, useCreateLLMCredentialMutation, useUpdateLLMCredentialMutation, useLazyGetIntegrationCredentialsQuery, useGetLlmsQuery, deriveSecretEnvVar, VIRTUAL_MACHINE_DEFAULT_HOST_PORT, VIRTUAL_MACHINE_ENV_VAR_MAX_LENGTH, validateSecretEnvVar, getVirtualMachineApiError, isSecretEnvVarTakenMessage } from '@iblai/data-layer';
|
|
5
|
+
import { FieldInfo } from '../field-info.js';
|
|
5
6
|
import { Button } from '../ui/button.js';
|
|
7
|
+
import { Command, CommandInput, CommandList, CommandEmpty, CommandItem } from '../ui/command.js';
|
|
6
8
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '../ui/dialog.js';
|
|
7
9
|
import { Input } from '../ui/input.js';
|
|
8
10
|
import { Label } from '../ui/label.js';
|
|
9
|
-
import { RadioGroup, RadioGroupItem } from '../ui/radio-group.js';
|
|
10
|
-
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../ui/select.js';
|
|
11
11
|
import { useT } from '../../i18n/context.js';
|
|
12
12
|
import '../../packages/i18n/dist/index.esm.js';
|
|
13
|
+
import { cn } from '../../lib/utils.js';
|
|
14
|
+
import { availableAzureModels, touchedAzureConfigs, AZURE_MODEL_FIELDS } from './azure-config.js';
|
|
15
|
+
import { AzureModelFields } from './azure-model-fields.js';
|
|
16
|
+
import { AI_PROVIDER_FORMS, agentKeyField, defaultHostsFor, deriveServiceEnvVar, SERVICE_PURPOSE, toIntegrationCredentialOptions, humanizeCredentialField, isAiKeyEditable } from './credential-options.js';
|
|
13
17
|
import { HostPortChipInput } from './host-port-chip-input.js';
|
|
14
|
-
import {
|
|
18
|
+
import { fieldsOfCredential, MASKED_VALUE_PATTERN } from './secret-rows.js';
|
|
19
|
+
import KeyRound from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/key-round.js';
|
|
15
20
|
import LoaderCircle from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/loader-circle.js';
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// Stable defaults: the reset effect depends on these, so a fresh array per render would re-run it.
|
|
23
|
+
const NO_SERVICES = [];
|
|
24
|
+
const NO_CREDENTIALS = [];
|
|
25
|
+
const NO_ENV_VARS = [];
|
|
26
|
+
const NO_AI_PROVIDERS = [];
|
|
27
|
+
const NO_AI_KEYS = [];
|
|
28
|
+
const NO_FIELDS = [];
|
|
29
|
+
const AI_PICK_PREFIX = 'ai:';
|
|
30
|
+
const AZURE_OPENAI_SLUG = 'azure_openai';
|
|
31
|
+
const AZURE_FIELD_LABELS = {
|
|
32
|
+
key: 'secrets.azureKeyLabel',
|
|
33
|
+
host: 'secrets.azureHostLabel',
|
|
34
|
+
version: 'secrets.azureVersionLabel',
|
|
35
|
+
deployment: 'secrets.azureDeploymentLabel',
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Read the first box's value. AI providers carry a prefix, so an AI slug
|
|
39
|
+
* can never collide with a service of the same name.
|
|
40
|
+
*/
|
|
41
|
+
function parsePick(value) {
|
|
42
|
+
if (value.startsWith(AI_PICK_PREFIX)) {
|
|
43
|
+
return { kind: 'ai', slug: value.slice(AI_PICK_PREFIX.length) };
|
|
44
|
+
}
|
|
45
|
+
return { kind: 'service', slug: value };
|
|
46
|
+
}
|
|
25
47
|
const NAME_MAX_LENGTH = 255;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
const ENV_VAR_ISSUE_KEYS = {
|
|
49
|
+
required: 'secrets.errorEnvVarRequired',
|
|
50
|
+
format: 'secrets.errorEnvVarFormat',
|
|
51
|
+
too_long: 'secrets.errorEnvVarTooLong',
|
|
52
|
+
reserved: 'secrets.errorEnvVarReserved',
|
|
53
|
+
taken: 'secrets.errorEnvVarTaken',
|
|
54
|
+
};
|
|
55
|
+
const fieldErrorKey = (field) => `field:${field}`;
|
|
56
|
+
/** A repeated AI add answers a unique-together 400 with a top-level `non_field_errors`, not a 409. */
|
|
57
|
+
const isUniqueTogetherError = (error) => { var _a; return Boolean((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.non_field_errors); };
|
|
58
|
+
const sameHosts = (a, b) => a.length === b.length && a.every((host, index) => host === b[index]);
|
|
29
59
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* a
|
|
60
|
+
* Add / Edit a key of another service, one form for every key. The lists the
|
|
61
|
+
* caller gives decide what opens, so nobody is ever asked whether a key is "a
|
|
62
|
+
* secret or a data source": AI providers give a type-to-search LLM box, whose
|
|
63
|
+
* pick shows its own form and is saved as its LLM credential; services give the
|
|
64
|
+
* same box as Service, whose pick shows that service's own fields and is saved as its
|
|
65
|
+
* integration credential; no list at all opens straight on a name, the key and
|
|
66
|
+
* the addresses it is sent to, saved as a VM secret. Lists that failed or have
|
|
67
|
+
* not answered never read as "only a custom key is possible": see `choices`.
|
|
68
|
+
* From an agent's Sandbox tab a known service's key is also bound to agents (one
|
|
69
|
+
* VM secret reading its key field), and `link` does only that binding for a key
|
|
70
|
+
* the organization already holds. The variable agents use is derived from the
|
|
71
|
+
* name and can be changed until saved; no key is ever shown back.
|
|
38
72
|
*/
|
|
39
|
-
function VmSecretDialog({ open, onOpenChange, tenantKey, secret = null,
|
|
40
|
-
var _a;
|
|
73
|
+
function VmSecretDialog({ open, onOpenChange, tenantKey, services = NO_SERVICES, credentials = NO_CREDENTIALS, aiProviders = NO_AI_PROVIDERS, aiKeys = NO_AI_KEYS, aiKeysSettled = true, aiKey = null, username, azureModels, takenEnvVars = NO_ENV_VARS, secret = null, credential = null, link = false, fromSandbox = false, fromServicesTab = false, customAllowed = true, choices = 'ready', onRetryChoices, onListOutOfDate, onSaved, toastOnSave = true, }) {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
41
75
|
const t = useT();
|
|
42
76
|
const baseId = useId();
|
|
43
77
|
const ids = {
|
|
78
|
+
service: `${baseId}-service`,
|
|
44
79
|
name: `${baseId}-name`,
|
|
45
|
-
envVar: `${baseId}-env-var`,
|
|
46
|
-
envVarHelp: `${baseId}-env-var-help`,
|
|
47
|
-
hosts: `${baseId}-hosts`,
|
|
48
|
-
source: `${baseId}-source`,
|
|
49
|
-
sourceValue: `${baseId}-source-value`,
|
|
50
|
-
sourceCredential: `${baseId}-source-credential`,
|
|
51
80
|
value: `${baseId}-value`,
|
|
52
81
|
valueHelp: `${baseId}-value-help`,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
82
|
+
hosts: `${baseId}-hosts`,
|
|
83
|
+
envVar: `${baseId}-env-var`,
|
|
84
|
+
envVarHelp: `${baseId}-env-var-help`,
|
|
85
|
+
field: (field) => `${baseId}-field-${field}`,
|
|
57
86
|
};
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
87
|
+
const firstInputRef = useRef(null);
|
|
88
|
+
const boxInputRef = useRef(null);
|
|
89
|
+
const changeButtonRef = useRef(null);
|
|
90
|
+
const moveFocusAfterSwap = useRef(false);
|
|
91
|
+
const [createSecret, { isLoading: isCreatingSecret }] = useCreateVirtualMachineSecretMutation();
|
|
92
|
+
const [updateSecret, { isLoading: isUpdatingSecret }] = useUpdateVirtualMachineSecretMutation();
|
|
93
|
+
const [createCredential, { isLoading: isCreatingCredential }] = useCreateIntegrationCredentialMutation();
|
|
94
|
+
const [updateCredential, { isLoading: isUpdatingCredential }] = useUpdateIntegrationCredentialMutation();
|
|
95
|
+
const [createLlmCredential, { isLoading: isCreatingLlmCredential }] = useCreateLLMCredentialMutation();
|
|
96
|
+
const [updateLlmCredential, { isLoading: isUpdatingLlmCredential }] = useUpdateLLMCredentialMutation();
|
|
97
|
+
const [fetchCredentials, { isFetching: isFetchingCredentials }] = useLazyGetIntegrationCredentialsQuery();
|
|
98
|
+
const isSaving = isCreatingSecret ||
|
|
99
|
+
isUpdatingSecret ||
|
|
100
|
+
isCreatingCredential ||
|
|
101
|
+
isUpdatingCredential ||
|
|
102
|
+
isCreatingLlmCredential ||
|
|
103
|
+
isUpdatingLlmCredential ||
|
|
104
|
+
isFetchingCredentials;
|
|
105
|
+
const isLink = credential !== null && link;
|
|
106
|
+
const isEditService = credential !== null && !link;
|
|
107
|
+
const isEditCustom = secret !== null && credential === null;
|
|
108
|
+
// A secret that reads a known service's key opens without its credential when
|
|
109
|
+
// that list is refused or has not answered. Typing a key here would cut it off
|
|
110
|
+
// from the service's key for good, so the form never offers to.
|
|
111
|
+
const readsServiceKey = isEditCustom && (secret === null || secret === void 0 ? void 0 : secret.source_credential_id) != null;
|
|
112
|
+
const isEditAi = aiKey !== null;
|
|
113
|
+
const isCreate = credential === null && secret === null && !isEditAi;
|
|
114
|
+
const hasAi = aiProviders.length > 0;
|
|
115
|
+
const hasServices = services.length > 0;
|
|
116
|
+
const customOnly = customAllowed && choices === 'ready' && !hasAi && !hasServices;
|
|
117
|
+
const isLlmBox = isCreate ? hasAi : isEditAi;
|
|
118
|
+
const boxLabel = t(isLlmBox ? 'secrets.fieldLlm' : 'secrets.fieldService');
|
|
119
|
+
const boxDisabled = choices === 'loading' || (!hasAi && !hasServices);
|
|
120
|
+
const bound = credential !== null && secret !== null;
|
|
121
|
+
const [serviceSlug, setServiceSlug] = useState('');
|
|
122
|
+
const [boxSearch, setBoxSearch] = useState('');
|
|
123
|
+
const [boxFocused, setBoxFocused] = useState(false);
|
|
124
|
+
const [fieldValues, setFieldValues] = useState({});
|
|
61
125
|
const [name, setName] = useState('');
|
|
62
|
-
const [envVar, setEnvVar] = useState('');
|
|
63
|
-
const [hosts, setHosts] = useState([]);
|
|
64
|
-
const [source, setSource] = useState('value');
|
|
65
126
|
const [value, setValue] = useState('');
|
|
66
|
-
const [
|
|
67
|
-
const [
|
|
127
|
+
const [hosts, setHosts] = useState([]);
|
|
128
|
+
const [envVar, setEnvVar] = useState('');
|
|
129
|
+
// Once the person types a variable, their text wins over the derived one.
|
|
130
|
+
const [envVarTouched, setEnvVarTouched] = useState(false);
|
|
131
|
+
// The service's key was saved but its sandbox binding failed: the main button retries only the binding.
|
|
132
|
+
const [credentialSaved, setCredentialSaved] = useState(false);
|
|
133
|
+
const [sourceFieldRefused, setSourceFieldRefused] = useState(false);
|
|
134
|
+
const [credentialReadFailed, setCredentialReadFailed] = useState(false);
|
|
135
|
+
const [azureSelected, setAzureSelected] = useState([]);
|
|
136
|
+
const [azureConfigs, setAzureConfigs] = useState({});
|
|
137
|
+
const [azureErrors, setAzureErrors] = useState({});
|
|
68
138
|
const [fieldErrors, setFieldErrors] = useState({});
|
|
69
139
|
const [formError, setFormError] = useState(null);
|
|
70
|
-
|
|
71
|
-
|
|
140
|
+
const pick = parsePick(serviceSlug);
|
|
141
|
+
const aiSlug = (_a = aiKey === null || aiKey === void 0 ? void 0 : aiKey.name) !== null && _a !== void 0 ? _a : (isCreate && pick.kind === 'ai' ? pick.slug : null);
|
|
142
|
+
const isAi = aiSlug !== null;
|
|
143
|
+
const aiProvider = aiSlug
|
|
144
|
+
? ((_b = aiProviders.find((provider) => provider.slug === aiSlug)) !== null && _b !== void 0 ? _b : null)
|
|
145
|
+
: null;
|
|
146
|
+
const aiForm = (_d = (_c = aiProvider === null || aiProvider === void 0 ? void 0 : aiProvider.form) !== null && _c !== void 0 ? _c : AI_PROVIDER_FORMS[aiSlug !== null && aiSlug !== void 0 ? aiSlug : '']) !== null && _d !== void 0 ? _d : 'fields';
|
|
147
|
+
const aiFields = (_e = aiProvider === null || aiProvider === void 0 ? void 0 : aiProvider.fields) !== null && _e !== void 0 ? _e : NO_FIELDS;
|
|
148
|
+
const heldAiSlugs = useMemo(() => new Set(aiKeys.map((key) => key.name)), [aiKeys]);
|
|
149
|
+
const heldAzure = (_f = aiKeys.find((key) => key.name === AZURE_OPENAI_SLUG)) !== null && _f !== void 0 ? _f : null;
|
|
150
|
+
const heldAzureModels = useMemo(() => { var _a; return ((_a = heldAzure === null || heldAzure === void 0 ? void 0 : heldAzure.models) !== null && _a !== void 0 ? _a : []).map((model) => model.name); }, [heldAzure]);
|
|
151
|
+
// A held Azure OpenAI needs the list before it is picked too: it greys out only with no model left to add.
|
|
152
|
+
const needsAzureModels = open &&
|
|
153
|
+
isCreate &&
|
|
154
|
+
aiProviders.some((provider) => provider.form === 'azure') &&
|
|
155
|
+
(aiForm === 'azure' || heldAzure !== null);
|
|
156
|
+
const { data: llmProviders, isLoading: isLoadingLlmProviders, isError: isLlmProvidersError, refetch: refetchLlmProviders, } = useGetLlmsQuery({
|
|
157
|
+
org: tenantKey,
|
|
158
|
+
// @ts-expect-error - userId is not in the generated query args but the endpoint scopes by it
|
|
159
|
+
userId: username !== null && username !== void 0 ? username : '',
|
|
160
|
+
}, { skip: !needsAzureModels || !username || azureModels !== undefined });
|
|
161
|
+
const allAzureModels = useMemo(() => {
|
|
162
|
+
var _a;
|
|
163
|
+
if (azureModels)
|
|
164
|
+
return azureModels;
|
|
165
|
+
if (!llmProviders)
|
|
166
|
+
return null;
|
|
167
|
+
const azure = llmProviders.find((provider) => provider.name === AZURE_OPENAI_SLUG);
|
|
168
|
+
// Typed as strings by the generated client; the endpoint answers { llm_name, display_name }.
|
|
169
|
+
return ((_a = azure === null || azure === void 0 ? void 0 : azure.chat_models) !== null && _a !== void 0 ? _a : []);
|
|
170
|
+
}, [azureModels, llmProviders]);
|
|
171
|
+
const pickableAzureModels = useMemo(() => availableAzureModels(allAzureModels !== null && allAzureModels !== void 0 ? allAzureModels : [], heldAzureModels), [allAzureModels, heldAzureModels]);
|
|
172
|
+
const azureFullyHeld = heldAzure !== null && allAzureModels !== null && pickableAzureModels.length === 0;
|
|
173
|
+
const azureListFailed = needsAzureModels && azureModels === undefined && (!username || Boolean(isLlmProvidersError));
|
|
174
|
+
const azureModelsNotice = azureListFailed
|
|
175
|
+
? t('secrets.azureModelsFailed')
|
|
176
|
+
: allAzureModels !== null && pickableAzureModels.length === 0
|
|
177
|
+
? t('secrets.azureModelsNone')
|
|
178
|
+
: undefined;
|
|
179
|
+
const selectedService = useMemo(() => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
if (isCreate)
|
|
182
|
+
return (_a = services.find((service) => service.slug === serviceSlug)) !== null && _a !== void 0 ? _a : null;
|
|
183
|
+
if (credential)
|
|
184
|
+
return (_b = services.find((service) => service.slug === credential.name)) !== null && _b !== void 0 ? _b : null;
|
|
185
|
+
return null;
|
|
186
|
+
}, [isCreate, services, serviceSlug, credential]);
|
|
187
|
+
const allServiceFields = useMemo(() => selectedService
|
|
188
|
+
? selectedService.fields
|
|
189
|
+
: credential
|
|
190
|
+
? fieldsOfCredential(credential, services)
|
|
191
|
+
: [], [selectedService, credential, services]);
|
|
192
|
+
const serviceFields = useMemo(() => allServiceFields.filter((field) => !field.systemManaged), [allServiceFields]);
|
|
193
|
+
const knownSlug = (_h = (_g = selectedService === null || selectedService === void 0 ? void 0 : selectedService.slug) !== null && _g !== void 0 ? _g : credential === null || credential === void 0 ? void 0 : credential.name) !== null && _h !== void 0 ? _h : null;
|
|
194
|
+
const serviceDisplayName = (_m = (_l = (_k = (_j = selectedService === null || selectedService === void 0 ? void 0 : selectedService.displayName) !== null && _j !== void 0 ? _j : credential === null || credential === void 0 ? void 0 : credential.displayName) !== null && _k !== void 0 ? _k : aiProvider === null || aiProvider === void 0 ? void 0 : aiProvider.displayName) !== null && _l !== void 0 ? _l : aiKey === null || aiKey === void 0 ? void 0 : aiKey.displayName) !== null && _m !== void 0 ? _m : '';
|
|
195
|
+
const serviceLogo = (_r = (_q = (_p = (_o = selectedService === null || selectedService === void 0 ? void 0 : selectedService.logo) !== null && _o !== void 0 ? _o : credential === null || credential === void 0 ? void 0 : credential.logo) !== null && _p !== void 0 ? _p : aiKey === null || aiKey === void 0 ? void 0 : aiKey.logo) !== null && _q !== void 0 ? _q : aiProvider === null || aiProvider === void 0 ? void 0 : aiProvider.logo) !== null && _r !== void 0 ? _r : null;
|
|
196
|
+
const agentField = knownSlug ? agentKeyField(knownSlug, allServiceFields) : null;
|
|
197
|
+
const isCustom = isEditCustom || (isCreate && customOnly);
|
|
198
|
+
const isKnown = isLink || isEditService || (isCreate && selectedService !== null);
|
|
199
|
+
const bindsOnCreate = isCreate && isKnown && fromSandbox && agentField !== null;
|
|
200
|
+
// A sign-in style key (Client ID / Client Secret) only ibl.ai can use.
|
|
201
|
+
const platformOnly = isCreate && isKnown && agentField === null;
|
|
202
|
+
const isFilePicker = knownSlug !== null && SERVICE_PURPOSE[knownSlug] === 'filePicker';
|
|
203
|
+
const showServiceSelect = isCreate && !customOnly;
|
|
204
|
+
const showServiceFields = (isCreate && isKnown && !credentialSaved) || isEditService;
|
|
205
|
+
const asksHosts = isCustom || isLink || bindsOnCreate || (isEditService && bound);
|
|
206
|
+
const showEnvVar = asksHosts;
|
|
207
|
+
const envVarReadOnly = isEditCustom || (isEditService && bound);
|
|
208
|
+
const showSuggestions = !boxDisabled && boxFocused;
|
|
209
|
+
const addedSlugs = useMemo(() => new Set(credentials.map((c) => c.name)), [credentials]);
|
|
210
|
+
// The org's other variables; the edited secret's own is not a clash.
|
|
211
|
+
const taken = useMemo(() => takenEnvVars.filter((entry) => entry !== (secret === null || secret === void 0 ? void 0 : secret.env_var)), [takenEnvVars, secret === null || secret === void 0 ? void 0 : secret.env_var]);
|
|
212
|
+
// Start from what is being edited (or blank) every time the dialog opens.
|
|
213
|
+
// A key is deliberately never prefilled. A list answering while the dialog is
|
|
214
|
+
// open must not reset it, or it wipes what the person typed.
|
|
72
215
|
useEffect(() => {
|
|
73
|
-
var _a, _b, _c, _d;
|
|
216
|
+
var _a, _b, _c, _d, _e, _f;
|
|
74
217
|
if (!open)
|
|
75
218
|
return;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
219
|
+
setServiceSlug(credential ? credential.name : '');
|
|
220
|
+
setBoxSearch('');
|
|
221
|
+
setBoxFocused(false);
|
|
222
|
+
const prefilled = {};
|
|
223
|
+
if (credential && !link) {
|
|
224
|
+
for (const field of fieldsOfCredential(credential, services)) {
|
|
225
|
+
if (!field.isSensitive)
|
|
226
|
+
prefilled[field.name] = (_a = credential.values[field.name]) !== null && _a !== void 0 ? _a : '';
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
setFieldValues(prefilled);
|
|
230
|
+
setName((_b = secret === null || secret === void 0 ? void 0 : secret.name) !== null && _b !== void 0 ? _b : '');
|
|
81
231
|
setValue('');
|
|
82
|
-
|
|
83
|
-
|
|
232
|
+
setHosts((_c = secret === null || secret === void 0 ? void 0 : secret.allow_hosts) !== null && _c !== void 0 ? _c : (credential && link ? defaultHostsFor(credential.name) : []));
|
|
233
|
+
setEnvVar((_d = secret === null || secret === void 0 ? void 0 : secret.env_var) !== null && _d !== void 0 ? _d : '');
|
|
234
|
+
setEnvVarTouched(false);
|
|
235
|
+
setCredentialSaved(false);
|
|
236
|
+
setSourceFieldRefused(false);
|
|
237
|
+
setCredentialReadFailed(false);
|
|
238
|
+
setAzureSelected((_f = (_e = aiKey === null || aiKey === void 0 ? void 0 : aiKey.models) === null || _e === void 0 ? void 0 : _e.map((model) => model.name)) !== null && _f !== void 0 ? _f : []);
|
|
239
|
+
setAzureConfigs({});
|
|
240
|
+
setAzureErrors({});
|
|
241
|
+
setFieldErrors({});
|
|
242
|
+
setFormError(null);
|
|
243
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
244
|
+
}, [open, secret, credential, aiKey, link]);
|
|
245
|
+
// The schema can answer after an edit opened: fill in the visible values it
|
|
246
|
+
// adds without touching what was typed.
|
|
247
|
+
useEffect(() => {
|
|
248
|
+
if (!open || !credential || link)
|
|
249
|
+
return;
|
|
250
|
+
setFieldValues((current) => {
|
|
251
|
+
var _a;
|
|
252
|
+
const next = { ...current };
|
|
253
|
+
for (const field of fieldsOfCredential(credential, services)) {
|
|
254
|
+
if (!field.isSensitive && !(field.name in next)) {
|
|
255
|
+
next[field.name] = (_a = credential.values[field.name]) !== null && _a !== void 0 ? _a : '';
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return next;
|
|
259
|
+
});
|
|
260
|
+
}, [open, credential, link, services]);
|
|
261
|
+
// The variable agents use, worked out from the name (or the service and its
|
|
262
|
+
// key field) until the person types one of their own.
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (envVarReadOnly || envVarTouched)
|
|
265
|
+
return;
|
|
266
|
+
if (isCustom) {
|
|
267
|
+
setEnvVar(name.trim() ? deriveSecretEnvVar(name, { taken }) : '');
|
|
268
|
+
}
|
|
269
|
+
else if (isKnown && agentField) {
|
|
270
|
+
setEnvVar(deriveServiceEnvVar(serviceDisplayName, agentField, taken));
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
setEnvVar('');
|
|
274
|
+
}
|
|
275
|
+
}, [
|
|
276
|
+
name,
|
|
277
|
+
isCustom,
|
|
278
|
+
isKnown,
|
|
279
|
+
agentField,
|
|
280
|
+
serviceDisplayName,
|
|
281
|
+
envVarReadOnly,
|
|
282
|
+
envVarTouched,
|
|
283
|
+
taken,
|
|
284
|
+
]);
|
|
285
|
+
// The suggestions sit in the dialog's flow, so closing them on blur would move the
|
|
286
|
+
// button under the pointer mid-press and lose its click. They close once the press
|
|
287
|
+
// or key that took focus away is over.
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
if (!boxFocused)
|
|
290
|
+
return;
|
|
291
|
+
const closeIfLeft = () => {
|
|
292
|
+
if (document.activeElement !== boxInputRef.current)
|
|
293
|
+
setBoxFocused(false);
|
|
294
|
+
};
|
|
295
|
+
document.addEventListener('click', closeIfLeft, true);
|
|
296
|
+
document.addEventListener('keyup', closeIfLeft, true);
|
|
297
|
+
return () => {
|
|
298
|
+
document.removeEventListener('click', closeIfLeft, true);
|
|
299
|
+
document.removeEventListener('keyup', closeIfLeft, true);
|
|
300
|
+
};
|
|
301
|
+
}, [boxFocused]);
|
|
302
|
+
// A pick swaps the box for the chosen row and Change swaps it back, removing the control that had focus.
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
var _a;
|
|
305
|
+
if (!moveFocusAfterSwap.current)
|
|
306
|
+
return;
|
|
307
|
+
moveFocusAfterSwap.current = false;
|
|
308
|
+
const next = serviceSlug
|
|
309
|
+
? ((_a = firstInputRef.current) !== null && _a !== void 0 ? _a : changeButtonRef.current)
|
|
310
|
+
: boxInputRef.current;
|
|
311
|
+
next === null || next === void 0 ? void 0 : next.focus();
|
|
312
|
+
}, [serviceSlug]);
|
|
313
|
+
const handleServiceChange = (next) => {
|
|
314
|
+
setServiceSlug(next);
|
|
315
|
+
setFieldValues({});
|
|
316
|
+
setAzureSelected([]);
|
|
317
|
+
setAzureConfigs({});
|
|
318
|
+
setAzureErrors({});
|
|
84
319
|
setFieldErrors({});
|
|
85
320
|
setFormError(null);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
321
|
+
setHosts(parsePick(next).kind === 'service' && fromSandbox ? defaultHostsFor(next) : []);
|
|
322
|
+
};
|
|
323
|
+
const pickFromBox = (next) => {
|
|
324
|
+
moveFocusAfterSwap.current = true;
|
|
325
|
+
setBoxSearch('');
|
|
326
|
+
setBoxFocused(false);
|
|
327
|
+
handleServiceChange(next);
|
|
328
|
+
};
|
|
329
|
+
const reopenBox = () => {
|
|
330
|
+
moveFocusAfterSwap.current = true;
|
|
331
|
+
setEnvVarTouched(false);
|
|
332
|
+
handleServiceChange('');
|
|
333
|
+
};
|
|
334
|
+
const closeAfterSave = (saved) => {
|
|
335
|
+
onSaved === null || onSaved === void 0 ? void 0 : onSaved(saved);
|
|
336
|
+
onOpenChange(false);
|
|
337
|
+
};
|
|
338
|
+
/** Put a VM-secret refusal under its field; anything else becomes one generic line. */
|
|
339
|
+
const showSecretFailure = (error) => {
|
|
340
|
+
const parsed = getVirtualMachineApiError(error);
|
|
341
|
+
if (parsed.status === 403) {
|
|
342
|
+
setFormError(t('secrets.forbiddenWrite'));
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (parsed.fieldErrors.source_field) {
|
|
346
|
+
setSourceFieldRefused(true);
|
|
347
|
+
setFormError(t('secrets.errorSourceField', { name: serviceDisplayName }));
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const nextErrors = {};
|
|
351
|
+
for (const [key, messages] of Object.entries(parsed.fieldErrors)) {
|
|
352
|
+
if (['name', 'env_var', 'allow_hosts', 'value'].includes(key)) {
|
|
353
|
+
nextErrors[key] = messages.join(' ');
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (isSecretEnvVarTakenMessage(parsed.message)) {
|
|
357
|
+
// The person never typed a derived variable, so the clash is about the name.
|
|
358
|
+
if (envVarTouched || !isCustom) {
|
|
359
|
+
nextErrors.env_var = t('secrets.errorEnvVarTaken', { envVar: envVar.trim() });
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
nextErrors.name = t('secrets.errorNameTaken');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
setFieldErrors(nextErrors);
|
|
366
|
+
if (Object.keys(nextErrors).length === 0)
|
|
367
|
+
setFormError(t('secrets.saveFailed'));
|
|
368
|
+
};
|
|
369
|
+
const typedValue = (field) => { var _a, _b; return (_b = (_a = fieldValues[field]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : ''; };
|
|
370
|
+
const fieldText = (field) => field === 'key' ? t('secrets.fieldKey') : humanizeCredentialField(field);
|
|
371
|
+
const aiNothingTyped = () => aiForm === 'azure'
|
|
372
|
+
? Object.keys(touchedAzureConfigs(azureConfigs)).length === 0
|
|
373
|
+
: Object.values(fieldValues).every((text) => !text.trim());
|
|
374
|
+
const aiFieldRequiredError = (field) => field === 'key'
|
|
375
|
+
? t('secrets.errorKeyRequired')
|
|
376
|
+
: t('secrets.errorServiceFieldRequired', { label: fieldText(field) });
|
|
377
|
+
const aiClientErrors = () => {
|
|
378
|
+
const errors = {};
|
|
379
|
+
if (aiForm === 'azure')
|
|
380
|
+
return errors;
|
|
381
|
+
for (const field of aiFields) {
|
|
382
|
+
if (field.required && !typedValue(field.name)) {
|
|
383
|
+
errors[fieldErrorKey(field.name)] = aiFieldRequiredError(field.name);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// The LLM PATCH stores what it is sent, so pasting the row's own `sk-***`
|
|
387
|
+
// would replace the real key and agents would stop answering.
|
|
388
|
+
for (const field of aiFields) {
|
|
389
|
+
if (field.isSensitive && MASKED_VALUE_PATTERN.test(typedValue(field.name))) {
|
|
390
|
+
errors[fieldErrorKey(field.name)] = t('secrets.errorKeyMasked');
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return errors;
|
|
394
|
+
};
|
|
395
|
+
const azureClientErrors = () => {
|
|
396
|
+
var _a, _b, _c, _d;
|
|
397
|
+
const errors = {};
|
|
398
|
+
if (aiForm !== 'azure')
|
|
399
|
+
return errors;
|
|
400
|
+
for (const model of azureSelected) {
|
|
401
|
+
if (MASKED_VALUE_PATTERN.test((_b = (_a = azureConfigs[model]) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : '')) {
|
|
402
|
+
errors[`${model}.key`] = t('secrets.errorKeyMasked');
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (isEditAi)
|
|
406
|
+
return errors;
|
|
407
|
+
if (azureSelected.length === 0) {
|
|
408
|
+
errors.model = azureModelsNotice !== null && azureModelsNotice !== void 0 ? azureModelsNotice : t('secrets.errorAzureModelRequired');
|
|
409
|
+
}
|
|
410
|
+
for (const model of azureSelected) {
|
|
411
|
+
for (const field of AZURE_MODEL_FIELDS) {
|
|
412
|
+
if (!((_d = (_c = azureConfigs[model]) === null || _c === void 0 ? void 0 : _c[field]) === null || _d === void 0 ? void 0 : _d.trim())) {
|
|
413
|
+
errors[`${model}.${field}`] = t('secrets.errorAzureFieldRequired', {
|
|
414
|
+
label: t(AZURE_FIELD_LABELS[field]),
|
|
415
|
+
model,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return errors;
|
|
421
|
+
};
|
|
422
|
+
const aiRequestValue = () => {
|
|
423
|
+
if (aiForm === 'azure')
|
|
424
|
+
return touchedAzureConfigs(azureConfigs);
|
|
425
|
+
const value = {};
|
|
426
|
+
for (const field of aiFields) {
|
|
427
|
+
const typed = typedValue(field.name);
|
|
428
|
+
if (typed)
|
|
429
|
+
value[field.name] = typed;
|
|
430
|
+
}
|
|
431
|
+
return value;
|
|
432
|
+
};
|
|
433
|
+
const showAiFailure = (error) => {
|
|
434
|
+
const parsed = getVirtualMachineApiError(error);
|
|
435
|
+
if (parsed.status === 403) {
|
|
436
|
+
setFormError(t('secrets.forbiddenWrite'));
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if ((parsed.status === 409 || isUniqueTogetherError(error)) && isCreate) {
|
|
440
|
+
onListOutOfDate === null || onListOutOfDate === void 0 ? void 0 : onListOutOfDate();
|
|
441
|
+
setFieldErrors({
|
|
442
|
+
service: t(isAiKeyEditable(aiProvider)
|
|
443
|
+
? 'secrets.serviceAlreadyAdded'
|
|
444
|
+
: 'secrets.serviceAlreadyAddedNoEdit', { name: serviceDisplayName }),
|
|
445
|
+
});
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const nextErrors = {};
|
|
449
|
+
for (const field of aiFields) {
|
|
450
|
+
if (!parsed.fieldErrors[field.name])
|
|
451
|
+
continue;
|
|
452
|
+
nextErrors[fieldErrorKey(field.name)] =
|
|
453
|
+
field.isSensitive && typedValue(field.name)
|
|
454
|
+
? t('secrets.keyPasteFull')
|
|
455
|
+
: t('secrets.errorServiceFieldRequired', { label: fieldText(field.name) });
|
|
456
|
+
}
|
|
457
|
+
setFieldErrors(nextErrors);
|
|
458
|
+
if (Object.keys(nextErrors).length === 0)
|
|
459
|
+
setFormError(t('secrets.saveFailed'));
|
|
460
|
+
};
|
|
461
|
+
const submitAi = async (slug) => {
|
|
462
|
+
if (isEditAi && aiNothingTyped()) {
|
|
463
|
+
onOpenChange(false);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const clientErrors = aiClientErrors();
|
|
467
|
+
const clientAzureErrors = azureClientErrors();
|
|
468
|
+
setFieldErrors(clientErrors);
|
|
469
|
+
setAzureErrors(clientAzureErrors);
|
|
470
|
+
setFormError(null);
|
|
471
|
+
if (Object.keys(clientErrors).length > 0 || Object.keys(clientAzureErrors).length > 0)
|
|
472
|
+
return;
|
|
473
|
+
const request = {
|
|
474
|
+
org: tenantKey,
|
|
475
|
+
requestBody: { name: slug, value: aiRequestValue(), platform: tenantKey },
|
|
476
|
+
};
|
|
477
|
+
try {
|
|
478
|
+
if (isEditAi)
|
|
479
|
+
await updateLlmCredential(request).unwrap();
|
|
480
|
+
else
|
|
481
|
+
await createLlmCredential(request).unwrap();
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
showAiFailure(error);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (toastOnSave) {
|
|
488
|
+
if (isEditAi) {
|
|
489
|
+
toast.success(t('secrets.updated', { name: serviceDisplayName }));
|
|
490
|
+
}
|
|
491
|
+
else if (aiForm === 'azure' && heldAzure) {
|
|
492
|
+
toast.success(t('secrets.azureModelsAdded', { count: azureSelected.length, name: serviceDisplayName }));
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
toast.success(t('secrets.aiProviderAdded', { name: serviceDisplayName }));
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
closeAfterSave(null);
|
|
499
|
+
};
|
|
90
500
|
const handleSubmit = async (event) => {
|
|
501
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
91
502
|
event.preventDefault();
|
|
503
|
+
if (aiSlug) {
|
|
504
|
+
await submitAi(aiSlug);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
92
507
|
const trimmedName = name.trim();
|
|
93
508
|
const trimmedEnvVar = envVar.trim();
|
|
509
|
+
const trimmedValue = value.trim();
|
|
94
510
|
const clientErrors = {};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (!
|
|
98
|
-
|
|
99
|
-
|
|
511
|
+
setSourceFieldRefused(false);
|
|
512
|
+
setCredentialReadFailed(false);
|
|
513
|
+
if (showServiceSelect && !serviceSlug) {
|
|
514
|
+
clientErrors.service = t(isLlmBox ? 'secrets.errorLlmRequired' : 'secrets.errorServiceRequired');
|
|
515
|
+
}
|
|
516
|
+
if (isCustom) {
|
|
517
|
+
if (!trimmedName)
|
|
518
|
+
clientErrors.name = t('secrets.errorNameRequired');
|
|
519
|
+
if (!isEditCustom && !trimmedValue) {
|
|
520
|
+
clientErrors.value = t('secrets.errorKeyRequired');
|
|
100
521
|
}
|
|
101
|
-
else if (
|
|
102
|
-
clientErrors.
|
|
522
|
+
else if (MASKED_VALUE_PATTERN.test(trimmedValue)) {
|
|
523
|
+
clientErrors.value = t('secrets.errorKeyMasked');
|
|
103
524
|
}
|
|
104
525
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
clientErrors.value = t('virtualMachineSecrets.errorValueTooShort', {
|
|
113
|
-
min: VIRTUAL_MACHINE_SECRET_VALUE_MIN_LENGTH,
|
|
114
|
-
});
|
|
526
|
+
if (isCreate && isKnown && !credentialSaved) {
|
|
527
|
+
for (const field of serviceFields) {
|
|
528
|
+
if (field.required && !((_a = fieldValues[field.name]) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
529
|
+
clientErrors[fieldErrorKey(field.name)] = t('secrets.errorServiceFieldRequired', {
|
|
530
|
+
label: fieldText(field.name),
|
|
531
|
+
});
|
|
532
|
+
}
|
|
115
533
|
}
|
|
116
|
-
|
|
117
|
-
|
|
534
|
+
}
|
|
535
|
+
if ((isCreate && isKnown && !credentialSaved) || isEditService) {
|
|
536
|
+
for (const field of serviceFields) {
|
|
537
|
+
const typedText = (_c = (_b = fieldValues[field.name]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
|
538
|
+
const storedText = ((_d = credential === null || credential === void 0 ? void 0 : credential.values[field.name]) !== null && _d !== void 0 ? _d : '').trim();
|
|
539
|
+
if (field.isSensitive && typedText !== storedText && MASKED_VALUE_PATTERN.test(typedText)) {
|
|
540
|
+
clientErrors[fieldErrorKey(field.name)] = t('secrets.errorKeyMasked');
|
|
541
|
+
}
|
|
118
542
|
}
|
|
119
543
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
544
|
+
if (asksHosts && hosts.length === 0)
|
|
545
|
+
clientErrors.allow_hosts = t('secrets.errorHostsRequired');
|
|
546
|
+
if (showEnvVar && !envVarReadOnly && (!isCustom || trimmedName)) {
|
|
547
|
+
const issue = validateSecretEnvVar(trimmedEnvVar, { taken });
|
|
548
|
+
if (issue) {
|
|
549
|
+
clientErrors.env_var = t(ENV_VAR_ISSUE_KEYS[issue], {
|
|
550
|
+
envVar: trimmedEnvVar,
|
|
551
|
+
max: VIRTUAL_MACHINE_ENV_VAR_MAX_LENGTH,
|
|
552
|
+
});
|
|
123
553
|
}
|
|
124
|
-
if (!field)
|
|
125
|
-
clientErrors.source_field = t('virtualMachineSecrets.errorFieldRequired');
|
|
126
554
|
}
|
|
127
555
|
setFieldErrors(clientErrors);
|
|
128
556
|
setFormError(null);
|
|
129
|
-
if (Object.
|
|
557
|
+
if (Object.values(clientErrors).some(Boolean))
|
|
130
558
|
return;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
559
|
+
if (isEditCustom && secret) {
|
|
560
|
+
const body = { env_var: secret.env_var };
|
|
561
|
+
if (trimmedName !== secret.name)
|
|
562
|
+
body.name = trimmedName;
|
|
563
|
+
if (!sameHosts(hosts, secret.allow_hosts))
|
|
564
|
+
body.allow_hosts = hosts;
|
|
565
|
+
if (trimmedValue && !readsServiceKey)
|
|
566
|
+
body.value = trimmedValue;
|
|
567
|
+
if (Object.keys(body).length === 1) {
|
|
568
|
+
onOpenChange(false);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
try {
|
|
572
|
+
const saved = await updateSecret({ org: tenantKey, body }).unwrap();
|
|
573
|
+
if (toastOnSave)
|
|
574
|
+
toast.success(t('secrets.envVarUpdated'));
|
|
575
|
+
closeAfterSave(saved);
|
|
576
|
+
}
|
|
577
|
+
catch (error) {
|
|
578
|
+
showSecretFailure(error);
|
|
579
|
+
}
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
if (isEditService && credential) {
|
|
583
|
+
const typed = {};
|
|
584
|
+
for (const field of serviceFields) {
|
|
585
|
+
const next = (_f = (_e = fieldValues[field.name]) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : '';
|
|
586
|
+
const changed = next !== ((_g = credential.values[field.name]) !== null && _g !== void 0 ? _g : '').trim();
|
|
587
|
+
// A blank secret box keeps the key, and its masked copy is never a new key.
|
|
588
|
+
if (changed && (next !== '' || !field.isSensitive))
|
|
589
|
+
typed[field.name] = next;
|
|
590
|
+
}
|
|
591
|
+
const hostsChanged = bound && secret !== null && !sameHosts(hosts, secret.allow_hosts);
|
|
592
|
+
if (Object.keys(typed).length === 0 && !hostsChanged) {
|
|
593
|
+
onOpenChange(false);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
if (Object.keys(typed).length > 0) {
|
|
597
|
+
try {
|
|
598
|
+
await updateCredential({
|
|
599
|
+
org: tenantKey,
|
|
600
|
+
requestBody: {
|
|
601
|
+
name: credential.name,
|
|
602
|
+
platform: (_h = credential.platform) !== null && _h !== void 0 ? _h : tenantKey,
|
|
603
|
+
value: typed,
|
|
604
|
+
},
|
|
605
|
+
}).unwrap();
|
|
151
606
|
}
|
|
152
|
-
|
|
153
|
-
|
|
607
|
+
catch (error) {
|
|
608
|
+
const parsed = getVirtualMachineApiError(error);
|
|
609
|
+
const firstSecretField = serviceFields.find((field) => field.isSensitive);
|
|
610
|
+
if (parsed.status === 403)
|
|
611
|
+
setFormError(t('secrets.forbiddenWrite'));
|
|
612
|
+
else if (firstSecretField) {
|
|
613
|
+
setFieldErrors({ [fieldErrorKey(firstSecretField.name)]: t('secrets.keyPasteFull') });
|
|
614
|
+
}
|
|
615
|
+
else
|
|
616
|
+
setFormError(t('secrets.saveFailed'));
|
|
154
617
|
return;
|
|
155
618
|
}
|
|
156
|
-
saved = await updateSecret({ org: tenantKey, body }).unwrap();
|
|
157
|
-
toast.success(t('virtualMachineSecrets.updated'));
|
|
158
619
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
620
|
+
try {
|
|
621
|
+
let saved = secret;
|
|
622
|
+
if (hostsChanged && secret) {
|
|
623
|
+
saved = await updateSecret({
|
|
624
|
+
org: tenantKey,
|
|
625
|
+
body: { env_var: secret.env_var, allow_hosts: hosts },
|
|
626
|
+
}).unwrap();
|
|
627
|
+
}
|
|
628
|
+
if (toastOnSave)
|
|
629
|
+
toast.success(t('secrets.updated', { name: serviceDisplayName }));
|
|
630
|
+
closeAfterSave(saved);
|
|
631
|
+
}
|
|
632
|
+
catch (error) {
|
|
633
|
+
showSecretFailure(error);
|
|
634
|
+
}
|
|
635
|
+
return;
|
|
173
636
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
637
|
+
if (isLink && credential && agentField) {
|
|
638
|
+
try {
|
|
639
|
+
const saved = await createSecret({
|
|
640
|
+
org: tenantKey,
|
|
641
|
+
body: {
|
|
642
|
+
name: credential.displayName,
|
|
643
|
+
env_var: trimmedEnvVar,
|
|
644
|
+
allow_hosts: hosts,
|
|
645
|
+
source_credential_id: credential.id,
|
|
646
|
+
source_field: agentField,
|
|
647
|
+
},
|
|
648
|
+
}).unwrap();
|
|
649
|
+
if (toastOnSave) {
|
|
650
|
+
toast.success(t('secrets.serviceLinked', { name: credential.displayName, envVar: saved.env_var }));
|
|
651
|
+
}
|
|
652
|
+
closeAfterSave(saved);
|
|
653
|
+
}
|
|
654
|
+
catch (error) {
|
|
655
|
+
showSecretFailure(error);
|
|
179
656
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
if (isCreate && isKnown && knownSlug) {
|
|
660
|
+
if (!credentialSaved) {
|
|
661
|
+
// A blank optional field still goes out: the backend wants every key of the schema on a new credential.
|
|
662
|
+
const valueToSave = {};
|
|
663
|
+
for (const field of serviceFields)
|
|
664
|
+
valueToSave[field.name] = typedValue(field.name);
|
|
665
|
+
try {
|
|
666
|
+
await createCredential({
|
|
667
|
+
org: tenantKey,
|
|
668
|
+
requestBody: { name: knownSlug, value: valueToSave, platform: tenantKey },
|
|
669
|
+
}).unwrap();
|
|
185
670
|
}
|
|
186
|
-
|
|
187
|
-
|
|
671
|
+
catch (error) {
|
|
672
|
+
const parsed = getVirtualMachineApiError(error);
|
|
673
|
+
if (parsed.status === 403)
|
|
674
|
+
setFormError(t('secrets.forbiddenWrite'));
|
|
675
|
+
else if (parsed.status === 409 || addedSlugs.has(knownSlug)) {
|
|
676
|
+
setFieldErrors({
|
|
677
|
+
service: t('secrets.serviceAlreadyAdded', { name: serviceDisplayName }),
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
const refused = serviceFields.filter((field) => parsed.fieldErrors[field.name]);
|
|
682
|
+
if (refused.length > 0) {
|
|
683
|
+
setFieldErrors(Object.fromEntries(refused.map((field) => [
|
|
684
|
+
fieldErrorKey(field.name),
|
|
685
|
+
t('secrets.errorServiceFieldRequired', { label: fieldText(field.name) }),
|
|
686
|
+
])));
|
|
687
|
+
}
|
|
688
|
+
else
|
|
689
|
+
setFormError(t('secrets.saveFailed'));
|
|
690
|
+
}
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
if (!bindsOnCreate) {
|
|
694
|
+
if (toastOnSave) {
|
|
695
|
+
toast.success(t(agentField === null ? 'secrets.platformOnlyAdded' : 'secrets.serviceAdded', {
|
|
696
|
+
name: serviceDisplayName,
|
|
697
|
+
}));
|
|
698
|
+
}
|
|
699
|
+
closeAfterSave(null);
|
|
700
|
+
return;
|
|
188
701
|
}
|
|
702
|
+
setCredentialSaved(true);
|
|
703
|
+
}
|
|
704
|
+
// The create response carries no id, so read the saved key back from the list.
|
|
705
|
+
let createdId = null;
|
|
706
|
+
try {
|
|
707
|
+
const list = await fetchCredentials({ org: tenantKey }).unwrap();
|
|
708
|
+
createdId =
|
|
709
|
+
(_k = (_j = toIntegrationCredentialOptions(list, tenantKey).find((option) => option.name === knownSlug)) === null || _j === void 0 ? void 0 : _j.id) !== null && _k !== void 0 ? _k : null;
|
|
189
710
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (message) {
|
|
193
|
-
setFormError(message);
|
|
711
|
+
catch (_l) {
|
|
712
|
+
createdId = null;
|
|
194
713
|
}
|
|
195
|
-
|
|
196
|
-
|
|
714
|
+
if (createdId === null || !agentField) {
|
|
715
|
+
setCredentialReadFailed(true);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
try {
|
|
719
|
+
const saved = await createSecret({
|
|
720
|
+
org: tenantKey,
|
|
721
|
+
body: {
|
|
722
|
+
name: serviceDisplayName,
|
|
723
|
+
env_var: trimmedEnvVar,
|
|
724
|
+
allow_hosts: hosts,
|
|
725
|
+
source_credential_id: createdId,
|
|
726
|
+
source_field: agentField,
|
|
727
|
+
},
|
|
728
|
+
}).unwrap();
|
|
729
|
+
closeAfterSave(saved);
|
|
197
730
|
}
|
|
731
|
+
catch (error) {
|
|
732
|
+
showSecretFailure(error);
|
|
733
|
+
}
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const body = {
|
|
737
|
+
name: trimmedName,
|
|
738
|
+
env_var: trimmedEnvVar,
|
|
739
|
+
allow_hosts: hosts,
|
|
740
|
+
value: trimmedValue,
|
|
741
|
+
};
|
|
742
|
+
try {
|
|
743
|
+
const saved = await createSecret({ org: tenantKey, body }).unwrap();
|
|
744
|
+
if (toastOnSave)
|
|
745
|
+
toast.success(t('secrets.customAdded', { name: trimmedName }));
|
|
746
|
+
closeAfterSave(saved);
|
|
747
|
+
}
|
|
748
|
+
catch (error) {
|
|
749
|
+
showSecretFailure(error);
|
|
198
750
|
}
|
|
199
751
|
};
|
|
200
752
|
const fieldError = (key, id) => fieldErrors[key] ? (jsx("p", { id: `${id}-error`, role: "alert", className: "text-xs text-red-600", children: fieldErrors[key] })) : null;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
753
|
+
const labelClass = 'flex items-center gap-2 text-sm font-medium text-[#646464]';
|
|
754
|
+
// A label row: the label itself (the input's accessible name), the red mark
|
|
755
|
+
// of a required field, and the info icon.
|
|
756
|
+
const fieldLabel = ({ htmlFor, onClick, text, info, required = false, }) => (jsxs("div", { className: "flex items-center gap-2", children: [jsx(Label, { htmlFor: htmlFor, onClick: onClick, className: "text-sm font-medium text-[#646464]", children: text }), required && (jsx("span", { className: "-ml-1 text-red-500", "aria-hidden": "true", children: "*" })), jsx(FieldInfo, { label: text, text: info })] }));
|
|
757
|
+
const credentialFieldBox = ({ field, required, placeholder, inputRef, }) => {
|
|
758
|
+
var _a;
|
|
759
|
+
const label = fieldText(field.name);
|
|
760
|
+
const id = ids.field(field.name);
|
|
761
|
+
const errorKey = fieldErrorKey(field.name);
|
|
762
|
+
return (jsxs("div", { className: "space-y-1.5", children: [fieldLabel({ htmlFor: id, text: label, info: t('secrets.serviceFieldInfo'), required }), jsx(Input, { ref: inputRef, id: id, type: field.isSensitive ? 'password' : 'text', value: (_a = fieldValues[field.name]) !== null && _a !== void 0 ? _a : '', onChange: (event) => setFieldValues((current) => ({
|
|
763
|
+
...current,
|
|
764
|
+
[field.name]: event.target.value,
|
|
765
|
+
})), placeholder: placeholder(label), autoComplete: field.isSensitive ? 'new-password' : 'off', spellCheck: false, "aria-invalid": fieldErrors[errorKey] ? true : undefined, "aria-describedby": fieldErrors[errorKey] ? `${id}-error` : undefined, "data-testid": `vm-secret-field-${field.name}` }), fieldError(errorKey, id)] }, field.name));
|
|
766
|
+
};
|
|
767
|
+
const aiFieldBox = (field, required, first = false) => credentialFieldBox({
|
|
768
|
+
field,
|
|
769
|
+
required,
|
|
770
|
+
placeholder: (label) => isEditAi
|
|
771
|
+
? t('secrets.keyKeepPlaceholder')
|
|
772
|
+
: field.name === 'key'
|
|
773
|
+
? t('secrets.keyPlaceholder')
|
|
774
|
+
: t('secrets.serviceFieldPlaceholder', { label }),
|
|
775
|
+
inputRef: first ? firstInputRef : undefined,
|
|
776
|
+
});
|
|
777
|
+
const aiEditHint = isEditAi && aiForm !== 'azure' ? t('secrets.keyKeepHelp') : null;
|
|
778
|
+
const isAiProviderHeld = (provider) => provider.form === 'azure' ? azureFullyHeld : heldAiSlugs.has(provider.slug);
|
|
779
|
+
const aiEntries = aiProviders
|
|
780
|
+
.map((provider) => ({
|
|
781
|
+
value: `${AI_PICK_PREFIX}${provider.slug}`,
|
|
782
|
+
testId: `vm-secret-service-ai-${provider.slug}`,
|
|
783
|
+
displayName: provider.displayName,
|
|
784
|
+
logo: provider.logo,
|
|
785
|
+
marker: !aiKeysSettled
|
|
786
|
+
? t('secrets.serviceNotLoadedMarker')
|
|
787
|
+
: isAiProviderHeld(provider)
|
|
788
|
+
? t('secrets.serviceAddedMarker')
|
|
789
|
+
: null,
|
|
790
|
+
}))
|
|
791
|
+
.sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
792
|
+
const serviceEntries = services
|
|
793
|
+
.map((service) => ({
|
|
794
|
+
value: service.slug,
|
|
795
|
+
testId: `vm-secret-service-${service.slug}`,
|
|
796
|
+
displayName: service.displayName,
|
|
797
|
+
logo: service.logo,
|
|
798
|
+
marker: addedSlugs.has(service.slug)
|
|
799
|
+
? t(fromSandbox ? 'secrets.serviceAddedMarkerSandbox' : 'secrets.serviceAddedMarker')
|
|
800
|
+
: null,
|
|
801
|
+
}))
|
|
802
|
+
.sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
803
|
+
const pickItem = (entry) => (jsxs(CommandItem, { value: entry.displayName, disabled: entry.marker !== null, onSelect: () => pickFromBox(entry.value), className: "cursor-pointer", "data-testid": entry.testId, children: [entry.logo ? (jsx("img", { src: entry.logo, alt: "", className: "h-4 w-4 rounded-sm object-contain" })) : (jsx(KeyRound, { className: "h-4 w-4 text-gray-400", "aria-hidden": "true" })), entry.displayName, entry.marker && jsx("span", { className: "text-xs text-gray-400", children: entry.marker })] }, entry.value));
|
|
804
|
+
const pickHint = isAi
|
|
805
|
+
? { text: t('secrets.aiProviderHint'), testId: 'vm-secret-ai-hint' }
|
|
806
|
+
: platformOnly
|
|
807
|
+
? isFilePicker
|
|
808
|
+
? {
|
|
809
|
+
text: t('secrets.filePickerPurpose', { name: serviceDisplayName }),
|
|
810
|
+
testId: 'vm-secret-file-picker-purpose',
|
|
811
|
+
}
|
|
812
|
+
: {
|
|
813
|
+
text: t('secrets.platformOnlyHint', { name: serviceDisplayName }),
|
|
814
|
+
testId: 'vm-secret-platform-only',
|
|
815
|
+
}
|
|
816
|
+
: isKnown && !fromSandbox
|
|
817
|
+
? { text: t('secrets.serviceAgentHint'), testId: 'vm-secret-service-agent-hint' }
|
|
818
|
+
: null;
|
|
819
|
+
const addLabel = t(isCustom
|
|
820
|
+
? 'secrets.addEnvVarTitle'
|
|
821
|
+
: isLlmBox
|
|
822
|
+
? 'secrets.addLlmTitle'
|
|
823
|
+
: 'secrets.addServiceTitle');
|
|
824
|
+
// Listed as an environment variable, a bound key keeps that title even when its credential did not answer.
|
|
825
|
+
const editLabel = t(isEditCustom || (bound && !fromServicesTab)
|
|
826
|
+
? 'secrets.editEnvVarTitle'
|
|
827
|
+
: isEditAi
|
|
828
|
+
? 'secrets.editLlmTitle'
|
|
829
|
+
: 'secrets.editServiceTitle');
|
|
830
|
+
const title = isLink
|
|
831
|
+
? t('secrets.linkTitle', { name: serviceDisplayName })
|
|
832
|
+
: isCreate
|
|
833
|
+
? addLabel
|
|
834
|
+
: editLabel;
|
|
835
|
+
const primaryLabel = isLink ? t('secrets.save') : isCreate ? addLabel : t('secrets.saveChanges');
|
|
836
|
+
const keyHelpText = isEditCustom && !readsServiceKey ? t('secrets.keyKeepHelp') : null;
|
|
837
|
+
const keyReadFromLine = (name) => (jsxs("div", { className: "space-y-1.5", children: [jsx("span", { className: labelClass, children: t('secrets.fieldKey') }), jsx("p", { className: "rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700", "data-testid": "vm-secret-key-read-from", children: t('secrets.keyReadFromService', { name }) })] }));
|
|
838
|
+
const serviceLine = (jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-900", "data-testid": "vm-secret-service", children: [serviceLogo ? (jsx("img", { src: serviceLogo, alt: "", className: "h-5 w-5 rounded-sm object-contain" })) : (jsx(KeyRound, { className: "h-5 w-5 text-gray-400", "aria-hidden": "true" })), jsx("span", { className: "font-medium", children: serviceDisplayName })] }));
|
|
839
|
+
return (jsx(Dialog, { open: open, onOpenChange: (next) => !isSaving && onOpenChange(next), children: jsxs(DialogContent, { className: "max-h-[90vh] w-full max-w-lg overflow-y-auto", "data-testid": "vm-secret-dialog",
|
|
840
|
+
// Land in the first box, not on its info icon (whose tooltip would open).
|
|
841
|
+
onOpenAutoFocus: (event) => {
|
|
842
|
+
var _a, _b;
|
|
843
|
+
event.preventDefault();
|
|
844
|
+
// A greyed-out box refuses focus, which would leave it behind the dialog.
|
|
845
|
+
const box = boxInputRef.current;
|
|
846
|
+
((_b = (_a = (box && !box.disabled ? box : null)) !== null && _a !== void 0 ? _a : firstInputRef.current) !== null && _b !== void 0 ? _b : event.currentTarget).focus();
|
|
847
|
+
}, children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { className: "ibl-dialog-title", children: title }), jsx(DialogDescription, { children: t('secrets.dialogDescription') })] }), jsxs("form", { onSubmit: handleSubmit, noValidate: true, className: "mt-1 grid gap-5", children: [showServiceSelect && (jsxs("div", { className: "space-y-1.5", children: [fieldLabel({
|
|
848
|
+
// cmdk puts its own id on the input, so a `for` could not reach it.
|
|
849
|
+
onClick: () => { var _a; return (_a = boxInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
850
|
+
text: boxLabel,
|
|
851
|
+
info: t(isLlmBox ? 'secrets.llmInfo' : 'secrets.serviceInfo'),
|
|
852
|
+
required: true,
|
|
853
|
+
}), serviceSlug ? (jsxs("div", { className: "border-input flex min-h-9 items-center justify-between gap-2 rounded-md border px-3 py-1", "data-testid": "vm-secret-service-picked", children: [serviceLine, !credentialSaved && (jsx(Button, { ref: changeButtonRef, type: "button", variant: "ghost", size: "sm", className: "h-7 cursor-pointer px-2 text-xs", disabled: isSaving, onClick: reopenBox, "data-testid": "vm-secret-service-change", children: t('secrets.changeService') }))] })) : (jsxs(Command, { label: boxLabel, className: cn('border-input focus-within:ring-ring h-auto rounded-md border bg-transparent focus-within:ring-1', !showSuggestions && '[&_[cmdk-input-wrapper]]:border-b-0'),
|
|
854
|
+
// A press on a suggestion must not take focus from the box, or the list closes before its click lands.
|
|
855
|
+
onMouseDown: (event) => {
|
|
856
|
+
var _a;
|
|
857
|
+
if (event.target === boxInputRef.current)
|
|
858
|
+
return;
|
|
859
|
+
event.preventDefault();
|
|
860
|
+
(_a = boxInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
861
|
+
}, children: [jsx(CommandInput, { ref: boxInputRef, value: boxSearch, onValueChange: setBoxSearch, onFocus: () => setBoxFocused(true), disabled: boxDisabled, placeholder: t(choices === 'loading'
|
|
862
|
+
? 'secrets.loading'
|
|
863
|
+
: isLlmBox
|
|
864
|
+
? 'secrets.llmPlaceholder'
|
|
865
|
+
: 'secrets.servicePlaceholder'), className: "h-9 py-1", "aria-invalid": fieldErrors.service ? true : undefined, "aria-describedby": fieldErrors.service ? `${ids.service}-error` : undefined, "data-testid": "vm-secret-service-select" }), showSuggestions && (jsxs(CommandList, { label: boxLabel, className: "max-h-56 p-1", children: [jsx(CommandEmpty, { className: "px-3 py-4 text-center text-sm text-gray-500", "data-testid": "vm-secret-service-no-match", children: t(isLlmBox ? 'secrets.noMatchLlm' : 'secrets.noMatchService') }), [...aiEntries, ...serviceEntries].map(pickItem)] }))] })), pickHint && (jsx("p", { className: "text-xs text-gray-500", "data-testid": pickHint.testId, children: pickHint.text })), fieldError('service', ids.service), choices === 'failed' && (jsxs("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "vm-secret-choices-failed", children: [jsx("p", { role: "alert", className: "text-xs text-red-600", children: t('secrets.choicesFailed') }), onRetryChoices && (jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onRetryChoices, "data-testid": "vm-secret-choices-retry", children: t('secrets.tryAgain') }))] }))] })), !isCreate && !isEditCustom && (jsxs("div", { className: "space-y-1.5", children: [jsx("span", { className: labelClass, children: boxLabel }), serviceLine] })), credentialSaved && !sourceFieldRefused && (jsx("p", { role: "status", className: "text-sm text-gray-700", "data-testid": "vm-secret-second-write", children: t(credentialReadFailed ? 'secrets.secondWriteRetry' : 'secrets.secondWriteFailed', {
|
|
866
|
+
name: serviceDisplayName,
|
|
867
|
+
}) })), showServiceFields &&
|
|
868
|
+
serviceFields.map((field, index) => credentialFieldBox({
|
|
869
|
+
field,
|
|
870
|
+
required: !isEditService && field.required,
|
|
871
|
+
placeholder: (label) => isEditService && field.isSensitive
|
|
872
|
+
? t('secrets.keyKeepPlaceholder')
|
|
873
|
+
: t('secrets.serviceFieldPlaceholder', { label }),
|
|
874
|
+
inputRef: index === 0 ? firstInputRef : undefined,
|
|
875
|
+
})), isAi &&
|
|
876
|
+
aiForm === 'fields' &&
|
|
877
|
+
aiFields.map((field, index) => aiFieldBox(field, field.required && !isEditAi, index === 0)), isAi && aiForm === 'azure' && (jsx(AzureModelFields, { models: pickableAzureModels, selected: azureSelected, configs: azureConfigs, onSelectedChange: setAzureSelected, onConfigsChange: setAzureConfigs, mode: isEditAi ? 'edit' : 'add', errors: azureErrors, loading: Boolean(isLoadingLlmProviders), modelsNotice: azureModelsNotice, onRetryModels: isLlmProvidersError && username ? () => void refetchLlmProviders() : undefined })), aiEditHint && (jsx("p", { className: "text-xs text-gray-500", "data-testid": "vm-secret-ai-hint", children: aiEditHint })), isCustom && (jsxs(Fragment, { children: [jsxs("div", { className: "space-y-1.5", children: [fieldLabel({
|
|
878
|
+
htmlFor: ids.name,
|
|
879
|
+
text: t('secrets.fieldName'),
|
|
880
|
+
info: t('secrets.nameInfo'),
|
|
881
|
+
required: true,
|
|
882
|
+
}), jsx(Input, { ref: firstInputRef, id: ids.name, value: name, maxLength: NAME_MAX_LENGTH, onChange: (event) => setName(event.target.value), placeholder: t('secrets.namePlaceholder'), "aria-invalid": fieldErrors.name ? true : undefined, "aria-describedby": fieldErrors.name ? `${ids.name}-error` : undefined, required: true }), fieldError('name', ids.name)] }), secret && readsServiceKey ? (keyReadFromLine(secret.name)) : (jsxs("div", { className: "space-y-1.5", children: [fieldLabel({
|
|
883
|
+
htmlFor: ids.value,
|
|
884
|
+
text: t('secrets.fieldKey'),
|
|
885
|
+
info: t('secrets.keyInfo'),
|
|
886
|
+
required: !isEditCustom,
|
|
887
|
+
}), jsx(Input, { id: ids.value, type: "password", value: value, onChange: (event) => setValue(event.target.value), placeholder: isEditCustom ? t('secrets.keyKeepPlaceholder') : t('secrets.keyPlaceholder'), autoComplete: "new-password", spellCheck: false, "aria-invalid": fieldErrors.value ? true : undefined, "aria-describedby": [
|
|
888
|
+
keyHelpText ? ids.valueHelp : '',
|
|
889
|
+
fieldErrors.value ? `${ids.value}-error` : '',
|
|
890
|
+
]
|
|
891
|
+
.filter(Boolean)
|
|
892
|
+
.join(' '), required: !isEditCustom, "data-testid": "vm-secret-value" }), keyHelpText && (jsx("p", { id: ids.valueHelp, className: "text-xs text-gray-500", children: keyHelpText })), fieldError('value', ids.value)] }))] })), isLink && keyReadFromLine(serviceDisplayName), asksHosts && (jsxs("div", { className: "space-y-1.5", children: [fieldLabel({
|
|
893
|
+
htmlFor: ids.hosts,
|
|
894
|
+
text: t('secrets.fieldHosts'),
|
|
895
|
+
info: t('secrets.hostsInfo'),
|
|
896
|
+
required: true,
|
|
897
|
+
}), jsx(HostPortChipInput, { id: ids.hosts, value: hosts, onChange: setHosts, defaultPort: VIRTUAL_MACHINE_DEFAULT_HOST_PORT, placeholder: t('secrets.hostsPlaceholder'), hint: isKnown ? t('secrets.serviceHostsHint') : t('secrets.hostsHint'), listLabel: t('secrets.fieldHosts'), error: fieldErrors.allow_hosts, testId: "vm-secret-hosts" })] })), showEnvVar && (jsxs("div", { className: "space-y-1.5", children: [fieldLabel({
|
|
898
|
+
htmlFor: ids.envVar,
|
|
899
|
+
text: t('secrets.fieldEnvVar'),
|
|
900
|
+
info: t('secrets.envVarInfo'),
|
|
901
|
+
required: !envVarReadOnly,
|
|
902
|
+
}), jsx(Input, { id: ids.envVar, value: envVar, maxLength: VIRTUAL_MACHINE_ENV_VAR_MAX_LENGTH, readOnly: envVarReadOnly, disabled: envVarReadOnly, onChange: (event) => {
|
|
903
|
+
setEnvVar(event.target.value);
|
|
904
|
+
// Emptying the box hands the variable back to the name.
|
|
905
|
+
setEnvVarTouched(event.target.value.length > 0);
|
|
906
|
+
}, placeholder: t('secrets.envVarPlaceholder'), autoCapitalize: "characters", autoComplete: "off", spellCheck: false, className: "font-mono", "aria-invalid": fieldErrors.env_var ? true : undefined, "aria-describedby": [ids.envVarHelp, fieldErrors.env_var ? `${ids.envVar}-error` : '']
|
|
208
907
|
.filter(Boolean)
|
|
209
|
-
.join(' '),
|
|
210
|
-
? t('virtualMachineSecrets.valueKeepHelp')
|
|
211
|
-
: t('virtualMachineSecrets.valueHelp', {
|
|
212
|
-
min: VIRTUAL_MACHINE_SECRET_VALUE_MIN_LENGTH,
|
|
213
|
-
}) }), fieldError('value', ids.value)] })) : (jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "space-y-1.5", children: [jsx(Label, { id: ids.credentialLabel, htmlFor: ids.credential, className: "flex items-center text-sm font-medium text-[#646464]", children: t('virtualMachineSecrets.fieldCredential') }), credentials.length === 0 ? (jsx("p", { className: "text-xs text-gray-500", "data-testid": "vm-secret-no-credentials", children: t('virtualMachineSecrets.noCredentials') })) : (jsxs(Select, { value: credentialId, onValueChange: (next) => {
|
|
214
|
-
setCredentialId(next);
|
|
215
|
-
setField('');
|
|
216
|
-
}, children: [jsx(SelectTrigger, { id: ids.credential, "aria-labelledby": ids.credentialLabel, "aria-invalid": fieldErrors.source_credential_id ? true : undefined, "data-testid": "vm-secret-credential-select", children: jsx(SelectValue, { placeholder: t('virtualMachineSecrets.credentialPlaceholder') }) }), jsx(SelectContent, { children: credentials.map((option) => (jsx(SelectItem, { value: String(option.id), children: option.name }, option.id))) })] })), fieldError('source_credential_id', ids.credential)] }), jsxs("div", { className: "space-y-1.5", children: [jsx(Label, { id: ids.fieldLabel, htmlFor: ids.field, className: "flex items-center text-sm font-medium text-[#646464]", children: t('virtualMachineSecrets.fieldCredentialField') }), jsxs(Select, { value: field, onValueChange: setField, disabled: !selectedCredential || credentialFields.length === 0, children: [jsx(SelectTrigger, { id: ids.field, "aria-labelledby": ids.fieldLabel, "aria-invalid": fieldErrors.source_field ? true : undefined, "data-testid": "vm-secret-field-select", children: jsx(SelectValue, { placeholder: t('virtualMachineSecrets.credentialFieldPlaceholder') }) }), jsx(SelectContent, { children: credentialFields.map((key) => (jsx(SelectItem, { value: key, children: key }, key))) })] }), selectedCredential && credentialFields.length === 0 && (jsx("p", { className: "text-xs text-gray-500", children: t('virtualMachineSecrets.credentialNoFields') })), fieldError('source_field', ids.field)] })] })), jsxs(DialogFooter, { children: [jsx(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSaving, children: t('virtualMachineSecrets.cancel') }), jsxs(Button, { type: "submit", disabled: isSaving, "data-testid": "vm-secret-save", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", children: [isSaving && jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }), isEdit
|
|
217
|
-
? t('virtualMachineSecrets.saveChanges')
|
|
218
|
-
: t('virtualMachineSecrets.createSecret')] })] })] })] }) }));
|
|
908
|
+
.join(' '), "data-testid": "vm-secret-env-var" }), jsx("p", { id: ids.envVarHelp, className: "text-xs text-gray-500", children: envVarReadOnly ? t('secrets.envVarReadOnlyHelp') : t('secrets.envVarHelp') }), fieldError('env_var', ids.envVar)] })), formError && (jsx("p", { role: "alert", "data-testid": "vm-secret-form-error", className: "text-sm text-red-600", children: formError })), jsxs(DialogFooter, { children: [jsx(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSaving, children: t('secrets.cancel') }), jsxs(Button, { type: "submit", disabled: isSaving, "data-testid": "vm-secret-save", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", children: [isSaving && jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }), primaryLabel] })] })] })] }) }));
|
|
219
909
|
}
|
|
220
910
|
|
|
221
|
-
export { VmSecretDialog };
|
|
911
|
+
export { VmSecretDialog, parsePick };
|
|
222
912
|
//# sourceMappingURL=vm-secret-dialog.js.map
|