-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b681a18
commit 51264c4
Showing
29 changed files
with
178 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import 'styles/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { Plugin, CoreStart, CoreSetup, PluginInitializerContext } from 'kibana/public'; | ||
import { first } from 'rxjs/operators'; | ||
import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
|
||
import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public'; | ||
import { LICENSE_CHECK_STATE } from '../../licensing/public'; | ||
|
||
import { PLUGIN } from '../common/constants'; | ||
import { PluginDependencies } from './types'; | ||
import { registerPainless } from './application/register_painless'; | ||
|
||
export class PainlessLabUIPlugin implements Plugin<void, void, PluginDependencies> { | ||
constructor(ctx: PluginInitializerContext) {} | ||
|
||
async setup( | ||
{ http, getStartServices, uiSettings }: CoreSetup, | ||
{ devTools, home, licensing }: PluginDependencies | ||
) { | ||
home.featureCatalogue.register({ | ||
id: PLUGIN.id, | ||
title: i18n.translate('xpack.painlessLab.registryProviderTitle', { | ||
defaultMessage: 'Painless Lab (beta)', | ||
}), | ||
description: i18n.translate('xpack.painlessLab.registryProviderDescription', { | ||
defaultMessage: 'Simulate and debug painless code.', | ||
}), | ||
icon: '', | ||
path: '/app/kibana#/dev_tools/painless_lab', | ||
showOnHomePage: false, | ||
category: FeatureCatalogueCategory.ADMIN, | ||
}); | ||
|
||
devTools.register({ | ||
id: 'painless_lab', | ||
order: 7, | ||
title: ( | ||
<EuiFlexGroup gutterSize="s" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
{i18n.translate('xpack.painlessLab.displayName', { | ||
defaultMessage: 'Painless Lab', | ||
})} | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem grow={false} className="painlessLab__betaLabelContainer"> | ||
<EuiBetaBadge | ||
label={i18n.translate('xpack.painlessLab.displayNameBetaLabel', { | ||
defaultMessage: 'Beta', | ||
})} | ||
tooltipContent={i18n.translate('xpack.painlessLab.displayNameBetaTooltipText', { | ||
defaultMessage: 'This feature might change drastically in future releases', | ||
})} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
) as any, | ||
enableRouting: false, | ||
disabled: false, | ||
// tooltipContent: xpackInfo.get('features.painlessLab.message'), | ||
mount: async (ctx, { element }) => { | ||
const [core] = await getStartServices(); | ||
|
||
const { | ||
i18n: { Context: I18nContext }, | ||
notifications, | ||
} = core; | ||
|
||
registerPainless(); | ||
|
||
const license = await licensing.license$.pipe(first()).toPromise(); | ||
const { state, message: invalidLicenseMessage } = license.check( | ||
PLUGIN.id, | ||
PLUGIN.minimumLicenseType | ||
); | ||
const isValidLicense = state === LICENSE_CHECK_STATE.Valid; | ||
|
||
if (!isValidLicense) { | ||
notifications.toasts.addDanger(invalidLicenseMessage as string); | ||
window.location.hash = '/dev_tools'; | ||
return () => {}; | ||
} | ||
|
||
const { renderApp } = await import('./application'); | ||
return renderApp(element, { I18nContext, http, uiSettings }); | ||
}, | ||
}); | ||
} | ||
|
||
async start(core: CoreStart, plugins: any) {} | ||
|
||
async stop() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Import the EUI global scope so we can use EUI constants | ||
@import 'src/legacy/ui/public/styles/_styling_constants'; | ||
|
||
/** | ||
* 1. This is a very brittle way of preventing the editor and other content from disappearing | ||
* behind the bottom bar. | ||
*/ | ||
.painlessLabBottomBarPlaceholder { | ||
height: $euiSize * 3; /* [1] */ | ||
} | ||
|
||
.painlessLabRightPane { | ||
border-right: none; | ||
border-top: none; | ||
border-bottom: none; | ||
border-radius: 0; | ||
padding-top: 0; | ||
height: 100%; | ||
} | ||
|
||
.painlessLabRightPane__tabs { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
|
||
[role="tabpanel"] { | ||
height: 100%; | ||
} | ||
} | ||
|
||
.painlessLab__betaLabelContainer { | ||
line-height: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; | ||
import { DevToolsSetup } from '../../../../src/plugins/dev_tools/public'; | ||
import { LicensingPluginSetup } from '../../licensing/public'; | ||
|
||
export interface PluginDependencies { | ||
licensing: LicensingPluginSetup; | ||
home: HomePublicPluginSetup; | ||
devTools: DevToolsSetup; | ||
} |