Skip to content

Commit

Permalink
[Website]Update route jump for restapi endpoint (apache#8898)
Browse files Browse the repository at this point in the history
### Motivation

This is an update after apache#8888, where `functions` should jump to `/functions-rest-api`,  `source` should jump to `/source-rest-api`, `sink` should jump to `/sink-rest-api`

### Modifications

* Update route jump
* Update markdown content render
  • Loading branch information
tuteng committed Dec 10, 2020
1 parent 8ded6de commit 9547dc0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions site2/website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,25 @@ const createVariableInjectionPlugin = variables => {
keyparts = key.split("|");
// endpoint api: endpoint|<op>
if (keyparts[0] == 'endpoint') {
const restApiVersion = keyparts[2].split('/')[2]
const restPath = keyparts[2].split('/')
const restApiVersion = restPath[2]
const restApiType = restPath[3]
let restBaseUrl = restApiUrl
if (restApiType == 'functions') {
restBaseUrl = functionsApiUrl
} else if (restApiType == 'source') {
restBaseUrl = sourceApiUrl
} else if (restApiType == 'sink') {
restBaseUrl = sinkApiUrl
}
const suffix = keyparts[keyparts.length - 1]
restUrl = ''
if (suffix.indexOf('?version') >= 0) {
restUrl = keyparts[keyparts.length - 1] + '&apiVersion=' + restApiVersion
} else {
restUrl = keyparts[keyparts.length - 1] + 'version=master&apiVersion=' + restApiVersion
}
return renderEndpoint(initializedPlugin, restApiUrl + "#", keyparts, restUrl);
return renderEndpoint(initializedPlugin, restBaseUrl + "#", keyparts, restUrl);
}
}
return initializedPlugin.render(variables[key])
Expand Down

0 comments on commit 9547dc0

Please sign in to comment.