@@ -176,95 +176,91 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
176
176
)
177
177
}
178
178
179
- const renderYAMLEditor = ( ) : JSX . Element => {
180
- return (
181
- < div className = "flex-grow-1 flexbox-col" >
182
- < CodeEditor
183
- readOnly = { ! isEdit }
184
- diffView = { isReviewState }
185
- mode = { MODES . YAML }
186
- noParsing
187
- theme = { AppThemeType . dark }
188
- height = "fitToParent"
189
- { ...( isReviewState
190
- ? {
191
- diffView : true ,
192
- originalValue : ( nodeDetail ?. manifest && YAMLStringify ( nodeDetail . manifest ) ) || '' ,
193
- modifiedValue : modifiedManifest ,
194
- onModifiedValueChange : handleEditorValueChange ,
195
- }
196
- : {
197
- diffView : false ,
198
- value : modifiedManifest ,
199
- onChange : handleEditorValueChange ,
200
- } ) }
201
- >
202
- { isReviewState && isShowWarning && (
203
- < CodeEditor . Warning
204
- className = "dc__ellipsis-right"
205
- text = "Actual YAML has changed since you made the changes. Please check the diff carefully."
206
- />
207
- ) }
208
- { isReviewState && (
209
- < CodeEditor . Header hideDefaultSplitHeader >
210
- < p className = "m-0 fs-12 fw-6 cn-7" > Current node YAML</ p >
211
- < p className = "m-0 fs-12 fw-6 cn-7 pl-16 flex left dc__gap-4" >
212
- < Edit className = "icon-dim-16" />
213
- < span > YAML (Editing)</ span >
214
- </ p >
215
- </ CodeEditor . Header >
216
- ) }
217
- </ CodeEditor >
218
- </ div >
219
- )
220
- }
179
+ const renderYAMLEditor = ( ) : JSX . Element => (
180
+ < div className = "flex-grow-1 flexbox-col" >
181
+ < CodeEditor
182
+ readOnly = { ! isEdit }
183
+ diffView = { isReviewState }
184
+ mode = { MODES . YAML }
185
+ noParsing
186
+ theme = { AppThemeType . dark }
187
+ height = "fitToParent"
188
+ { ...( isReviewState
189
+ ? {
190
+ diffView : true ,
191
+ originalValue : ( nodeDetail ?. manifest && YAMLStringify ( nodeDetail . manifest ) ) || '' ,
192
+ modifiedValue : modifiedManifest ,
193
+ onModifiedValueChange : handleEditorValueChange ,
194
+ }
195
+ : {
196
+ diffView : false ,
197
+ value : modifiedManifest ,
198
+ onChange : handleEditorValueChange ,
199
+ } ) }
200
+ >
201
+ { isReviewState && isShowWarning && (
202
+ < CodeEditor . Warning
203
+ className = "dc__ellipsis-right"
204
+ text = "Actual YAML has changed since you made the changes. Please check the diff carefully."
205
+ />
206
+ ) }
207
+ { isReviewState && (
208
+ < CodeEditor . Header hideDefaultSplitHeader >
209
+ < p className = "m-0 fs-12 fw-6 cn-7" > Current node YAML</ p >
210
+ < p className = "m-0 fs-12 fw-6 cn-7 pl-16 flex left dc__gap-4" >
211
+ < Edit className = "icon-dim-16" />
212
+ < span > YAML (Editing)</ span >
213
+ </ p >
214
+ </ CodeEditor . Header >
215
+ ) }
216
+ </ CodeEditor >
217
+ </ div >
218
+ )
221
219
222
- const renderConditions = ( ) : JSX . Element => {
223
- return (
224
- < div className = "node-details-container flex-grow-1 flexbox-col dc__overflow-auto" >
225
- < div className = "ml-20 mr-20 mb-12 mt-12 bg__primary br-8 en-2 bw-1" >
226
- < div className = "condition-grid cn-7 fw-6 fs-13 dc__border-bottom pt-8 pl-20 pb-8 pr-20" >
227
- < div > Type</ div >
228
- < div > Status</ div >
229
- < div > Message</ div >
230
- </ div >
231
- { nodeDetail . conditions . map ( ( condition ) => (
232
- < div className = "condition-grid cn-9 fw-4 fs-13 dc__border-bottom-n1 pt-12 pl-20 pb-12 pr-20" >
233
- < div > { condition . type } </ div >
234
- < div className = "flexbox" >
235
- { condition . haveIssue ? (
236
- < Error className = "mt-2 mb-2 mr-8 icon-dim-18" />
237
- ) : (
238
- < Success className = "mt-2 mb-2 mr-8 icon-dim-18" />
239
- ) }
240
- { condition . reason }
241
- </ div >
242
- < div > { condition . message } </ div >
243
- </ div >
244
- ) ) }
220
+ const renderConditions = ( ) : JSX . Element => (
221
+ < div className = "node-details-container flex-grow-1 flexbox-col dc__overflow-auto" >
222
+ < div className = "ml-20 mr-20 mb-12 mt-12 bg__primary br-8 en-2 bw-1" >
223
+ < div className = "condition-grid cn-7 fw-6 fs-13 dc__border-bottom pt-8 pl-20 pb-8 pr-20" >
224
+ < div > Type</ div >
225
+ < div > Status</ div >
226
+ < div > Message</ div >
245
227
</ div >
228
+ { nodeDetail . conditions . map ( ( condition ) => (
229
+ < div className = "condition-grid cn-9 fw-4 fs-13 dc__border-bottom-n1 pt-12 pl-20 pb-12 pr-20" >
230
+ < div > { condition . type } </ div >
231
+ < div className = "flexbox" >
232
+ { condition . haveIssue ? (
233
+ < Error className = "mt-2 mb-2 mr-8 icon-dim-18" />
234
+ ) : (
235
+ < Success className = "mt-2 mb-2 mr-8 icon-dim-18" />
236
+ ) }
237
+ { condition . reason }
238
+ </ div >
239
+ < div > { condition . message } </ div >
240
+ </ div >
241
+ ) ) }
246
242
</ div >
247
- )
248
- }
243
+ </ div >
244
+ )
249
245
250
246
// id will be populated into url
251
247
const NODE_TABS_INFO : NodeDetailTabsInfoType = [
252
248
{
253
249
id : getSanitizedNodeTabId ( NODE_DETAILS_TABS . summary ) ,
254
250
label : NODE_DETAILS_TABS . summary ,
255
- node : renderSummary ,
251
+ renderComponent : renderSummary ,
256
252
} ,
257
253
...( window . _env_ . FEATURE_REDFISH_NODE_ENABLE ? REDFISH_NODE_UI_TABS : [ ] ) ,
258
254
{
259
255
id : getSanitizedNodeTabId ( NODE_DETAILS_TABS . yaml ) ,
260
256
label : NODE_DETAILS_TABS . yaml ,
261
257
icon : Edit ,
262
- node : renderYAMLEditor ,
258
+ renderComponent : renderYAMLEditor ,
263
259
} ,
264
260
{
265
261
id : getSanitizedNodeTabId ( NODE_DETAILS_TABS . nodeConditions ) ,
266
262
label : NODE_DETAILS_TABS . nodeConditions ,
267
- node : renderConditions ,
263
+ renderComponent : renderConditions ,
268
264
} ,
269
265
]
270
266
@@ -304,7 +300,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
304
300
}
305
301
306
302
const renderNodeDetailsTabs = ( ) : JSX . Element => {
307
- const tabs : TabProps [ ] = NODE_TABS_INFO . map ( ( { node , ...tabDetails } , index ) => ( {
303
+ const tabs : TabProps [ ] = NODE_TABS_INFO . map ( ( { renderComponent , ...tabDetails } , index ) => ( {
308
304
...tabDetails ,
309
305
tabType : 'navLink' ,
310
306
props : {
@@ -994,7 +990,7 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
994
990
995
991
const renderTabContent = ( ) : JSX . Element => {
996
992
const selectedTab = NODE_TABS_INFO [ selectedTabIndex ]
997
- const renderNode = selectedTab ?. node
993
+ const renderNode = selectedTab ?. renderComponent
998
994
999
995
if ( renderNode ) {
1000
996
return renderNode ( )
0 commit comments