Fix AuthorizeOperationBtn staleness issue
This commit is contained in:
@@ -54,6 +54,7 @@ export default class Operation extends PureComponent {
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
isShown,
|
isShown,
|
||||||
|
isAuthorized,
|
||||||
jumpToKey,
|
jumpToKey,
|
||||||
path,
|
path,
|
||||||
method,
|
method,
|
||||||
@@ -78,9 +79,9 @@ export default class Operation extends PureComponent {
|
|||||||
} = op.operation
|
} = op.operation
|
||||||
|
|
||||||
let operation = operationProps.getIn(["op", "operation"])
|
let operation = operationProps.getIn(["op", "operation"])
|
||||||
|
let security = operationProps.get("security")
|
||||||
let responses = operation.get("responses")
|
let responses = operation.get("responses")
|
||||||
let produces = operation.get("produces")
|
let produces = operation.get("produces")
|
||||||
let security = operation.get("security") || specSelectors.security()
|
|
||||||
let parameters = getList(operation, ["parameters"])
|
let parameters = getList(operation, ["parameters"])
|
||||||
let operationScheme = specSelectors.operationScheme(path, method)
|
let operationScheme = specSelectors.operationScheme(path, method)
|
||||||
let isShownKey = ["operations", tag, operationId]
|
let isShownKey = ["operations", tag, operationId]
|
||||||
@@ -128,7 +129,7 @@ export default class Operation extends PureComponent {
|
|||||||
{
|
{
|
||||||
(!security || !security.count()) ? null :
|
(!security || !security.count()) ? null :
|
||||||
<AuthorizeOperationBtn
|
<AuthorizeOperationBtn
|
||||||
isAuthorized={ authSelectors.isAuthorized(security) }
|
isAuthorized={ isAuthorized }
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const applicableDefinitions = authSelectors.definitionsForRequirements(security)
|
const applicableDefinitions = authSelectors.definitionsForRequirements(security)
|
||||||
authActions.showDefinitions(applicableDefinitions)
|
authActions.showDefinitions(applicableDefinitions)
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ export default class OperationContainer extends PureComponent {
|
|||||||
jumpToKey: PropTypes.string.isRequired,
|
jumpToKey: PropTypes.string.isRequired,
|
||||||
allowTryItOut: PropTypes.bool,
|
allowTryItOut: PropTypes.bool,
|
||||||
displayOperationId: PropTypes.bool,
|
displayOperationId: PropTypes.bool,
|
||||||
|
isAuthorized: PropTypes.bool,
|
||||||
displayRequestDuration: PropTypes.bool,
|
displayRequestDuration: PropTypes.bool,
|
||||||
response: PropTypes.instanceOf(Iterable),
|
response: PropTypes.instanceOf(Iterable),
|
||||||
request: PropTypes.instanceOf(Iterable),
|
request: PropTypes.instanceOf(Iterable),
|
||||||
|
security: PropTypes.instanceOf(Iterable),
|
||||||
isDeepLinkingEnabled: PropTypes.bool.isRequired,
|
isDeepLinkingEnabled: PropTypes.bool.isRequired,
|
||||||
|
|
||||||
getComponent: PropTypes.func.isRequired,
|
getComponent: PropTypes.func.isRequired,
|
||||||
@@ -59,6 +61,7 @@ export default class OperationContainer extends PureComponent {
|
|||||||
const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
|
const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
|
||||||
const allowTryItOut = typeof props.allowTryItOut === "undefined" ?
|
const allowTryItOut = typeof props.allowTryItOut === "undefined" ?
|
||||||
props.specSelectors.allowTryItOutFor(props.path, props.method) : props.allowTryItOut
|
props.specSelectors.allowTryItOutFor(props.path, props.method) : props.allowTryItOut
|
||||||
|
const security = op.getIn(["operation", "security"]) || props.specSelectors.security()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
operationId,
|
operationId,
|
||||||
@@ -67,6 +70,8 @@ export default class OperationContainer extends PureComponent {
|
|||||||
displayOperationId,
|
displayOperationId,
|
||||||
displayRequestDuration,
|
displayRequestDuration,
|
||||||
allowTryItOut,
|
allowTryItOut,
|
||||||
|
security,
|
||||||
|
isAuthorized: props.authSelectors.isAuthorized(security),
|
||||||
isShown: layoutSelectors.isShown(isShownKey, docExpansion === "full" ),
|
isShown: layoutSelectors.isShown(isShownKey, docExpansion === "full" ),
|
||||||
jumpToKey: `paths.${props.path}.${props.method}`,
|
jumpToKey: `paths.${props.path}.${props.method}`,
|
||||||
response: props.specSelectors.responseFor(props.path, props.method),
|
response: props.specSelectors.responseFor(props.path, props.method),
|
||||||
@@ -123,6 +128,8 @@ export default class OperationContainer extends PureComponent {
|
|||||||
tag,
|
tag,
|
||||||
path,
|
path,
|
||||||
method,
|
method,
|
||||||
|
security,
|
||||||
|
isAuthorized,
|
||||||
operationId,
|
operationId,
|
||||||
showSummary,
|
showSummary,
|
||||||
isShown,
|
isShown,
|
||||||
@@ -152,6 +159,8 @@ export default class OperationContainer extends PureComponent {
|
|||||||
tag,
|
tag,
|
||||||
path,
|
path,
|
||||||
method,
|
method,
|
||||||
|
security,
|
||||||
|
isAuthorized,
|
||||||
operationId,
|
operationId,
|
||||||
showSummary,
|
showSummary,
|
||||||
isShown,
|
isShown,
|
||||||
|
|||||||
Reference in New Issue
Block a user