Skip to content

Commit

Permalink
feat: added 'root' extension-point
Browse files Browse the repository at this point in the history
  • Loading branch information
unlok committed Nov 2, 2021
1 parent 52cda51 commit b7e571a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ directory.
* `result` - allows to extend each test result; adds `resultId` and `testName` props to the plugin component;
* `result_meta` - allows to extend meta information of each test result; adds `result` and `testName` props to the plugin component;
* `menu-bar` - allows to extend menu bar.
* `root` - allows to add floating items like modal or popup.

An extension point may be extended by more than one component. In that case order of components application is determined by `plugins` config order. Each following component is applied to all previously composed components at the extension point.

Expand Down
1 change: 1 addition & 0 deletions lib/constants/extension-points.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
export const RESULT = 'result';
export const RESULT_META = 'result_meta';
export const MENU_BAR = 'menu-bar';
export const ROOT = 'root';
24 changes: 14 additions & 10 deletions lib/static/components/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Notifications from 'reapop';
import wybo from 'reapop-theme-wybo';
import {bindActionCreators} from 'redux';

import {ROOT} from '../../constants/extension-points';
import * as actions from '../modules/actions';
import ControlButtons from './controls/gui-controls';
import SkippedList from './skipped-list';
Expand All @@ -14,6 +15,7 @@ import MainTree from './main-tree';
import CustomScripts from './custom-scripts';
import clientEvents from '../../gui/constants/client-events';
import FaviconChanger from './favicon-changer';
import ExtensionPoint from './extension-point';

class Gui extends Component {
static propTypes = {
Expand Down Expand Up @@ -74,16 +76,18 @@ class Gui extends Component {

return (
<Fragment>
<CustomScripts scripts={customScripts}/>
<Notifications theme={wybo}/>
<FaviconChanger />
<ControlButtons />
<main className="container">
<SkippedList />
<MainTree />
</main>
<Loading active={loading.active} content={loading.content} />
<ModalContainer />
<ExtensionPoint name={ROOT}>
<CustomScripts scripts={customScripts}/>
<Notifications theme={wybo}/>
<FaviconChanger />
<ControlButtons />
<main className="container">
<SkippedList />
<MainTree />
</main>
<Loading active={loading.active} content={loading.content} />
<ModalContainer />
</ExtensionPoint>
</Fragment>
);
}
Expand Down
22 changes: 13 additions & 9 deletions lib/static/components/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Notifications from 'reapop';
import wybo from 'reapop-theme-wybo';
import {bindActionCreators} from 'redux';

import {ROOT} from '../../constants/extension-points';
import * as actions from '../modules/actions';
import Loading from './loading';
import Header from './header';
Expand All @@ -13,6 +14,7 @@ import SkippedList from './skipped-list';
import MainTree from './main-tree';
import CustomScripts from './custom-scripts';
import FaviconChanger from './favicon-changer';
import ExtensionPoint from './extension-point';

class Report extends Component {
static propTypes = {
Expand Down Expand Up @@ -44,15 +46,17 @@ class Report extends Component {

return (
<Fragment>
<CustomScripts scripts={this.props.customScripts}/>
<Notifications theme={wybo} />
<FaviconChanger />
<Header/>
<ControlButtons/>
<main className="container">
<SkippedList />
<MainTree />
</main>
<ExtensionPoint name={ROOT}>
<CustomScripts scripts={this.props.customScripts}/>
<Notifications theme={wybo} />
<FaviconChanger />
<Header/>
<ControlButtons/>
<main className="container">
<SkippedList />
<MainTree />
</main>
</ExtensionPoint>
</Fragment>
);
}
Expand Down

0 comments on commit b7e571a

Please sign in to comment.