mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Edit screen redesign * Edit screen redesign * Redesign view screen * Redesign view screen * Fixing type failure, and functional test * Updating failing functional tests * update dashboard empty styles * i18n fix * Updating failing snapshot Co-authored-by: Ryan Keairns <rkeairns@chef.io> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Ryan Keairns <rkeairns@chef.io> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
12f47611ee
commit
3d088cc3cf
13 changed files with 402 additions and 305 deletions
|
@ -2,6 +2,31 @@
|
|||
|
||||
exports[`DashboardEmptyScreen renders correctly with visualize paragraph 1`] = `
|
||||
<DashboardEmptyScreen
|
||||
http={
|
||||
Object {
|
||||
"addLoadingCountSource": [MockFunction],
|
||||
"anonymousPaths": Object {
|
||||
"isAnonymous": [MockFunction],
|
||||
"register": [MockFunction],
|
||||
},
|
||||
"basePath": BasePath {
|
||||
"basePath": "",
|
||||
"get": [Function],
|
||||
"prepend": [Function],
|
||||
"remove": [Function],
|
||||
},
|
||||
"delete": [MockFunction],
|
||||
"fetch": [MockFunction],
|
||||
"get": [MockFunction],
|
||||
"getLoadingCount$": [MockFunction],
|
||||
"head": [MockFunction],
|
||||
"intercept": [MockFunction],
|
||||
"options": [MockFunction],
|
||||
"patch": [MockFunction],
|
||||
"post": [MockFunction],
|
||||
"put": [MockFunction],
|
||||
}
|
||||
}
|
||||
intl={
|
||||
Object {
|
||||
"defaultFormats": Object {},
|
||||
|
@ -106,6 +131,35 @@ exports[`DashboardEmptyScreen renders correctly with visualize paragraph 1`] = `
|
|||
}
|
||||
onLinkClick={[MockFunction]}
|
||||
showLinkToVisualize={true}
|
||||
uiSettings={
|
||||
Object {
|
||||
"get": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
"theme:darkMode",
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
"get$": [MockFunction],
|
||||
"getAll": [MockFunction],
|
||||
"getSaved$": [MockFunction],
|
||||
"getUpdate$": [MockFunction],
|
||||
"getUpdateErrors$": [MockFunction],
|
||||
"isCustom": [MockFunction],
|
||||
"isDeclared": [MockFunction],
|
||||
"isDefault": [MockFunction],
|
||||
"isOverridden": [MockFunction],
|
||||
"overrideLocalDefault": [MockFunction],
|
||||
"remove": [MockFunction],
|
||||
"set": [MockFunction],
|
||||
}
|
||||
}
|
||||
>
|
||||
<I18nProvider>
|
||||
<IntlProvider
|
||||
|
@ -193,178 +247,112 @@ exports[`DashboardEmptyScreen renders correctly with visualize paragraph 1`] = `
|
|||
textComponent={Symbol(react.fragment)}
|
||||
>
|
||||
<PseudoLocaleWrapper>
|
||||
<EuiPage
|
||||
className="dshStartScreen"
|
||||
restrictWidth="36em"
|
||||
<div
|
||||
className="dshEmptyWidget"
|
||||
data-test-subj="emptyDashboardWidget"
|
||||
>
|
||||
<div
|
||||
className="euiPage euiPage--restrictWidth-custom dshStartScreen"
|
||||
style={
|
||||
Object {
|
||||
"maxWidth": "36em",
|
||||
}
|
||||
}
|
||||
<EuiText
|
||||
color="subdued"
|
||||
size="m"
|
||||
>
|
||||
<EuiPageBody>
|
||||
<main
|
||||
className="euiPageBody"
|
||||
<div
|
||||
className="euiText euiText--medium"
|
||||
>
|
||||
<EuiTextColor
|
||||
color="subdued"
|
||||
component="div"
|
||||
>
|
||||
<EuiPageContent
|
||||
horizontalPosition="center"
|
||||
verticalPosition="center"
|
||||
<div
|
||||
className="euiTextColor euiTextColor--subdued"
|
||||
>
|
||||
<EuiPanel
|
||||
className="euiPageContent euiPageContent--verticalCenter euiPageContent--horizontalCenter"
|
||||
paddingSize="l"
|
||||
>
|
||||
<div
|
||||
className="euiPanel euiPanel--paddingLarge euiPageContent euiPageContent--verticalCenter euiPageContent--horizontalCenter"
|
||||
<p>
|
||||
<EuiLink
|
||||
aria-label="Add an existing visualization"
|
||||
data-test-subj=""
|
||||
onClick={[MockFunction]}
|
||||
>
|
||||
<EuiIcon
|
||||
color="subdued"
|
||||
size="xxl"
|
||||
type="dashboardApp"
|
||||
<button
|
||||
aria-label="Add an existing visualization"
|
||||
className="euiLink euiLink--primary"
|
||||
data-test-subj=""
|
||||
onClick={[MockFunction]}
|
||||
type="button"
|
||||
>
|
||||
<EuiIconEmpty
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon--app euiIcon-isLoading"
|
||||
focusable="false"
|
||||
role="img"
|
||||
style={null}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon--app euiIcon-isLoading"
|
||||
focusable="false"
|
||||
height={16}
|
||||
role="img"
|
||||
style={null}
|
||||
viewBox="0 0 16 16"
|
||||
width={16}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
/>
|
||||
</EuiIconEmpty>
|
||||
</EuiIcon>
|
||||
<EuiSpacer
|
||||
size="s"
|
||||
>
|
||||
<div
|
||||
className="euiSpacer euiSpacer--s"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<EuiText
|
||||
grow={true}
|
||||
>
|
||||
<div
|
||||
className="euiText euiText--medium"
|
||||
>
|
||||
<h2
|
||||
key="0.5"
|
||||
>
|
||||
This dashboard is empty. Let’s fill it up!
|
||||
</h2>
|
||||
</div>
|
||||
</EuiText>
|
||||
<EuiSpacer
|
||||
size="m"
|
||||
>
|
||||
<div
|
||||
className="euiSpacer euiSpacer--m"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<EuiText
|
||||
size="m"
|
||||
>
|
||||
<div
|
||||
className="euiText euiText--medium"
|
||||
>
|
||||
<p>
|
||||
Click the
|
||||
<EuiLink
|
||||
aria-label="Add visualization"
|
||||
data-test-subj="emptyDashboardAddPanelButton"
|
||||
onClick={[MockFunction]}
|
||||
>
|
||||
<button
|
||||
aria-label="Add visualization"
|
||||
className="euiLink euiLink--primary"
|
||||
data-test-subj="emptyDashboardAddPanelButton"
|
||||
onClick={[MockFunction]}
|
||||
type="button"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
</EuiLink>
|
||||
button in the menu bar above to add a visualization to the dashboard.
|
||||
</p>
|
||||
</div>
|
||||
</EuiText>
|
||||
<EuiSpacer
|
||||
size="m"
|
||||
>
|
||||
<div
|
||||
className="euiSpacer euiSpacer--m"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<p
|
||||
data-test-subj="linkToVisualizeParagraph"
|
||||
>
|
||||
<EuiButton
|
||||
data-test-subj="addVisualizationButton"
|
||||
fill={true}
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
>
|
||||
<button
|
||||
className="euiButton euiButton--primary euiButton--iconRight euiButton--fill"
|
||||
data-test-subj="addVisualizationButton"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
className="euiButton__content"
|
||||
>
|
||||
<EuiIcon
|
||||
aria-hidden="true"
|
||||
className="euiButton__icon"
|
||||
size="m"
|
||||
type="arrowDown"
|
||||
>
|
||||
<EuiIconEmpty
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--medium euiIcon-isLoading euiButton__icon"
|
||||
focusable="false"
|
||||
role="img"
|
||||
style={null}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--medium euiIcon-isLoading euiButton__icon"
|
||||
focusable="false"
|
||||
height={16}
|
||||
role="img"
|
||||
style={null}
|
||||
viewBox="0 0 16 16"
|
||||
width={16}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
/>
|
||||
</EuiIconEmpty>
|
||||
</EuiIcon>
|
||||
<span
|
||||
className="euiButton__text"
|
||||
>
|
||||
Create new
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</EuiButton>
|
||||
</p>
|
||||
</div>
|
||||
</EuiPanel>
|
||||
</EuiPageContent>
|
||||
</main>
|
||||
</EuiPageBody>
|
||||
</div>
|
||||
</EuiPage>
|
||||
Add an existing
|
||||
</button>
|
||||
</EuiLink>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
or new object to this dashboard
|
||||
</p>
|
||||
</div>
|
||||
</EuiTextColor>
|
||||
</div>
|
||||
</EuiText>
|
||||
<EuiSpacer
|
||||
size="l"
|
||||
>
|
||||
<div
|
||||
className="euiSpacer euiSpacer--l"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<p
|
||||
data-test-subj="linkToVisualizeParagraph"
|
||||
>
|
||||
<EuiButton
|
||||
aria-label="Create new visualization button"
|
||||
data-test-subj="addVisualizationButton"
|
||||
fill={true}
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
size="s"
|
||||
>
|
||||
<button
|
||||
aria-label="Create new visualization button"
|
||||
className="euiButton euiButton--primary euiButton--small euiButton--iconRight euiButton--fill"
|
||||
data-test-subj="addVisualizationButton"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
className="euiButton__content"
|
||||
>
|
||||
<EuiIcon
|
||||
aria-hidden="true"
|
||||
className="euiButton__icon"
|
||||
size="m"
|
||||
type="arrowDown"
|
||||
>
|
||||
<EuiIconEmpty
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--medium euiIcon-isLoading euiButton__icon"
|
||||
focusable="false"
|
||||
role="img"
|
||||
style={null}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--medium euiIcon-isLoading euiButton__icon"
|
||||
focusable="false"
|
||||
height={16}
|
||||
role="img"
|
||||
style={null}
|
||||
viewBox="0 0 16 16"
|
||||
width={16}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
/>
|
||||
</EuiIconEmpty>
|
||||
</EuiIcon>
|
||||
<span
|
||||
className="euiButton__text"
|
||||
>
|
||||
Create new
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</EuiButton>
|
||||
</p>
|
||||
</div>
|
||||
</PseudoLocaleWrapper>
|
||||
</IntlProvider>
|
||||
</I18nProvider>
|
||||
|
@ -373,6 +361,31 @@ exports[`DashboardEmptyScreen renders correctly with visualize paragraph 1`] = `
|
|||
|
||||
exports[`DashboardEmptyScreen renders correctly without visualize paragraph 1`] = `
|
||||
<DashboardEmptyScreen
|
||||
http={
|
||||
Object {
|
||||
"addLoadingCountSource": [MockFunction],
|
||||
"anonymousPaths": Object {
|
||||
"isAnonymous": [MockFunction],
|
||||
"register": [MockFunction],
|
||||
},
|
||||
"basePath": BasePath {
|
||||
"basePath": "",
|
||||
"get": [Function],
|
||||
"prepend": [Function],
|
||||
"remove": [Function],
|
||||
},
|
||||
"delete": [MockFunction],
|
||||
"fetch": [MockFunction],
|
||||
"get": [MockFunction],
|
||||
"getLoadingCount$": [MockFunction],
|
||||
"head": [MockFunction],
|
||||
"intercept": [MockFunction],
|
||||
"options": [MockFunction],
|
||||
"patch": [MockFunction],
|
||||
"post": [MockFunction],
|
||||
"put": [MockFunction],
|
||||
}
|
||||
}
|
||||
intl={
|
||||
Object {
|
||||
"defaultFormats": Object {},
|
||||
|
@ -477,6 +490,42 @@ exports[`DashboardEmptyScreen renders correctly without visualize paragraph 1`]
|
|||
}
|
||||
onLinkClick={[MockFunction]}
|
||||
showLinkToVisualize={false}
|
||||
uiSettings={
|
||||
Object {
|
||||
"get": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
"theme:darkMode",
|
||||
],
|
||||
Array [
|
||||
"theme:darkMode",
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
"get$": [MockFunction],
|
||||
"getAll": [MockFunction],
|
||||
"getSaved$": [MockFunction],
|
||||
"getUpdate$": [MockFunction],
|
||||
"getUpdateErrors$": [MockFunction],
|
||||
"isCustom": [MockFunction],
|
||||
"isDeclared": [MockFunction],
|
||||
"isDefault": [MockFunction],
|
||||
"isOverridden": [MockFunction],
|
||||
"overrideLocalDefault": [MockFunction],
|
||||
"remove": [MockFunction],
|
||||
"set": [MockFunction],
|
||||
}
|
||||
}
|
||||
>
|
||||
<I18nProvider>
|
||||
<IntlProvider
|
||||
|
@ -566,13 +615,13 @@ exports[`DashboardEmptyScreen renders correctly without visualize paragraph 1`]
|
|||
<PseudoLocaleWrapper>
|
||||
<EuiPage
|
||||
className="dshStartScreen"
|
||||
restrictWidth="36em"
|
||||
restrictWidth="500px"
|
||||
>
|
||||
<div
|
||||
className="euiPage euiPage--restrictWidth-custom dshStartScreen"
|
||||
style={
|
||||
Object {
|
||||
"maxWidth": "36em",
|
||||
"maxWidth": "500px",
|
||||
}
|
||||
}
|
||||
>
|
||||
|
@ -581,59 +630,48 @@ exports[`DashboardEmptyScreen renders correctly without visualize paragraph 1`]
|
|||
className="euiPageBody"
|
||||
>
|
||||
<EuiPageContent
|
||||
className="dshStartScreen__pageContent"
|
||||
horizontalPosition="center"
|
||||
paddingSize="none"
|
||||
verticalPosition="center"
|
||||
>
|
||||
<EuiPanel
|
||||
className="euiPageContent euiPageContent--verticalCenter euiPageContent--horizontalCenter"
|
||||
paddingSize="l"
|
||||
className="euiPageContent euiPageContent--verticalCenter euiPageContent--horizontalCenter dshStartScreen__pageContent"
|
||||
paddingSize="none"
|
||||
>
|
||||
<div
|
||||
className="euiPanel euiPanel--paddingLarge euiPageContent euiPageContent--verticalCenter euiPageContent--horizontalCenter"
|
||||
className="euiPanel euiPageContent euiPageContent--verticalCenter euiPageContent--horizontalCenter dshStartScreen__pageContent"
|
||||
>
|
||||
<EuiIcon
|
||||
color="subdued"
|
||||
size="xxl"
|
||||
type="dashboardApp"
|
||||
<EuiImage
|
||||
alt=""
|
||||
url="/plugins/kibana/home/assets/welcome_graphic_light_2x.png"
|
||||
>
|
||||
<EuiIconEmpty
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon--app euiIcon-isLoading"
|
||||
focusable="false"
|
||||
role="img"
|
||||
style={null}
|
||||
<figure
|
||||
className="euiImage"
|
||||
role="figure"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
className="euiIcon euiIcon--xxLarge euiIcon--subdued euiIcon--app euiIcon-isLoading"
|
||||
focusable="false"
|
||||
height={16}
|
||||
role="img"
|
||||
style={null}
|
||||
viewBox="0 0 16 16"
|
||||
width={16}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
<img
|
||||
alt=""
|
||||
className="euiImage__img"
|
||||
src="/plugins/kibana/home/assets/welcome_graphic_light_2x.png"
|
||||
/>
|
||||
</EuiIconEmpty>
|
||||
</EuiIcon>
|
||||
<EuiSpacer
|
||||
size="s"
|
||||
>
|
||||
<div
|
||||
className="euiSpacer euiSpacer--s"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
</figure>
|
||||
</EuiImage>
|
||||
<EuiText
|
||||
grow={true}
|
||||
size="m"
|
||||
>
|
||||
<div
|
||||
className="euiText euiText--medium"
|
||||
>
|
||||
<h2
|
||||
key="0.5"
|
||||
<p
|
||||
style={
|
||||
Object {
|
||||
"fontWeight": "bold",
|
||||
}
|
||||
}
|
||||
>
|
||||
This dashboard is empty. Let’s fill it up!
|
||||
</h2>
|
||||
</p>
|
||||
</div>
|
||||
</EuiText>
|
||||
<EuiSpacer
|
||||
|
@ -643,33 +681,53 @@ exports[`DashboardEmptyScreen renders correctly without visualize paragraph 1`]
|
|||
className="euiSpacer euiSpacer--m"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<EuiText
|
||||
size="m"
|
||||
<div
|
||||
className="dshStartScreen__panelDesc"
|
||||
>
|
||||
<div
|
||||
className="euiText euiText--medium"
|
||||
<EuiText
|
||||
color="subdued"
|
||||
size="m"
|
||||
>
|
||||
<p>
|
||||
Click the
|
||||
<EuiLink
|
||||
aria-label="Edit dashboard"
|
||||
data-test-subj=""
|
||||
onClick={[MockFunction]}
|
||||
<div
|
||||
className="euiText euiText--medium"
|
||||
>
|
||||
<EuiTextColor
|
||||
color="subdued"
|
||||
component="div"
|
||||
>
|
||||
<button
|
||||
aria-label="Edit dashboard"
|
||||
className="euiLink euiLink--primary"
|
||||
data-test-subj=""
|
||||
onClick={[MockFunction]}
|
||||
type="button"
|
||||
<div
|
||||
className="euiTextColor euiTextColor--subdued"
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
</EuiLink>
|
||||
button in the menu bar above to start working on your new dashboard.
|
||||
</p>
|
||||
</div>
|
||||
</EuiText>
|
||||
<p>
|
||||
Click
|
||||
<span>
|
||||
|
||||
</span>
|
||||
<EuiLink
|
||||
aria-label="Edit dashboard"
|
||||
data-test-subj=""
|
||||
onClick={[MockFunction]}
|
||||
>
|
||||
<button
|
||||
aria-label="Edit dashboard"
|
||||
className="euiLink euiLink--primary"
|
||||
data-test-subj=""
|
||||
onClick={[MockFunction]}
|
||||
type="button"
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
</EuiLink>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
in the menu bar above to start adding panels.
|
||||
</p>
|
||||
</div>
|
||||
</EuiTextColor>
|
||||
</div>
|
||||
</EuiText>
|
||||
</div>
|
||||
</div>
|
||||
</EuiPanel>
|
||||
</EuiPageContent>
|
||||
|
|
|
@ -24,11 +24,16 @@ import {
|
|||
} from '../np_ready/dashboard_empty_screen';
|
||||
// @ts-ignore
|
||||
import { findTestSubject } from '@elastic/eui/lib/test';
|
||||
import { coreMock } from '../../../../../../core/public/mocks';
|
||||
|
||||
describe('DashboardEmptyScreen', () => {
|
||||
const setupMock = coreMock.createSetup();
|
||||
|
||||
const defaultProps = {
|
||||
showLinkToVisualize: true,
|
||||
onLinkClick: jest.fn(),
|
||||
uiSettings: setupMock.uiSettings,
|
||||
http: setupMock.http,
|
||||
};
|
||||
|
||||
function mountComponent(props?: DashboardEmptyScreenProps) {
|
||||
|
|
|
@ -6,5 +6,31 @@
|
|||
|
||||
.dshStartScreen {
|
||||
text-align: center;
|
||||
padding: $euiSizeS;
|
||||
}
|
||||
|
||||
.dshStartScreen__pageContent {
|
||||
padding: $euiSizeXXL;
|
||||
}
|
||||
|
||||
.dshStartScreen__panelDesc {
|
||||
max-width: 260px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.dshEmptyWidget {
|
||||
border: $euiBorderThin;
|
||||
border-style: dashed;
|
||||
border-radius: $euiBorderRadius;
|
||||
padding: $euiSizeXXL * 2;
|
||||
max-width: 400px;
|
||||
margin-left: $euiSizeS;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dshEmptyWidget {
|
||||
border: 2px dashed $euiColorLightShade;
|
||||
padding: 4 * $euiSize;
|
||||
max-width: 20em;
|
||||
margin-left: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ export class DashboardAppController {
|
|||
timefilter: { timefilter },
|
||||
},
|
||||
},
|
||||
core: { notifications, overlays, chrome, injectedMetadata, uiSettings, savedObjects },
|
||||
core: { notifications, overlays, chrome, injectedMetadata, uiSettings, savedObjects, http },
|
||||
}: DashboardAppControllerDependencies) {
|
||||
new FilterStateManager(globalState, getAppState, filterManager);
|
||||
const queryFilter = filterManager;
|
||||
|
@ -197,6 +197,8 @@ export class DashboardAppController {
|
|||
const emptyScreenProps: DashboardEmptyScreenProps = {
|
||||
onLinkClick: shouldShowEditHelp ? $scope.showAddPanel : $scope.enterEditMode,
|
||||
showLinkToVisualize: shouldShowEditHelp,
|
||||
uiSettings,
|
||||
http,
|
||||
};
|
||||
if (shouldShowEditHelp) {
|
||||
emptyScreenProps.onVisualizeClick = addVisualization;
|
||||
|
|
|
@ -19,94 +19,110 @@
|
|||
import React from 'react';
|
||||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
import {
|
||||
EuiIcon,
|
||||
EuiLink,
|
||||
EuiSpacer,
|
||||
EuiPageContent,
|
||||
EuiPageBody,
|
||||
EuiPage,
|
||||
EuiImage,
|
||||
EuiText,
|
||||
EuiButton,
|
||||
} from '@elastic/eui';
|
||||
import { IUiSettingsClient, HttpStart } from 'kibana/public';
|
||||
import * as constants from './dashboard_empty_screen_constants';
|
||||
|
||||
export interface DashboardEmptyScreenProps {
|
||||
showLinkToVisualize: boolean;
|
||||
onLinkClick: () => void;
|
||||
onVisualizeClick?: () => void;
|
||||
uiSettings: IUiSettingsClient;
|
||||
http: HttpStart;
|
||||
}
|
||||
|
||||
export function DashboardEmptyScreen({
|
||||
showLinkToVisualize,
|
||||
onLinkClick,
|
||||
onVisualizeClick,
|
||||
uiSettings,
|
||||
http,
|
||||
}: DashboardEmptyScreenProps) {
|
||||
const IS_DARK_THEME = uiSettings.get('theme:darkMode');
|
||||
const emptyStateGraphicURL = IS_DARK_THEME
|
||||
? '/plugins/kibana/home/assets/welcome_graphic_dark_2x.png'
|
||||
: '/plugins/kibana/home/assets/welcome_graphic_light_2x.png';
|
||||
const linkToVisualizeParagraph = (
|
||||
<p data-test-subj="linkToVisualizeParagraph">
|
||||
<EuiButton
|
||||
iconSide="right"
|
||||
size="s"
|
||||
fill
|
||||
iconType="arrowDown"
|
||||
onClick={onVisualizeClick}
|
||||
data-test-subj="addVisualizationButton"
|
||||
aria-label={constants.createNewVisualizationButtonAriaLabel}
|
||||
>
|
||||
{constants.createNewVisualizationButton}
|
||||
</EuiButton>
|
||||
</p>
|
||||
);
|
||||
const paragraph = (
|
||||
description1: string,
|
||||
description1: string | null,
|
||||
description2: string,
|
||||
linkText: string,
|
||||
ariaLabel: string,
|
||||
dataTestSubj?: string
|
||||
) => {
|
||||
return (
|
||||
<EuiText size="m">
|
||||
<EuiText size="m" color="subdued">
|
||||
<p>
|
||||
{description1}
|
||||
{description1 && <span> </span>}
|
||||
<EuiLink onClick={onLinkClick} aria-label={ariaLabel} data-test-subj={dataTestSubj || ''}>
|
||||
{linkText}
|
||||
</EuiLink>
|
||||
<span> </span>
|
||||
{description2}
|
||||
</p>
|
||||
</EuiText>
|
||||
);
|
||||
};
|
||||
const addVisualizationParagraph = (
|
||||
<React.Fragment>
|
||||
{paragraph(
|
||||
constants.addVisualizationDescription1,
|
||||
constants.addVisualizationDescription2,
|
||||
constants.addVisualizationLinkText,
|
||||
constants.addVisualizationLinkAriaLabel,
|
||||
'emptyDashboardAddPanelButton'
|
||||
)}
|
||||
<EuiSpacer size="m" />
|
||||
{linkToVisualizeParagraph}
|
||||
</React.Fragment>
|
||||
);
|
||||
const enterEditModeParagraph = paragraph(
|
||||
constants.howToStartWorkingOnNewDashboardDescription1,
|
||||
constants.howToStartWorkingOnNewDashboardDescription2,
|
||||
constants.howToStartWorkingOnNewDashboardEditLinkText,
|
||||
constants.howToStartWorkingOnNewDashboardEditLinkAriaLabel
|
||||
);
|
||||
return (
|
||||
<I18nProvider>
|
||||
<EuiPage className="dshStartScreen" restrictWidth="36em">
|
||||
<EuiPageBody>
|
||||
<EuiPageContent verticalPosition="center" horizontalPosition="center">
|
||||
<EuiIcon type="dashboardApp" size="xxl" color="subdued" />
|
||||
<EuiSpacer size="s" />
|
||||
<EuiText grow={true}>
|
||||
<h2 key={0.5}>{constants.fillDashboardTitle}</h2>
|
||||
</EuiText>
|
||||
<EuiSpacer size="m" />
|
||||
{showLinkToVisualize ? addVisualizationParagraph : enterEditModeParagraph}
|
||||
</EuiPageContent>
|
||||
</EuiPageBody>
|
||||
</EuiPage>
|
||||
</I18nProvider>
|
||||
const enterViewModeParagraph = paragraph(
|
||||
null,
|
||||
constants.addNewVisualizationDescription,
|
||||
constants.addExistingVisualizationLinkText,
|
||||
constants.addExistingVisualizationLinkAriaLabel
|
||||
);
|
||||
const viewMode = (
|
||||
<EuiPage className="dshStartScreen" restrictWidth="500px">
|
||||
<EuiPageBody>
|
||||
<EuiPageContent
|
||||
verticalPosition="center"
|
||||
horizontalPosition="center"
|
||||
paddingSize="none"
|
||||
className="dshStartScreen__pageContent"
|
||||
>
|
||||
<EuiImage url={http.basePath.prepend(emptyStateGraphicURL)} alt="" />
|
||||
<EuiText size="m">
|
||||
<p style={{ fontWeight: 'bold' }}>{constants.fillDashboardTitle}</p>
|
||||
</EuiText>
|
||||
<EuiSpacer size="m" />
|
||||
<div className="dshStartScreen__panelDesc">{enterEditModeParagraph}</div>
|
||||
</EuiPageContent>
|
||||
</EuiPageBody>
|
||||
</EuiPage>
|
||||
);
|
||||
const editMode = (
|
||||
<div data-test-subj="emptyDashboardWidget" className="dshEmptyWidget">
|
||||
{enterViewModeParagraph}
|
||||
<EuiSpacer size="l" />
|
||||
{linkToVisualizeParagraph}
|
||||
</div>
|
||||
);
|
||||
return <I18nProvider>{showLinkToVisualize ? editMode : viewMode}</I18nProvider>;
|
||||
}
|
||||
|
|
|
@ -19,40 +19,20 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const addVisualizationDescription1: string = i18n.translate(
|
||||
'kbn.dashboard.addVisualizationDescription1',
|
||||
{
|
||||
defaultMessage: 'Click the ',
|
||||
}
|
||||
);
|
||||
export const addVisualizationDescription2: string = i18n.translate(
|
||||
'kbn.dashboard.addVisualizationDescription2',
|
||||
{
|
||||
defaultMessage: ' button in the menu bar above to add a visualization to the dashboard.',
|
||||
}
|
||||
);
|
||||
export const addVisualizationLinkText: string = i18n.translate(
|
||||
'kbn.dashboard.addVisualizationLinkText',
|
||||
{
|
||||
defaultMessage: 'Add',
|
||||
}
|
||||
);
|
||||
export const addVisualizationLinkAriaLabel: string = i18n.translate(
|
||||
'kbn.dashboard.addVisualizationLinkAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Add visualization',
|
||||
}
|
||||
);
|
||||
/** VIEW MODE CONSTANTS **/
|
||||
export const fillDashboardTitle: string = i18n.translate('kbn.dashboard.fillDashboardTitle', {
|
||||
defaultMessage: 'This dashboard is empty. Let\u2019s fill it up!',
|
||||
});
|
||||
export const howToStartWorkingOnNewDashboardDescription1: string = i18n.translate(
|
||||
'kbn.dashboard.howToStartWorkingOnNewDashboardDescription1',
|
||||
{
|
||||
defaultMessage: 'Click the ',
|
||||
defaultMessage: 'Click',
|
||||
}
|
||||
);
|
||||
export const howToStartWorkingOnNewDashboardDescription2: string = i18n.translate(
|
||||
'kbn.dashboard.howToStartWorkingOnNewDashboardDescription2',
|
||||
{
|
||||
defaultMessage: ' button in the menu bar above to start working on your new dashboard.',
|
||||
defaultMessage: 'in the menu bar above to start adding panels.',
|
||||
}
|
||||
);
|
||||
export const howToStartWorkingOnNewDashboardEditLinkText: string = i18n.translate(
|
||||
|
@ -67,13 +47,23 @@ export const howToStartWorkingOnNewDashboardEditLinkAriaLabel: string = i18n.tra
|
|||
defaultMessage: 'Edit dashboard',
|
||||
}
|
||||
);
|
||||
export const fillDashboardTitle: string = i18n.translate('kbn.dashboard.fillDashboardTitle', {
|
||||
defaultMessage: 'This dashboard is empty. Let\u2019s fill it up!',
|
||||
});
|
||||
export const visualizeAppLinkTest: string = i18n.translate(
|
||||
'kbn.dashboard.visitVisualizeAppLinkText',
|
||||
/** EDIT MODE CONSTANTS **/
|
||||
export const addExistingVisualizationLinkText: string = i18n.translate(
|
||||
'kbn.dashboard.addExistingVisualizationLinkText',
|
||||
{
|
||||
defaultMessage: 'visit the Visualize app',
|
||||
defaultMessage: 'Add an existing',
|
||||
}
|
||||
);
|
||||
export const addExistingVisualizationLinkAriaLabel: string = i18n.translate(
|
||||
'kbn.dashboard.addVisualizationLinkAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Add an existing visualization',
|
||||
}
|
||||
);
|
||||
export const addNewVisualizationDescription: string = i18n.translate(
|
||||
'kbn.dashboard.addNewVisualizationText',
|
||||
{
|
||||
defaultMessage: 'or new object to this dashboard',
|
||||
}
|
||||
);
|
||||
export const createNewVisualizationButton: string = i18n.translate(
|
||||
|
@ -82,3 +72,9 @@ export const createNewVisualizationButton: string = i18n.translate(
|
|||
defaultMessage: 'Create new',
|
||||
}
|
||||
);
|
||||
export const createNewVisualizationButtonAriaLabel: string = i18n.translate(
|
||||
'kbn.dashboard.createNewVisualizationButtonAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Create new visualization button',
|
||||
}
|
||||
);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
|
@ -44,13 +44,13 @@ export default function({ getService, getPageObjects }) {
|
|||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
});
|
||||
|
||||
it('should display add button', async () => {
|
||||
const addButtonExists = await testSubjects.exists('emptyDashboardAddPanelButton');
|
||||
expect(addButtonExists).to.be(true);
|
||||
it('should display empty widget', async () => {
|
||||
const emptyWidgetExists = await testSubjects.exists('emptyDashboardWidget');
|
||||
expect(emptyWidgetExists).to.be(true);
|
||||
});
|
||||
|
||||
it.skip('should open add panel when add button is clicked', async () => {
|
||||
await testSubjects.click('emptyDashboardAddPanelButton');
|
||||
await testSubjects.click('dashboardAddPanelButton');
|
||||
const isAddPanelOpen = await dashboardAddPanel.isAddPanelOpen();
|
||||
expect(isAddPanelOpen).to.be(true);
|
||||
});
|
||||
|
|
|
@ -1773,10 +1773,7 @@
|
|||
"kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage": "にアクセスして有効な別のドキュメントを選択してください。",
|
||||
"kbn.context.unableToLoadAnchorDocumentDescription": "別のドキュメントが読み込めません",
|
||||
"kbn.context.unableToLoadDocumentDescription": "ドキュメントが読み込めません",
|
||||
"kbn.dashboard.addVisualizationDescription1": "上のメニューバーの ",
|
||||
"kbn.dashboard.addVisualizationDescription2": " ボタンをクリックして、ダッシュボードにビジュアライゼーションを追加します。",
|
||||
"kbn.dashboard.addVisualizationLinkAriaLabel": "ビジュアライゼーションを追加",
|
||||
"kbn.dashboard.addVisualizationLinkText": "追加",
|
||||
"kbn.dashboard.badge.readOnly.text": "読み込み専用",
|
||||
"kbn.dashboard.badge.readOnly.tooltip": "ダッシュボードを保存できません",
|
||||
"kbn.dashboard.changeViewModeConfirmModal.cancelButtonLabel": "編集を続行",
|
||||
|
|
|
@ -1774,10 +1774,7 @@
|
|||
"kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage": "以选择有效地定位点文档。",
|
||||
"kbn.context.unableToLoadAnchorDocumentDescription": "无法加载该定位点文档",
|
||||
"kbn.context.unableToLoadDocumentDescription": "无法加载文档",
|
||||
"kbn.dashboard.addVisualizationDescription1": "单击上述菜单栏中的 ",
|
||||
"kbn.dashboard.addVisualizationDescription2": " 按钮,以将可视化添加到仪表板。",
|
||||
"kbn.dashboard.addVisualizationLinkAriaLabel": "添加可视化",
|
||||
"kbn.dashboard.addVisualizationLinkText": "添加",
|
||||
"kbn.dashboard.badge.readOnly.text": "只读",
|
||||
"kbn.dashboard.badge.readOnly.tooltip": "无法保存仪表板",
|
||||
"kbn.dashboard.changeViewModeConfirmModal.cancelButtonLabel": "继续编辑",
|
||||
|
|
|
@ -107,7 +107,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
|
|||
shouldLoginIfPrompted: false,
|
||||
}
|
||||
);
|
||||
await testSubjects.existOrFail('emptyDashboardAddPanelButton', { timeout: 10000 });
|
||||
await testSubjects.existOrFail('emptyDashboardWidget', { timeout: 10000 });
|
||||
});
|
||||
|
||||
it(`can view existing Dashboard`, async () => {
|
||||
|
|
|
@ -73,7 +73,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
|
|||
shouldLoginIfPrompted: false,
|
||||
}
|
||||
);
|
||||
await testSubjects.existOrFail('emptyDashboardAddPanelButton', { timeout: 10000 });
|
||||
await testSubjects.existOrFail('emptyDashboardWidget', { timeout: 10000 });
|
||||
});
|
||||
|
||||
it(`can view existing Dashboard`, async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue