Skip to content

Commit 597d807

Browse files
committed
Merge branch 'main' of https://github.com/devtron-labs/devtron-fe-common-lib into chore/merge-user-export-list
2 parents 58edf31 + 9566cc4 commit 597d807

11 files changed

Lines changed: 454 additions & 218 deletions

File tree

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "4.0.3-pre-0",
3+
"version": "4.0.6-pre-0",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -107,6 +107,7 @@
107107
"@rjsf/utils": "^6.2.4",
108108
"@rjsf/validator-ajv8": "^6.2.4",
109109
"@tanstack/react-query": "^5.90.21",
110+
"@tanstack/react-virtual": "^3.13.24",
110111
"@uiw/codemirror-extensions-hyper-link": "4.23.10",
111112
"@uiw/codemirror-theme-github": "4.23.7",
112113
"@uiw/react-codemirror": "4.23.7",

src/Common/Helper.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -889,11 +889,7 @@ export function useScrollable(options: scrollableInterface) {
889889
)
890890

891891
function scrollToTop(e) {
892-
targetRef.current.scrollBy({
893-
top: -1 * scrollTop,
894-
left: 0,
895-
behavior: 'smooth',
896-
})
892+
targetRef.current.scrollTop = 0
897893
if (options.autoBottomScroll) {
898894
toggleAutoBottom(false)
899895
}

src/Pages-Devtron-2.0/Shared/Routes/routes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ export const BASE_ROUTES = {
288288
ROOT: 'cluster-env',
289289
MANAGE_CATEGORIES: 'manage-categories',
290290
},
291+
NODE_AUTOSCALER: {
292+
ROOT: 'node-autoscaler',
293+
CREATE_PROFILE: 'create-profile',
294+
EDIT_PROFILE: 'edit/:profileId',
295+
},
291296
DOCKER: 'docker',
292297
PROJECTS: 'projects',
293298
AUTH: {

src/Shared/Components/CICDHistory/LogStageAccordion.tsx

Lines changed: 0 additions & 171 deletions
This file was deleted.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import ICCaretDown from '@Icons/ic-caret-down.svg?react'
18+
import ICStack from '@Icons/ic-stack.svg?react'
19+
import { getTimeDifference } from '@Shared/Helpers'
20+
21+
import { TargetPlatformListTooltip } from '../TargetPlatforms'
22+
import { LogStageHeaderProps } from './types'
23+
import { getStageStatusIcon } from './utils'
24+
25+
const LogStageHeader = ({
26+
stage,
27+
isOpen,
28+
status,
29+
startTime,
30+
endTime,
31+
targetPlatforms,
32+
stageIndex,
33+
fullScreenView,
34+
handleStageClose,
35+
handleStageOpen,
36+
logsRendererRef,
37+
applySticky = true,
38+
}: LogStageHeaderProps) => {
39+
const handleAccordionToggle = () => {
40+
if (isOpen) {
41+
handleStageClose(stageIndex)
42+
} else {
43+
handleStageOpen(stageIndex)
44+
}
45+
}
46+
47+
const getFormattedTimeDifference = (): string => {
48+
const timeDifference = getTimeDifference({ startTime, endTime })
49+
if (timeDifference === '0s') {
50+
return '< 1s'
51+
}
52+
return timeDifference
53+
}
54+
55+
const getLogsRendererReference = () => logsRendererRef.current
56+
57+
return (
58+
<button
59+
className={`flexbox dc__transparent dc__content-space py-6 px-8 br-4 dc__align-items-center dc__select-text logs-renderer__stage-accordion w-100 ${
60+
isOpen ? 'logs-renderer__stage-accordion--open-stage' : ''
61+
} ${applySticky ? `dc__position-sticky dc__zi-1 ${fullScreenView ? 'dc__top-44' : 'dc__top-80'}` : ''}`}
62+
type="button"
63+
role="tab"
64+
onClick={handleAccordionToggle}
65+
>
66+
<div className="flexbox dc__gap-8 dc__transparent dc__align-items-center">
67+
<ICCaretDown
68+
className={`icon-dim-16 dc__no-shrink dc__transition--transform icon-stroke__white ${!isOpen ? 'dc__flip-n90 dc__opacity-0_5' : ''}`}
69+
/>
70+
71+
<div className="flexbox dc__gap-12 dc__align-items-center">
72+
{getStageStatusIcon(status)}
73+
74+
<h3 className="m-0 text__white fs-13 fw-4 lh-20 dc__word-break">{stage}</h3>
75+
</div>
76+
</div>
77+
78+
<div className="flexbox dc__gap-8 dc__align-items-center">
79+
{!!targetPlatforms?.length && (
80+
<>
81+
<TargetPlatformListTooltip
82+
targetPlatforms={targetPlatforms}
83+
appendTo={getLogsRendererReference}
84+
>
85+
<div className="flexbox dc__gap-4 dc__align-items-center">
86+
<ICStack className="dc__no-shrink icon-stroke__white icon-dim-12" />
87+
<span className="text__white fs-13 fw-4 lh-20">
88+
{targetPlatforms.length}&nbsp;target platform
89+
{targetPlatforms.length > 1 ? 's' : ''}
90+
</span>
91+
</div>
92+
</TargetPlatformListTooltip>
93+
94+
{!!endTime && <div className="dc__bullet--white dc__bullet" />}
95+
</>
96+
)}
97+
98+
{!!endTime && <span className="text__white fs-13 fw-4 lh-20">{getFormattedTimeDifference()}</span>}
99+
</div>
100+
</button>
101+
)
102+
}
103+
104+
export default LogStageHeader

0 commit comments

Comments
 (0)