Skip to content

Commit 3829735

Browse files
committed
show YAML page
Signed-off-by: Atif Ali <atali@redhat.com> show YAML page better Signed-off-by: Atif Ali <atali@redhat.com> complete YAML page and cleanup Signed-off-by: Atif Ali <atali@redhat.com> implement edit appset Signed-off-by: Atif Ali <atali@redhat.com>
1 parent 4c9b72d commit 3829735

File tree

8 files changed

+108
-47
lines changed

8 files changed

+108
-47
lines changed

src/gitops/components/appset/AppSetDetailsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
23
import { Timestamp } from '@openshift-console/dynamic-plugin-sdk';
34
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
45
import {
@@ -12,7 +13,7 @@ import {
1213
import ResourceDetailsAttributes from '../../utils/components/ResourceDetails/ResourceDetailsAttributes';
1314
import './AppSetDetailsTab.scss';
1415

15-
type AppSetDetailsTabProps = {
16+
type AppSetDetailsTabProps = RouteComponentProps<{ ns: string; name: string }> & {
1617
obj?: ApplicationSetKind;
1718
namespace?: string;
1819
name?: string;

src/gitops/components/appset/AppSetNavPage.scss

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
&__main-section {
33
display: flex;
44
flex-direction: column;
5-
height: 100%;
5+
height: 100vh; // Use full viewport height
66
}
77

88
&__body {
@@ -14,6 +14,33 @@
1414
&__pane-body {
1515
flex: 1;
1616
padding: 20px;
17-
overflow-y: auto;
17+
overflow-y: auto; // Restore scrolling for other tabs
18+
19+
/* Remove min-height constraints that force outer scrolling */
20+
.pf-v6-c-code-editor,
21+
.pf-c-code-editor {
22+
height: 100% !important;
23+
border: 0 !important;
24+
box-shadow: none !important;
25+
outline: none !important;
26+
}
27+
.pf-v6-c-code-editor__main,
28+
.pf-c-code-editor__main {
29+
height: 100% !important;
30+
border: 0 !important;
31+
box-shadow: none !important;
32+
outline: none !important;
33+
}
34+
.pf-v6-c-code-editor__main::before,
35+
.pf-v6-c-code-editor__main::after,
36+
.pf-v6-c-code-editor__main::before,
37+
.pf-c-code-editor__main::after {
38+
content: none !important;
39+
display: none !important;
40+
}
41+
.monaco-editor,
42+
.monaco-editor .overflow-guard {
43+
height: 100% !important;
44+
}
1845
}
1946
}

src/gitops/components/appset/AppSetNavPage.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import AppsTab from './AppsTab';
1616
import EventsTab from './EventsTab';
1717
import YAMLTab from './YAMLTab';
1818
import './AppSetNavPage.scss';
19+
import { useLocation } from 'react-router-dom-v5-compat';
1920

2021
type AppSetPageProps = {
2122
name: string;
@@ -24,8 +25,9 @@ type AppSetPageProps = {
2425
};
2526

2627
const AppSetNavPage: React.FC<AppSetPageProps> = ({ name, namespace, kind }) => {
28+
const location = useLocation();
2729
const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
28-
30+
2931
const [appSet, loaded, loadError] = useK8sWatchResource<ApplicationSetKind>({
3032
groupVersionKind: {
3133
group: 'argoproj.io',
@@ -38,14 +40,26 @@ const AppSetNavPage: React.FC<AppSetPageProps> = ({ name, namespace, kind }) =>
3840

3941
const [actions] = useApplicationSetActionsProvider(appSet);
4042

43+
// Handle tab query parameter
44+
React.useEffect(() => {
45+
const searchParams = new URLSearchParams(location.search);
46+
const tabParam = searchParams.get('tab');
47+
if (tabParam === 'yaml') {
48+
setActiveTabKey(1); // YAML tab is at index 1
49+
}
50+
}, [location.search]);
51+
4152
if (loadError) return <div>Error loading ApplicationSet details.</div>;
4253
if (!loaded || !appSet) return (
4354
<Bullseye>
4455
<Spinner size="xl" />
4556
</Bullseye>
4657
);
4758

48-
const handleTabClick = (event: React.MouseEvent<HTMLElement, MouseEvent>, tabIndex: string | number) => {
59+
const handleTabClick = (
60+
event: React.MouseEvent<HTMLElement, MouseEvent>,
61+
tabIndex: string | number,
62+
) => {
4963
setActiveTabKey(tabIndex);
5064
};
5165

@@ -60,8 +74,8 @@ const AppSetNavPage: React.FC<AppSetPageProps> = ({ name, namespace, kind }) =>
6074
iconText="AS"
6175
iconTitle="Argo CD ApplicationSet"
6276
resourcePrefix="Argo CD"
77+
showDevPreviewBadge={true}
6378
/>
64-
6579
<div className="application-set-details-page__body">
6680
<div className="application-set-details-page__pane-body">
6781
<Tabs activeKey={activeTabKey} onSelect={handleTabClick} className="pf-v6-c-tabs">

src/gitops/components/appset/AppsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
23
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
34
import { PageSection } from '@patternfly/react-core';
45
import ApplicationList from '../shared/ApplicationList';
56
import './AppsTab.scss';
67

7-
type AppsTabProps = {
8+
type AppsTabProps = RouteComponentProps<{ ns: string; name: string }> & {
89
obj?: ApplicationSetKind;
910
namespace?: string;
1011
name?: string;

src/gitops/components/appset/EventsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
23
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
34
import {
45
Badge,
@@ -7,7 +8,7 @@ import {
78
} from '@patternfly/react-core';
89
import './EventsTab.scss';
910

10-
type EventsTabProps = {
11+
type EventsTabProps = RouteComponentProps<{ ns: string; name: string }> & {
1112
obj?: ApplicationSetKind;
1213
namespace?: string;
1314
name?: string;

src/gitops/components/appset/GeneratorsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
23
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
34
import { PageSection } from '@patternfly/react-core';
45
import Generators from './Generators';
56
import './GeneratorsTab.scss';
67

7-
type GeneratorsTabProps = {
8+
type GeneratorsTabProps = RouteComponentProps<{ ns: string; name: string }> & {
89
obj?: ApplicationSetKind;
910
namespace?: string;
1011
name?: string;
Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,61 @@
1-
.application-set-details-page {
2-
&__yaml-editor {
3-
background: #1a1d21;
4-
border: 1px solid #393F44;
5-
border-radius: 8px;
6-
overflow: hidden;
1+
.yaml-tab-container {
2+
// Use viewport height to fit the page without scrolling - adjust for header, tabs, and footer
3+
height: calc(97vh - 320px); // Slightly reduced to make footer fully visible
4+
display: flex;
5+
flex-direction: column;
6+
overflow: hidden; // Prevent page scrolling for YAML tab only
7+
8+
// Override parent scrolling behavior for YAML tab
9+
.application-set-details-page__pane-body {
10+
overflow: hidden !important; // Override parent scrolling for YAML tab
11+
}
12+
13+
.pf-v6-c-code-editor:focus-within,
14+
.pf-c-code-editor:focus-within {
15+
box-shadow: none !important;
16+
outline: none !important;
717
}
818

9-
&__yaml-editor-header {
10-
display: flex;
11-
justify-content: space-between;
12-
align-items: center;
13-
padding: 12px 16px;
14-
background: #212427;
15-
border-bottom: 1px solid #393F44;
19+
.monaco-editor .scrollbar .slider {
20+
border: 0 !important;
1621
}
1722

18-
&__yaml-editor-header-buttons {
19-
display: flex;
20-
gap: 8px;
23+
.monaco-editor .scrollbar .slider:hover {
24+
border: 0 !important;
2125
}
2226

23-
&__yaml-editor-header-shortcuts {
24-
font-size: 12px;
27+
.monaco-editor .scrollbar.vertical {
28+
border-left: 0 !important;
2529
}
2630

27-
&__yaml-editor-header-shortcuts-link {
28-
color: #0066cc;
29-
text-decoration: none;
31+
.monaco-editor .scrollbar.horizontal {
32+
border-top: 0 !important;
33+
}
34+
35+
.monaco-editor .margin-view-overlays {
36+
border: 0 !important;
37+
}
3038

31-
&:hover {
32-
text-decoration: underline;
33-
}
39+
.monaco-editor .glyph-margin {
40+
border: 0 !important;
3441
}
3542

36-
&__yaml-editor-content {
37-
padding: 16px;
38-
max-height: 600px;
39-
overflow-y: auto;
43+
.monaco-editor .monaco-editor-background:focus {
44+
outline: none !important;
45+
border: 0 !important;
46+
}
47+
48+
.monaco-editor .scrollbar .corner:hover {
49+
background: transparent !important;
50+
border: 0 !important;
51+
}
52+
53+
.monaco-editor .scrollbar .slider.active:hover {
54+
border: 0 !important;
55+
}
4056

41-
pre {
42-
margin: 0;
43-
color: #ffffff;
44-
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
45-
font-size: 12px;
46-
line-height: 1.5;
47-
white-space: pre-wrap;
48-
word-break: break-word;
49-
}
57+
.monaco-editor .scrollbar .slider::before,
58+
.monaco-editor .scrollbar .slider::after {
59+
display: none !important;
5060
}
5161
}

src/gitops/components/appset/YAMLTab.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as React from 'react';
22
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
33
import { ResourceYAMLEditor } from '@openshift-console/dynamic-plugin-sdk';
4+
import { Bullseye, Spinner } from '@patternfly/react-core';
5+
import './YAMLTab.scss';
46

57
type YAMLTabProps = {
68
obj?: ApplicationSetKind;
@@ -12,7 +14,11 @@ const YAMLTab: React.FC<YAMLTabProps> = ({ obj }) => {
1214
if (!obj) return null;
1315

1416
return (
15-
<ResourceYAMLEditor initialResource={obj} header={obj?.kind} />
17+
<div className="yaml-tab-container">
18+
<React.Suspense fallback={<Bullseye><Spinner size="xl" /></Bullseye>}>
19+
<ResourceYAMLEditor initialResource={obj} />
20+
</React.Suspense>
21+
</div>
1622
);
1723
};
1824

0 commit comments

Comments
 (0)