Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design PR #3

Merged
merged 2 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
479 changes: 243 additions & 236 deletions x-pack/legacy/plugins/graph/public/app.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions x-pack/legacy/plugins/graph/public/components/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './graph_settings/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import './legacy_icon';
@import './url_template_list';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gphLegacyIcon {
width: $euiSizeS * 2;
}

.gphLegacyIcon--list {
margin-right: $euiSizeM;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.gphUrlTemplateList__accordion {
border-top: $euiBorderThin;
border-bottom: $euiBorderThin;

& + & {
// If there is another after it, shift up 1px to overlap borders
margin-top: -1px;
}

&-isOpen {
background-color: $euiPageBackgroundColor;
}
}

.gphUrlTemplateList__accordionbutton {
padding: $euiSizeM;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export function BlacklistForm({
'aria-label': i18n.translate('xpack.graph.blacklist.removeButtonAriaLabel', {
defaultMessage: 'Remove',
}),
title: i18n.translate('xpack.graph.blacklist.removeButtonAriaLabel', {
defaultMessage: 'Remove',
}),
color: 'danger',
onClick: () => {
unblacklistNode(node);
Expand All @@ -72,14 +75,16 @@ export function BlacklistForm({
data-test-subj="graphUnblacklistAll"
color="danger"
iconType="trash"
size="s"
fill
onClick={() => {
blacklistedNodes.forEach(node => {
unblacklistNode(node);
});
}}
>
{i18n.translate('xpack.graph.settings.blacklist.clearButtonLabel', {
defaultMessage: 'Clear all',
defaultMessage: 'Remove all',
})}
</EuiButton>
</>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@

import React, { useState, useEffect } from 'react';
import {
EuiForm,
EuiFormRow,
EuiFieldText,
EuiComboBox,
EuiButton,
EuiSpacer,
EuiFlexGroup,
EuiFlexItem,
EuiButtonEmpty,
EuiLink,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { UrlTemplate } from '../../types';
Expand Down Expand Up @@ -114,7 +113,6 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {
}
}}
>
<EuiSpacer size="s" />
<EuiFormRow
fullWidth
label={i18n.translate('xpack.graph.settings.drillDowns.urlDescriptionInputLabel', {
Expand All @@ -134,68 +132,69 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {
)}
/>
</EuiFormRow>
<EuiForm>
<EuiFormRow
fullWidth
label={i18n.translate('xpack.graph.settings.drillDowns.urlInputLabel', {
defaultMessage: 'URL',
})}
helpText={
<>
{autoformatUrl && (
<EuiFormRow
fullWidth
label={i18n.translate('xpack.graph.settings.drillDowns.urlInputLabel', {
defaultMessage: 'URL',
})}
helpText={
<>
{autoformatUrl && (
<p>
<strong>
{i18n.translate('xpack.graph.settings.drillDowns.kibanaUrlWarningText', {
defaultMessage: 'Possible Kibana URL pasted, ',
})}
<button className="gphSettings__helpTextButton" onClick={convertUrl}>
{i18n.translate(
'xpack.graph.settings.drillDowns.kibanaUrlWarningConvertOptionLinkText',
{ defaultMessage: 'convert it' }
)}
</button>
<br />
<EuiLink onClick={convertUrl}>
<strong>
{i18n.translate(
'xpack.graph.settings.drillDowns.kibanaUrlWarningConvertOptionLinkText',
{ defaultMessage: 'convert it' }
)}
</strong>
</EuiLink>
</strong>
)}
{i18n.translate('xpack.graph.settings.drillDowns.urlInputHelpText', {
defaultMessage:
'Define template URLs using {gquery} where the selected vertex terms are inserted',
values: { gquery: '{{gquery}}' },
})}
</>
}
onBlur={() => setTouched({ ...touched, url: true })}
</p>
)}
{i18n.translate('xpack.graph.settings.drillDowns.urlInputHelpText', {
defaultMessage:
'Define template URLs using {gquery} where the selected vertex terms are inserted',
values: { gquery: '{{gquery}}' },
})}
</>
}
onBlur={() => setTouched({ ...touched, url: true })}
isInvalid={urlPlaceholderMissing || (touched.url && !currentTemplate.url)}
error={
urlPlaceholderMissing
? [
i18n.translate('xpack.graph.settings.drillDowns.invalidUrlWarningText', {
defaultMessage: 'The URL must contain a {placeholder} string',
values: { placeholder: '{{gquery}}' },
}),
]
: []
}
>
<EuiFieldText
fullWidth
placeholder="https://www.google.co.uk/#q={{gquery}}"
value={currentTemplate.url}
onChange={e => {
setValue('url', e.target.value);
setAutoformatUrl(false);
}}
onPaste={e => {
e.preventDefault();
const pastedUrl = e.clipboardData.getData('text/plain');
if (isKibanaUrl(pastedUrl)) {
setAutoformatUrl(true);
}
setValue('url', pastedUrl);
}}
isInvalid={urlPlaceholderMissing || (touched.url && !currentTemplate.url)}
error={
urlPlaceholderMissing
? [
i18n.translate('xpack.graph.settings.drillDowns.invalidUrlWarningText', {
defaultMessage: 'The URL must contain a {placeholder} string',
values: { placeholder: '{{gquery}}' },
}),
]
: []
}
>
<EuiFieldText
fullWidth
placeholder="https://www.google.co.uk/#q={{gquery}}"
value={currentTemplate.url}
onChange={e => {
setValue('url', e.target.value);
setAutoformatUrl(false);
}}
onPaste={e => {
e.preventDefault();
const pastedUrl = e.clipboardData.getData('text/plain');
if (isKibanaUrl(pastedUrl)) {
setAutoformatUrl(true);
}
setValue('url', pastedUrl);
}}
isInvalid={urlPlaceholderMissing || (touched.url && !currentTemplate.url)}
/>
</EuiFormRow>
</EuiForm>
/>
</EuiFormRow>
<EuiFormRow
fullWidth
helpText={currentTemplate.encoder.description}
Expand Down Expand Up @@ -239,7 +238,7 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {
))}
</div>
</EuiFormRow>
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexGroup justifyContent="flexEnd" responsive={false}>
{isUpdateForm(props) && (
<>
<EuiFlexItem grow={null}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { Fragment } from 'react';
import { EuiText, EuiAccordion, EuiSpacer, EuiIcon } from '@elastic/eui';
import { EuiText, EuiAccordion, EuiSpacer, EuiIcon, EuiTextAlign, EuiButton } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { GraphSettingsProps } from './graph_settings';
import { UrlTemplateForm } from './url_template_form';
Expand All @@ -32,8 +32,14 @@ export function UrlTemplateList({
<EuiAccordion
id={getListKey(template)}
buttonContent={template.description}
className="gphSettingsAccordion"
buttonClassName="gphSettingsAccordion__button"
// TODO: Change the icon below to the template.icon
extraAction={<EuiIcon type="alert" />}
className="gphUrlTemplateList__accordion"
buttonClassName="gphUrlTemplateList__accordionbutton"
onToggle={isOpen => {
/* TODO: Use this to set a classname .gphUrlTemplateList__accordion-isOpen for the background color change */
}}
paddingSize="m"
>
<UrlTemplateForm
initialTemplate={template}
Expand All @@ -45,24 +51,34 @@ export function UrlTemplateList({
}}
/>
</EuiAccordion>
<EuiSpacer />
</Fragment>
))}

{/* TODO: Only show the following accordion when the user clicked "Add template" and auto-expand */}
<EuiAccordion
id="accordion-new"
buttonContent={i18n.translate('xpack.graph.templates.addLabel', {
defaultMessage: 'New template',
})}
className="gphSettingsAccordion"
buttonClassName="gphSettingsAccordion__button"
extraAction={<EuiIcon type="plusInCircleFilled" color="primary" />}
className="gphUrlTemplateList__accordion"
buttonClassName="gphUrlTemplateList__accordionbutton"
paddingSize="m"
>
<UrlTemplateForm
onSubmit={newTemplate => {
saveUrlTemplate(-1, newTemplate);
}}
/>
</EuiAccordion>

<EuiSpacer />

{/* TODO: Hook this up */}
<EuiTextAlign textAlign="center">
<EuiButton size="s" fill iconType="plusInCircle">
Add template
</EuiButton>
</EuiTextAlign>
</>
);
}
3 changes: 1 addition & 2 deletions x-pack/legacy/plugins/graph/public/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@

@import './main';
@import './angular/templates/index';

@import './components/graph_settings/graph_settings';
@import './components/index';