forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Index pattern management UI -> TypeScript (scripted_fields_table) (el…
…astic#63247) * Index pattern management UI -> TypeScript (scripted_fields_table)
- Loading branch information
Showing
23 changed files
with
346 additions
and
182 deletions.
There are no files selected for viewing
40 changes: 21 additions & 19 deletions
40
...shots__/scripted_field_table.test.js.snap → ...hots__/scripted_field_table.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...st__/__snapshots__/call_outs.test.js.snap → ...uts/__snapshots__/call_outs.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
...fields_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
...x_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.test.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,37 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { DeleteScritpedFieldConfirmationModal } from './confirmation_modal'; | ||
|
||
describe('DeleteScritpedFieldConfirmationModal', () => { | ||
test('should render normally', () => { | ||
const component = shallow( | ||
<DeleteScritpedFieldConfirmationModal | ||
field={{ name: '', script: '', lang: '' }} | ||
deleteField={() => {}} | ||
hideDeleteConfirmationModal={() => {}} | ||
/> | ||
); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
63 changes: 63 additions & 0 deletions
63
..._index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.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,63 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EUI_MODAL_CONFIRM_BUTTON, EuiConfirmModal, EuiOverlayMask } from '@elastic/eui'; | ||
|
||
import { ScriptedFieldItem } from '../../types'; | ||
|
||
interface DeleteScritpedFieldConfirmationModalProps { | ||
field: ScriptedFieldItem; | ||
hideDeleteConfirmationModal: ( | ||
event?: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLButtonElement> | ||
) => void; | ||
deleteField: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; | ||
} | ||
|
||
export const DeleteScritpedFieldConfirmationModal = ({ | ||
field, | ||
hideDeleteConfirmationModal, | ||
deleteField, | ||
}: DeleteScritpedFieldConfirmationModalProps) => { | ||
const title = i18n.translate('kbn.management.editIndexPattern.scripted.deleteFieldLabel', { | ||
defaultMessage: "Delete scripted field '{fieldName}'?", | ||
values: { fieldName: field.name }, | ||
}); | ||
const cancelButtonText = i18n.translate( | ||
'kbn.management.editIndexPattern.scripted.deleteField.cancelButton', | ||
{ defaultMessage: 'Cancel' } | ||
); | ||
const confirmButtonText = i18n.translate( | ||
'kbn.management.editIndexPattern.scripted.deleteField.deleteButton', | ||
{ defaultMessage: 'Delete' } | ||
); | ||
|
||
return ( | ||
<EuiOverlayMask> | ||
<EuiConfirmModal | ||
title={title} | ||
onCancel={hideDeleteConfirmationModal} | ||
onConfirm={deleteField} | ||
cancelButtonText={cancelButtonText} | ||
confirmButtonText={confirmButtonText} | ||
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON} | ||
/> | ||
</EuiOverlayMask> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
..._patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/index.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,20 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export { DeleteScritpedFieldConfirmationModal } from './confirmation_modal'; |
File renamed without changes.
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
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
File renamed without changes.
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
7 changes: 5 additions & 2 deletions
7
...__jest__/__snapshots__/table.test.js.snap → ...s/table/__snapshots__/table.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.