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

[frontend] Changes to helper text for search widgets #4915

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions opencti-platform/opencti-front/src/components/SearchInput.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import { Component } from 'react';
import * as PropTypes from 'prop-types';
import withStyles from '@mui/styles/withStyles';
import TextField from '@mui/material/TextField';
Expand Down Expand Up @@ -53,7 +53,11 @@ const styles = (theme) => ({

class SearchInput extends Component {
render() {
const { t, classes, onChange, onSubmit, variant, keyword, fullWidth } = this.props;
const {
t,
classes, onChange, onSubmit, variant, keyword, fullWidth,
placeholder = `${t('Search these results')}...`,
} = this.props;
let classRoot = classes.searchRoot;
if (variant === 'inDrawer') {
classRoot = classes.searchRootInDrawer;
Expand All @@ -71,7 +75,7 @@ class SearchInput extends Component {
defaultValue={keyword}
variant="outlined"
size="small"
placeholder={`${t('Search')}...`}
placeholder={placeholder}
onChange={(event) => {
const { value } = event.target;
if (typeof onChange === 'function') {
Expand Down Expand Up @@ -115,6 +119,7 @@ SearchInput.propTypes = {
onSubmit: PropTypes.func,
variant: PropTypes.string,
fullWidth: PropTypes.bool,
placeholder: PropTypes.func,
};

export default compose(inject18n, withStyles(styles))(SearchInput);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Add } from '@mui/icons-material';
import Skeleton from '@mui/material/Skeleton';
import makeStyles from '@mui/styles/makeStyles';
import Drawer from '../../common/drawer/Drawer';
import { useFormatter } from '../../../../components/i18n';
import SearchInput from '../../../../components/SearchInput';
import { QueryRenderer } from '../../../../relay/environment';
import AddExternalReferencesLines, { addExternalReferencesLinesQuery } from './AddExternalReferencesLines';
Expand All @@ -32,7 +31,6 @@ const AddExternalReferences = ({
stixCoreObjectOrStixCoreRelationshipReferences,
}) => {
const classes = useStyles();
const { t } = useFormatter();
const [open, setOpen] = useState(false);
const [search, setSearch] = useState('');

Expand Down Expand Up @@ -69,7 +67,6 @@ const AddExternalReferences = ({
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={handleSearch}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class AddNotes extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class AddSoftwares extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ class StixCoreRelationshipCreationFromRelation extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ class StixNestedRefRelationshipCreationFromEntity extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ const StixSightingRelationshipCreationFromEntity = ({
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
keyword={search}
onSubmit={handleSearch}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ const TopBarComponent: FunctionComponent<TopBarProps> = ({
onSubmit={handleSearch}
keyword={keyword}
variant="topBar"
placeholder={`${t('Search OpenCTI')}...`}
/>
<Filters
variant="dialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class IndicatorAddObservables extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class StixCyberObservableAddIndicators extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class AddCoursesOfAction extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const AddDataComponents: FunctionComponent<{
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={handleSearch}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class AddSubAttackPattern extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class AddAttackPatterns extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const AddAttackPatterns: FunctionComponent<{
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={handleSearch}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const AddDataSources: FunctionComponent<{ dataComponentId: string }> = ({
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={handleSearch}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const AddDataComponents: FunctionComponent<{
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={handleSearch}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class AddSubNarrative extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class AddLocations extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class AddLocationsThreatActorGroup extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class AddLocationsThreatActorIndividual extends Component {
<div className={classes.search}>
<SearchInput
variant="inDrawer"
placeholder={`${t('Search')}...`}
onSubmit={this.handleSearch.bind(this)}
/>
</div>
Expand Down
8 changes: 8 additions & 0 deletions opencti-platform/opencti-front/src/utils/Localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const i18n = {
'When enforcing 2FA authentication, all users will be asked to enable 2FA to be able to login in the platform.':
'Al aplicar la autenticación 2FA, se pedirá a todos los usuarios que habiliten 2FA para poder iniciar sesión en la plataforma.',
Search: 'Buscar',
'Search these results': 'Buscar estos resultados',
'Search OpenCTI': 'Buscar OpenCTI',
Active: 'Activo',
Inactive: 'Inactivo',
'Last update': 'Última actualización',
Expand Down Expand Up @@ -2285,6 +2287,8 @@ const i18n = {
'When enforcing 2FA authentication, all users will be asked to enable 2FA to be able to login in the platform.':
"Lors de l’application de l'authentication à deux facteurs, tous les utilisateurs seront invités à activer l'authentication à deux facteurs pour pouvoir se connecter à la plate-forme.",
Search: 'Rechercher',
'Search these results': 'Rechercher ces résultats',
'Search OpenCTI': 'Rechercher OpenCTI',
Active: 'Actif',
Inactive: 'Inactif',
'Last update': 'Dernière mise à jour',
Expand Down Expand Up @@ -4514,6 +4518,8 @@ const i18n = {
'When enforcing 2FA authentication, all users will be asked to enable 2FA to be able to login in the platform.':
'2要素認証を強制する場合、すべてのユーザーは、プラットフォームにログインできるように2要素認証を有効にするように求められます。',
Search: '検索',
'Search these results': 'これらの結果を検索',
'Search OpenCTI': 'OpenCTI を検索',
Active: 'アクティブ',
Inactive: '非活性',
'Last update': '最終更新',
Expand Down Expand Up @@ -6658,6 +6664,8 @@ const i18n = {
'When enforcing 2FA authentication, all users will be asked to enable 2FA to be able to login in the platform.':
'強制執行雙因素身份驗證時,將要求所有使用者啟用雙因素身份驗證才能登錄平臺。',
Search: '搜索',
'Search these results': '搜索这些结果',
'Search OpenCTI': '搜索 OpenCTI',
Active: '活跃',
Inactive: '不活跃',
'Last update': '上次更新',
Expand Down