Skip to content

Commit

Permalink
Added package to hold routerProps utils
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrdyn committed Dec 13, 2023
1 parent bcba990 commit 1bdf293
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@
"@kbn/response-stream-plugin": "link:examples/response_stream",
"@kbn/rison": "link:packages/kbn-rison",
"@kbn/rollup-plugin": "link:x-pack/plugins/rollup",
"@kbn/router-utils": "link:packages/kbn-router-utils",
"@kbn/routing-example-plugin": "link:examples/routing_example",
"@kbn/rrule": "link:packages/kbn-rrule",
"@kbn/rule-data-utils": "link:packages/kbn-rule-data-utils",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-router-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/router-utils

This package provides util functions when working with the router.
9 changes: 9 additions & 0 deletions packages/kbn-router-utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { getRouterLinkProps } from './src/get_router_link_props';
13 changes: 13 additions & 0 deletions packages/kbn-router-utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-router-utils'],
};
5 changes: 5 additions & 0 deletions packages/kbn-router-utils/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/router-utils",
"owner": "@elastic/obs-ux-logs-team"
}
6 changes: 6 additions & 0 deletions packages/kbn-router-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/router-utils",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

interface GetRouterLinkPropsDeps {
Expand Down
19 changes: 19 additions & 0 deletions packages/kbn-router-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,8 @@
"@kbn/rison/*": ["packages/kbn-rison/*"],
"@kbn/rollup-plugin": ["x-pack/plugins/rollup"],
"@kbn/rollup-plugin/*": ["x-pack/plugins/rollup/*"],
"@kbn/router-utils": ["packages/kbn-router-utils"],
"@kbn/router-utils/*": ["packages/kbn-router-utils/*"],
"@kbn/routing-example-plugin": ["examples/routing_example"],
"@kbn/routing-example-plugin/*": ["examples/routing_example/*"],
"@kbn/rrule": ["packages/kbn-rrule"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { EuiLink } from '@elastic/eui';
import React from 'react';
import { getRouterLinkProps } from '@kbn/observability-shared-plugin/public';
import { getRouterLinkProps } from '@kbn/router-utils';
import {
SingleDatasetLocatorParams,
SINGLE_DATASET_LOCATOR_ID,
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/dataset_quality/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"@kbn/io-ts-utils",
"@kbn/observability-plugin",
"@kbn/es-types",
"@kbn/deeplinks-observability"
"@kbn/deeplinks-observability",
"@kbn/router-utils",
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { EuiBadge, EuiButton, EuiHorizontalRule } from '@elastic/eui';
import { getRouterLinkProps } from '@kbn/observability-shared-plugin/public';
import React from 'react';
import { getRouterLinkProps } from '@kbn/router-utils';
import { DiscoverEsqlUrlProps } from '../../../hooks/use_esql';
import { technicalPreview, tryEsql } from '../constants';

Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/log_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"@kbn/xstate-utils",
"@kbn/ecs",
"@kbn/react-field",
"@kbn/observability-shared-plugin"
"@kbn/observability-shared-plugin",
"@kbn/router-utils",
],
"exclude": [
"target/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getDiscoverColumnsFromDisplayOptions,
getDiscoverFiltersFromState,
} from '@kbn/log-explorer-plugin/public';
import { getRouterLinkProps } from '@kbn/observability-shared-plugin/public';
import { getRouterLinkProps } from '@kbn/router-utils';
import { MatchedStateFromActor } from '@kbn/xstate-utils';
import { useActor } from '@xstate/react';
import React, { useMemo } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ObservabilityOnboardingLocatorParams,
OBSERVABILITY_ONBOARDING_LOCATOR,
} from '@kbn/deeplinks-observability/locators';
import { getRouterLinkProps } from '@kbn/observability-shared-plugin/public';
import { getRouterLinkProps } from '@kbn/router-utils';
import { BrowserUrlService } from '@kbn/share-plugin/public';
import React from 'react';
import { onboardingLinkTitle } from '../../common/translations';
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/observability_log_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"@kbn/shared-ux-router",
"@kbn/shared-ux-utility",
"@kbn/ui-theme",
"@kbn/xstate-utils"
"@kbn/xstate-utils",
"@kbn/router-utils",
],
"exclude": [
"target/**/*"
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/observability_shared/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export type { ApmIndicesConfig, UXMetrics } from './types';

export { noCasesPermissions, allCasesPermissions } from './utils/cases_permissions';

export { getRouterLinkProps } from './utils/get_router_link_props';

export {
type ObservabilityActionContextMenuItemProps,
getContextMenuItemsFromActions,
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5427,6 +5427,10 @@
version "0.0.0"
uid ""

"@kbn/router-utils@link:packages/kbn-router-utils":
version "0.0.0"
uid ""

"@kbn/routing-example-plugin@link:examples/routing_example":
version "0.0.0"
uid ""
Expand Down

0 comments on commit 1bdf293

Please sign in to comment.