Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class PolicyTable extends Component {
icon: 'list',
onClick: () => {
this.props.navigateToApp('management', {
path: `/data/index_management${getIndexListUri(`ilm.policy:${policy.name}`)}`,
path: `/data/index_management${getIndexListUri(`ilm.policy:${policy.name}`, true)}`,
});
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export const services = {
services.uiMetricService.setup({ reportUiStats() {} } as any);
setExtensionsService(services.extensionsService);
setUiMetricService(services.uiMetricService);
const appDependencies = { services, core: { getUrlForApp: () => {} }, plugins: {} } as any;
const appDependencies = {
services,
core: { getUrlForApp: () => {} },
plugins: {},
} as any;

export const setupEnvironment = () => {
// Mock initialization of services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ export const IndexManagementHome: React.FunctionComponent<RouteComponentProps<Ma
component={DataStreamList}
/>
<Route exact path={`/${Section.Indices}`} component={IndexList} />
<Route exact path={`/${Section.Indices}/filter/:filter?`} component={IndexList} />
<Route
exact
path={[`/${Section.IndexTemplates}`, `/${Section.IndexTemplates}/:templateName?`]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const HEADERS = {

export class IndexTable extends Component {
static getDerivedStateFromProps(props, state) {
// Deselct any indices which no longer exist, e.g. they've been deleted.
// Deselect any indices which no longer exist, e.g. they've been deleted.
const { selectedIndicesMap } = state;
const indexNames = props.indices.map((index) => index.name);
const selectedIndexNames = Object.keys(selectedIndicesMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {
EuiFlexItem,
EuiCodeBlock,
} from '@elastic/eui';
import { useAppContext } from '../../../../../app_context';
import { TemplateDeserialized } from '../../../../../../../common';
import { getILMPolicyPath } from '../../../../../services/navigation';
import { getILMPolicyPath } from '../../../../../services/routing';

interface Props {
templateDetails: TemplateDeserialized;
Expand Down Expand Up @@ -51,6 +52,10 @@ export const TabSummary: React.FunctionComponent<Props> = ({ templateDetails })

const numIndexPatterns = indexPatterns.length;

const {
core: { getUrlForApp },
} = useAppContext();

return (
<EuiFlexGroup data-test-subj="summaryTab">
<EuiFlexItem>
Expand Down Expand Up @@ -153,7 +158,13 @@ export const TabSummary: React.FunctionComponent<Props> = ({ templateDetails })
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
{ilmPolicy && ilmPolicy.name ? (
<EuiLink href={getILMPolicyPath(ilmPolicy.name)}>{ilmPolicy.name}</EuiLink>
<EuiLink
href={getUrlForApp('management', {
path: getILMPolicyPath(ilmPolicy.name),
})}
>
{ilmPolicy.name}
</EuiLink>
) : (
i18nTexts.none
)}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ export const getTemplateCloneLink = (name: string, isLegacy?: boolean) => {
return encodeURI(url);
};

export const getILMPolicyPath = (policyName: string) => {
return encodeURI(
`/data/index_lifecycle_management/policies/edit/${encodeURIComponent(policyName)}`
);
};

export const getIndexListUri = (filter?: string, includeHiddenIndices?: boolean) => {
const hiddenIndicesParam =
typeof includeHiddenIndices !== 'undefined' ? includeHiddenIndices : false;
if (filter) {
// React router tries to decode url params but it can't because the browser partially
// decodes them. So we have to encode both the URL and the filter to get it all to
// work correctly for filters with URL unsafe characters in them.
return encodeURI(
`/indices?includeHiddenIndices=${hiddenIndicesParam}&filter=${encodeURIComponent(filter)}`
);
}

// If no filter, URI is already safe so no need to encode.
return '/indices';
};

export const decodePathFromReactRouter = (pathname: string): string => {
let decodedPath;
try {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/index_management/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export const plugin = () => {

export { IndexManagementPluginSetup };

export { getIndexListUri } from './application/services/navigation';
export { getIndexListUri } from './application/services/routing';