From 9547dc02bdd1fec8d31a8cdda059efe10523605f Mon Sep 17 00:00:00 2001 From: Guangning Date: Fri, 11 Dec 2020 00:13:26 +0800 Subject: [PATCH] [Website]Update route jump for restapi endpoint (#8898) ### Motivation This is an update after https://github.com/apache/pulsar/pull/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 --- site2/website/siteConfig.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/site2/website/siteConfig.js b/site2/website/siteConfig.js index e0a2d9cd7eafa..f52c7b118835c 100644 --- a/site2/website/siteConfig.js +++ b/site2/website/siteConfig.js @@ -33,7 +33,17 @@ const createVariableInjectionPlugin = variables => { keyparts = key.split("|"); // endpoint api: endpoint| 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) { @@ -41,7 +51,7 @@ const createVariableInjectionPlugin = variables => { } 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])