Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dcf1162
Merge branch 'main' of https://github.com/devtron-labs/devtron-fe-com…
arunjaindev Oct 9, 2025
d5d6c46
chore: version bump
arunjaindev Oct 9, 2025
4fbef3b
Merge pull request #924 from devtron-labs/chore/sync-main
arunjaindev Oct 9, 2025
40388fb
feat: use lowercase f in filter button
Oct 23, 2025
3806d64
feat: add restart to ResourceBrowserActions
Oct 25, 2025
7669467
chore: bump version
Oct 27, 2025
94337c4
chore: bump version
Oct 27, 2025
4346c48
Merge pull request #936 from devtron-labs/feat/misc-tasks
whoami-amrit Oct 27, 2025
b2adc39
Merge branch 'main' of https://github.com/devtron-labs/devtron-fe-com…
arunjaindev Nov 12, 2025
9d67971
Merge pull request #959 from devtron-labs/chore/sync-main-dev-12-11
arunjaindev Nov 12, 2025
c5600c6
feat: observability routing url added in the constants
shivani170 Oct 8, 2025
5e85834
feat: replaced all customer with tenants
shivani170 Nov 4, 2025
6cb6860
feat: breadcrumb css updated
shivani170 Nov 7, 2025
b9feabe
chore: icon added
shivani170 Nov 11, 2025
4619bfd
chore: code refactoring
shivani170 Nov 11, 2025
9ee12b1
chore: day picker range controller fixes
shivani170 Nov 12, 2025
9a20656
chore: version bump
shivani170 Nov 12, 2025
441c291
chore: js extension removed
shivani170 Nov 13, 2025
b28b467
chore: eslint ignore added
shivani170 Nov 13, 2025
dbf46d5
chore: stroke added in binoculars
shivani170 Nov 13, 2025
f78c632
Merge pull request #960 from devtron-labs/feat/datepicker-range-43
shivani170 Nov 13, 2025
363769f
chore: bump version to 1.20.8 in package.json and package-lock.json
arunjaindev Nov 21, 2025
7a02756
chore: bump version to 1.21.0 in package.json and package-lock.json
arunjaindev Nov 21, 2025
01e0d21
Merge pull request #966 from devtron-labs/bump-rc-43
arunjaindev Nov 21, 2025
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "1.20.7",
"version": "1.21.0",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-binoculars.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-enter-fullscreen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-exit-fullscreen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions src/Common/BreadCrumb/BreadCrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React, { useMemo, useEffect } from 'react'
import { Link, useRouteMatch, useParams } from 'react-router-dom'
import { useBreadcrumbContext } from './BreadcrumbStore'
import { getBreadCrumbSeparator, useBreadcrumbContext } from './BreadcrumbStore'
import { ConditionalWrap } from '../Helper'
import { Breadcrumb, Breadcrumbs, UseBreadcrumbOptionalProps, UseBreadcrumbState } from './Types'

Expand Down Expand Up @@ -90,7 +90,7 @@ export function useBreadcrumb(props?: UseBreadcrumbOptionalProps, deps?: any[]):
export const BreadCrumb: React.FC<Breadcrumbs> = ({
breadcrumbs,
sep = '/',
className = 'dc__devtron-breadcrumb__item',
className = 'dc__devtron-breadcrumb__item fs-16 fw-4 lh-1-5 dc__ellipsis-right dc__mxw-155',
}) => {
const { url } = useRouteMatch()
const filteredCrumbs = breadcrumbs.filter((crumb) => !!crumb.name)
Expand All @@ -114,9 +114,7 @@ export const BreadCrumb: React.FC<Breadcrumbs> = ({
{breadcrumb.name}
</ConditionalWrap>

{idx + 1 !== filteredCrumbs.length && breadcrumb.name && (
<span className={`${className}__separator cn-5`}>{sep}</span>
)}
{idx + 1 !== filteredCrumbs.length && breadcrumb.name && getBreadCrumbSeparator()}
</React.Fragment>
))}
</>
Expand Down
7 changes: 6 additions & 1 deletion src/Common/BreadCrumb/BreadcrumbStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ const initialState = {
}

export const BreadcrumbText = ({ heading, isActive, shouldTruncate = false }: BreadcrumbTextProps) => (
<h2 className={`m-0 fs-16 fw-6 lh-32 ${shouldTruncate ? 'dc__truncate' : ''} ${isActive ? 'cn-9' : 'cb-5'}`}>{heading}</h2>
<span className={`dc__breadcrumb-text cb-5 fs-16 lh-1-5 ${shouldTruncate ? 'dc__truncate' : ''} ${isActive ? 'cn-9 fw-6' : 'cb-5 fw-4 dc__mxw-155 dc__ellipsis-right'}`}>{heading}</span>
)

export const getBreadCrumbSeparator = (sep: string = '/') => (
<span className="dc__devtron-breadcrumb__item__separator">{sep}</span>
)


const Store = ({ children }) => {
const [state, setState] = useState(initialState)
return <BreadcrumbContext.Provider value={{ state, setState }}>{children}</BreadcrumbContext.Provider>
Expand Down
5 changes: 5 additions & 0 deletions src/Common/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const PATTERNS = {
}

const GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP = '/global-config/templates/devtron-apps'
const OBSERVABILITY_ROOT = '/observability'

export const URLS = {
LOGIN: '/login',
Expand Down Expand Up @@ -88,6 +89,10 @@ export const URLS = {
GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP_DETAIL: `${GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP}/detail/:appId`,
LICENSE_AUTH: '/license-auth',
GLOBAL_CONFIG_EDIT_CLUSTER: '/global-config/cluster-env/edit/:clusterId',
// OBSERVABILITY
OBSERVABILITY: OBSERVABILITY_ROOT,
OBSERVABILITY_OVERVIEW: `${OBSERVABILITY_ROOT}/overview`,
OBSERVABILITY_CUSTOMER_LIST: `${OBSERVABILITY_ROOT}/tenants`,
} as const

export const ROUTES = {
Expand Down
1 change: 1 addition & 0 deletions src/Pages/ResourceBrowser/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,5 @@ export enum ResourceBrowserActionMenuEnum {
terminal = 'terminal',
delete = 'delete',
vulnerability = 'vulnerability',
restart = 'restart',
}
173 changes: 173 additions & 0 deletions src/Shared/Components/DatePicker/DayPickerRangeController.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
/*
* Copyright (c) 2024. Devtron Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { useState } from 'react'
import { DayPickerRangeController, isInclusivelyBeforeDay } from 'react-dates'
// eslint-disable-next-line import/extensions
import CustomizableCalendarDay from 'react-dates/esm/components/CustomizableCalendarDay.js'
import moment, { Moment } from 'moment'

import { ComponentSizeType } from '@Shared/constants'

import 'react-dates/initialize'

import { Button } from '../Button'
import { Icon } from '../Icon'
import { customDayStyles, DayPickerCalendarInfoHorizontal, DayPickerRangeControllerPresets, styles } from './constants'
import { DatePickerRangeControllerProps } from './types'

import 'react-dates/lib/css/_datepicker.css'

export const DatePickerRangeController = ({
handlePredefinedRange,
handleApply,
calendar,
calendarInputs,
handleDateInput,
handleDatesChange,
calendarValue,
focusedInput,
handleFocusChange,
}: DatePickerRangeControllerProps) => {
const [showCalendar, setShowCalender] = useState(false)
const onClickApplyTimeChange = () => {
setShowCalender(false)
handleApply()
}

const onClickPredefinedTimeRange = (startDate: Moment, endDate: Moment, endStr: string) => () => {
handlePredefinedRange(startDate, endDate, endStr)
setShowCalender(false)
}

const renderDatePresets = () => (
<div
className="flex left top"
style={{
...styles.PresetDateRangePicker_panel,
...DayPickerCalendarInfoHorizontal,
...{
PresetDateRangePicker_panel: {
padding: '0px',
width: '200px',
height: '100%',
},
...styles.DayPicker__horizontal,
},
}}
>
<div className="w-300 h-300 p-16">
<p className="mb-16 fw-6">Pick time range</p>
<div>
<div className="w-100 mb-16">
<span>From</span>
<input
type="text"
className="dc__block w-100 dc__border"
value={calendarInputs.startDate}
onChange={(event) => {
handleDateInput('startDate', event.target.value)
}}
/>
</div>
<div className="w-100 mb-16">
<span>To</span>
<input
type="text"
className="dc__block w-100 dc__border"
value={calendarInputs.endDate}
onChange={(event) => {
handleDateInput('endDate', event.target.value)
}}
/>
</div>
<Button
text="Apply Time Range"
onClick={onClickApplyTimeChange}
dataTestId="apply-time-range"
size={ComponentSizeType.medium}
/>
</div>
</div>
<div className="w-200 p-16 h-300">
{DayPickerRangeControllerPresets.map(({ text, startDate, endDate, endStr }) => {
const isSelected =
startDate.isSame(calendar.startDate, 'minute') &&
startDate.isSame(calendar.startDate, 'hour') &&
startDate.isSame(calendar.startDate, 'day') &&
endDate.isSame(calendar.endDate, 'day')
let buttonStyles = {
...styles.PresetDateRangePicker_button,
}
if (isSelected) {
buttonStyles = {
...buttonStyles,
...styles.PresetDateRangePicker_button__selected,
}
}
return (
<button
type="button"
key={text}
style={{ ...buttonStyles, textAlign: 'left' }}
onClick={onClickPredefinedTimeRange(startDate, endDate, endStr)}
>
{text}
</button>
)
})}
</div>
</div>
)

const toggleCalender = () => {
setShowCalender(!showCalendar)
}

const hideCalender = () => setShowCalender(false)

return (
<>
<div
data-testid="app-metrics-range-picker-box"
className="flex h-36"
style={{ borderRadius: '4px', border: 'solid 1px var(--N200)' }}
onClick={toggleCalender}
>
<p className="cursor mb-0 h-32 p-6">{calendarValue}</p>
<Icon name="ic-caret-down-small" color="N600" />
</div>
{showCalendar && (
<DayPickerRangeController
startDate={calendar.startDate}
endDate={calendar.endDate}
focusedInput={focusedInput}
onDatesChange={handleDatesChange}
onFocusChange={handleFocusChange}
numberOfMonths={1}
withPortal
renderCalendarInfo={renderDatePresets}
calendarInfoPosition="after"
hideKeyboardShortcutsPanel
isOutsideRange={(day) => !isInclusivelyBeforeDay(day, moment())} // enable past dates
renderCalendarDay={(props) => <CustomizableCalendarDay {...props} {...customDayStyles} />}
onOutsideClick={hideCalender}
initialVisibleMonth={() => moment().subtract(2, 'd')} //
/>
)}
</>
)
}
79 changes: 76 additions & 3 deletions src/Shared/Components/DatePicker/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

const selectedStyles = {
import moment from 'moment'

export const selectedStyles = {
background: 'var(--B100)',
color: 'var(--B500)',

Expand All @@ -24,7 +26,7 @@ const selectedStyles = {
},
}

const selectedSpanStyles = {
export const selectedSpanStyles = {
background: 'var(--B100)',
color: 'var(--B500)',
hover: {
Expand All @@ -33,7 +35,7 @@ const selectedSpanStyles = {
},
}

const hoveredSpanStyles = {
export const hoveredSpanStyles = {
background: 'var(--B100)',
color: 'var(--B500)',
}
Expand Down Expand Up @@ -145,3 +147,74 @@ export const DATE_PICKER_IDS = {
MONTH: 'month_picker',
TIME: 'time_picker',
}

export const styles = {
PresetDateRangePicker_panel: {
padding: '0px',
width: '200px',
height: '100%',
},
PresetDateRangePicker_button: {
width: '188px',
background: 'var(--transparent)',
border: 'none',
color: 'var(--N900)',
padding: '8px',
font: 'inherit',
fontWeight: 500,
lineHeight: 'normal',
overflow: 'visible',
cursor: 'pointer',
':active': {
outline: 0,
},
},
DayPicker__horizontal: {
borderRadius: '4px',
},
PresetDateRangePicker_button__selected: {
color: 'var(--B500)',
fontWeight: 600,
background: 'var(--B100)',
outline: 'none',
},
}

export const DayPickerCalendarInfoHorizontal = {
width: '532px',
boxShadow: 'none',
}

export const DayPickerRangeControllerPresets = [
{ text: 'Last 5 minutes', endDate: moment(), startDate: moment().subtract(5, 'minutes'), endStr: 'now-5m' },
{ text: 'Last 30 minutes', endDate: moment(), startDate: moment().subtract(30, 'minutes'), endStr: 'now-30m' },
{ text: 'Last 1 hour', endDate: moment(), startDate: moment().subtract(1, 'hours'), endStr: 'now-1h' },
{ text: 'Last 24 hours', endDate: moment(), startDate: moment().subtract(24, 'hours'), endStr: 'now-24h' },
{ text: 'Last 7 days', endDate: moment(), startDate: moment().subtract(7, 'days'), endStr: 'now-7d' },
{ text: 'Last 1 month', endDate: moment(), startDate: moment().subtract(1, 'months'), endStr: 'now-1M' },
{ text: 'Last 6 months', endDate: moment(), startDate: moment().subtract(6, 'months'), endStr: 'now-6M' },
]

/**
* Returns a string representing the range of dates
* given by the start and end dates. If the end date
* is 'now' and the start date includes 'now',
* it will return the corresponding range from the
* DayPickerRangeControllerPresets array.
* @param startDateStr - the start date string
* @param endDateStr - the end date string
* @returns - a string representing the range of dates
*/

export function getCalendarValue(startDateStr: string, endDateStr: string): string {
let str: string = `${startDateStr} - ${endDateStr}`
if (endDateStr === 'now' && startDateStr.includes('now')) {
const range = DayPickerRangeControllerPresets.find((d) => d.endStr === startDateStr)
if (range) {
str = range.text
} else {
str = `${startDateStr} - ${endDateStr}`
}
}
return str
}
1 change: 1 addition & 0 deletions src/Shared/Components/DatePicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

export * from './constants'
export { default as DateTimePicker } from './DateTimePicker'
export { DatePickerRangeController } from './DayPickerRangeController'
export * from './MonthlySelect'
export { default as SingleDatePickerComponent } from './SingleDatePickerComponent'
export * from './TimeSelect'
Expand Down
Loading
Loading