Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @vivek-devtron @vikramdevtron
* @vivek-devtron
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "4.0.11",
"@devtron-labs/devtron-fe-common-lib": "4.0.12",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@sentry/browser": "7.119.1",
"@sentry/integrations": "7.50.0",
Expand Down
21 changes: 21 additions & 0 deletions src/components/gitOps/BitbucketCloudAuthSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { RadioGroup, RadioGroupItem } from '@devtron-labs/devtron-fe-common-lib'

import { BITBUCKET_CLOUD_AUTH_MODE_OPTIONS } from './constants'
import type { BitbucketCloudAuthSelectorProps } from './gitops.type'

const BitbucketCloudAuthSelector = ({ authMode, handleAuthModeChange }: BitbucketCloudAuthSelectorProps) => (
<RadioGroup
className="radio-group-no-border"
name="toggle-bitbucket-cloud-auth-mode"
value={authMode}
onChange={handleAuthModeChange}
>
{BITBUCKET_CLOUD_AUTH_MODE_OPTIONS.map((option) => (
<RadioGroupItem key={option.value} value={option.value}>
{option.label}
</RadioGroupItem>
))}
</RadioGroup>
)

export default BitbucketCloudAuthSelector
198 changes: 125 additions & 73 deletions src/components/gitOps/GitOpsConfiguration.tsx

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/components/gitOps/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { DocLinkProps } from '@devtron-labs/devtron-fe-common-lib'
import { DocLinkProps, GitOpsAuthModeType } from '@devtron-labs/devtron-fe-common-lib'

import { GitProvider } from '@Components/common/GitTabs/constants'

Expand Down Expand Up @@ -116,3 +116,12 @@ export const PROVIDER_DOC_LINK_MAP: Record<
[GitProvider.AZURE_DEVOPS]: 'GLOBAL_CONFIG_GITOPS_AZURE',
[GitProvider.BITBUCKET_CLOUD]: 'GLOBAL_CONFIG_GITOPS_BITBUCKET',
}

export const UNABLE_TO_DELETE_WARNING =
'Devtron was unable to delete the test repository “devtron-sample-repo-dryrun-…”. Please delete it manually.'

export const BITBUCKET_CLOUD_AUTH_MODE_OPTIONS = [
{ label: 'App Password', value: GitOpsAuthModeType.PASSWORD },
{ label: 'Access Token', value: GitOpsAuthModeType.ACCESS_TOKEN },
{ label: 'API Token', value: GitOpsAuthModeType.API_TOKEN },
]
5 changes: 5 additions & 0 deletions src/components/gitOps/gitops.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,8 @@ export interface UpdateConfirmationDialogProps
*/
enableBitBucketSource: boolean
}

export interface BitbucketCloudAuthSelectorProps {
authMode: GitOpsAuthModeType
handleAuthModeChange: (event: React.SyntheticEvent) => void
}
51 changes: 51 additions & 0 deletions src/components/gitOps/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/

import { GitOpsAuthModeType } from '@devtron-labs/devtron-fe-common-lib'

import { GitProvider } from '@Components/common/GitTabs/constants'
import { GitProviderType } from '@Components/common/GitTabs/types'

export const getGitOpsLabelText = (providerTab: GitProvider): string => {
switch (providerTab) {
Expand All @@ -26,3 +29,51 @@ export const getGitOpsLabelText = (providerTab: GitProvider): string => {
return 'Git Host'
}
}

export const getGitAccessPasswordInputLabel = (providerTab: GitProviderType, authMode: GitOpsAuthModeType): string => {
if (providerTab === GitProvider.AZURE_DEVOPS) {
return 'Azure DevOps Access Token '
}
if (providerTab === GitProvider.BITBUCKET_CLOUD) {
if (authMode === GitOpsAuthModeType.API_TOKEN) {
return 'Token'
}
if (authMode === GitOpsAuthModeType.PASSWORD) {
return 'Password'
}
if (authMode === GitOpsAuthModeType.ACCESS_TOKEN) {
return 'Bearer Token'
}
}
return 'Personal Access Token '
}

export const getGitAccessUsernameInputLabel = (
providerTab: GitProviderType | 'BITBUCKET_DC',
authMode: GitOpsAuthModeType,
): string => {
if (providerTab === GitProvider.GITLAB) {
return 'GitLab Username'
}
if (providerTab === GitProvider.AZURE_DEVOPS) {
return 'Azure DevOps Username'
}
if (providerTab === GitProvider.BITBUCKET_CLOUD) {
if (authMode === GitOpsAuthModeType.API_TOKEN) {
return 'Email'
}
// Using 'Bitbucket Username' for fallback, should be visible only when authMode is PASSWORD
return 'Bitbucket Username'
}
return 'GitHub Username'
}

export const getGitAccessUsernameInputPlaceholder = (
providerTab: GitProvider | 'BITBUCKET_DC',
authMode: GitOpsAuthModeType,
): string => {
if (providerTab === GitProvider.BITBUCKET_CLOUD && authMode === GitOpsAuthModeType.API_TOKEN) {
return 'Enter email'
}
return 'Enter username'
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1738,9 +1738,9 @@ __metadata:
languageName: node
linkType: hard

"@devtron-labs/devtron-fe-common-lib@npm:4.0.11":
version: 4.0.11
resolution: "@devtron-labs/devtron-fe-common-lib@npm:4.0.11"
"@devtron-labs/devtron-fe-common-lib@npm:4.0.12":
version: 4.0.12
resolution: "@devtron-labs/devtron-fe-common-lib@npm:4.0.12"
dependencies:
"@codemirror/autocomplete": "npm:6.18.6"
"@codemirror/lang-json": "npm:6.0.1"
Expand Down Expand Up @@ -1794,7 +1794,7 @@ __metadata:
react-select: 5.8.0
rxjs: ^7.8.1
yaml: ^2.8.3
checksum: 10c0/054e4e16280ac7de048aeeb13d23f281d2963ece4b0ec36622dc4326fe500e3e9fd239423ecae64a442133271ac47728f33fc2ed505097994591c946d1749bde
checksum: 10c0/f4fb753ff5eefd9ee32e6d190d7e1d97583b189912503f59bee892dbcd72cae27d9c7267ad57d985d91f65db618c73b56a4d8c3a69da83773feebae4c9335610
languageName: node
linkType: hard

Expand Down Expand Up @@ -5529,7 +5529,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "dashboard@workspace:."
dependencies:
"@devtron-labs/devtron-fe-common-lib": "npm:4.0.11"
"@devtron-labs/devtron-fe-common-lib": "npm:4.0.12"
"@esbuild-plugins/node-globals-polyfill": "npm:0.2.3"
"@playwright/test": "npm:^1.32.1"
"@sentry/browser": "npm:7.119.1"
Expand Down
Loading