Use documentation link service for Watcher (#93339)

This commit is contained in:
James Rodewig 2021-03-16 08:45:32 -04:00 committed by GitHub
parent 4a83a02433
commit 6c9cfd4893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,18 +16,14 @@ interface ContextValue extends Omit<AppDeps, 'docLinks'> {
const AppContext = createContext<ContextValue>(null as any);
// eslint-disable-next-line @typescript-eslint/naming-convention
const generateDocLinks = ({ ELASTIC_WEBSITE_URL, DOC_LINK_VERSION }: DocLinksStart) => {
const elasticDocLinkBase = `${ELASTIC_WEBSITE_URL}guide/en/`;
const esBase = `${elasticDocLinkBase}elasticsearch/reference/${DOC_LINK_VERSION}`;
const kibanaBase = `${elasticDocLinkBase}kibana/${DOC_LINK_VERSION}`;
const putWatchApiUrl = `${esBase}/watcher-api-put-watch.html`;
const executeWatchApiUrl = `${esBase}/watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`;
const watcherGettingStartedUrl = `${kibanaBase}/watcher-ui.html`;
const generateDocLinks = ({ links }: DocLinksStart) => {
const putWatchApiUrl = `${links.apis.putWatch}`;
const executeWatchApiUrl = `${links.apis.executeWatchActionModes}`;
const watcherGettingStartedUrl = `${links.watcher.ui}`;
const watchActionsConfigurationMap = {
[ACTION_TYPES.SLACK]: `${esBase}/actions-slack.html#configuring-slack`,
[ACTION_TYPES.PAGERDUTY]: `${esBase}/actions-pagerduty.html#configuring-pagerduty`,
[ACTION_TYPES.JIRA]: `${esBase}/actions-jira.html#configuring-jira`,
[ACTION_TYPES.SLACK]: `${links.watcher.slackAction}`,
[ACTION_TYPES.PAGERDUTY]: `${links.watcher.pagerDutyAction}`,
[ACTION_TYPES.JIRA]: `${links.watcher.jiraAction}`,
};
return {