@@ -3,6 +3,9 @@ import PropTypes from 'prop-types';
33import ErrorBoundary from './error-boundary' ;
44import * as plugins from '../modules/plugins' ;
55
6+ import { TestRepeaterComponent } from './test-repeater' ;
7+ import { ExtensionPointName } from '@/static/new-ui/constants/plugins' ;
8+
69export default class ExtensionPoint extends Component {
710 static propTypes = {
811 name : PropTypes . string . isRequired ,
@@ -12,13 +15,18 @@ export default class ExtensionPoint extends Component {
1215 render ( ) {
1316 const loadedPluginConfigs = plugins . getLoadedConfigs ( ) ;
1417
15- if ( loadedPluginConfigs . length ) {
16- const { name : pointName , children : reportComponent , ...componentProps } = this . props ;
17- const pluginComponents = getExtensionPointComponents ( loadedPluginConfigs , pointName ) ;
18- return getComponentsComposition ( pluginComponents , reportComponent , componentProps ) ;
19- }
18+ const { name : pointName , children : reportComponent , ...componentProps } = this . props ;
19+ const pluginComponents = getExtensionPointComponents ( loadedPluginConfigs , pointName ) ;
20+
21+ const style = pointName === ExtensionPointName . RunTestOptions ?
22+ { display : 'flex' , gap : '12px' , flexDirection : 'column' } : { }
23+ ;
2024
21- return this . props . children ;
25+ return (
26+ < div style = { style } >
27+ { getComponentsComposition ( pluginComponents , reportComponent , componentProps ) }
28+ </ div >
29+ ) ;
2230 }
2331}
2432
@@ -60,26 +68,30 @@ function composeComponents(PluginComponent, pluginProps, currentComponent, posit
6068 }
6169}
6270
71+ const defaultComponents = [
72+ TestRepeaterComponent
73+ ] ;
74+
6375export function getExtensionPointComponents ( loadedPluginConfigs , pointName ) {
64- return loadedPluginConfigs
65- . map ( config => {
66- try {
67- const PluginComponent = plugins . get ( config . name , config . component ) ;
68- return {
69- PluginComponent,
70- name ,
71- point : getComponentPoint ( PluginComponent , config ) ,
72- position : getComponentPosition ( PluginComponent , config ) ,
73- config
74- } ;
75- } catch ( err ) {
76- console . error ( err ) ;
77- return { } ;
78- }
79- } )
80- . filter ( ( { point , position } ) => {
81- return point && position && point === pointName ;
82- } ) ;
76+ return [
77+ ... defaultComponents ,
78+ ... loadedPluginConfigs
79+ . map ( config => {
80+ try {
81+ const PluginComponent = plugins . get ( config . name , config . component ) ;
82+ return {
83+ PluginComponent ,
84+ name ,
85+ point : getComponentPoint ( PluginComponent , config ) ,
86+ position : getComponentPosition ( PluginComponent , config ) ,
87+ config
88+ } ;
89+ } catch ( err ) {
90+ console . error ( err ) ;
91+ return { } ;
92+ }
93+ } )
94+ ] . filter ( ( { point , position } ) => ( point && position && point === pointName ) ) ;
8395}
8496
8597function getComponentPoint ( component , config ) {
0 commit comments