Skip to content

Commit

Permalink
[Code] initial commit for Code doc (#38521) (#38625)
Browse files Browse the repository at this point in the history
  • Loading branch information
chongzhe authored Jun 10, 2019
1 parent 1d12402 commit 2c1dc3b
Show file tree
Hide file tree
Showing 23 changed files with 268 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/code/code-basic-nav.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[code-basic-nav]]
== Basic navigation

[float]
==== View file structure and information
The *File* tree on the left is the major way for you to navigate through your folder structure. When you are on a directory, *Code* also presents a finder-like view on the right. Additionally, a file path breadcrumb makes it easy to go back to any parent directory.

[float]
==== Git History and Blame
The *Directory* view shows the most recent commits. Clicking *View More* or *History* shows the complete commit history of the current folder or file.

[role="screenshot"]
image::images/code-history.png[]

Clicking *Blame* shows the most recent commit per line.

[role="screenshot"]
image::images/code-blame.png[]

include::code-semantic-nav.asciidoc[]
37 changes: 37 additions & 0 deletions docs/code/code-getting-started.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[code-getting-started]]
== Getting Started with Code

The easiest way to get started with *Code* is to import a real-world repository into *Code*.

[float]
==== Before you begin
You must have a {kib} instance up and running.

If you are in an environment where you have multiple {kib} instances in a cluster, see <<code-multiple-kibana-instances-config, Config for multiple Kibana instances>>.

[float]
==== Import your first repository
. Navigate to the Code app.

. In *Repository URL*, paste the following GitHub clone URL:
+
[source,bash]
----
https://github.com/Microsoft/TypeScript-Node-Starter
----

. Click *Import*.
+
A list item shows the cloning, then indexing progress of the `TypeScript-Node-Starter` repo.
+
[role="screenshot"]
image::images/code-import-repo.png[]

. After the indexing is complete, navigate to the repo by clicking its name in the list.
+
[role="screenshot"]
image::images/code-starter-root.png[]
+
Congratulations! You just imported your first repo into *Code*.

include::code-repo-management.asciidoc[]
21 changes: 21 additions & 0 deletions docs/code/code-install-lang-server.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[code-install-lang-server]]
== Install language server

*Code* comes to with built-in language support to TypeScript. You can install additional languages as a {kib} plugin.

[role="screenshot"]
image::images/code-lang-server-tab.png[]

The following languages are supported for the current version:

* Built-in language support: `TypeScript`

* Additional language support: `Java`

You can check the status of the language servers and get installation instructions on the *Language Servers* tab. Make sure the status of the language server is `INSTALLED` or `RUNNING` after your restart the {kib} instance.
[role="screenshot"]
image::images/code-lang-server-status.png[]



include::code-basic-nav.asciidoc[]
10 changes: 10 additions & 0 deletions docs/code/code-multiple-kibana-instances-config.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[code-multiple-kibana-instances-config]]
== Config for multiple {kib} instances
If you are using multiple instances of {kib}, you must assign one {kib} instance as a *Code* `node`. Add the following line of code to your `kibana.yml` file for every {kib} instance and restart the instances:

[source,yaml]
----
xpack.code.codeNodeUrl: 'http://$YourCodeNodeAddress'
----

`$YourCodeNoteAddress` is the URL of your assigned *Code* node accessible by other {kib} instances.
51 changes: 51 additions & 0 deletions docs/code/code-repo-management.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[[code-repo-management]]
== Repo management

Code starts with an overview of your repositories. You can then use the UI to add, delete, and reindex a repo.
[role="screenshot"]
image::images/code-repo-management.png[]

[float]
==== Add and delete a repo
The <<code-getting-started, Getting Started>> 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 SSH key to {kib} to clone private repo.

Deleting a repo removes it from local storage and the Elasticsearch index.

[float]
==== Reindex a repo
*Code* automatically reindexes an imported repo, 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.

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

[source,yaml]
----
['github.com', 'gitlab.com', 'bitbucket.org', 'gitbox.apache.org', 'eclipse.org']
----

You can add your own hostname (for example, acme.com) to the whitelist by adding the following line to your `config/kibana.yaml` file:

[source,yaml]
----
xpack.code.gitHostWhitelist: [ "github.com", "gitlab.com", "bitbucket.org", "gitbox.apache.org", "eclipse.org", "acme.com" ]
----

Set `xpack.code.gitHostWhitelist` to [] (empty list) allow any hostname.

You can also control the protocol to use for the clone address. By default, the following protocols are supported: `[ 'https', 'git', 'ssh' ]`. You can change this value by adding the following line to your `config/kibana.yaml` file. In this example, the user only wants to support the `https` protocol:

[source,yaml]
----
xpack.code.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.



include::code-install-lang-server.asciidoc[]
24 changes: 24 additions & 0 deletions docs/code/code-search.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[[code-search]]
== Search

[float]
==== Typeahead search
The search bar is built to minimize the time for you to locate the result. It shows `Symbols`, `Files`, and `Repos` results as you type, and clicking on any result takes you to the definition. You can use the search type dropdown to show all types of results or limit it to a specific search type.

[role="screenshot"]
image::images/code-quick-search.png[]

[float]
==== Full-text search
If the quick search results don’t contain what you are looking for, you can press ‘Enter’ to bring out the full text search.
[role="screenshot"]
image::images/code-full-text-search.png[]
You can further slice and dice the results using the repo and language facet filters on the left.

[float]
==== Search filter
You can also use the Search Filters to limit the search scope to certain repos before issuing a query. To search across all repos, remove all repo filters. By default, the search repo is limited to the current repo.
[role="screenshot"]
image::images/code-search-filter.png[]

include::code-multiple-kibana-instances-config.asciidoc[]
24 changes: 24 additions & 0 deletions docs/code/code-semantic-nav.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[[code-semantic-nav]]

== Semantic code navigation
If the file is one of *Code’s* <<code-install-lang-server, supported languages>> and the corresponding language server is <<code-install-lang-server, properly installed>>, you can navigate the files with semantic code navigation features.

[float]
==== Goto definition and find reference
Hovering your cursor over a symbol in a file opens information about the symbol, including its qualified name and documentation, when available. You can perform two actions:

* *Goto Definition* navigates to the symbol definition. If the definition is defined in another repo, *Code* can find the definition if the definition repo is also imported.

* *Find Reference* opens a panel that lists all the places where the symbol is referenced in the current repo.

[role="screenshot"]
image::images/code-semantic-nav.png[]

[float]
==== View symbol table
From the *Structure* tab, you can open a symbol table that details the structure of the current class. Clicking on a member function or variable jumps to its definition.

[role="screenshot"]
image::images/code-symbol-table.png[]

include::code-search.asciidoc[]
19 changes: 19 additions & 0 deletions docs/code/index.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[code-intro]]
= Code

[partintro]
--

beta[] Interaction with source code is pervasive and essential for any technology company. How efficiently you search, navigate, and gain insight to your source code impacts how fast your organization can innovate. *Code* provides an easy-to-use code search solution that scales with your organization, so your team can focus on shipping awesome products and providing the best services. *Code* provides the following functions:

Code provides:

* Jump to definition and find references for a symbol
* Typeahead search for symbol definition, file, and repo
* Symbol table
* Full text search with repo and language filters

<<code-getting-started, Get Started>> with *Code* by importing your first repo.
--

include::code-getting-started.asciidoc[]
Binary file added docs/images/code-blame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-full-text-search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-import-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-lang-server-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-lang-server-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-quick-search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-repo-management.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-search-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-semantic-nav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-starter-root.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/code-symbol-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ include::ml/index.asciidoc[]

include::maps/index.asciidoc[]

include::code/index.asciidoc[]

include::infrastructure/index.asciidoc[]

include::logs/index.asciidoc[]
Expand Down
59 changes: 59 additions & 0 deletions docs/settings/code-settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[role="xpack"]
[[code-settings-kibana]]
== Code Settings in Kibana
++++
<titleabbrev>Code settings</titleabbrev>
++++

Unless you are running multiple Kibana instances as a cluster, you do not need to change any settings to use *Code* by default. If you’d like to change any of the default values, copy and paste the relevant settings below into your `kibana.yml` configuration file.

`xpack.code.queueIndex`::
Internal worker queue index name. Defaults to `.code_internal-worker-queue`.

`xpack.code.queueTimeoutMs`::
Internal worker queue task timeout. Default to `3600000`.

`xpack.code.updateFrequencyMs`::
Update scheduler execution frequency in milliseconds. Defaults to `300000`.

`xpack.code.indexFrequencyMs`::
Index scheduler execution frequency in milliseconds. Defaults to `86400000`.

`xpack.code.updateRepoFrequencyMs`::
Repo update frequency in milliseconds. Defaults to `300000`.

`xpack.code.indexRepoFrequencyMs`::
Repo index frequency in milliseconds. Defaults to `86400000`.

`xpack.code.lsp.requestTimeoutMs`::
Timeout time for a request to language servers in milliseconds. Defaults to `10000`.

`xpack.code.lsp.detach`::
Whether language servers will run in detach mode. Defaults to `false`.

`xpack.code.lsp.verbose`::
Whether to show more verbose log for language servers. Defaults to `false`.

`xpack.code.security.enableMavenImport`::
Whether to support maven. Defaults to `true`.

`xpack.code.security.enableGradleImport`::
Whether to support gradle. Defaults to `false`.

`xpack.code.security.installNodeDependency`::
Whether to enable node dependency download. Defaults to `true`.

`xpack.code.security.gitHostWhitelist`::
Whitelist of hostnames for git clone address. Defaults to `[ 'github.com', 'gitlab.com', 'bitbucket.org', 'gitbox.apache.org', 'eclipse.org',]`.

`xpack.code.security.gitProtocolWhitelist`::
Whitelist of protocols for git clone address. Defaults to `[ 'https', 'git', 'ssh' ]`.

`xpack.code.security.enableGitCertCheck`::
Whether to enable Code to load git key pairs. Defaults to `true`.

`xpack.code.maxWorkspace`::
Maximal number of workspaces each language server allows to span. Defaults to `5`.

`xpack.code.codeNodeUrl`::
URL of the Code node. This config is only needed when multiple Kibana instances are set up as a cluster. Defaults to ``
1 change: 1 addition & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ Rollup user interface.


include::{docdir}/settings/apm-settings.asciidoc[]
include::{docdir}/settings/code-settings.asciidoc[]
include::{docdir}/settings/dev-settings.asciidoc[]
include::{docdir}/settings/graph-settings.asciidoc[]
include::{docdir}/settings/infrastructure-ui-settings.asciidoc[]
Expand Down

0 comments on commit 2c1dc3b

Please sign in to comment.