Rewire ability to disable Try It Out from OperationContainer

This commit is contained in:
Kyle Shockey
2017-11-17 15:47:54 -08:00
parent 84db66eb94
commit b61cf558f3

View File

@@ -57,6 +57,8 @@ export default class OperationContainer extends PureComponent {
const operationId = op.getIn(["operation", "operationId"]) || op.getIn(["operation", "__originalOperationId"]) || opId(op.get("operation"), props.path, props.method) || op.get("id") const operationId = op.getIn(["operation", "operationId"]) || op.getIn(["operation", "__originalOperationId"]) || opId(op.get("operation"), props.path, props.method) || op.get("id")
const isShownKey = ["operations", props.tag, operationId] const isShownKey = ["operations", props.tag, operationId]
const isDeepLinkingEnabled = deepLinking && deepLinking !== "false" const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
const allowTryItOut = typeof props.allowTryItOut === "undefined" ?
props.specSelectors.allowTryItOutFor(props.path, props.method) : props.allowTryItOut
return { return {
operationId, operationId,
@@ -64,9 +66,9 @@ export default class OperationContainer extends PureComponent {
showSummary, showSummary,
displayOperationId, displayOperationId,
displayRequestDuration, displayRequestDuration,
allowTryItOut,
isShown: layoutSelectors.isShown(isShownKey, docExpansion === "full" ), isShown: layoutSelectors.isShown(isShownKey, docExpansion === "full" ),
jumpToKey: `paths.${props.path}.${props.method}`, jumpToKey: `paths.${props.path}.${props.method}`,
allowTryItOut: props.specSelectors.allowTryItOutFor(props.path, props.method),
response: props.specSelectors.responseFor(props.path, props.method), response: props.specSelectors.responseFor(props.path, props.method),
request: props.specSelectors.requestFor(props.path, props.method) request: props.specSelectors.requestFor(props.path, props.method)
} }