fix: repair schemes servers rendering (via #4913)
* create AuthorizeBtnContainer * remove Servers and AuthorizeBtn from Schemes' concern * add AuthorizeBtnContainer to base * strengthen OAS3 definitionsToAuthorize * drop obsolete tests * linter fixes
This commit is contained in:
@@ -3,26 +3,21 @@ import PropTypes from "prop-types"
|
||||
|
||||
export default class AuthorizeBtn extends React.Component {
|
||||
static propTypes = {
|
||||
className: PropTypes.string
|
||||
}
|
||||
|
||||
onClick =() => {
|
||||
let { authActions, authSelectors } = this.props
|
||||
let definitions = authSelectors.definitionsToAuthorize()
|
||||
|
||||
authActions.showDefinitions(definitions)
|
||||
onClick: PropTypes.func,
|
||||
isAuthorized: PropTypes.bool,
|
||||
showPopup: PropTypes.bool,
|
||||
getComponent: PropTypes.func.isRequired
|
||||
}
|
||||
|
||||
render() {
|
||||
let { authSelectors, getComponent } = this.props
|
||||
let { isAuthorized, showPopup, onClick, getComponent } = this.props
|
||||
|
||||
//must be moved out of button component
|
||||
const AuthorizationPopup = getComponent("authorizationPopup", true)
|
||||
let showPopup = !!authSelectors.shownDefinitions()
|
||||
let isAuthorized = !!authSelectors.authorized().size
|
||||
|
||||
return (
|
||||
<div className="auth-wrapper">
|
||||
<button className={isAuthorized ? "btn authorize locked" : "btn authorize unlocked"} onClick={ this.onClick }>
|
||||
<button className={isAuthorized ? "btn authorize locked" : "btn authorize unlocked"} onClick={onClick}>
|
||||
<span>Authorize</span>
|
||||
<svg width="20" height="20">
|
||||
<use href={ isAuthorized ? "#locked" : "#unlocked" } xlinkHref={ isAuthorized ? "#locked" : "#unlocked" } />
|
||||
@@ -32,12 +27,4 @@ export default class AuthorizeBtn extends React.Component {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
static propTypes = {
|
||||
getComponent: PropTypes.func.isRequired,
|
||||
authSelectors: PropTypes.object.isRequired,
|
||||
errActions: PropTypes.object.isRequired,
|
||||
authActions: PropTypes.object.isRequired,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ export default class BaseLayout extends React.Component {
|
||||
let Errors = getComponent("errors", true)
|
||||
|
||||
const SchemesContainer = getComponent("SchemesContainer", true)
|
||||
const AuthorizeBtnContainer = getComponent("AuthorizeBtnContainer", true)
|
||||
const FilterContainer = getComponent("FilterContainer", true)
|
||||
let isSwagger2 = specSelectors.isSwagger2()
|
||||
let isOAS3 = specSelectors.isOAS3()
|
||||
@@ -60,10 +61,15 @@ export default class BaseLayout extends React.Component {
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<SchemesContainer>
|
||||
<ServersContainer/>
|
||||
</SchemesContainer>
|
||||
|
||||
<div>
|
||||
<div className="scheme-container">
|
||||
<Col className="schemes wrapper" mobile={12}>
|
||||
<ServersContainer />
|
||||
<SchemesContainer />
|
||||
<AuthorizeBtnContainer />
|
||||
</Col>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<FilterContainer/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user