Skip to content

Commit

Permalink
Merge branch 'main' into fixing-onboarding-type-problems
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrdyn authored Sep 26, 2023
2 parents 9ad8279 + 22029b5 commit 2c465f8
Show file tree
Hide file tree
Showing 140 changed files with 2,115 additions and 905 deletions.
30 changes: 22 additions & 8 deletions .buildkite/scripts/steps/check_types_commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ if [[ "${CI-}" == "true" ]]; then
sha1=$(git merge-base $GITHUB_PR_TARGET_BRANCH $GITHUB_PR_TRIGGERED_SHA)
sha2="${GITHUB_PR_TRIGGERED_SHA-}"
else
# Script take between 0 and 2 arguments representing two commit SHA's:
# If 0, it will diff HEAD and HEAD^
# If 1 (SHA1), it will diff SHA1 and SHA1^
# If 2 (SHA1, SHA2), it will diff SHA1 and SHA2
sha1="${1-HEAD}"
sha2="${2-$sha1^}"
if [[ "${1-}" == "--cached" ]]; then
# Only check staged files
sha1=$1
sha2=""
else
# Script take between 0 and 2 arguments representing two commit SHA's:
# If 0, it will diff HEAD and HEAD^
# If 1 (SHA1), it will diff SHA1 and SHA1^
# If 2 (SHA1, SHA2), it will diff SHA1 and SHA2
sha1="${1-HEAD}"
sha2="${2-$sha1^}"
fi
fi

uniq_dirs=()
uniq_tsconfigs=()

echo "Detecting files changed between $sha1 and $sha2..."
if [[ "$sha1" == "--cached" ]]; then
echo "Detecting files changed in staging area..."
else
echo "Detecting files changed between $sha1 and $sha2..."
fi

files=($(git diff --name-only $sha1 $sha2))

Expand Down Expand Up @@ -102,7 +112,11 @@ do
done

if [ ${#uniq_tsconfigs[@]} -eq 0 ]; then
echo "No tsconfig.json files found for changes in $sha1 $sha2"
if [[ "$sha1" == "--cached" ]]; then
echo "No tsconfig.json files found for staged changes"
else
echo "No tsconfig.json files found for changes between $sha1 and $sha2"
fi
exit
fi

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@
"del": "^6.1.0",
"elastic-apm-node": "^4.0.0",
"email-addresses": "^5.0.0",
"execa": "^4.0.2",
"execa": "^5.1.1",
"expiry-js": "0.1.7",
"extract-zip": "^2.0.1",
"fast-deep-equal": "^3.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const IMAGE = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8
describe('ChangeImageLink', () => {
const defaultProps: ChangeImageLinkProps = {
field: {
name: 'test',
id: 'test',
type: 'image',
ariaAttributes: {
ariaLabel: 'test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
*/

export { FieldInputFooter, type FieldInputFooterProps } from './input_footer';
export { InputResetLink, type FieldResetLinkProps } from './reset_link';
export { InputResetLink } from './reset_link';
export type { InputResetLinkProps } from './reset_link';
7 changes: 5 additions & 2 deletions packages/kbn-unified-doc-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
"sideEffects": [
"*.css",
"*.scss"
]
}
6 changes: 3 additions & 3 deletions src/plugins/console/public/lib/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,12 +998,12 @@ export default function ({
) {
// will simulate autocomplete on 'GET /a/b/' with a filter by index
return {
tokenPath: context.urlTokenPath.slice(0, -1),
predicate: (term) => term.meta === 'index',
tokenPath: context.urlTokenPath?.slice(0, -1),
predicate: (term: any) => term.meta === 'index',
};
} else {
// will do nothing special
return { tokenPath: context.urlTokenPath, predicate: (term) => true };
return { tokenPath: context.urlTokenPath, predicate: () => true };
}
})();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export const dashboardCopyToDashboardActionStrings = {
i18n.translate('dashboard.panel.copyToDashboard.existingDashboardOptionLabel', {
defaultMessage: 'Existing dashboard',
}),
getDescription: () =>
i18n.translate('dashboard.panel.copyToDashboard.description', {
defaultMessage: 'Choose the destination dashboard.',
}),
};

export const dashboardAddToLibraryActionStrings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import React from 'react';

import { toMountPoint } from '@kbn/kibana-react-plugin/public';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { CoreStart } from '@kbn/core-lifecycle-browser';
import type { IEmbeddable } from '@kbn/embeddable-plugin/public';
import { Action, IncompatibleActionError } from '@kbn/ui-actions-plugin/public';
import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public';

import { pluginServices } from '../services/plugin_services';
import { CopyToDashboardModal } from './copy_to_dashboard_modal';
Expand Down Expand Up @@ -39,16 +39,12 @@ export class CopyToDashboardAction implements Action<CopyToDashboardActionContex
public order = 1;

private dashboardCapabilities;
private theme$;
private openModal;

constructor(private PresentationUtilContext: PresentationUtilPluginStart['ContextProvider']) {
constructor(private core: CoreStart) {
({
dashboardCapabilities: this.dashboardCapabilities,
overlays: { openModal: this.openModal },
settings: {
theme: { theme$: this.theme$ },
},
} = pluginServices.getServices());
}

Expand Down Expand Up @@ -81,15 +77,15 @@ export class CopyToDashboardAction implements Action<CopyToDashboardActionContex
throw new IncompatibleActionError();
}

const { theme, i18n } = this.core;
const session = this.openModal(
toMountPoint(
<CopyToDashboardModal
PresentationUtilContext={this.PresentationUtilContext}
closeModal={() => session.close()}
dashboardId={(embeddable.parent as DashboardContainer).getDashboardSavedObjectId()}
embeddable={embeddable}
/>,
{ theme$: this.theme$ }
{ theme, i18n }
),
{
maxWidth: 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import React, { useCallback, useState } from 'react';
import { omit } from 'lodash';

import {
EuiText,
EuiRadio,
EuiPanel,
EuiButton,
EuiSpacer,
EuiFormRow,
EuiFocusTrap,
EuiModalBody,
EuiButtonEmpty,
EuiModalFooter,
EuiModalHeader,
EuiModalHeaderTitle,
EuiOutsideClickDetector,
} from '@elastic/eui';
import { IEmbeddable, PanelNotFoundError } from '@kbn/embeddable-plugin/public';
import {
EmbeddablePackageState,
IEmbeddable,
PanelNotFoundError,
} from '@kbn/embeddable-plugin/public';
import { LazyDashboardPicker, withSuspense } from '@kbn/presentation-util-plugin/public';

import { DashboardPanelState } from '../../common';
Expand All @@ -33,7 +33,6 @@ import { dashboardCopyToDashboardActionStrings } from './_dashboard_actions_stri
import { createDashboardEditUrl, CREATE_NEW_DASHBOARD_URL } from '../dashboard_constants';

interface CopyToDashboardModalProps {
PresentationUtilContext: React.FC;
embeddable: IEmbeddable;
dashboardId?: string;
closeModal: () => void;
Expand All @@ -42,7 +41,6 @@ interface CopyToDashboardModalProps {
const DashboardPicker = withSuspense(LazyDashboardPicker);

export function CopyToDashboardModal({
PresentationUtilContext,
dashboardId,
embeddable,
closeModal,
Expand All @@ -65,11 +63,15 @@ export function CopyToDashboardModal({
throw new PanelNotFoundError();
}

const state = {
const state: EmbeddablePackageState = {
type: embeddable.type,
input: {
...omit(panelToCopy.explicitInput, 'id'),
},
size: {
width: panelToCopy.gridData.w,
height: panelToCopy.gridData.h,
},
};

const path =
Expand All @@ -88,90 +90,73 @@ export function CopyToDashboardModal({
const descriptionId = 'copyToDashboardDescription';

return (
<EuiFocusTrap clickOutsideDisables={true}>
<EuiOutsideClickDetector onOutsideClick={closeModal}>
<div
role="dialog"
aria-modal="true"
aria-labelledby={titleId}
aria-describedby={descriptionId}
>
<PresentationUtilContext>
<EuiModalHeader>
<EuiModalHeaderTitle id={titleId} component="h2">
{dashboardCopyToDashboardActionStrings.getDisplayName()}
</EuiModalHeaderTitle>
</EuiModalHeader>
<div role="dialog" aria-modal="true" aria-labelledby={titleId} aria-describedby={descriptionId}>
<EuiModalHeader>
<EuiModalHeaderTitle id={titleId} component="h2">
{dashboardCopyToDashboardActionStrings.getDisplayName()}
</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
<>
<EuiText>
<p id={descriptionId}>{dashboardCopyToDashboardActionStrings.getDescription()}</p>
</EuiText>
<EuiSpacer />
<EuiFormRow hasChildLabel={false}>
<EuiPanel
color="subdued"
hasShadow={false}
data-test-subj="add-to-dashboard-options"
>
<div>
{canEditExisting && (
<>
<EuiRadio
checked={dashboardOption === 'existing'}
data-test-subj="add-to-existing-dashboard-option"
id="existing-dashboard-option"
name="dashboard-option"
label={dashboardCopyToDashboardActionStrings.getExistingDashboardOption()}
onChange={() => setDashboardOption('existing')}
/>
<div className="savAddDashboard__searchDashboards">
<DashboardPicker
isDisabled={dashboardOption !== 'existing'}
idsToOmit={dashboardId ? [dashboardId] : undefined}
onChange={(dashboard) => setSelectedDashboard(dashboard)}
/>
</div>
<EuiSpacer size="s" />
</>
)}
{canCreateNew && (
<>
<EuiRadio
checked={dashboardOption === 'new'}
data-test-subj="add-to-new-dashboard-option"
id="new-dashboard-option"
name="dashboard-option"
disabled={!dashboardId}
label={dashboardCopyToDashboardActionStrings.getNewDashboardOption()}
onChange={() => setDashboardOption('new')}
/>
<EuiSpacer size="s" />
</>
)}
</div>
</EuiPanel>
</EuiFormRow>
</>
</EuiModalBody>
<EuiModalBody>
<>
<EuiFormRow hasChildLabel={false}>
<div data-test-subj="add-to-dashboard-options">
{canEditExisting && (
<>
<EuiRadio
checked={dashboardOption === 'existing'}
data-test-subj="add-to-existing-dashboard-option"
id="existing-dashboard-option"
name="dashboard-option"
label={dashboardCopyToDashboardActionStrings.getExistingDashboardOption()}
onChange={() => setDashboardOption('existing')}
/>
<EuiSpacer size="s" />
<div>
<DashboardPicker
isDisabled={dashboardOption !== 'existing'}
idsToOmit={dashboardId ? [dashboardId] : undefined}
onChange={(dashboard) => {
setSelectedDashboard(dashboard);
setDashboardOption('existing');
}}
/>
</div>
<EuiSpacer size="s" />
</>
)}
{canCreateNew && (
<>
<EuiRadio
checked={dashboardOption === 'new'}
data-test-subj="add-to-new-dashboard-option"
id="new-dashboard-option"
name="dashboard-option"
disabled={!dashboardId}
label={dashboardCopyToDashboardActionStrings.getNewDashboardOption()}
onChange={() => setDashboardOption('new')}
/>
<EuiSpacer size="s" />
</>
)}
</div>
</EuiFormRow>
</>
</EuiModalBody>

<EuiModalFooter>
<EuiButtonEmpty data-test-subj="cancelCopyToButton" onClick={() => closeModal()}>
{dashboardCopyToDashboardActionStrings.getCancelButtonName()}
</EuiButtonEmpty>
<EuiButton
fill
data-test-subj="confirmCopyToButton"
onClick={onSubmit}
disabled={dashboardOption === 'existing' && !selectedDashboard}
>
{dashboardCopyToDashboardActionStrings.getAcceptButtonName()}
</EuiButton>
</EuiModalFooter>
</PresentationUtilContext>
</div>
</EuiOutsideClickDetector>
</EuiFocusTrap>
<EuiModalFooter>
<EuiButtonEmpty data-test-subj="cancelCopyToButton" onClick={() => closeModal()}>
{dashboardCopyToDashboardActionStrings.getCancelButtonName()}
</EuiButtonEmpty>
<EuiButton
fill
data-test-subj="confirmCopyToButton"
onClick={onSubmit}
disabled={dashboardOption === 'existing' && !selectedDashboard}
>
{dashboardCopyToDashboardActionStrings.getAcceptButtonName()}
</EuiButton>
</EuiModalFooter>
</div>
);
}
4 changes: 2 additions & 2 deletions src/plugins/dashboard/public/dashboard_actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const buildAllDashboardActions = async ({
plugins,
allowByValueEmbeddables,
}: BuildAllDashboardActionsProps) => {
const { uiActions, share, presentationUtil, savedObjectsTaggingOss, contentManagement } = plugins;
const { uiActions, share, savedObjectsTaggingOss, contentManagement } = plugins;

const clonePanelAction = new ClonePanelAction();
uiActions.registerAction(clonePanelAction);
Expand Down Expand Up @@ -73,7 +73,7 @@ export const buildAllDashboardActions = async ({
uiActions.registerAction(libraryNotificationAction);
uiActions.attachAction(PANEL_NOTIFICATION_TRIGGER, libraryNotificationAction.id);

const copyToDashboardAction = new CopyToDashboardAction(presentationUtil.ContextProvider);
const copyToDashboardAction = new CopyToDashboardAction(core);
uiActions.registerAction(copyToDashboardAction);
uiActions.attachAction(CONTEXT_MENU_TRIGGER, copyToDashboardAction.id);
}
Expand Down
Loading

0 comments on commit 2c465f8

Please sign in to comment.