Skip to content

Commit

Permalink
Merge pull request #2193 from devtron-labs/feat/swap-traffic
Browse files Browse the repository at this point in the history
feat: add swap traffic button
  • Loading branch information
arunjaindev authored Jan 3, 2025
2 parents d5be6cc + 165ecb4 commit a818a7a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ FEATURE_CONFIG_DRIFT_ENABLE=false
FEATURE_PROMO_EMBEDDED_BUTTON_TEXT=
FEATURE_PROMO_EMBEDDED_MODAL_TITLE=
FEATURE_PROMO_EMBEDDED_IFRAME_URL=
FEATURE_SWAP_TRAFFIC_ENABLE=false
FEATURE_RB_SYNC_CLUSTER_ENABLE=false
FEATURE_BULK_RESTART_WORKLOADS_FROM_RB=deployment,rollout,daemonset,statefulset
FEATURE_DEFAULT_MERGE_STRATEGY=
Expand Down
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": "1.3.0-patch-4",
"@devtron-labs/devtron-fe-common-lib": "1.3.0-patch-5",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand Down
34 changes: 25 additions & 9 deletions src/components/app/details/appDetails/SourceInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import HelmAppConfigApplyStatusCard from '@Components/v2/appDetails/sourceInfo/e
const AppDetailsDownloadCard = importComponentFromFELibrary('AppDetailsDownloadCard')
const DeploymentWindowStatusCard = importComponentFromFELibrary('DeploymentWindowStatusCard')
const ConfigSyncStatusButton = importComponentFromFELibrary('ConfigSyncStatusButton', null, 'function')
const SwapTraffic = importComponentFromFELibrary('SwapTraffic', null, 'function')

export const SourceInfo = ({
appDetails,
Expand Down Expand Up @@ -158,15 +159,18 @@ export const SourceInfo = ({
</div>
</Tooltip>
)}
{appDetails?.resourceTree && !isIsolatedEnv && window._env_.FEATURE_CONFIG_DRIFT_ENABLE && ConfigSyncStatusButton && (
<div className="pl-8">
<ConfigSyncStatusButton
areConfigurationsDrifted={appDetails.resourceTree.hasDrift}
appId={appDetails.appId}
envId={envId}
/>
</div>
)}
{appDetails?.resourceTree &&
!isIsolatedEnv &&
window._env_.FEATURE_CONFIG_DRIFT_ENABLE &&
ConfigSyncStatusButton && (
<div className="pl-8">
<ConfigSyncStatusButton
areConfigurationsDrifted={appDetails.resourceTree.hasDrift}
appId={appDetails.appId}
envId={envId}
/>
</div>
)}
{isdeploymentAppDeleting && (
<div data-testid="deleteing-argocd-pipeline" className="flex left">
<Trash className="icon-dim-16 mr-8 ml-12" />
Expand Down Expand Up @@ -214,6 +218,18 @@ export const SourceInfo = ({
style={ButtonStyleType.neutral}
/>
)}
{window._env_.FEATURE_SWAP_TRAFFIC_ENABLE &&
SwapTraffic &&
!!appDetails.pcoId &&
!appDetails.trafficSwitched && (
<SwapTraffic
appName={appDetails.appName}
envName={appDetails.environmentName}
appId={appDetails.appId}
envId={appDetails.environmentId}
pcoId={appDetails.pcoId}
/>
)}
{!isVirtualEnvironment && showHibernateModal && (
<Button
dataTestId="app-details-hibernate-modal-button"
Expand Down
2 changes: 2 additions & 0 deletions src/components/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export interface AppDetails extends CDModalProps {
imageTag?: string
isPipelineTriggered?: boolean
releaseMode: ReleaseMode
trafficSwitched?: boolean
pcoId?: number
}

export interface LabelTag {
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ if (!window || !window._env_) {
FEATURE_CONFIG_DRIFT_ENABLE: false,
FEATURE_PROMO_EMBEDDED_BUTTON_TEXT: '',
FEATURE_PROMO_EMBEDDED_MODAL_TITLE: '',
FEATURE_SWAP_TRAFFIC_ENABLE: false,
FEATURE_BULK_RESTART_WORKLOADS_FROM_RB: 'deployment,rollout,daemonset,statefulset',
FEATURE_RB_SYNC_CLUSTER_ENABLE: true,
FEATURE_PROMO_EMBEDDED_IFRAME_URL: '',
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,10 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"

"@devtron-labs/[email protected]4":
version "1.3.0-patch-4"
resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-1.3.0-patch-4.tgz#4ef2929242914d1a1217becb44990247476476ce"
integrity sha512-soVpUM4gHhPgvDIGfDtnk+wibmvdeKDIcUb6BGDtg51dqJt6PGubX0/btjmtLLrtxTVvtDG0wW1dtN0BK/ok8Q==
"@devtron-labs/[email protected]5":
version "1.3.0-patch-5"
resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-1.3.0-patch-5.tgz#d2fb48716af0d209f4d3d0bb2d6a0bff25a698b6"
integrity sha512-gFgwRlWUAKOT15rbwP3Zhh36d5UYmmxzmO2T1JyzJv+6nKpJFoyZPsR1ku66Ga6G58m5g5z6GoO1exjDWi0sBQ==
dependencies:
"@types/react-dates" "^21.8.6"
ansi_up "^5.2.1"
Expand Down

0 comments on commit a818a7a

Please sign in to comment.