Skip to content

Commit d6a11e7

Browse files
authored
[7.x] Backport code commits (#35548)
* Create a squash commit for code (#35547) * [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 35e9d5c16fd20db5ef15a686eda79bb0fd3f40a6. * 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 * [Code]: fix the capabilities type (#35499) * [Code]: fix the capabilities type * [Code] disable the functional test * [core/ftr] disable tests by commenting out test file * Updating the font sizes on the directory view. (#35507) * Updating the font sizes on the directory view. * Adding less left margin to the recent commits heading.
1 parent d2edef1 commit d6a11e7

File tree

357 files changed

+38591
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+38591
-104
lines changed

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@
207207
"react-color": "^2.13.8",
208208
"react-dom": "^16.8.0",
209209
"react-grid-layout": "^0.16.2",
210-
"react-markdown": "^3.1.4",
210+
"react-input-range": "^1.3.0",
211+
"react-markdown": "^3.4.1",
211212
"react-redux": "^5.0.7",
212213
"react-router-dom": "^4.3.1",
213214
"react-sizeme": "^2.3.6",
@@ -272,6 +273,7 @@
272273
"@types/bluebird": "^3.1.1",
273274
"@types/boom": "^7.2.0",
274275
"@types/chance": "^1.0.0",
276+
"@types/cheerio": "^0.22.10",
275277
"@types/chromedriver": "^2.38.0",
276278
"@types/classnames": "^2.2.3",
277279
"@types/d3": "^3.5.41",
@@ -284,7 +286,7 @@
284286
"@types/execa": "^0.9.0",
285287
"@types/fetch-mock": "7.2.1",
286288
"@types/getopts": "^2.0.1",
287-
"@types/glob": "^5.0.35",
289+
"@types/glob": "^7.1.1",
288290
"@types/globby": "^8.0.0",
289291
"@types/graphql": "^0.13.1",
290292
"@types/hapi": "^17.0.18",
@@ -320,7 +322,7 @@
320322
"@types/rimraf": "^2.0.2",
321323
"@types/selenium-webdriver": "^3.0.15",
322324
"@types/semver": "^5.5.0",
323-
"@types/sinon": "^5.0.1",
325+
"@types/sinon": "^7.0.0",
324326
"@types/strip-ansi": "^3.0.0",
325327
"@types/styled-components": "^3.0.1",
326328
"@types/supertest": "^2.0.5",
@@ -398,7 +400,7 @@
398400
"multistream": "^2.1.1",
399401
"murmurhash3js": "3.0.1",
400402
"mutation-observer": "^1.0.3",
401-
"nock": "8.0.0",
403+
"nock": "10.0.4",
402404
"node-sass": "^4.9.4",
403405
"normalize-path": "^3.0.0",
404406
"pixelmatch": "4.0.2",
@@ -412,7 +414,7 @@
412414
"sass-lint": "^1.12.1",
413415
"selenium-webdriver": "^4.0.0-alpha.1",
414416
"simple-git": "1.37.0",
415-
"sinon": "^5.0.7",
417+
"sinon": "^7.2.2",
416418
"strip-ansi": "^3.0.1",
417419
"supertest": "^3.1.0",
418420
"supertest-as-promised": "^4.0.2",

packages/kbn-ui-framework/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"redux": "3.7.2",
6666
"redux-thunk": "2.2.0",
6767
"sass-loader": "^7.1.0",
68-
"sinon": "^5.0.7",
68+
"sinon": "^7.2.2",
6969
"style-loader": "^0.23.1",
7070
"webpack": "^4.23.1",
7171
"webpack-dev-server": "^3.1.10",

src/cli/cluster/cluster_manager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export default class ClusterManager {
181181
/[\\\/](\..*|node_modules|bower_components|public|__[a-z0-9_]+__|coverage)[\\\/]/,
182182
/\.test\.js$/,
183183
...extraIgnores,
184+
'plugins/java_languageserver'
184185
],
185186
});
186187

674 Bytes
Binary file not shown.

src/cli_plugin/install/zip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export function extractArchive(archive, targetDir, extractPath) {
132132
return reject(err);
133133
}
134134

135-
readStream.pipe(createWriteStream(fileName));
135+
readStream.pipe(createWriteStream(fileName, { mode: entry.externalFileAttributes >>> 16 }));
136136
readStream.on('end', function () {
137137
zipfile.readEntry();
138138
});

src/cli_plugin/install/zip.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import rimraf from 'rimraf';
2121
import path from 'path';
2222
import os from 'os';
2323
import glob from 'glob';
24+
import fs from 'fs';
2425
import { analyzeArchive, extractArchive, _isDirectory } from './zip';
2526

2627
describe('kibana cli', function () {
@@ -72,6 +73,28 @@ describe('kibana cli', function () {
7273
});
7374
});
7475

76+
describe('checkFilePermission', () => {
77+
it('verify consistency of modes of files', async () => {
78+
const archivePath = path.resolve(repliesPath, 'test_plugin.zip');
79+
80+
await extractArchive(archivePath, tempPath, 'kibana/libs');
81+
const files = await glob.sync('**/*', { cwd: tempPath });
82+
83+
const expected = [
84+
'executable',
85+
'unexecutable'
86+
];
87+
expect(files.sort()).toEqual(expected.sort());
88+
89+
const executableMode = '0' + (fs.statSync(path.resolve(tempPath, 'executable')).mode & parseInt('777', 8)).toString(8);
90+
const unExecutableMode = '0' + (fs.statSync(path.resolve(tempPath, 'unexecutable')).mode & parseInt('777', 8)).toString(8);
91+
92+
expect(executableMode).toEqual('0755');
93+
expect(unExecutableMode).toEqual('0644');
94+
95+
});
96+
});
97+
7598
it('handles a corrupt zip archive', async () => {
7699
try {
77100
await extractArchive(path.resolve(repliesPath, 'corrupt.zip'));

src/dev/build/build_distributables.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
ExtractNodeBuildsTask,
4545
InstallDependenciesTask,
4646
OptimizeBuildTask,
47+
PatchNativeModulesTask,
4748
RemovePackageJsonDepsTask,
4849
RemoveWorkspacesTask,
4950
TranspileBabelTask,
@@ -131,6 +132,7 @@ export async function buildDistributables(options) {
131132
* directories and perform platform-specific steps
132133
*/
133134
await run(CreateArchivesSourcesTask);
135+
await run(PatchNativeModulesTask);
134136
await run(CleanExtraBinScriptsTask);
135137
await run(CleanExtraBrowsersTask);
136138
await run(CleanNodeBuildsTask);

src/dev/build/tasks/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ export * from './typecheck_typescript_task';
3737
export * from './transpile_scss_task';
3838
export * from './verify_env_task';
3939
export * from './write_sha_sums_task';
40+
export * from './patch_native_modules_task';
4041
export * from './path_length_task';
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { scanCopy, untar, deleteAll } from '../lib';
21+
import { createWriteStream } from 'fs';
22+
import { binaryInfo } from '../../../../x-pack/plugins/code/tasks/nodegit_info';
23+
import wreck from 'wreck';
24+
import mkdirp from 'mkdirp';
25+
import { dirname, join, basename } from 'path';
26+
import { createPromiseFromStreams } from '../../../legacy/utils/streams';
27+
28+
async function download(url, destination, log) {
29+
const response = await wreck.request('GET', url);
30+
31+
if (response.statusCode !== 200) {
32+
throw new Error(
33+
`Unexpected status code ${response.statusCode} when downloading ${url}`
34+
);
35+
}
36+
mkdirp.sync(dirname(destination));
37+
await createPromiseFromStreams([
38+
response,
39+
createWriteStream(destination)
40+
]);
41+
log.debug('Downloaded ', url);
42+
}
43+
44+
async function downloadAndExtractTarball(url, dest, log, retry) {
45+
try {
46+
await download(url, dest, log);
47+
const extractDir = join(dirname(dest), basename(dest, '.tar.gz'));
48+
await untar(dest, extractDir, {
49+
strip: 1
50+
});
51+
return extractDir;
52+
} catch (e) {
53+
if (retry > 0) {
54+
await downloadAndExtractTarball(url, dest, log, retry - 1);
55+
} else {
56+
throw e;
57+
}
58+
}
59+
}
60+
61+
async function patchNodeGit(config, log, build, platform) {
62+
const plat = platform.isWindows() ? 'win32' : platform.getName();
63+
const arch = platform.getNodeArch().split('-')[1];
64+
const { downloadUrl, packageName } = binaryInfo(plat, arch);
65+
66+
const downloadPath = build.resolvePathForPlatform(platform, '.nodegit_binaries', packageName);
67+
const extractDir = await downloadAndExtractTarball(downloadUrl, downloadPath, log, 3);
68+
69+
const destination = build.resolvePathForPlatform(platform, 'node_modules/nodegit/build/Release');
70+
log.debug('Replacing nodegit binaries from ', extractDir);
71+
await deleteAll([destination], log);
72+
await scanCopy({
73+
source: extractDir,
74+
destination: destination,
75+
time: new Date(),
76+
});
77+
await deleteAll([extractDir, downloadPath], log);
78+
}
79+
80+
81+
82+
export const PatchNativeModulesTask = {
83+
description: 'Patching platform-specific native modules directories',
84+
async run(config, log, build) {
85+
await Promise.all(config.getTargetPlatforms().map(async platform => {
86+
if (!build.isOss()) {
87+
await patchNodeGit(config, log, build, platform);
88+
}
89+
}));
90+
}
91+
};

src/legacy/ui/public/chrome/api/breadcrumbs.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ function createBreadcrumbsApi(chrome: { [key: string]: any }) {
7272
filter(fn: (breadcrumb: Breadcrumb, i: number, all: Breadcrumb[]) => boolean) {
7373
newPlatformChrome.setBreadcrumbs(currentBreadcrumbs.filter(fn));
7474
},
75+
76+
/**
77+
* Remove last element of the breadcrumb
78+
*/
79+
pop() {
80+
newPlatformChrome.setBreadcrumbs(currentBreadcrumbs.slice(0, -1));
81+
},
7582
},
7683
};
7784
}

0 commit comments

Comments
 (0)