mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Enterprise Search][Search Application] Remove application name validation from Create Search App Flyout (#158120)
## Summary
* Remove search application name validation from UI side in Create search application Flyout, Instead verify error from logs.
2a945d8d
-45ae-41ce-a143-a126b993132d
This commit is contained in:
parent
59c2ff5f20
commit
2a97425f58
2 changed files with 23 additions and 11 deletions
|
@ -47,7 +47,7 @@ describe('CreateEngineLogic', () => {
|
|||
});
|
||||
|
||||
describe('listeners', () => {
|
||||
it('createEngine makes expected request action', () => {
|
||||
it('createEngine makes expected request action with VALID_ENGINE_NAME', () => {
|
||||
jest.spyOn(CreateEngineLogic.actions, 'createEngineRequest');
|
||||
|
||||
CreateEngineLogic.actions.setEngineName(VALID_ENGINE_NAME);
|
||||
|
@ -61,6 +61,22 @@ describe('CreateEngineLogic', () => {
|
|||
indices: ['search-index-01'],
|
||||
});
|
||||
});
|
||||
|
||||
it('createEngine makes expected request action with INVALID_ENGINE_NAME', () => {
|
||||
jest.spyOn(CreateEngineLogic.actions, 'createEngineRequest');
|
||||
|
||||
CreateEngineLogic.actions.setEngineName(INVALID_ENGINE_NAME);
|
||||
CreateEngineLogic.actions.setSelectedIndices(VALID_INDICES_DATA);
|
||||
|
||||
CreateEngineLogic.actions.createEngine();
|
||||
|
||||
expect(CreateEngineLogic.actions.createEngineRequest).toHaveBeenCalledTimes(1);
|
||||
expect(CreateEngineLogic.actions.createEngineRequest).toHaveBeenCalledWith({
|
||||
engineName: INVALID_ENGINE_NAME,
|
||||
indices: ['search-index-01'],
|
||||
});
|
||||
});
|
||||
|
||||
it('engineCreated is handled and is navigated to Search application list page', () => {
|
||||
jest.spyOn(CreateEngineLogic.actions, 'fetchEngines');
|
||||
jest
|
||||
|
@ -84,10 +100,9 @@ describe('CreateEngineLogic', () => {
|
|||
|
||||
expect(CreateEngineLogic.values.engineNameStatus).toEqual('complete');
|
||||
});
|
||||
it('returns warning for invalid engine name', () => {
|
||||
it('returns complete with invalid engine name', () => {
|
||||
CreateEngineLogic.actions.setEngineName(INVALID_ENGINE_NAME);
|
||||
|
||||
expect(CreateEngineLogic.values.engineNameStatus).toEqual('warning');
|
||||
expect(CreateEngineLogic.values.engineNameStatus).toEqual('complete');
|
||||
});
|
||||
});
|
||||
describe('indicesStatus', () => {
|
||||
|
@ -106,11 +121,11 @@ describe('CreateEngineLogic', () => {
|
|||
|
||||
expect(CreateEngineLogic.values.createDisabled).toEqual(false);
|
||||
});
|
||||
it('true with invalid data', () => {
|
||||
it('false with invalid data', () => {
|
||||
CreateEngineLogic.actions.setSelectedIndices(VALID_INDICES_DATA);
|
||||
CreateEngineLogic.actions.setEngineName(INVALID_ENGINE_NAME);
|
||||
|
||||
expect(CreateEngineLogic.values.createDisabled).toEqual(true);
|
||||
expect(CreateEngineLogic.values.createDisabled).toEqual(false);
|
||||
});
|
||||
});
|
||||
describe('formDisabled', () => {
|
||||
|
|
|
@ -18,8 +18,6 @@ import { ENGINES_PATH } from '../../routes';
|
|||
|
||||
import { EnginesListLogic } from './engines_list_logic';
|
||||
|
||||
const NAME_VALIDATION = new RegExp(/^[a-z0-9\-]+$/);
|
||||
|
||||
export interface CreateEngineLogicActions {
|
||||
createEngine: () => void;
|
||||
createEngineRequest: CreateEngineApiLogicActions['makeRequest'];
|
||||
|
@ -37,7 +35,7 @@ export interface CreateEngineLogicValues {
|
|||
createEngineError?: typeof CreateEngineApiLogic.values.error;
|
||||
createEngineStatus: typeof CreateEngineApiLogic.values.status;
|
||||
engineName: string;
|
||||
engineNameStatus: 'complete' | 'incomplete' | 'warning';
|
||||
engineNameStatus: 'complete' | 'incomplete';
|
||||
formDisabled: boolean;
|
||||
indicesStatus: 'complete' | 'incomplete';
|
||||
selectedIndices: string[];
|
||||
|
@ -103,8 +101,7 @@ export const CreateEngineLogic = kea<
|
|||
() => [selectors.engineName],
|
||||
(engineName: string) => {
|
||||
if (engineName.length === 0) return 'incomplete';
|
||||
if (NAME_VALIDATION.test(engineName)) return 'complete';
|
||||
return 'warning';
|
||||
return 'complete';
|
||||
},
|
||||
],
|
||||
formDisabled: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue