Skip to content

Commit 699721b

Browse files
authored
Merge pull request #2073 from devtron-labs/feat/expand-all-logs
feat: add support to expand/collapse all log accordions at once
2 parents cd40ff6 + e5defaf commit 699721b

File tree

23 files changed

+193
-488
lines changed

23 files changed

+193
-488
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "0.3.12",
7+
"@devtron-labs/devtron-fe-common-lib": "0.3.13",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/ClusterEnvironmentDrawer.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
ToastVariantType,
3232
ServerErrors,
3333
Drawer,
34+
stopPropagation,
3435
} from '@devtron-labs/devtron-fe-common-lib'
3536

3637
import { ReactComponent as Close } from '@Icons/ic-close.svg'
@@ -135,10 +136,10 @@ export const ClusterEnvironmentDrawer = ({
135136
// FORM METHODS
136137
const { data, errors, register, handleSubmit, trigger } = useForm<ClusterEnvironmentDrawerFormProps>({
137138
initialValues: {
138-
environmentName,
139-
namespace,
139+
environmentName: environmentName ?? '',
140+
namespace: namespace ?? '',
140141
isProduction: !!isProduction,
141-
description,
142+
description: description ?? '',
142143
},
143144
validations: clusterEnvironmentDrawerFormValidationSchema({ isNamespaceMandatory: !isVirtual }),
144145
})
@@ -224,7 +225,7 @@ export const ClusterEnvironmentDrawer = ({
224225

225226
return (
226227
<Drawer position="right" width="800px" onEscape={hideClusterDrawer} onClose={hideClusterDrawer}>
227-
<div className="h-100 bcn-0 flexbox-col">
228+
<div className="h-100 bcn-0 flexbox-col" onClick={stopPropagation}>
228229
<div className="flexbox dc__align-items-center dc__content-space dc__border-bottom bcn-0 py-12 px-20">
229230
<h3 className="m-0 fs-16 fw-6 lh-1-43">{id ? 'Edit Environment' : 'Add Environment'}</h3>
230231
<button

src/components/ClusterNodes/ClusterTerminal.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,10 @@ node-details-full-screen
999999
registerLinkMatcher: renderRegisterLinkMatcher,
10001000
},
10011001
},
1002+
metadata: {
1003+
node: selectedNodeName?.label ?? '',
1004+
namespace: selectedNamespace?.label ?? '',
1005+
},
10021006
}
10031007

10041008
return (

src/components/ClusterNodes/clusterNodes.service.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export const patchClusterNote = (requestPayload: ClusteNotePatchRequest): Promis
4343
export const patchApplicationNote = (requestPayload: ClusteNotePatchRequest): Promise<ClusterNoteResponse> =>
4444
put(Routes.APPLICATION_NOTE, requestPayload)
4545

46-
export const getClusterList = (): Promise<ClusterListResponse> => get(Routes.CLUSTER_LIST)
46+
export const getClusterList = (signal: AbortSignal): Promise<ClusterListResponse> =>
47+
get(Routes.CLUSTER_LIST, { signal })
4748

4849
export const getClusterListMin = (): Promise<ClusterListResponse> => get(Routes.CLUSTER_LIST_MIN)
4950

src/components/ResourceBrowser/ResourceBrowser.tsx

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

17-
import React, { useMemo } from 'react'
17+
import React, { useEffect, useMemo, useRef } from 'react'
1818
import {
1919
showError,
2020
getUserRole,
2121
DevtronProgressing,
2222
useAsync,
2323
PageHeader,
2424
ErrorScreenManager,
25+
getIsRequestAborted,
2526
} from '@devtron-labs/devtron-fe-common-lib'
2627
import { DEFAULT_CLUSTER_ID } from '@Components/cluster/cluster.type'
2728
import { sortObjectArrayAlphabetically } from '../common'
@@ -31,11 +32,15 @@ import { ClusterDetail } from '../ClusterNodes/types'
3132
import { AddClusterButton } from './PageHeader.buttons'
3233

3334
const ResourceBrowser: React.FC = () => {
35+
const abortControllerRef = useRef<AbortController>(new AbortController())
36+
3437
const [detailClusterListLoading, detailClusterList, , reloadDetailClusterList] = useAsync(async () => {
3538
try {
36-
return await getClusterList()
39+
return await getClusterList(abortControllerRef.current.signal)
3740
} catch (err) {
38-
showError(err)
41+
if (!getIsRequestAborted(err)) {
42+
showError(err)
43+
}
3944
return null
4045
}
4146
})
@@ -45,6 +50,13 @@ const ResourceBrowser: React.FC = () => {
4550
/* transpose the data */
4651
const [clusterListMinData = null, userRoleData = null] = data || []
4752

53+
useEffect(
54+
() => () => {
55+
abortControllerRef.current.abort()
56+
},
57+
[],
58+
)
59+
4860
const sortedClusterList: ClusterDetail[] = useMemo(
4961
() =>
5062
(

src/components/ResourceBrowser/ResourceList/ResourceList.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
getResourceGroupListRaw,
3030
noop,
3131
} from '@devtron-labs/devtron-fe-common-lib'
32-
import { ShortcutProvider } from 'react-keybind'
3332
import { ClusterOptionType, FIXED_TABS_INDICES, URLParams } from '../Types'
3433
import { ALL_NAMESPACE_OPTION, K8S_EMPTY_GROUP, SIDEBAR_KEYS } from '../Constants'
3534
import { URLS } from '../../../config'
@@ -289,6 +288,7 @@ const ResourceList = () => {
289288
setLogSearchTerms={setLogSearchTerms}
290289
removeTabByIdentifier={getRemoveTabByIdentifierForId(tabId)}
291290
updateTabUrl={getUpdateTabUrlForId(tabId)}
291+
clusterName={selectedCluster.label}
292292
/>
293293
</div>
294294
)
@@ -374,17 +374,15 @@ const ResourceList = () => {
374374

375375
return (
376376
<UseRegisterShortcutProvider>
377-
<ShortcutProvider>
378-
<div className="resource-browser-container h-100 bcn-0">
379-
<PageHeader
380-
isBreadcrumbs
381-
breadCrumbs={renderBreadcrumbs}
382-
headerName=""
383-
renderActionButtons={renderCreateResourceButton(clusterId, closeResourceModal)}
384-
/>
385-
{renderMainBody()}
386-
</div>
387-
</ShortcutProvider>
377+
<div className="resource-browser-container h-100 bcn-0">
378+
<PageHeader
379+
isBreadcrumbs
380+
breadCrumbs={renderBreadcrumbs}
381+
headerName=""
382+
renderActionButtons={renderCreateResourceButton(clusterId, closeResourceModal)}
383+
/>
384+
{renderMainBody()}
385+
</div>
388386
</UseRegisterShortcutProvider>
389387
)
390388
}

src/components/app/details/cIDetails/ciDetails.scss

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@
3737
position: absolute;
3838
bottom: 12px;
3939
right: 12px;
40-
transition: top 0.3s;
41-
padding: 6px;
42-
width: 32px;
43-
height: 32px;
44-
border-radius: 4px;
45-
box-shadow:
46-
0 0 4px 0 rgba(0, 10, 20, 0.5),
47-
0 0 4px 0 rgba(0, 10, 20, 0.5);
48-
background-color: #2c3354;
49-
opacity: 0.8;
50-
51-
&:hover {
52-
opacity: 1;
53-
}
5440
}
5541

5642
.ci-details__history {
@@ -110,10 +96,6 @@
11096
transition: height 0.3s;
11197
}
11298
}
113-
114-
.zoom {
115-
transition: top 0.3s;
116-
}
11799
}
118100
}
119101

src/components/command/Command.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,9 @@ export class Command extends Component<CommandProps, CommandState> {
303303
return isTotal
304304
}
305305

306-
handleKeyPress(event) {
307-
if (event.metaKey && event.key === 'k') {
306+
handleKeyPress(event: KeyboardEvent) {
307+
if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
308+
event.preventDefault()
308309
this.props.toggleCommandBar(true)
309310
ReactGA.event({
310311
category: 'Command Bar',

src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigToolbar.tsx

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

1717
import React from 'react'
18+
import ReactGA from 'react-ga4'
1819
import { ReactComponent as FileCode } from '../../../assets/icons/ic-file-code.svg'
1920
import { ReactComponent as CompareIcon } from '../../../assets/icons/ic-arrows-left-right.svg'
2021
import { ReactComponent as ReadmeIcon } from '../../../assets/icons/ic-book-open.svg'
@@ -58,6 +59,22 @@ export default function DeploymentConfigToolbar({
5859
setConvertVariables(!convertVariables)
5960
}
6061

62+
const handleCompareValuesDropdownClicked = () => {
63+
ReactGA.event({
64+
category: 'Deployment Template',
65+
action: 'Compare values clicked'
66+
})
67+
handleOptionClick(true)
68+
}
69+
70+
const handleCompareManifestDropdownClicked = () => {
71+
ReactGA.event({
72+
category: 'Deployment Template',
73+
action: 'Compare manifest clicked',
74+
})
75+
handleOptionClick(false)
76+
}
77+
6178
const renderDropdownContainer = () => (
6279
<div
6380
className="flex-col white-background dc__position-abs bcn-0 w-204 h-72 dc__border-radius-4-imp dc__left-0 dc__border dc__zi-20 config-toolbar-dropdown-shadow"
@@ -66,13 +83,13 @@ export default function DeploymentConfigToolbar({
6683
<div className="pt-4 pb-4 pl-0 pr-0">
6784
<DropdownItem
6885
label="Compare Values"
69-
onClick={() => handleOptionClick(true)}
86+
onClick={handleCompareValuesDropdownClicked}
7087
index={1}
7188
isValues={isValues}
7289
/>
7390
<DropdownItem
7491
label="Compare generated manifest"
75-
onClick={() => handleOptionClick(false)}
92+
onClick={handleCompareManifestDropdownClicked}
7693
index={2}
7794
isValues={isValues}
7895
/>
@@ -82,6 +99,14 @@ export default function DeploymentConfigToolbar({
8299

83100
const tippyMsg = convertVariables ? 'Hide variables values' : 'Show variables values'
84101

102+
const handleCompareValuesButtonClick = (e) => {
103+
ReactGA.event({
104+
category: 'Deployment Template',
105+
action: 'Compare values clicked'
106+
})
107+
changeTab(e)
108+
}
109+
85110
return (
86111
<div className="config-toolbar-container flex dc__content-space bcn-0 pt-8 pl-16 pr-16 dc__border-bottom">
87112
{!noReadme && showReadme ? (
@@ -100,7 +125,7 @@ export default function DeploymentConfigToolbar({
100125
className={`${getTabClassName(2)} dc__position-rel`}
101126
data-index={2}
102127
data-testid="compare-values-tab"
103-
onClick={changeTab}
128+
onClick={handleCompareValuesButtonClick}
104129
>
105130
<CompareIcon className={getTabIconClass(2)} />
106131
Compare&nbsp;

0 commit comments

Comments
 (0)