@@ -15,46 +15,56 @@ export interface YamlViewButtonResourceProps {
1515 variant : 'resource' ;
1616 resource : Resource ;
1717 toolbarContent ?: JSX . Element ;
18+ withoutApiConfig ?: boolean ;
1819}
1920export interface YamlViewButtonLoaderProps {
2021 variant : 'loader' ;
2122 workspaceName ?: string ;
2223 resourceType : 'projects' | 'workspaces' | 'managedcontrolplanes' ;
2324 resourceName : string ;
25+ withoutApiConfig ?: boolean ;
2426}
2527export type YamlViewButtonProps = YamlViewButtonResourceProps | YamlViewButtonLoaderProps ;
2628
2729export function YamlViewButton ( { variant, ...props } : YamlViewButtonProps ) {
2830 const { t } = useTranslation ( ) ;
29- const { openInAsideWithApiConfig } = useSplitter ( ) ;
31+ const { openInAsideWithApiConfig, openInAside } = useSplitter ( ) ;
3032 const apiConfig = useContext ( ApiConfigContext ) ;
3133 const openSplitterSidePanel = ( ) => {
3234 switch ( variant ) {
3335 case 'resource' : {
34- const { resource, toolbarContent } = props as YamlViewButtonResourceProps ;
35- openInAsideWithApiConfig (
36+ const { resource, toolbarContent, withoutApiConfig } = props as YamlViewButtonResourceProps ;
37+ const content = (
3638 < YamlSidePanel
3739 isEdit = { false }
3840 resource = { resource }
3941 filename = { `${ resource ?. kind ?? '' } ${ resource ?. metadata ?. name ? '_' : '' } ${ resource ?. metadata ?. name ?? '' } ` }
4042 toolbarContent = { toolbarContent }
41- /> ,
42- apiConfig ,
43+ />
4344 ) ;
45+ if ( withoutApiConfig ) {
46+ openInAside ( content ) ;
47+ } else {
48+ openInAsideWithApiConfig ( content , apiConfig ) ;
49+ }
4450 break ;
4551 }
4652
4753 case 'loader' : {
48- const { workspaceName, resourceType, resourceName } = props as YamlViewButtonLoaderProps ;
49- openInAsideWithApiConfig (
54+ const { workspaceName, resourceType, resourceName, withoutApiConfig } = props as YamlViewButtonLoaderProps ;
55+ const content = (
5056 < YamlSidePanelWithLoader
5157 isEdit = { false }
5258 workspaceName = { workspaceName }
5359 resourceType = { resourceType }
5460 resourceName = { resourceName }
55- /> ,
56- apiConfig ,
61+ />
5762 ) ;
63+ if ( withoutApiConfig ) {
64+ openInAside ( content ) ;
65+ } else {
66+ openInAsideWithApiConfig ( content , apiConfig ) ;
67+ }
5868 break ;
5969 }
6070 }
0 commit comments