Skip to content

Commit a14f557

Browse files
committed
Merge branch 'feature/application-template' of github.com:devtron-labs/devtron-fe-common-lib into feature/application-template
2 parents 52b05c6 + 774805f commit a14f557

File tree

20 files changed

+1922
-243
lines changed

20 files changed

+1922
-243
lines changed

package-lock.json

Lines changed: 1820 additions & 207 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Assets/IconV2/ic-card-stack.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Assets/IconV2/ic-copy.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Assets/IconV2/ic-new.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Common/GenericDescription/GenericDescription.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import { useState, useRef, useEffect } from 'react'
1818
import Tippy from '@tippyjs/react'
1919
import ReactMde from 'react-mde'
2020
import 'react-mde/lib/styles/css/react-mde-all.css'
21-
import moment from 'moment'
2221
import Markdown from '../Markdown/MarkDown'
23-
import { DATE_TIME_FORMATS, deepEqual, showError } from '..'
22+
import { deepEqual, showError } from '..'
2423
import './genericDescription.scss'
2524
import { ReactComponent as Edit } from '../../Assets/Icon/ic-pencil.svg'
2625
import { GenericDescriptionProps, MDEditorSelectedTabType } from './types'
@@ -43,6 +42,7 @@ import { ReactComponent as OrderedListIcon } from '../../Assets/Icon/ic-ordered-
4342
import { ReactComponent as UnorderedListIcon } from '../../Assets/Icon/ic-unordered-list.svg'
4443
import { ReactComponent as CheckedListIcon } from '../../Assets/Icon/ic-checked-list.svg'
4544
import { DESCRIPTION_EMPTY_ERROR_MSG, DESCRIPTION_UNSAVED_CHANGES_MSG } from './constant'
45+
import { getParsedUpdatedOnDate } from './utils'
4646

4747
const GenericDescription = ({
4848
text,
@@ -65,9 +65,7 @@ const GenericDescription = ({
6565
setModifiedDescriptionText(text)
6666
}, [text])
6767

68-
// TODO (Arun): Replace with dayjs
69-
const _moment = moment(updatedOn)
70-
const _date = _moment.isValid() ? _moment.format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT) : updatedOn
68+
const _date = getParsedUpdatedOnDate(updatedOn)
7169

7270
const validateDescriptionText = (description: string): boolean => {
7371
let isValid = true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import moment from 'moment'
2+
import { DATE_TIME_FORMATS, ZERO_TIME_STRING } from '@Common/Constants'
3+
4+
export const getParsedUpdatedOnDate = (updatedOn: string) => {
5+
if (!updatedOn || updatedOn === ZERO_TIME_STRING) {
6+
return ''
7+
}
8+
9+
const _moment = moment(updatedOn)
10+
11+
return _moment.isValid() ? _moment.format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT) : updatedOn
12+
}

src/Common/Types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,10 @@ export interface CiMaterial {
909909
id: number
910910
gitMaterialName: string
911911
isRegex?: boolean
912+
/**
913+
* Available only for template view
914+
*/
915+
gitMaterialUrl: string
912916
}
913917

914918
export interface Task {
@@ -1092,4 +1096,4 @@ export enum ActionTypes {
10921096
UPDATE = 'update',
10931097
EDIT = 'edit',
10941098
APPROVER = 'approver',
1095-
}
1099+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ export enum GetTemplateAPIRouteType {
7070
CD_DEPLOY_CONFIG = 'cd-deploy-config',
7171
CD_ENV_LIST = 'cd-env-list',
7272
CONFIG_DEPLOYMENT_TEMPLATE = 'config/deployment-template',
73+
CONFIG_DEPLOYMENT_TEMPLATE_ENV = 'config/deployment-template/env',
7374
CONFIG_DATA = 'config-data',
7475
CONFIG_CM = 'config/config-map',
7576
CONFIG_CS = 'config/secret',
77+
WORKFLOW = 'workflow',
7678
WORKFLOW_LIST = 'workflow/list',
7779
OVERVIEW = 'overview',
7880
README = 'readme',
@@ -83,6 +85,8 @@ export enum GetTemplateAPIRouteType {
8385
CD_PIPELINE = 'cd-pipeline',
8486
CONFIG_STRATEGY = 'config/strategy',
8587
CHART_REF = 'chartRef',
88+
PIPELINE_SUGGEST_CI = 'pipeline/suggest/ci',
89+
PIPELINE_SUGGEST_CD = 'pipeline/suggest/cd',
8690
}
8791

8892
export interface GetTemplateAPIRouteProps {

src/Shared/Components/FloatingVariablesSuggestions/FloatingVariablesSuggestions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ const FloatingVariablesSuggestions = ({
4444
bounds,
4545
hideObjectVariables = true,
4646
showValueOnHover = true,
47+
isTemplateView,
4748
}: FloatingVariablesSuggestionsProps) => {
4849
const [isActive, setIsActive] = useState<boolean>(false)
4950
const [collapsedPosition, setCollapsedPosition] = useState<{ x: number; y: number }>({ x: 0, y: 0 })
5051
const [expandedPosition, setExpandedPosition] = useState<{ x: number; y: number }>({ x: 0, y: 0 })
5152

5253
const [loadingScopedVariables, variablesData, error, reloadScopedVariables] = useAsync(
53-
() => getScopedVariables(appId, envId, clusterId, hideObjectVariables),
54+
() => getScopedVariables(appId, envId, clusterId, { hideObjectVariables, isTemplateView }),
5455
[appId, envId, clusterId],
5556
)
5657

src/Shared/Components/FloatingVariablesSuggestions/service.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ const getScopedVariablesQuery = ({
2929
appId,
3030
envId,
3131
clusterId,
32-
}: Pick<FloatingVariablesSuggestionsProps, 'appId' | 'envId' | 'clusterId'>) => {
32+
isTemplateView,
33+
}: Pick<FloatingVariablesSuggestionsProps, 'appId' | 'envId' | 'clusterId' | 'isTemplateView'>) => {
3334
if (!appId) {
3435
return ''
3536
}
3637

37-
let query = `?appId=${appId}&scope={`
38+
let query = `?${isTemplateView ? '' : `appId=${appId}&`}scope={`
3839

39-
query += generateScope('appId', appId)
40+
if (!isTemplateView) {
41+
query += generateScope('appId', appId)
42+
}
4043
query += generateScope('envId', envId)
4144
query += generateScope('clusterId', clusterId)
4245

@@ -53,13 +56,17 @@ export const getScopedVariables = async (
5356
appId: FloatingVariablesSuggestionsProps['appId'],
5457
envId: FloatingVariablesSuggestionsProps['envId'],
5558
clusterId: FloatingVariablesSuggestionsProps['clusterId'],
56-
hideObjectVariables: boolean = true,
59+
{
60+
hideObjectVariables,
61+
isTemplateView,
62+
}: Pick<FloatingVariablesSuggestionsProps, 'isTemplateView'> & { hideObjectVariables?: boolean },
5763
): Promise<ScopedVariableType[]> => {
5864
const { result } = await get<ScopedVariableType[]>(
5965
`${ROUTES.SCOPED_GLOBAL_VARIABLES}${getScopedVariablesQuery({
6066
appId,
6167
envId,
6268
clusterId,
69+
isTemplateView,
6370
})}`,
6471
)
6572
if (!result) {

0 commit comments

Comments
 (0)