-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…74556) * [ILM] Convert node allocation component to TS and use hooks * [ILM] Fix jest tests * [ILM] Fix i18n check * [ILM] Implement code review suggestions * [ILM] Fix type check, docs link and button maxWidth in NodeAllocation component * Fix internaliation error * [ILM] Change error message when unable to load node attributes * [ILM] Delete a period in error callout Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
62cce80
commit 1301561
Showing
16 changed files
with
365 additions
and
298 deletions.
There are no files selected for viewing
147 changes: 82 additions & 65 deletions
147
x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
x-pack/plugins/index_lifecycle_management/__jest__/components/helpers/http_requests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import sinon, { SinonFakeServer } from 'sinon'; | ||
|
||
type HttpResponse = Record<string, any> | any[]; | ||
|
||
const registerHttpRequestMockHelpers = (server: SinonFakeServer) => { | ||
const setPoliciesResponse = (response: HttpResponse = []) => { | ||
server.respondWith('/api/index_lifecycle_management/policies', [ | ||
200, | ||
{ 'Content-Type': 'application/json' }, | ||
JSON.stringify(response), | ||
]); | ||
}; | ||
|
||
const setNodesListResponse = (response: HttpResponse = []) => { | ||
server.respondWith('/api/index_lifecycle_management/nodes/list', [ | ||
200, | ||
{ 'Content-Type': 'application/json' }, | ||
JSON.stringify(response), | ||
]); | ||
}; | ||
|
||
return { | ||
setPoliciesResponse, | ||
setNodesListResponse, | ||
}; | ||
}; | ||
|
||
export const init = () => { | ||
const server = sinon.fakeServer.create(); | ||
|
||
// Define default response for unhandled requests. | ||
// We make requests to APIs which don't impact the component under test, e.g. UI metric telemetry, | ||
// and we can mock them all with a 200 instead of mocking each one individually. | ||
server.respondWith([200, {}, 'DefaultSinonMockServerResponse']); | ||
|
||
const httpRequestsMockHelpers = registerHttpRequestMockHelpers(server); | ||
|
||
return { | ||
server, | ||
httpRequestsMockHelpers, | ||
}; | ||
}; |
33 changes: 0 additions & 33 deletions
33
...gins/index_lifecycle_management/public/application/sections/components/learn_more_link.js
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...ins/index_lifecycle_management/public/application/sections/components/learn_more_link.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { ReactNode } from 'react'; | ||
import { EuiLink } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
import { createDocLink } from '../../services/documentation'; | ||
|
||
interface Props { | ||
docPath: string; | ||
text?: ReactNode; | ||
} | ||
|
||
export const LearnMoreLink: React.FunctionComponent<Props> = ({ docPath, text }) => { | ||
const content = text ? ( | ||
text | ||
) : ( | ||
<FormattedMessage id="xpack.indexLifecycleMgmt.learnMore" defaultMessage="Learn more" /> | ||
); | ||
return ( | ||
<EuiLink href={createDocLink(docPath)} target="_blank" external={true}> | ||
{content} | ||
</EuiLink> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
.../application/sections/edit_policy/components/node_allocation/node_allocation.container.js
This file was deleted.
Oops, something went wrong.
120 changes: 0 additions & 120 deletions
120
...ent/public/application/sections/edit_policy/components/node_allocation/node_allocation.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.