Skip to content

Commit b5b2acf

Browse files
committed
refactor: move getTemplateAPIRoute to fe-lib
1 parent 20025f9 commit b5b2acf

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/Pages/Applications/DevtronApps/Details/AppConfigurations/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ export * from './DeploymentTemplate'
1818
export * from './types'
1919
export * from './constants'
2020
export { default as OverrideStrategyTippyContent } from './OverrideStrategyTippyContent'
21-
export { getDeploymentStageTitle, getTemplateAPIRoute } from './utils'
21+
export { getDeploymentStageTitle } from './utils'
2222
export * from './ConfigMapSecret'

src/Pages/Applications/DevtronApps/Details/AppConfigurations/types.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,19 @@ export interface AppConfigProps {
6363
isTemplateView?: boolean
6464
}
6565

66+
export enum GetTemplateAPIRouteType {
67+
GIT_MATERIAL = 'git-material',
68+
CI_BUILD_CONFIG = 'ci-build-config',
69+
STAGE_STATUS = 'stage-status',
70+
CD_DEPLOY_CONFIG = 'cd-deploy-config',
71+
CD_ENV_LIST = 'cd-env-list',
72+
CONFIG_DEPLOYMENT_TEMPLATE = 'config/deployment-template',
73+
CONFIG_MAP_CREATE = 'config/config-map',
74+
CONFIG_SECRET_CREATE = 'config/secret',
75+
WORKFLOW_LIST = 'workflow/list',
76+
}
77+
6678
export interface GetTemplateAPIRouteProps {
67-
type: 'git-material'
68-
queryParams: { id: string } & Record<string, string>
79+
type: GetTemplateAPIRouteType
80+
queryParams: { id: string } & Record<string, any>
6981
}

src/Pages/Applications/DevtronApps/Details/AppConfigurations/utils.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616

1717
import { DeploymentStageType } from '@Shared/constants'
18-
import { getUrlWithSearchParams } from '@Common/Helper'
19-
import { GetTemplateAPIRouteProps } from './types'
2018

2119
export const getDeploymentStageTitle = (stage: DeploymentStageType) => {
2220
switch (stage) {
@@ -30,8 +28,3 @@ export const getDeploymentStageTitle = (stage: DeploymentStageType) => {
3028
return '-'
3129
}
3230
}
33-
34-
const TEMPLATE_API_ROUTE_PREFIX = '/resource/template/devtron-application/alpha1'
35-
36-
export const getTemplateAPIRoute = ({ type, queryParams }: GetTemplateAPIRouteProps) =>
37-
getUrlWithSearchParams(`${TEMPLATE_API_ROUTE_PREFIX}/${type}`, { templateId: queryParams.id, ...queryParams })

0 commit comments

Comments
 (0)