Skip to content

Commit

Permalink
Add routes and path generator util
Browse files Browse the repository at this point in the history
  • Loading branch information
scottybollinger committed Mar 10, 2021
1 parent 3d38d50 commit 8920d56
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { generateRoleMappingPath } from './utils';

describe('generateRoleMappingPath', () => {
it('generates paths with roleId filled', () => {
const roleId = 'role123';

expect(generateRoleMappingPath(roleId)).toEqual(`/role-mappings/${roleId}/edit`);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { ROLE_MAPPING_PATH } from '../../routes';
import { generateEncodedPath } from '../../utils/encode_path_params';

export const generateRoleMappingPath = (roleId: string) =>
generateEncodedPath(ROLE_MAPPING_PATH, { roleId });
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ import { docLinks } from '../shared/doc_links';
export const DOCS_PREFIX = docLinks.appSearchBase;

export const ROOT_PATH = '/';
export const NOT_FOUND_PATH = '/404';
export const SETUP_GUIDE_PATH = '/setup_guide';
export const LIBRARY_PATH = '/library';
export const SETTINGS_PATH = '/settings/account';
export const CREDENTIALS_PATH = '/credentials';
export const ROLE_MAPPINGS_PATH = '#/role-mappings'; // This page seems to 404 if the # isn't included

export const ROLE_MAPPINGS_PATH = '/role-mappings';
export const ROLE_MAPPING_PATH = `${ROLE_MAPPINGS_PATH}/:roleId/edit`;
export const ROLE_MAPPING_NEW_PATH = `${ROLE_MAPPINGS_PATH}/new`;

export const ENGINES_PATH = '/engines';
export const ENGINE_CREATION_PATH = '/engine_creation';
Expand Down

0 comments on commit 8920d56

Please sign in to comment.