Skip to content

Commit

Permalink
Merge branch 'main' into 204238-ecoinventory-v2-turn-off-entitycentri…
Browse files Browse the repository at this point in the history
…cexperience-feature-flag-by-default
  • Loading branch information
rmyz authored Dec 17, 2024
2 parents dd5184f + 714ba67 commit a09cfa4
Show file tree
Hide file tree
Showing 66 changed files with 1,232 additions and 869 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1997,9 +1997,6 @@ module.exports = {
},
{
files: [
// logsShared depends on o11y/private plugins, but platform plugins depend on it
'x-pack/plugins/observability_solution/logs_shared/**',

// TODO @kibana/operations
'scripts/create_observability_rules.js', // is importing "@kbn/observability-alerting-test-data" (observability/private)
'src/cli_setup/**', // is importing "@kbn/interactive-setup-plugin" (platform/private)
Expand Down
1 change: 1 addition & 0 deletions packages/core/application/core-application-common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
export type { AppCategory } from './src/app_category';
export { APP_WRAPPER_CLASS } from './src/app_wrapper_class';
export { DEFAULT_APP_CATEGORIES } from './src/default_app_categories';
export { GlobalAppStyle } from './src/global_app_style';
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React from 'react';
import { css, Global } from '@emotion/react';
import { useEuiTheme, type UseEuiTheme } from '@elastic/eui';

export const renderingOverrides = (euiTheme: UseEuiTheme['euiTheme']) => css`
#kibana-body {
// DO NOT ADD ANY OVERFLOW BEHAVIORS HERE
// It will break the sticky navigation
min-height: 100%;
display: flex;
flex-direction: column;
}
// Affixes a div to restrict the position of charts tooltip to the visible viewport minus the header
#app-fixed-viewport {
pointer-events: none;
visibility: hidden;
position: fixed;
top: var(--kbnAppHeadersOffset, var(--euiFixedHeadersOffset, 0));
right: 0;
bottom: 0;
left: 0;
}
.kbnAppWrapper {
// DO NOT ADD ANY OTHER STYLES TO THIS SELECTOR
// This a very nested dependency happening in "all" apps
display: flex;
flex-flow: column nowrap;
flex-grow: 1;
z-index: 0; // This effectively puts every high z-index inside the scope of this wrapper to it doesn't interfere with the header and/or overlay mask
position: relative; // This is temporary for apps that relied on this being present on \`.application\`
}
.kbnBody {
padding-top: var(--euiFixedHeadersOffset, 0);
}
// Conditionally override :root CSS fixed header variable. Updating \`--euiFixedHeadersOffset\`
//on the body will cause all child EUI components to automatically update their offsets
.kbnBody--hasHeaderBanner {
--euiFixedHeadersOffset: var(--kbnHeaderOffsetWithBanner);
// Offset fixed EuiHeaders by the top banner
.euiHeader[data-fixed-header] {
margin-top: var(--kbnHeaderBannerHeight);
}
// Prevent banners from covering full screen data grids
.euiDataGrid--fullScreen {
height: calc(100vh - var(--kbnHeaderBannerHeight));
top: var(--kbnHeaderBannerHeight);
}
}
// Set a body CSS variable for the app container to use - calculates the total
// height of all fixed headers + the sticky action menu toolbar
.kbnBody--hasProjectActionMenu {
--kbnAppHeadersOffset: calc(
var(--kbnHeaderOffset) + var(--kbnProjectHeaderAppActionMenuHeight)
);
&.kbnBody--hasHeaderBanner {
--kbnAppHeadersOffset: calc(
var(--kbnHeaderOffsetWithBanner) + var(--kbnProjectHeaderAppActionMenuHeight)
);
}
}
.kbnBody--chromeHidden {
// stylelint-disable-next-line length-zero-no-unit
--euiFixedHeadersOffset: 0px;
&.kbnBody--hasHeaderBanner {
--euiFixedHeadersOffset: var(--kbnHeaderBannerHeight);
}
&.kbnBody--hasProjectActionMenu {
--kbnAppHeadersOffset: var(--euiFixedHeadersOffset, 0);
}
}
`;

export const bannerStyles = (euiTheme: UseEuiTheme['euiTheme']) => css`
.header__topBanner {
position: fixed;
top: 0;
left: 0;
height: var(--kbnHeaderBannerHeight);
width: 100%;
z-index: ${euiTheme.levels.header};
}
.header__topBannerContainer {
height: 100%;
width: 100%;
}
`;

export const chromeStyles = (euiTheme: UseEuiTheme['euiTheme']) => css`
.euiDataGrid__restrictBody {
.headerGlobalNav,
.kbnQueryBar {
display: none;
}
}
.euiDataGrid__restrictBody.euiBody--headerIsFixed {
.euiFlyout {
top: 0;
height: 100%;
}
}
.chrHeaderHelpMenu__version {
text-transform: none;
}
.chrHeaderBadge__wrapper {
align-self: center;
margin-right: ${euiTheme.size.base};
}
.header__toggleNavButtonSection {
.euiBody--collapsibleNavIsDocked & {
display: none;
}
}
.header__breadcrumbsWithExtensionContainer {
overflow: hidden; // enables text-ellipsis in the last breadcrumb
.euiHeaderBreadcrumbs {
// stop breadcrumbs from growing.
// this makes the extension appear right next to the last breadcrumb
flex-grow: 0;
margin-right: 0;
overflow: hidden; // enables text-ellipsis in the last breadcrumb
}
}
.header__breadcrumbsAppendExtension {
flex-grow: 1;
}
`;

export const GlobalAppStyle = () => {
const { euiTheme } = useEuiTheme();
return (
<Global
styles={css`
${bannerStyles(euiTheme)} ${chromeStyles(euiTheme)} ${renderingOverrides(euiTheme)}
`}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { APP_FIXED_VIEWPORT_ID } from '@kbn/core-rendering-browser';
import { GlobalAppStyle } from '@kbn/core-application-common';
import { AppWrapper } from './app_containers';

interface StartServices {
Expand Down Expand Up @@ -62,6 +63,9 @@ export class RenderingService {
ReactDOM.render(
<KibanaRootContextProvider {...startServices} globalStyles={true}>
<>
{/* Global Styles that apply across the entire app */}
<GlobalAppStyle />

{/* Fixed headers */}
{chromeHeader}

Expand Down
62 changes: 48 additions & 14 deletions packages/kbn-relocate/relocate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { orderBy } from 'lodash';
import type { ToolingLog } from '@kbn/tooling-log';
import { getPackages } from '@kbn/repo-packages';
import { REPO_ROOT } from '@kbn/repo-info';
import type { Package } from './types';
import type { Package, PullRequest } from './types';
import { DESCRIPTION, EXCLUDED_MODULES, KIBANA_FOLDER, NEW_BRANCH } from './constants';
import {
belongsTo,
Expand All @@ -26,7 +26,15 @@ import {
} from './utils/relocate';
import { safeExec } from './utils/exec';
import { relocatePlan, relocateSummary } from './utils/logging';
import { checkoutBranch, checkoutResetPr, findGithubLogin, findRemoteName } from './utils/git';
import {
checkoutBranch,
checkoutResetPr,
cherryPickManualCommits,
findGithubLogin,
findPr,
findRemoteName,
getManualCommits,
} from './utils/git';

const moveModule = async (module: Package, log: ToolingLog) => {
const destination = calculateModuleTargetFolder(module);
Expand Down Expand Up @@ -128,6 +136,9 @@ export const findAndMoveModule = async (moduleId: string, log: ToolingLog) => {
};

export const findAndRelocateModules = async (params: RelocateModulesParams, log: ToolingLog) => {
const { prNumber, baseBranch, ...findParams } = params;
let pr: PullRequest | undefined;

const upstream = await findRemoteName('elastic/kibana');
if (!upstream) {
log.error(
Expand All @@ -142,8 +153,6 @@ export const findAndRelocateModules = async (params: RelocateModulesParams, log:
return;
}

const { prNumber, baseBranch, ...findParams } = params;

const toMove = findModules(findParams, log);
if (!toMove.length) {
log.info(
Expand All @@ -153,40 +162,60 @@ export const findAndRelocateModules = async (params: RelocateModulesParams, log:
}

relocatePlan(toMove, log);
const res1 = await inquirer.prompt({

const resConfirmPlan = await inquirer.prompt({
type: 'confirm',
name: 'confirmPlan',
message: `The script will RESET CHANGES in this repository, relocate the modules above and update references. Proceed?`,
});

if (!res1.confirmPlan) {
if (!resConfirmPlan.confirmPlan) {
log.info('Aborting');
return;
}

if (prNumber) {
pr = await findPr(prNumber);

if (getManualCommits(pr.commits).length > 0) {
const resOverride = await inquirer.prompt({
type: 'confirm',
name: 'overrideManualCommits',
message: 'Detected manual commits in the PR, do you want to override them?',
});
if (!resOverride.overrideManualCommits) {
return;
}
}
}

// start with a clean repo
await safeExec(`git restore --staged .`);
await safeExec(`git restore .`);
await safeExec(`git clean -f -d`);
await safeExec(`git checkout ${baseBranch} && git pull ${upstream} ${baseBranch}`);

if (prNumber) {
if (pr) {
// checkout existing PR, reset all commits, rebase from baseBranch
try {
if (!(await checkoutResetPr(baseBranch, prNumber))) {
log.info('Aborting');
return;
}
await checkoutResetPr(pr, baseBranch);
} catch (error) {
log.error(`Error checking out / resetting PR #${prNumber}:`);
log.error(error);
return;
}
} else {
// checkout [new] branch
// checkout new branch
await checkoutBranch(NEW_BRANCH);
}

// push changes in the branch
await inquirer.prompt({
type: 'confirm',
name: 'readyRelocate',
message: `Ready to relocate! You can commit changes previous to the relocation at this point. Confirm to proceed with the relocation`,
});

// relocate modules
await safeExec(`yarn kbn bootstrap`);
const movedCount = await relocateModules(toMove, log);
Expand All @@ -197,10 +226,15 @@ export const findAndRelocateModules = async (params: RelocateModulesParams, log:
);
return;
}

relocateSummary(log);

if (pr) {
await cherryPickManualCommits(pr, log);
}

// push changes in the branch
const res2 = await inquirer.prompt({
const resPushBranch = await inquirer.prompt({
type: 'confirm',
name: 'pushBranch',
message: `Relocation finished! You can commit extra changes at this point. Confirm to proceed pushing the current branch`,
Expand All @@ -210,7 +244,7 @@ export const findAndRelocateModules = async (params: RelocateModulesParams, log:
? `git push --force-with-lease`
: `git push --set-upstream ${origin} ${NEW_BRANCH}`;

if (!res2.pushBranch) {
if (!resPushBranch.pushBranch) {
log.info(`Remember to push changes with "${pushCmd}"`);
return;
}
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-relocate/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface CommitAuthor {
}

export interface Commit {
oid: string;
messageHeadline: string;
authors: CommitAuthor[];
}
Expand Down
Loading

0 comments on commit a09cfa4

Please sign in to comment.