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

Remove typeahead.less. #20641

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
62 changes: 0 additions & 62 deletions graylog2-web-interface/public/stylesheets/typeahead.less

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import ApiRoutes from 'routing/ApiRoutes';
import { qualifyUrl } from 'util/URLUtils';
import fetch from 'logic/rest/FetchProvider';

import { Container } from './TypeAheadInput';

/**
* Component that renders an input offering auto-completion for message fields.
* Fields are loaded from the Graylog server in the background.
Expand Down Expand Up @@ -137,14 +139,16 @@ class TypeAheadFieldInput extends React.Component {
const { id, label, valueLink, error, onBlur } = this.props;

return (
<Input id={id}
ref={(fieldInput) => { this.fieldInput = fieldInput; }}
label={label}
onBlur={onBlur}
error={error}
wrapperClassName="typeahead-wrapper"
defaultValue={valueLink ? valueLink.value : null}
{...this._getFilteredProps()} />
<Container>
<Input id={id}
ref={(fieldInput) => { this.fieldInput = fieldInput; }}
label={label}
onBlur={onBlur}
error={error}
wrapperClassName="typeahead-wrapper"
defaultValue={valueLink ? valueLink.value : null}
{...this._getFilteredProps()} />
</Container>
);
}
}
Expand Down
95 changes: 87 additions & 8 deletions graylog2-web-interface/src/components/common/TypeAheadInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,88 @@
import escape from 'lodash/escape';
import $ from 'jquery';
import 'typeahead.js';
import styled from 'styled-components';
import styled, { css } from 'styled-components';

import UniversalSearch from 'logic/search/UniversalSearch';
import { Input } from 'components/bootstrap';

export const Container = styled.div(({ theme }) => css`
width: 100%;

.twitter-typeahead {
width: 100%;
}

.typeahead,
.tt-query,
.tt-hint {
border: 2px solid #ccc;
border-radius: 4px;
outline: none;
}

.typeahead {
background-color: #fff;
}

.typeahead:focus {
border: 2px solid #0097cf;
}

.tt-query {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

input[type="text"].tt-hint {
color: #999
}

.tt-menu {
min-width: 160px;
//background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 4px;
//box-shadow: 0 5px 10px rgba(0,0,0,.2);
width: 100%;
background-color: ${theme.colors.global.contentBackground};
box-shadow: 0 3px 3px ${theme.colors.global.navigationBoxShadow};
color: ${theme.colors.global.textDefault};

.tt-suggestion:hover,
.tt-suggestion.tt-cursor {
color: ${theme.colors.variant.darkest.info};
background-color: ${theme.colors.variant.lighter.info};
background-image: none;
}
}

.tt-dataset {
margin-top: 10px;
}

.tt-suggestion {
font-size: 1rem; /* theme.fonts.size.body */
line-height: 20px;
padding: 3px 10px;
cursor: pointer;
}

.tt-suggestion:hover,
.tt-suggestion.tt-cursor {
color: #ffffff;
text-decoration: none;
background-color: #0081c2;
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
outline: 0;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
}

.tt-suggestion p {
margin: 0;
}
`);

const StyledInput = styled(Input)`
input&.tt-hint {
background-color: transparent !important;
Expand Down Expand Up @@ -104,9 +181,9 @@
this._destroyTypeahead();
}

getValue = () => $(this.fieldInput).typeahead('val');

Check warning on line 184 in graylog2-web-interface/src/components/common/TypeAheadInput.jsx

View workflow job for this annotation

GitHub Actions / Reviewbot

Unused method or property "getValue" of class "TypeAheadInput"

No further rule information available.

clear = () => {

Check warning on line 186 in graylog2-web-interface/src/components/common/TypeAheadInput.jsx

View workflow job for this annotation

GitHub Actions / Reviewbot

Unused method or property "clear" of class "TypeAheadInput"

No further rule information available.
$(this.fieldInput).typeahead('val', '');
};

Expand Down Expand Up @@ -159,13 +236,15 @@
const { id, label, onKeyPress, formGroupClassName } = this.props;

return (
<StyledInput id={id}
type="text"
ref={(fieldInput) => { this.fieldInputElem = fieldInput; }}
wrapperClassName="typeahead-wrapper"
formGroupClassName={formGroupClassName}
label={label}
onKeyPress={onKeyPress} />
<Container>
<StyledInput id={id}
type="text"
ref={(fieldInput) => { this.fieldInputElem = fieldInput; }}
wrapperClassName="typeahead-wrapper"
formGroupClassName={formGroupClassName}
label={label}
onKeyPress={onKeyPress} />
</Container>
);
}
}
Expand Down
1 change: 0 additions & 1 deletion graylog2-web-interface/src/routing/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import CurrentUserContext from 'contexts/CurrentUserContext';
import Navigation from 'components/navigation/Navigation';
import ReportedErrorBoundary from 'components/errors/ReportedErrorBoundary';
import RuntimeErrorBoundary from 'components/errors/RuntimeErrorBoundary';
import 'stylesheets/typeahead.less';
import NavigationTelemetry from 'logic/telemetry/NavigationTelemetry';
import HotkeysProvider from 'contexts/HotkeysProvider';
import HotkeysModalContainer from 'components/hotkeys/HotkeysModalContainer';
Expand Down
13 changes: 0 additions & 13 deletions graylog2-web-interface/src/theme/GlobalThemeStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,19 +563,6 @@ const GlobalThemeStyles = createGlobalStyle(({ theme }) => css`
width: auto;
}

.typeahead-wrapper .tt-menu {
background-color: ${theme.colors.global.contentBackground};
box-shadow: 0 3px 3px ${theme.colors.global.navigationBoxShadow};
color: ${theme.colors.global.textDefault};

.tt-suggestion:hover,
.tt-suggestion.tt-cursor {
color: ${theme.colors.variant.darkest.info};
background-color: ${theme.colors.variant.lighter.info};
background-image: none;
}
}

.form-group-inline {
display: inline-block;
margin: 0;
Expand Down
1 change: 0 additions & 1 deletion graylog2-web-interface/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ module.exports = {
'regenerator-runtime/runtime',
'bootstrap/less/bootstrap.less',
'toastr/toastr.less',
'stylesheets/typeahead.less',
'./fetch-mock',
],
sections: [
Expand Down
Loading