Skip to content

Commit 20025f9

Browse files
committed
feat: add getTemplateAPIRoute
1 parent 88c217a commit 20025f9

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
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 } from './utils'
21+
export { getDeploymentStageTitle, getTemplateAPIRoute } from './utils'
2222
export * from './ConfigMapSecret'

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { ResourceKindType } from '@Shared/types'
1718
import { ReactNode, SyntheticEvent } from 'react'
1819

1920
export enum ConfigHeaderTabType {
@@ -54,3 +55,15 @@ export interface OverrideStrategyTippyContentProps {
5455
*/
5556
children?: ReactNode
5657
}
58+
59+
export interface AppConfigProps {
60+
appName: string
61+
resourceKind: Extract<ResourceKindType, ResourceKindType.devtronApplication | ResourceKindType.job>
62+
filteredEnvIds?: string
63+
isTemplateView?: boolean
64+
}
65+
66+
export interface GetTemplateAPIRouteProps {
67+
type: 'git-material'
68+
queryParams: { id: string } & Record<string, string>
69+
}

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

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

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

1921
export const getDeploymentStageTitle = (stage: DeploymentStageType) => {
2022
switch (stage) {
@@ -28,3 +30,8 @@ export const getDeploymentStageTitle = (stage: DeploymentStageType) => {
2830
return '-'
2931
}
3032
}
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)