Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Watcher] Simplify doc links service and fix links. #35382

Merged
merged 1 commit into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { makeDocumentationLink } from './make_documentation_link';
import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links';

export const documentationLinks = {
watcher: {
putWatchApi: makeDocumentationLink(
'{baseUrl}guide/en/elasticsearch/reference/{urlVersion}/watcher-api-put-watch.html'
),
executeWatchApi: makeDocumentationLink(
'{baseUrl}guide/en/elasticsearch/reference/{urlVersion}/watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode'
),
watchNotificationSettings: makeDocumentationLink(
'{baseUrl}guide/en/elasticsearch/reference/{urlVersion}/notification-settings.html#slack-notification-settings'
),
},
};
const esBase = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}`;

export const putWatchApiUrl = `${esBase}/watcher-api-put-watch.html`;
export const executeWatchApiUrl = `${esBase}/watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`;
export const watchNotificationSettingsUrl = `${esBase}/notification-settings.html#slack-notification-settings`;
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { documentationLinks } from './documentation_links';
export * from './documentation_links';

This file was deleted.

4 changes: 2 additions & 2 deletions x-pack/plugins/watcher/public/models/action/slack_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BaseAction } from './base_action';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiCode, EuiLink } from '@elastic/eui';
import { documentationLinks } from '../../lib/documentation_links';
import { watchNotificationSettingsUrl } from '../../lib/documentation_links';

export class SlackAction extends BaseAction {
constructor(props = {}) {
Expand All @@ -34,7 +34,7 @@ export class SlackAction extends BaseAction {
values={{
ymlValue: <EuiCode transparentBackground>message_defaults</EuiCode>,
link: (
<EuiLink href={documentationLinks.watcher.watchNotificationSettings} target="_blank">
<EuiLink href={watchNotificationSettingsUrl} target="_blank">
<FormattedMessage
id="xpack.watcher.sections.watchEdit.json.slackActionValidationWarningMessage.helpLinkText"
defaultMessage="Learn more."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { i18n } from '@kbn/i18n';
import { ConfirmWatchesModal } from '../../../components/confirm_watches_modal';
import { ErrableFormRow } from '../../../components/form_errors';
import { documentationLinks } from '../../../lib/documentation_links';
import { putWatchApiUrl } from '../../../lib/documentation_links';
import { onWatchSave, saveWatch } from '../watch_edit_actions';
import { WatchContext } from './watch_context';
import { LicenseServiceContext } from '../../../license_service_context';
Expand Down Expand Up @@ -105,7 +105,7 @@ export const JsonWatchEditForm = () => {
defaultMessage: 'Watch JSON',
})}{' '}
(
<EuiLink href={documentationLinks.watcher.putWatchApi} target="_blank">
<EuiLink href={putWatchApiUrl} target="_blank">
{i18n.translate('xpack.watcher.sections.watchEdit.json.form.watchJsonDocLink', {
defaultMessage: 'Syntax',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ACTION_MODES, TIME_UNITS } from '../../../../common/constants';
import { ExecutedWatchDetails, ExecutedWatchResults } from '../../../../common/types/watch_types';
import { ErrableFormRow } from '../../../components/form_errors';
import { executeWatch } from '../../../lib/api';
import { documentationLinks } from '../../../lib/documentation_links';
import { executeWatchApiUrl } from '../../../lib/documentation_links';
import { WatchContext } from '../../../sections/watch_edit/components/watch_context';
import { timeUnits } from '../time_units';
import { JsonWatchEditSimulateResults } from './json_watch_edit_simulate_results';
Expand Down Expand Up @@ -369,7 +369,7 @@ export const JsonWatchEditSimulate = ({
defaultMessage="Allow the watch to execute or skip actions. {actionsLink}"
values={{
actionsLink: (
<EuiLink href={documentationLinks.watcher.executeWatchApi} target="_blank">
<EuiLink href={executeWatchApiUrl} target="_blank">
{i18n.translate(
'xpack.watcher.sections.watchEdit.simulate.form.actionOverridesDescription.linkLabel',
{
Expand Down