Skip to content

Commit

Permalink
Remove constants
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonStoltz committed Feb 9, 2021
1 parent f16fd97 commit 309f884
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,29 @@ export const RELEVANCE_TUNING_TITLE = i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.relevanceTuning.title',
{ defaultMessage: 'Relevance Tuning' }
);

export const UPDATE_SUCCESS_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.updateSuccess',
{
defaultMessage: 'Relevance successfully tuned. The changes will impact your results shortly.',
}
);
export const DELETE_SUCCESS_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.deleteSuccess',
{
defaultMessage:
'Relevance has been reset to default values. The change will impact your results shortly.',
}
);
export const RESET_CONFIRMATION_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.resetConfirmation',
{
defaultMessage: 'Are you sure you want to restore relevance defaults?',
}
);
export const DELETE_CONFIRMATION_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.deleteConfirmation',
{
defaultMessage: 'Are you sure you want to delete this boost?',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import { kea, MakeLogicType } from 'kea';
import { omit, cloneDeep, isEmpty } from 'lodash';

import { i18n } from '@kbn/i18n';

import { NUMBER } from '../../../shared/constants/field_types';
import { HttpLogic } from '../../../shared/http';
import { Schema, SchemaConflicts, SchemaTypes } from '../../../shared/types';
Expand All @@ -19,6 +17,13 @@ import { Result } from '../result/types';
import { EngineLogic } from '../engine';

import { BaseBoost, Boost, BoostType, SearchSettings } from './types';
import {
UPDATE_SUCCESS_MESSAGE,
RESET_CONFIRMATION_MESSAGE,
DELETE_SUCCESS_MESSAGE,
DELETE_CONFIRMATION_MESSAGE,
} from './constants';

interface RelevanceTuningProps {
searchSettings: SearchSettings;
schema: Schema;
Expand Down Expand Up @@ -100,32 +105,6 @@ interface RelevanceTuningValues {
resultsLoading: boolean;
}

const UPDATE_SUCCESS_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.updateSuccess',
{
defaultMessage: 'Relevance successfully tuned. The changes will impact your results shortly.',
}
);
const DELETE_SUCCESS_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.deleteSuccess',
{
defaultMessage:
'Relevance has been reset to default values. The change will impact your results shortly.',
}
);
const RESET_CONFIRMATION_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.resetConfirmation',
{
defaultMessage: 'Are you sure you want to restore relevance defaults?',
}
);
const DELETE_CONFIRMATION_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.relevanceTuning.messages.deleteConfirmation',
{
defaultMessage: 'Are you sure you want to delete this boost?',
}
);

// If the user hasn't entered a filter, then we can skip filtering the array entirely
const filterIfTerm = (array: string[], filterTerm: string): string[] => {
return filterTerm === '' ? array : array.filter((item) => item.includes(filterTerm));
Expand Down

0 comments on commit 309f884

Please sign in to comment.