Skip to content

Commit

Permalink
Merge branch 'master' into update-react-router-dom-to-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Sep 30, 2019
2 parents 6c9cd26 + 3316d44 commit e95f1a4
Show file tree
Hide file tree
Showing 197 changed files with 3,856 additions and 1,710 deletions.
2 changes: 1 addition & 1 deletion docs/code/code-import-first-repo.asciidoc
Expand Up @@ -29,7 +29,7 @@ xpack.code.ui.enabled: true
https://github.com/Microsoft/TypeScript-Node-Starter
----

`https` is recommend for cloning git repositories.
`https` is recommend for cloning most git repositories. To clone a private repository, <<code-repo-management, use SSH>>.

. Click *Import*.
+
Expand Down
40 changes: 31 additions & 9 deletions docs/code/code-repo-management.asciidoc
Expand Up @@ -6,20 +6,40 @@ Code starts with an overview of your repositories. You can then use the UI to a
image::images/code-repo-management.png[]

[float]
[[add-delete-a-repo]]
==== Add and delete a repo
The <<code-import-first-repo, Import your first repository>> page provides step-by-step instructions for adding a GitHub repo to *Code*. You can fine tune the hostname of the git clone URL in your `kibana.yml` file.
The <<code-import-first-repo, Import your first repository>> page provides step-by-step instructions for adding a GitHub repo to *Code*. You can fine-tune the hostname of the git clone URL in your `kibana.yml` file.

For security reasons, Code allows only a few trusted hostnames, such as github.com, by default. You can add an SSH key to {kib} to clone private repos.
For security reasons, Code allows only a few <<clone-url-management,trusted hostnames>>, such as github.com. To clone private repositories see <<clone-private-repo,add an SSH key>>.

Deleting a repo removes it from local storage and the Elasticsearch index.
To delete a repository, go to the **Repositories** tab, find the name of the repo, and click *Delete*.

[float]
==== Reindex a repo
*Code* automatically reindexes an imported repo at set intervals, but in some cases you might need to manually refresh the index. For example, you might refresh an index after a new language server is installed. Or, you might want to immediately update the index to the HEAD revision. Click *Reindex* to initiate a reindex.
[[clone-private-repo]]
==== Clone private repo with an SSH key
Clones of private repos require an SSH key for authentication. The username associated with your host must have write access to the repository you want to clone.

The following section provides links for generating your ssh key through GitHub. If you already have an SSH key added through your host, skip to step 4.

1. https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key[Generate an ssh key].

2. https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent[Add the ssh key to your ssh-agent.]

3. https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account[Add the ssh key to your host].

4. Copy the ssh key into `data/code/credentials/` under the {kib} folder.

In some cases you might need to manually refresh the index besides automatic indexing. For example, you might refresh an index after a new language server is installed. Or, you might want to immediately update the index to the HEAD revision. Click *Reindex* to initiate a reindex.
You can now copy private Git repositories into Code.

To delete a repository, find the go to the **Repositories** tab, find the name of the repo and click *Delete*.

[float]
[[reindex-a-repo]]
==== Reindex a repo
*Code* automatically reindexes an imported repo at set intervals, but in some cases, you might need to refresh the index manually. For example, you might refresh an index after a new language server installs. Or, you might want to update the index to the HEAD revision immediately. Click *Reindex* to initiate a reindex.

[float]
[[clone-url-management]]
==== Clone URL management
For security reasons, *Code* only allows the following hostnames in the git clone URL by default:

Expand All @@ -46,9 +66,11 @@ xpack.code.security.gitProtocolWhitelist: [ "https" ]
----

[float]
==== Clone repo with SSH key
If your repo clone requires an SSH key for authentication, put the SSH key in `data/code/credentials/` under the {kib} folder.

[[repo-limitations]]
==== Limitations
Consider the following limitations before cloning repositories:

- Only Git is supported. Other version control systems, such as Mercurial and SVN, are not supported.
- Your disk might not have enough space to clone repositories due to {kib} watermark settings. To update your watermark settings, contact your system administrator and request additional disk space.

include::code-install-lang-server.asciidoc[]
16 changes: 8 additions & 8 deletions docs/management/watcher-ui/index.asciidoc
Expand Up @@ -19,7 +19,7 @@ With this UI, you can:
[role="screenshot"]
image:management/watcher-ui/images/watches.png["Watcher list"]

{stack-ov}/xpack-alerting.html[Alerting on cluster and index events]
{ref}/xpack-alerting.html[Alerting on cluster and index events]
is a good source for detailed
information on how watches work. If you are using the UI to create a
threshold watch, take a look at the different watcher actions. If you are
Expand Down Expand Up @@ -110,9 +110,9 @@ image:management/watcher-ui/images/threshold-alert/threshold-alert-condition.png

Now that the condition is set, you must add an action. The action triggers
when the watch condition is met. For a complete list of actions and how to configure them, see
{stack-ov}/action-conditions.html[Adding conditions to actions].
{ref}/action-conditions.html[Adding conditions to actions].

In this example, you’ll configure an email action. You must have an {stack-ov}/actions-email.html#configuring-email[email account configured]
In this example, you’ll configure an email action. You must have an {ref}/actions-email.html#configuring-email[email account configured]
in {es} for this example to work.

. Click *Add action* and select *Email*.
Expand Down Expand Up @@ -178,7 +178,7 @@ image:management/watcher-ui/images/execution-history.png["Execution history tab"
The *Action statuses* tab lists all actions associated with the watch and
the state of each action. If the action is firing, you can acknowledge the
watch to prevent too many executions of the same action for the same watch.
See {stack-ov}/actions.html#actions-ack-throttle[Acknowledgement and Throttling] for details.
See {ref}/actions.html#actions-ack-throttle[Acknowledgement and throttling] for details.

[role="screenshot"]
image:management/watcher-ui/images/alerts-status.png["Action status tab"]
Expand Down Expand Up @@ -209,7 +209,7 @@ For more information, see {ref}/query-dsl.html[Query DSL].
On the Watch overview page, click *Create* and choose *Create advanced watch*.
An advanced watch requires a name and ID. Name is a user-friendly way to
identify the watch, and ID refers to the identifier used by {es}. Refer to
{stack-ov}/how-watcher-works.html#watch-definition[Watch definition] for how
{ref}/how-watcher-works.html#watch-definition[Watch definition] for how
to input the watch JSON.

[role="screenshot"]
Expand All @@ -227,7 +227,7 @@ simulation. Be aware of these implementation details on overrides:
* Action overrides support {ref}/watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode[multiple options].

After starting the simulation, you’ll see a results screen. For more information
on the fields in the response, see the {ref}//watcher-api-execute-watch.html[Execute Watch API].
on the fields in the response, see the {ref}/watcher-api-execute-watch.html[Execute watch API].

[role="screenshot"]
image:management/watcher-ui/images/advanced-watch/advanced-watch-simulate.png["Create advanced watch"]
Expand All @@ -237,8 +237,8 @@ image:management/watcher-ui/images/advanced-watch/advanced-watch-simulate.png["C

Refer to these examples for creating an advanced watch:

* {stack-ov}/watch-cluster-status.html[Watch the status of an {es} cluster]
* {stack-ov}/watching-meetup-data.html[Watch event data]
* {ref}/watch-cluster-status.html[Watch the status of an {es} cluster]
* {ref}/watching-meetup-data.html[Watch event data]



2 changes: 1 addition & 1 deletion docs/user/monitoring/cluster-alerts.asciidoc
Expand Up @@ -47,7 +47,7 @@ include::cluster-alerts-license.asciidoc[]
To receive email notifications for the Cluster Alerts:

. Configure an email account as described in
{stack-ov}/actions-email.html#configuring-email[Configuring email accounts].
{ref}/actions-email.html#configuring-email[Configuring email accounts].
. Configure the
`xpack.monitoring.cluster_alerts.email_notifications.email_address` setting in
`kibana.yml` with your email address.
Expand Down
4 changes: 2 additions & 2 deletions docs/user/monitoring/viewing-metrics.asciidoc
Expand Up @@ -29,8 +29,8 @@ By default, data is retrieved from the cluster specified in the
from a different cluster, set `xpack.monitoring.elasticsearch.hosts`.

To learn more about typical monitoring architectures,
see {stack-ov}/how-monitoring-works.html[How monitoring works] and
{stack-ov}/monitoring-production.html[Monitoring in a production environment].
see {ref}/how-monitoring-works.html[How monitoring works] and
{ref}/monitoring-production.html[Monitoring in a production environment].
--

. Verify that `xpack.monitoring.ui.enabled` is set to `true`, which is the
Expand Down
4 changes: 2 additions & 2 deletions docs/user/reporting/watch-example.asciidoc
Expand Up @@ -4,7 +4,7 @@ see {kibana-ref}/secure-reporting.html[Securing Reporting].

To configure a watch to email reports, you use the `reporting` attachment type
in an `email` action. For more information, see
{stack-ov}/actions-email.html#configuring-email[Configuring Email Accounts].
{ref}/actions-email.html#configuring-email[Configuring email accounts].

For example, the following watch generates a PDF report and emails the report every hour:

Expand Down Expand Up @@ -46,7 +46,7 @@ PUT _watcher/watch/error_report

<1> You must configure at least one email account to enable Watcher to send email.
For more information, see
{xpack-ref}/actions-email.html#configuring-email[Configuring Email Accounts].
{ref}/actions-email.html#configuring-email[Configuring email accounts].
<2> This is an example POST URL. You can copy and paste the URL for any
report from the Kibana UI.
<3> Optional, default is 40
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -107,7 +107,7 @@
"@babel/register": "^7.5.5",
"@elastic/charts": "^12.0.2",
"@elastic/datemath": "5.0.2",
"@elastic/eui": "14.2.0",
"@elastic/eui": "14.3.0",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.3.3",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -106,6 +106,7 @@ export class ConsoleMenu extends Component<Props, State> {
<EuiButtonIcon
iconType="wrench"
onClick={this.onButtonClick}
data-test-subj="toggleConsoleMenu"
// @ts-ignore
aria-label={
<FormattedMessage
Expand Down Expand Up @@ -133,6 +134,7 @@ export class ConsoleMenu extends Component<Props, State> {
</EuiContextMenuItem>,
<EuiContextMenuItem
key="Open documentation"
data-test-subj="consoleMenuOpenDocs"
onClick={() => {
this.openDocs();
}}
Expand All @@ -142,7 +144,11 @@ export class ConsoleMenu extends Component<Props, State> {
defaultMessage="Open documentation"
/>
</EuiContextMenuItem>,
<EuiContextMenuItem key="Auto indent" onClick={this.autoIndent}>
<EuiContextMenuItem
data-test-subj="consoleMenuAutoIndent"
key="Auto indent"
onClick={this.autoIndent}
>
<FormattedMessage
id="console.requestOptions.autoIndentButtonLabel"
defaultMessage="Auto indent"
Expand Down
@@ -0,0 +1,124 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React from 'react';
import { ReactWrapper, mount } from 'enzyme';
import { I18nProvider } from '@kbn/i18n/react';
import * as sinon from 'sinon';

import { EditorContextProvider } from '../../context';
import { AppContextProvider } from '../../../../context';
import { Editor } from './editor';

jest.mock('../../../../components/editor_example.tsx', () => {});
jest.mock('../../../../../../../public/quarantined/src/mappings.js', () => ({
retrieveAutoCompleteInfo: () => {},
}));
jest.mock('../../../../../../../public/quarantined/src/input.js', () => {
return {
initializeInput: () => ({
$el: {
css: () => {},
},
focus: () => {},
update: () => {},
getSession: () => ({ on: () => {}, setUseWrapMode: () => {} }),
commands: {
addCommand: () => {},
},
}),
};
});

import * as sendRequestModule from './send_current_request_to_es';
import * as consoleMenuActions from '../console_menu_actions';

describe('Legacy (Ace) Console Editor Component Smoke Test', () => {
let mockedAppContextValue: any;
let editor: ReactWrapper;

beforeEach(() => {
document.queryCommandSupported = sinon.fake(() => true);
mockedAppContextValue = {
services: {
history: {
getSavedEditorState: () => null,
updateCurrentState: () => {},
},
},
// eslint-disable-next-line
ResizeChecker: function() {
return { on: () => {} };
},
docLinkVersion: 'NA',
};
editor = mount(
<I18nProvider>
<AppContextProvider value={mockedAppContextValue}>
<EditorContextProvider settings={{} as any}>
<Editor />
</EditorContextProvider>
</AppContextProvider>
</I18nProvider>
);
});

it('calls send current request to ES', () => {
const stub = sinon.stub(sendRequestModule, 'sendCurrentRequestToES');
try {
editor.find('[data-test-subj~="sendRequestButton"]').simulate('click');
expect(stub.called).toBe(true);
expect(stub.callCount).toBe(1);
} finally {
stub.restore();
}
});

it('opens docs', () => {
const stub = sinon.stub(consoleMenuActions, 'getDocumentation');
try {
const consoleMenuToggle = editor.find('[data-test-subj~="toggleConsoleMenu"]').last();
consoleMenuToggle.simulate('click');

const docsButton = editor.find('[data-test-subj~="consoleMenuOpenDocs"]').last();
docsButton.simulate('click');

expect(stub.called).toBe(true);
expect(stub.callCount).toBe(1);
} finally {
stub.restore();
}
});

it('prompts auto-indent', () => {
const stub = sinon.stub(consoleMenuActions, 'autoIndent');
try {
const consoleMenuToggle = editor.find('[data-test-subj~="toggleConsoleMenu"]').last();
consoleMenuToggle.simulate('click');

const autoIndentButton = editor.find('[data-test-subj~="consoleMenuAutoIndent"]').last();
autoIndentButton.simulate('click');

expect(stub.called).toBe(true);
expect(stub.callCount).toBe(1);
} finally {
stub.restore();
}
});
});
Expand Up @@ -181,7 +181,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) {
>
<button
onClick={sendCurrentRequestToES}
data-test-subj="send-request-button"
data-test-subj="sendRequestButton"
className="conApp__editorActionButton conApp__editorActionButton--success"
>
<EuiIcon type="play" />
Expand Down
6 changes: 0 additions & 6 deletions src/legacy/core_plugins/console/public/quarantined/src/es.js
Expand Up @@ -35,11 +35,6 @@ export function getContentType(body) {
export function send(method, path, data) {
const wrappedDfd = $.Deferred(); // eslint-disable-line new-cap

const isGetRequest = /^get$/i.test(method);
if (data && isGetRequest) {
method = 'POST';
}

const options = {
url: '../api/console/proxy?' + formatQueryString({ path, method }),
data,
Expand All @@ -50,7 +45,6 @@ export function send(method, path, data) {
dataType: 'text', // disable automatic guessing
};


$.ajax(options).then(
function (data, textStatus, jqXHR) {
wrappedDfd.resolveWith(this, [data, textStatus, jqXHR]);
Expand Down
Expand Up @@ -267,7 +267,7 @@ function retrieveSettings(settingsKey, settingsToRetrieve) {

// Fetch autocomplete info if setting is set to true, and if user has made changes.
if (currentSettings[settingsKey] && settingsToRetrieve[settingsKey]) {
return es.send('GET', settingKeyToPathMap[settingsKey], null, null, true);
return es.send('GET', settingKeyToPathMap[settingsKey], null);
} else {
const settingsPromise = new $.Deferred();
// If a user has saved settings, but a field remains checked and unchanged, no need to make changes
Expand Down

0 comments on commit e95f1a4

Please sign in to comment.