Skip to content

Commit

Permalink
[frontend] Changes to helper text for search widgets (#4915)
Browse files Browse the repository at this point in the history
  • Loading branch information
ParamConstructor committed Nov 19, 2023
1 parent ad44f75 commit 076c0a6
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 24 deletions.
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 @@ -2303,6 +2305,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 @@ -4550,6 +4554,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 @@ -6712,6 +6718,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

0 comments on commit 076c0a6

Please sign in to comment.