Fix deep linking
This commit is contained in:
@@ -54,11 +54,11 @@ export default class Operation extends PureComponent {
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
isShown,
|
isShown,
|
||||||
isShownKey,
|
|
||||||
jumpToKey,
|
jumpToKey,
|
||||||
path,
|
path,
|
||||||
method,
|
method,
|
||||||
op,
|
op,
|
||||||
|
tag,
|
||||||
showSummary,
|
showSummary,
|
||||||
operationId,
|
operationId,
|
||||||
allowTryItOut,
|
allowTryItOut,
|
||||||
@@ -83,6 +83,7 @@ export default class Operation extends PureComponent {
|
|||||||
let security = operation.get("security") || specSelectors.security()
|
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]
|
||||||
|
|
||||||
const Responses = getComponent("responses")
|
const Responses = getComponent("responses")
|
||||||
const Parameters = getComponent( "parameters" )
|
const Parameters = getComponent( "parameters" )
|
||||||
@@ -110,7 +111,7 @@ export default class Operation extends PureComponent {
|
|||||||
<a
|
<a
|
||||||
className="nostyle"
|
className="nostyle"
|
||||||
onClick={isDeepLinkingEnabled ? (e) => e.preventDefault() : null}
|
onClick={isDeepLinkingEnabled ? (e) => e.preventDefault() : null}
|
||||||
href={isDeepLinkingEnabled ? `#/${tagKey}/${operationKey}` : null}>
|
href={isDeepLinkingEnabled ? `#/${isShownKey.join("/")}` : null}>
|
||||||
<span>{path}</span>
|
<span>{path}</span>
|
||||||
</a>
|
</a>
|
||||||
<JumpToPath path={jumpToKey} />
|
<JumpToPath path={jumpToKey} />
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export default class OperationContainer extends PureComponent {
|
|||||||
operationId: PropTypes.string.isRequired,
|
operationId: PropTypes.string.isRequired,
|
||||||
showSummary: PropTypes.bool.isRequired,
|
showSummary: PropTypes.bool.isRequired,
|
||||||
isShown: PropTypes.bool.isRequired,
|
isShown: PropTypes.bool.isRequired,
|
||||||
isShownKey: PropTypes.instanceOf(Iterable).isRequired,
|
|
||||||
jumpToKey: PropTypes.string.isRequired,
|
jumpToKey: PropTypes.string.isRequired,
|
||||||
allowTryItOut: PropTypes.bool,
|
allowTryItOut: PropTypes.bool,
|
||||||
displayOperationId: PropTypes.bool,
|
displayOperationId: PropTypes.bool,
|
||||||
@@ -55,13 +54,12 @@ export default class OperationContainer extends PureComponent {
|
|||||||
const { docExpansion, deepLinking, displayOperationId, displayRequestDuration } = getConfigs()
|
const { docExpansion, deepLinking, displayOperationId, displayRequestDuration } = getConfigs()
|
||||||
const showSummary = layoutSelectors.showSummary()
|
const showSummary = layoutSelectors.showSummary()
|
||||||
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 = fromJS(["operations", props.tag, operationId])
|
const isShownKey = ["operations", props.tag, operationId]
|
||||||
const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
|
const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
operationId,
|
operationId,
|
||||||
isDeepLinkingEnabled,
|
isDeepLinkingEnabled,
|
||||||
isShownKey,
|
|
||||||
showSummary,
|
showSummary,
|
||||||
displayOperationId,
|
displayOperationId,
|
||||||
displayRequestDuration,
|
displayRequestDuration,
|
||||||
@@ -125,7 +123,6 @@ export default class OperationContainer extends PureComponent {
|
|||||||
operationId,
|
operationId,
|
||||||
showSummary,
|
showSummary,
|
||||||
isShown,
|
isShown,
|
||||||
isShownKey,
|
|
||||||
jumpToKey,
|
jumpToKey,
|
||||||
allowTryItOut,
|
allowTryItOut,
|
||||||
response,
|
response,
|
||||||
@@ -155,7 +152,6 @@ export default class OperationContainer extends PureComponent {
|
|||||||
operationId,
|
operationId,
|
||||||
showSummary,
|
showSummary,
|
||||||
isShown,
|
isShown,
|
||||||
isShownKey,
|
|
||||||
jumpToKey,
|
jumpToKey,
|
||||||
allowTryItOut,
|
allowTryItOut,
|
||||||
request,
|
request,
|
||||||
@@ -171,6 +167,7 @@ export default class OperationContainer extends PureComponent {
|
|||||||
operation={operationProps}
|
operation={operationProps}
|
||||||
response={response}
|
response={response}
|
||||||
request={request}
|
request={request}
|
||||||
|
isShown={isShown}
|
||||||
|
|
||||||
toggleShown={this.toggleShown}
|
toggleShown={this.toggleShown}
|
||||||
onTryoutClick={this.onTryoutClick}
|
onTryoutClick={this.onTryoutClick}
|
||||||
|
|||||||
Reference in New Issue
Block a user