-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Euify management edit-index-pattern component. #47448
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8d12fce
De-angularized index_header
sainthkh eb3aa1f
De-angularized texts.
sainthkh ecfd2eb
De-angularized filters.
sainthkh b545526
De-angularized tabs.
sainthkh 10f85f6
Made SearchField controlled component.
sainthkh e9ef754
Add EuiSpacer for scripted fields and source filter tabs.
sainthkh 463ccbf
Load tab from state.
sainthkh 33babae
Fixed functional tests.
sainthkh 3361750
Fixed jp, ch language file problem caused by string format change.
sainthkh 63076f0
Merge branch 'master' into management-edit-eui
sainthkh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...kibana/public/management/sections/index_patterns/edit_index_pattern/components/alerts.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,49 @@ | ||
/* | ||
* 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 { EuiCallOut } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
interface Props { | ||
conflictFields: any; | ||
} | ||
|
||
export const Alerts = ({ conflictFields }: Props) => { | ||
return ( | ||
<EuiCallOut | ||
title={ | ||
<FormattedMessage | ||
id="kbn.management.editIndexPattern.mappingConflictHeader" | ||
defaultMessage="Mapping conflict" | ||
/> | ||
} | ||
color="warning" | ||
iconType="bolt" | ||
> | ||
<FormattedMessage | ||
id="kbn.management.editIndexPattern.mappingConflictLabel" | ||
defaultMessage="{conflictFieldsLength, plural, one {A field is} other {# fields are}} defined as several types (string, integer, etc) across the indices that match this pattern. You may still be able to use these conflict fields in parts of Kibana, but they will be unavailable for functions that require Kibana to know their type. Correcting this issue will require reindexing your data." | ||
values={{ | ||
conflictFieldsLength: conflictFields.length, | ||
}} | ||
/> | ||
</EuiCallOut> | ||
); | ||
}; |
53 changes: 53 additions & 0 deletions
53
...kibana/public/management/sections/index_patterns/edit_index_pattern/components/badges.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,53 @@ | ||
/* | ||
* 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 { EuiBadge } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
interface Props { | ||
indexPattern: any; | ||
} | ||
|
||
export const Badges = ({ indexPattern }: Props) => { | ||
return ( | ||
<p> | ||
{indexPattern.timeFieldName ? ( | ||
<EuiBadge color="warning"> | ||
<FormattedMessage | ||
id="kbn.management.editIndexPattern.timeFilterHeader" | ||
defaultMessage="Time Filter field name: {timeFieldName}" | ||
values={{ | ||
timeFieldName: indexPattern.timeFieldName, | ||
}} | ||
/> | ||
</EuiBadge> | ||
) : null} | ||
{indexPattern.tags && indexPattern.tags.length | ||
? indexPattern.tags.map((tag: any, i: number) => { | ||
return ( | ||
<EuiBadge key={i} color="hollow"> | ||
{tag.name} | ||
</EuiBadge> | ||
); | ||
}) | ||
: null} | ||
</p> | ||
); | ||
}; |
54 changes: 54 additions & 0 deletions
54
...na/public/management/sections/index_patterns/edit_index_pattern/components/guide_text.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,54 @@ | ||
/* | ||
* 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 { EuiText, EuiLink, EuiIcon } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
interface Props { | ||
indexPattern: any; | ||
} | ||
|
||
export const GuideText = ({ indexPattern }: Props) => { | ||
return ( | ||
<EuiText> | ||
<p> | ||
<FormattedMessage | ||
id="kbn.management.editIndexPattern.timeFilterLabel.timeFilterDetail" | ||
defaultMessage="This page lists every field in the {indexPatternTitle} index and the field's associated core type as recorded by Elasticsearch. To change a field type, use the Elasticsearch {apiLink}." | ||
values={{ | ||
indexPatternTitle: <strong>{indexPattern.title}</strong>, | ||
apiLink: ( | ||
<EuiLink | ||
target="_blank" | ||
href="http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html" | ||
> | ||
<FormattedMessage | ||
id="kbn.management.editIndexPattern.timeFilterLabel.mappingAPILink" | ||
defaultMessage="Mapping API" | ||
/> | ||
<EuiIcon type="link" /> | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</p> | ||
</EuiText> | ||
); | ||
}; |
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
94 changes: 94 additions & 0 deletions
94
.../public/management/sections/index_patterns/edit_index_pattern/components/index_header.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,94 @@ | ||
/* | ||
* 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 { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiButtonEmpty, EuiIcon } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
interface Props { | ||
defaultIndex: boolean; | ||
indexPatternTitle: string; | ||
setDefault: any; | ||
refreshFields: any; | ||
removePattern: any; | ||
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are angular functions and should be re-written later. So, they should be left as
These |
||
} | ||
|
||
export const IndexHeader = ({ | ||
defaultIndex, | ||
indexPatternTitle, | ||
setDefault, | ||
refreshFields, | ||
removePattern, | ||
}: Props) => { | ||
return ( | ||
<div> | ||
<EuiFlexGroup justifyContent="spaceBetween"> | ||
<EuiFlexItem grow={false}> | ||
<EuiTitle size="m"> | ||
<h1 data-test-subj="indexPatternTitle"> | ||
{defaultIndex ? <EuiIcon type="starFilled" size="xl" /> : null} | ||
{indexPatternTitle} | ||
</h1> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiFlexGroup alignItems="center"> | ||
<EuiButtonEmpty | ||
onClick={() => setDefault()} | ||
size="s" | ||
aria-label={i18n.translate('kbn.management.editIndexPattern.setDefaultAria', { | ||
defaultMessage: 'Set as default index', | ||
})} | ||
title={i18n.translate('kbn.management.editIndexPattern.setDefaultTooltip', { | ||
defaultMessage: 'Set as default index', | ||
})} | ||
data-test-subj="setDefaultIndexPatternButton" | ||
> | ||
<EuiIcon type="starFilled" size="l"></EuiIcon> | ||
</EuiButtonEmpty> | ||
<EuiButtonEmpty | ||
onClick={() => refreshFields()} | ||
aria-label={i18n.translate('kbn.management.editIndexPattern.refreshAria', { | ||
defaultMessage: 'Reload field list', | ||
})} | ||
title={i18n.translate('kbn.management.editIndexPattern.refreshTooltip', { | ||
defaultMessage: 'Refresh field list', | ||
})} | ||
> | ||
<EuiIcon type="refresh" size="l"></EuiIcon> | ||
</EuiButtonEmpty> | ||
<EuiButtonEmpty | ||
color="danger" | ||
onClick={() => removePattern()} | ||
aria-label={i18n.translate('kbn.management.editIndexPattern.removeAria', { | ||
defaultMessage: 'Remove index pattern', | ||
})} | ||
title={i18n.translate('kbn.management.editIndexPattern.removeTooltip', { | ||
defaultMessage: 'Remove index pattern', | ||
})} | ||
data-test-subj="deleteIndexPatternButton" | ||
> | ||
<EuiIcon type="trash" size="l"></EuiIcon> | ||
</EuiButtonEmpty> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); | ||
}; |
50 changes: 50 additions & 0 deletions
50
.../public/management/sections/index_patterns/edit_index_pattern/components/search_field.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,50 @@ | ||
/* | ||
* 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, { useState } from 'react'; | ||
import { EuiFieldSearch } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
interface Props { | ||
$scope: any; | ||
} | ||
|
||
export const SearchField = ({ $scope }: Props) => { | ||
const [text, setText] = useState<string>($scope.fieldFilter || ''); | ||
|
||
return ( | ||
<EuiFieldSearch | ||
fullWidth={true} | ||
placeholder={i18n.translate('kbn.management.editIndexPattern.fields.filterPlaceholder', { | ||
defaultMessage: 'Filter', | ||
})} | ||
aria-label={i18n.translate('kbn.management.editIndexPattern.fields.filterAria', { | ||
defaultMessage: 'Filter', | ||
})} | ||
data-test-subj="indexPatternFieldFilter" | ||
value={text} | ||
onChange={event => { | ||
const newText = event.target.value; | ||
setText(newText); | ||
$scope.fieldFilter = newText; | ||
$scope.$apply(); | ||
}} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it "link to the mapping api" to be a value instead of a separate component. It's because in some languages like Korean and Japanese, link cannot be placed at the end of the explanation text.
I've fixed the language files in the below.