Skip to content

Commit

Permalink
Create a squash commit for code (#35547)
Browse files Browse the repository at this point in the history
* [Code] Use system JDK if it is available (#31389)

* [Code] fix functional tests (#31555)

* fix(code/frontend): main page (#29811)

* [Code] fix find references style (#30911)

* [Code]: properly reconnect when langserver is down and clean up logs, fix #839, #891 (#30601)

* fix(code/frontend): wider clickable area for file and structure node (#31176)

* fix(code/frontend): fix project filter press enter location change (#29919)

* Code: move all non-error LSP logging to debug level

* [Code] Dark mode cleanup (#31208)

* fix(code/frontend): fix componentWillMount (#31772)

* [Code] Remove socket.io and use polling message to pull progresses (#31398)

* [Code] Remove socket.io and use polling message to pull progresses

* [Code] refactor the status polling logic

* [Code] fix a minor test issue

* [Code] correctly handle url when workspace is a symbol link. (#31782)

* fix(code/frontend): lose symbols (#31664)

* [Code] functional test for code intelligence (#31673)

* [Code] Add api test for multi code node setup (#31460)

* [Code] fix the bug the first type in querybar is alwasy discarded (#31884)

* [Code] disable cross repo jump functional test

* fix(code/frontend): replace deprecated react lifecycle methods (#31874)

* [Code] Add duration for queued tasks (#31885)

* [Code] fix editor lifecycle method (#31983)

* [Code] force delete repository (#31995)

* feature(code/frontend): implement new breadcrumb design (#31247)

* [Code] handle import error (#31875)

* fix(code/frontend): show import project error message

* [Code] increase the git clone/update throttle param to make ES data update less frequent (#31988)

* fix(code/frontend): side navigation bar width should be fixed (#31876)

* fix(code/frontend): should show import modal (#31987)

* [Code] update repo by set target ref directly (#32002)

* [Code] show nothing if setup status is not ready yet. (#31993)

* [Code] fix editor `goto line` (#32094)

* fix(code/frontend): match props missing (#32100)

* [Code] Improve repository progress polling when clone/index is interrupted by delete (#31989)

* [Code] fix tree flatten/expand/collapse problems (#32099)

* [Code] Fix check for JDK's version (#32104)

* fix(code/frontend): type errors (#32119)

* [Code] specify nodegit commit sha in package.json (#32170)

* [Code] fix setup page (#32179)

* [Code] fix type error in java launcher (#32270)

* [plugin installer] Keep external attributes of files during unarchiving (#32105)

* [plugin installer] Keep external attributes of files during unarchiving

* [plugin installer] add test for files' modes check

* [Code] Ignore certificate check for clone (#32271)

* [Code] fix tsc error

* [Code] fix yarn.lock

* Code: fix getClient is not a function error after merging (#32338)

* [Code] fix load file tree by refresh (#32280)

* [Code] Adjust `GoLauncher` to adapt to the running pattern of go server. (#32293)

This adjust will let the code plugin connect the go-langserver actively.
It should be noted that the `GoLauncher` is a semi-manufacture only
support the detach mode for now.

* [Code] Fix a line number bug for composite content calculation (#32376)

* [Code] function test for securities (#32278)

* [Code] hide import button if current user is not code_admin

* [Code] function test for securities

* [Code] apply the correct timestamp to admin page (#32379)

* [Code]: fix duplicate import agains kbn/test/types package, update typescript language server version (#32439)

* fix(code/frontend): highlight structure node (#32034)

* fix(code/frontend): special symbol container name (#32281)

* Monaco Editor Dark Mode (#32263)

* Initial go at light/dark mode compatability for the Monaco editor.

* Alphebetizing the imports.

* Using the color-convert package to convert rgb to hex values. Updating the monaco hover widget for dark mode.

* Changes to highlight and selection colors.

* Misspelled an EUI color variable name.

* Dark mode for the search results page.

* Prettifying code_result.tsx.

* Removing the monaco scroll decorator from the editor.

* Fixing some type errors for color-convert

* Markdown styling for dark mode.

* Changing the import location of 'chrome' in the monaco editor

* Adding a constant for the getTheme() method and adjusting blame view dark mode styles.

* [Code]: always downgrade language server logging level by one

* [Code]: upgrade ts langserver version, reduce the timeout for waiting langserver init

* [Code] replace _term aggregator order to _key (#32541)

* fix(code/frontend): reset breadcrumbs and fix code href (#32277)

* [Code] improve index progress calculation (#32537)

* [Code]: clean up the way we config LSP related configs (#32607)

* [Code] change nodegit to @elastic/nodegit (#32543)

* [Code] fix tree loading when jumping between different repos (#32650)

* [Code] Use data dir as config dir (#32609)

* [Code]: remove uneccessary color convert after upgrade to EUI 9

* [Code] fix a undefined path problem

* [Code] compute url for language server plugin (#32644)

* [Code] fix typo (#32751)

[Code] fixed some type errors
[Code] try change nodegit_info task to typescript to avoid ci problem

* [Code]: Update UI test snapshot

* [Code]: Disable project setting, branch selection and diff page (#32799)

* [Code] adjust search bar suggestions style (#32726)

* [Code] disable indent guides lines in editors (#32730)

* feature(code/frontend): show loading spinner when loading file/structure tree (#32775)

* fix(code/frontend): truncate blame date (#32764)

* [Code] Call default to lsp options (#32843)

* [Code] fix path handling in windows (#32882)

* feature(code/frontend): implement new 404 page (#32859)

* fix(code/frontend): truncate directory node and fix margin (#32858)

* [Code]: Upgrade ts langserver version

* [Code]: upgrade test snapshot

* [Build]: use the resolution in CreatePackageJsonTask task

* [Code]: correctly handle errors in JDK finding (#32824)

* [Code] Fix functional test (#32991)

* fix(code): clear import project input after submit (#32970)

* [Code] Show some content for file name matching (#32958)

* [Code] fix goto definition failed after user click `go back` (#32968)

* Forcing the filetree open on mobile devices. (#33056)

* [Code] remove requirement for SettingRepository button in tests (#33081)

* [Code]: clean up the code breadcrumb (#33069)

* [Code]: fix top bar button size, width and right margin (#33061)

* [Code]: link to the setup guide button should be the entire button (#33031)

* [Code] Remove the repository status in repo search result item (#32967)

* [Code] Add additional git url validation in clone worker (#33097)

* [Code] hide language server errors (#33082)

* [Code] fix tree expand problems (#32984)

* Fixes for dark mode (#33014)

* Fixing the keyboard shortcut modal appearance in dark mode.

* Fixing the language server icon colors in dark mode.

* Fixing the white background in markdown code blocks in dark mode (Code issue #942)

* Fixing the file tree background color (Code repo issue #986)

* Updating file_tree snapshots.

* Using variables in the shortcuts.scss file, moving the language icon selector to the path rather than the SVG itself.

* Fixing a type error for an unused import.

* [Code] make find references panel's file name clickable (#33083)

* [Code] update worker queue index name to exclude from code user/admin roles (#33223)

* fix(code): symbol tree style (#33224)

* [Code] Index job timeout should show repository index error (#33140)

* [Code] Index job timeout should show repository index error

* [Code] Add a new unit test for clone worker git url validation

* [Code] fix the test

* [Code] adjust repo search scope REST API params (#33219)

* [Code] scroll the selected file into view when navigate files (#33225)

* [Code] fix a minor bug for clone repo

* [Code] fix a tree expand/collapse problem (#33227)

* [Code] fixes for search page (#33281)

* [Code] fixes for search page

* [Code] fix functional test

* [Code] fix functioanl test

* [Code] Calculate the index job timeout based on the size of the repo (#33226)

* [Code]: add a test util file and move common class into it (#33283)

* fix(code/frontend): unset min-width of breadcrumb (#33298)

* fix(code): highlight only one symbol and unexpected tree loading (#33114)

* [Code] use callWithRequest instead of callWithInternalUser in cluster routes (#33098)

* [Code] Add options to disable maven/gradle importer and autobuild (#33240)

* [Code] Add options to disable maven/gradle importer and autobuild

* [Code] rename option to codeSecurity

* [Code] Add initial options to request expander

* [Code]: add option to disable node depdendency downloading (#33340)

* [Code]: change config code.codeSecurity to code.security

* [Code]: more clean up to the test option (#33355)

* [Code] Add git clone url host and protocol whitelist (#33371)

* [Code] align search page border and correct the rendering of empty search page (#33378)

* [Code] focus input when switch search scope with shortcuts (#33379)

* [Code] focus input when switch search scope with shortcuts

* [Code] prevent default action of the shortcut event

* fix(code): add project root link to kibana breadcrumb (#33297)

* Revert "fix(code): add project root link to kibana breadcrumb (#33297)"

This reverts commit e206b71.

* [Code]: upgrade to typescript server 0.1.19

* [Code] Fix randomized port in Java launcher (#33495)

* [Code] fix popover style changes when click on buttons (#33472)

* [Code] fix setup guide style (#33474)

* [Code] fix a problem we start more than one lang-server for the same repo. (#33382)

* fix(code): use monospace font for commit hash (#33307)

* [Code] fix reference panel layout problems (#33546)

* [Code] fix lang-sever initializing popover (#33482)

* fix(code/frontend): truncate commit message (#33548)

* fix(code/frontend): use eui toast for import message (#33487)

* fix(code/frontend): check file path before reveal position (#33555)

* fix(code/frontend): should have no container (#33492)

* [Code] change lsp http error codes (#33633)

* fix(code/frontend): combobox in search setting flyout should be stretched to fit the width (#33553)

* [Code]  Enabgle `go` language of the monaco editor. (#33476)

This change will make the code plugin have the ability in the
development mode to highlight the go source code and send
the go-to definition request to the lang server.

* fix(code/frontend): error message for empty project url (#33549)

* [Code] connect the modify search settings button with the search scope settings (#33691)

* [Code] connect the modify search settings button with the search scope setting

* [Code] a minor fix

* [Code] minor style improvement

* [Code]: fix integration test using new API (#33730)

* [Code] fix a tree expanding problem (#33766)

* Fixing the directory node focus state. (#33821)

* [Code] fix a reference panel height problem (#33767)

* [Code] upgrade nodegit, set max returned commits results (#33913)

* [Code]: Upgrade dependencies

* [Code]: Syntax clean after bable-ts-transform upgrade

* [Code] don't patch native modules when build oss package (#33915)

* [Code] improve repository index naming (#33911)

* Revert "Fixing the directory node focus state. (#33821)"

This reverts commit 866db39.

* [Code] Remove regex git url validation and add more unit tests for repository utils (#33919)

* [Code] more unit tests

* [Code] fix ci breaks

* [Code] handle nodegit deprecation warnings (#33932)

* Reducing top and bottom padding of the directory and file nodes in the directory view. (#34007)

* Styling the File Tree Scrollbar (#33988)

* Styling the scrollbar.

* Removing the duplicated mixin code.

* [Code] check file path in lsp requests (#33916)

* [Code] Implement the index checkpointing (#32682)

* [Code] Persist index checkpoint into index progress in ES

* [Code] apply checkpoint to lsp indexer

* [Code] Add unit tests for index checkpointing

* [Code] move checkpoint from text to object

* [Code]: raise default security level (#33956)

* fix(code/frontend): should not show import error at the first time (#33921)

* [Code]: add missing dependencies that are not in x-pack

* [Code]: fix test snapshot and eui usages

* chore(code/frontend): move props files to __fixtures__ folder (#34031)

* [Code] fix a tree collapse problem (#34030)

* [Code] fix a tree collapse problem
added functional tests for file tree

* Fix type errors and snapshot

* [Code]: simplify the path computation of ts server

* [Code]: clean uneccessary ts-ignores (#34203)

* [Code] apply repo search scope right away in search page (#34029)

* [Code] upgrade git-url-parse version and enable ssh git clone protocol (#34336)

* [Code] upgrade git-url-parse version and enable ssh git clone protocol

* [Code] fix unit test

* [Code]: minor clean up of tslint usage, up ts server version

* fix(code/frontend): use different actions to handle repo scope search and repo search (#34043)

* [Code] fix the crash when we refresh the blame view (#34335)

* [Code] enable ssh protocol, only read ssh key pairs from data folder. (#34412)

* [Code] reset processing jobs when system is initializing (#34408)

* [Code] functional test for git:// url (#34512)

* [Code] fix search query bar item selection issue (#34514)

* [Code]: use absolute path for api path (#34582)

* [Code]: use absolute path for api path

* [Code]: always use url.format to construct url with queries that have variables

* [Code]: prefix lsp api with code

* [Code]: Add chrome.addBasePath call for raw fetch argument

* [Code]: minor UI adjustment (#34659)

* [Code]: fix new eslint errors (#34671)

* [Code] save code_node_info in an index (#34244)

* [Code] fix line height changed after find reference is open (#34682)

* [Code] add description for file and repo typeahead items (#34681)

* [Code] encode/decode branchs and tags (#34683)

* [Code] Incremental Indexing (#33485)

* [Code] Add a git api to get diff from arbitrary 2 revisions

* [Code] Apply incremental index triggering

* [Code] implement the actual incremental indexing

* [Code] apply checkpoint validation for both lsp and lsp incremental indexer

* [Code] add unit tests

* [Code] only disable index scheduler but leave update scheduler on

* [Code]: disable more eslint error due to nodegit

* [Code]: add a go language icon

* [Code]: fix test snapshot after upgrade eui

* fix(code/frontend): make blame view scrollable (#34519)

* [Code]: add beta indicator (#34899)

* [Code]: add a toast for permission change in setup page (#34901)

* [Code] support '/' in getCommit (#34774)

* [Code]: show error message when importing repo at import repo page, fix type error (#34898)

* [Code]: add setup guide link in help menu and pre-define document links (#34902)

* [Code] hide index button when repo is in indexing (#34904)

* [Code]: clean uneccessary code, lint error

* [Code] apply encode to revision in url (#34906)

* [Code] disable blame button when select a non-text file (#34775)

* [Code] disable blame button when select a non-text file

* [Code] Change button label based on file type

* [Code] Provide more reasons for git url validation (#34914)

* fix(code/frontend): should disable structure tab if no structure or load failed (#34908)

* [Code] don't allow access secured routes before x-pack info is available (#34994)

* fix(code/frontend): remove line decorations if no line number specified (#35047)

* Reset initialized when proxy re-connects (#34970)

* [Code] setup multi-code mode by config (#34988)

* [Code] Persist clone error messages (#34977)

* test(code/frontend): history functional test (#34921)

* Implement Code feature control (#35115)

* update security api tests

* rough POC to migrate Code to use Feature Controls

* fix tests

* [Code]: Integrate with Feature control

* Rename callWithRequest to callCluster

* feature(code/frontend): search filter default repo options (#35202)

* [Code] minor fix of proejct status update (#35207)

* feature(code/frontend): search in project page set current repo as default scope (#35062)

* fix(code/frontend): structure tab highlight, align and collapse (#35221)

* [Code] add api integration tests for feature control (#35146)

* [Code] Ignore certificateCheck in update as well (#35273)

* [Code]: fix test snapshot

* [Code] Removing styled components & SCSS cleanup (#35107)

* Removing the sidebar class from the project container and replacing styled component eui buttons with a className.

* Renaming scss includes.

* Moving admin.scss content into _buttons.scss.

* Refactor project_item removing styled components

* Refactor admin.tsx to remove styled components

* Refactor import_project.tsx to remove styled components

* Refactor lang server tab to remove styled components

* Refactor project settings modal removing styled components

* Refactoring setup_guide to remove styled components

* Cleanup sidebar.scss: follow convention for classes

* Refactor codeblock css naming conventions

* Resolving an issue with the monaco scss file name

* Editor file cleanup. Renaming css classes

* Cleaning up the file_tree component.

* Hover widget cleanup.

* Blame cleanup.

* Breadcrumb cleanup.

* Cleaning up clone status — removing ProgressContainer export. Didn't seem to be used anywhere. You can use the codeContainer__progress class to apply those styles now.

* Cleaning up commit history styles

* Putting the indentation back in the file tree.

* Refactoring the main content window.

* Cleaning up the directory component.

* Reducing spacing between directory and file lists.

* Removing styled components from the error panel.

* Reducing the font size of buttons in the source view button groups.

* Removing styled components from main.tsx

* CSS naming & removing styled components from not_found.tsx

* CSS naming & removing styled components from not_found.tsx

* Removing styled components from search_bar and top_bar.

* Removing styled components from query_bar components.

* Removing styled components from search_page components.

* removing styled components from code_symbol_tree

* Fixing a few css issues.

* Updating test snapshots.

* Removing a stray '>' symbol from the search tabs.

* Condensing the spacing of the EUI facets on the search page.

* class name of the flyout container.

* Revert "class name of the flyout container."

This reverts commit 35e9d5c.

* class name tweaks.

* Fixing type errors.

* Putting back an accidental deletion in file_tree.tsx.

* Updating file_tree snapshot.

* Implementing changes from 604e4d1 to address failing tests.

* Adding in additional classes deleted during merge

* Updating test snapshots.

* Removing the focusring from the items in the file_tree. (#35364)

* [Code] pagination for history (#35329)

* Updating the markdown rendering to use EUI styles. (#35439)

* [Code]: fix icon for module and namespace (#35428)

* [Code] apply git clone/update cert check for production env (#35399)

* fix(code/frontend): source view page, click line number should stay in the same side tab (#35396)

* [Code] Add a security flag for git certificate check (#35445)

* fix(code/frontend): fix blank left to blame (#35449)

* [Code]: Improve code setup guide text
  • Loading branch information
zfy0701 authored Apr 24, 2019
1 parent 9947045 commit a162e64
Show file tree
Hide file tree
Showing 357 changed files with 38,591 additions and 104 deletions.
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@
"react-color": "^2.13.8",
"react-dom": "^16.8.0",
"react-grid-layout": "^0.16.2",
"react-markdown": "^3.1.4",
"react-input-range": "^1.3.0",
"react-markdown": "^3.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-sizeme": "^2.3.6",
Expand Down Expand Up @@ -274,6 +275,7 @@
"@types/bluebird": "^3.1.1",
"@types/boom": "^7.2.0",
"@types/chance": "^1.0.0",
"@types/cheerio": "^0.22.10",
"@types/chromedriver": "^2.38.0",
"@types/classnames": "^2.2.3",
"@types/d3": "^3.5.41",
Expand All @@ -286,7 +288,7 @@
"@types/execa": "^0.9.0",
"@types/fetch-mock": "7.2.1",
"@types/getopts": "^2.0.1",
"@types/glob": "^5.0.35",
"@types/glob": "^7.1.1",
"@types/globby": "^8.0.0",
"@types/graphql": "^0.13.1",
"@types/hapi": "^17.0.18",
Expand Down Expand Up @@ -322,7 +324,7 @@
"@types/rimraf": "^2.0.2",
"@types/selenium-webdriver": "^3.0.15",
"@types/semver": "^5.5.0",
"@types/sinon": "^5.0.1",
"@types/sinon": "^7.0.0",
"@types/strip-ansi": "^3.0.0",
"@types/styled-components": "^3.0.1",
"@types/supertest": "^2.0.5",
Expand Down Expand Up @@ -400,7 +402,7 @@
"multistream": "^2.1.1",
"murmurhash3js": "3.0.1",
"mutation-observer": "^1.0.3",
"nock": "8.0.0",
"nock": "10.0.4",
"node-sass": "^4.9.4",
"normalize-path": "^3.0.0",
"pixelmatch": "4.0.2",
Expand All @@ -414,7 +416,7 @@
"sass-lint": "^1.12.1",
"selenium-webdriver": "^4.0.0-alpha.1",
"simple-git": "1.37.0",
"sinon": "^5.0.7",
"sinon": "^7.2.2",
"strip-ansi": "^3.0.1",
"supertest": "^3.1.0",
"supertest-as-promised": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"redux": "3.7.2",
"redux-thunk": "2.2.0",
"sass-loader": "^7.1.0",
"sinon": "^5.0.7",
"sinon": "^7.2.2",
"style-loader": "^0.23.1",
"webpack": "^4.23.1",
"webpack-dev-server": "^3.1.10",
Expand Down
1 change: 1 addition & 0 deletions src/cli/cluster/cluster_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default class ClusterManager {
/[\\\/](\..*|node_modules|bower_components|public|__[a-z0-9_]+__|coverage)[\\\/]/,
/\.test\.js$/,
...extraIgnores,
'plugins/java_languageserver'
],
});

Expand Down
Binary file modified src/cli_plugin/install/__fixtures__/replies/test_plugin.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion src/cli_plugin/install/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function extractArchive(archive, targetDir, extractPath) {
return reject(err);
}

readStream.pipe(createWriteStream(fileName));
readStream.pipe(createWriteStream(fileName, { mode: entry.externalFileAttributes >>> 16 }));
readStream.on('end', function () {
zipfile.readEntry();
});
Expand Down
23 changes: 23 additions & 0 deletions src/cli_plugin/install/zip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import rimraf from 'rimraf';
import path from 'path';
import os from 'os';
import glob from 'glob';
import fs from 'fs';
import { analyzeArchive, extractArchive, _isDirectory } from './zip';

describe('kibana cli', function () {
Expand Down Expand Up @@ -72,6 +73,28 @@ describe('kibana cli', function () {
});
});

describe('checkFilePermission', () => {
it('verify consistency of modes of files', async () => {
const archivePath = path.resolve(repliesPath, 'test_plugin.zip');

await extractArchive(archivePath, tempPath, 'kibana/libs');
const files = await glob.sync('**/*', { cwd: tempPath });

const expected = [
'executable',
'unexecutable'
];
expect(files.sort()).toEqual(expected.sort());

const executableMode = '0' + (fs.statSync(path.resolve(tempPath, 'executable')).mode & parseInt('777', 8)).toString(8);
const unExecutableMode = '0' + (fs.statSync(path.resolve(tempPath, 'unexecutable')).mode & parseInt('777', 8)).toString(8);

expect(executableMode).toEqual('0755');
expect(unExecutableMode).toEqual('0644');

});
});

it('handles a corrupt zip archive', async () => {
try {
await extractArchive(path.resolve(repliesPath, 'corrupt.zip'));
Expand Down
2 changes: 2 additions & 0 deletions src/dev/build/build_distributables.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
ExtractNodeBuildsTask,
InstallDependenciesTask,
OptimizeBuildTask,
PatchNativeModulesTask,
RemovePackageJsonDepsTask,
RemoveWorkspacesTask,
TranspileBabelTask,
Expand Down Expand Up @@ -131,6 +132,7 @@ export async function buildDistributables(options) {
* directories and perform platform-specific steps
*/
await run(CreateArchivesSourcesTask);
await run(PatchNativeModulesTask);
await run(CleanExtraBinScriptsTask);
await run(CleanExtraBrowsersTask);
await run(CleanNodeBuildsTask);
Expand Down
1 change: 1 addition & 0 deletions src/dev/build/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ export * from './typecheck_typescript_task';
export * from './transpile_scss_task';
export * from './verify_env_task';
export * from './write_sha_sums_task';
export * from './patch_native_modules_task';
export * from './path_length_task';
91 changes: 91 additions & 0 deletions src/dev/build/tasks/patch_native_modules_task.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* 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 { scanCopy, untar, deleteAll } from '../lib';
import { createWriteStream } from 'fs';
import { binaryInfo } from '../../../../x-pack/plugins/code/tasks/nodegit_info';
import wreck from 'wreck';
import mkdirp from 'mkdirp';
import { dirname, join, basename } from 'path';
import { createPromiseFromStreams } from '../../../legacy/utils/streams';

async function download(url, destination, log) {
const response = await wreck.request('GET', url);

if (response.statusCode !== 200) {
throw new Error(
`Unexpected status code ${response.statusCode} when downloading ${url}`
);
}
mkdirp.sync(dirname(destination));
await createPromiseFromStreams([
response,
createWriteStream(destination)
]);
log.debug('Downloaded ', url);
}

async function downloadAndExtractTarball(url, dest, log, retry) {
try {
await download(url, dest, log);
const extractDir = join(dirname(dest), basename(dest, '.tar.gz'));
await untar(dest, extractDir, {
strip: 1
});
return extractDir;
} catch (e) {
if (retry > 0) {
await downloadAndExtractTarball(url, dest, log, retry - 1);
} else {
throw e;
}
}
}

async function patchNodeGit(config, log, build, platform) {
const plat = platform.isWindows() ? 'win32' : platform.getName();
const arch = platform.getNodeArch().split('-')[1];
const { downloadUrl, packageName } = binaryInfo(plat, arch);

const downloadPath = build.resolvePathForPlatform(platform, '.nodegit_binaries', packageName);
const extractDir = await downloadAndExtractTarball(downloadUrl, downloadPath, log, 3);

const destination = build.resolvePathForPlatform(platform, 'node_modules/nodegit/build/Release');
log.debug('Replacing nodegit binaries from ', extractDir);
await deleteAll([destination], log);
await scanCopy({
source: extractDir,
destination: destination,
time: new Date(),
});
await deleteAll([extractDir, downloadPath], log);
}



export const PatchNativeModulesTask = {
description: 'Patching platform-specific native modules directories',
async run(config, log, build) {
await Promise.all(config.getTargetPlatforms().map(async platform => {
if (!build.isOss()) {
await patchNodeGit(config, log, build, platform);
}
}));
}
};
7 changes: 7 additions & 0 deletions src/legacy/ui/public/chrome/api/breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ function createBreadcrumbsApi(chrome: { [key: string]: any }) {
filter(fn: (breadcrumb: Breadcrumb, i: number, all: Breadcrumb[]) => boolean) {
newPlatformChrome.setBreadcrumbs(currentBreadcrumbs.filter(fn));
},

/**
* Remove last element of the breadcrumb
*/
pop() {
newPlatformChrome.setBreadcrumbs(currentBreadcrumbs.slice(0, -1));
},
},
};
}
Expand Down
2 changes: 2 additions & 0 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { dashboardMode } from './plugins/dashboard_mode';
import { logstash } from './plugins/logstash';
import { beats } from './plugins/beats_management';
import { apm } from './plugins/apm';
import { code } from './plugins/code';
import { maps } from './plugins/maps';
import { licenseManagement } from './plugins/license_management';
import { cloud } from './plugins/cloud';
Expand Down Expand Up @@ -55,6 +56,7 @@ module.exports = function (kibana) {
logstash(kibana),
beats(kibana),
apm(kibana),
code(kibana),
maps(kibana),
canvas(kibana),
licenseManagement(kibana),
Expand Down
Loading

0 comments on commit a162e64

Please sign in to comment.