Skip to content

Commit

Permalink
Remove translations from management section (#13049)
Browse files Browse the repository at this point in the history
We need to revisit how we embed translations into templates, so until we
do we might as well go back to embedding text directly in the page. The
translation implementation now makes it difficult to navigate throughout
complicated HTML.

It also suffers from an inability to flag on unused translation keys,
which creates a good deal of technical debt. Close to half of all
translation keys in the translation file in this initial pilot were
already unused since it was introduced a couple of months ago.
  • Loading branch information
epixa committed Jul 24, 2017
1 parent dc02424 commit 4acaf61
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
data-test-subj="createIndexPatternContainer"
class="kuiViewContent"
>
<h1
class="kuiTitle kuiVerticalRhythm"
translate="KIBANA-CONFIGURE_INDEX_PATTERN"
></h1>
<h1 class="kuiTitle kuiVerticalRhythm">
Configure an index pattern
</h1>

<p
class="kuiText kuiVerticalRhythm"
translate="KIBANA-MUST_CONFIGURE_INDEX_PATTERN"
></p>
<p class="kuiText kuiVerticalRhythm">
In order to use Kibana you must configure at least one index pattern.
Index patterns are used to identify the Elasticsearch index to run
search and analytics against. They are also used to configure fields.
</p>

<div class="kuiVerticalRhythm">
<!-- Form -->
Expand All @@ -27,14 +27,15 @@
<!-- Index pattern input -->
<div class="kuiVerticalRhythm">
<label class="kuiLabel kuiVerticalRhythmSmall">
<span translate="KIBANA-INDEX_PATTERN"></span>
<span>Index pattern</span>

<small>
<a
class="kuiLink"
ng-click="controller.toggleAdvancedIndexOptions();"
translate="KIBANA-ADVANCED_OPTIONS"
></a>
>
advanced options
</a>
</small>
</label>

Expand Down Expand Up @@ -70,44 +71,50 @@
<p
class="kuiSubText kuiVerticalRhythmSmall"
ng-if="!controller.formValues.nameIsPattern"
translate="KIBANA-WILDCARD_DYNAMIC_INDEX_PATTERNS"
></p>
>
Patterns allow you to define dynamic index names using * as a wildcard. Example: logstash-*
</p>

<p
class="kuiSubText kuiVerticalRhythmSmall"
ng-if="controller.formValues.nameIsPattern"
>
<span translate="KIBANA-STATIC_TEXT_IN_DYNAMIC_INDEX_PATTERNS"></span> &mdash;
<span>
Patterns allow you to define dynamic index names. Static text in an index name is denoted
using brackets. Example: [logstash-]YYYY.MM.DD. Please note that weeks are setup to use
ISO weeks which start on Monday.
</span> &mdash;
<a
class="kuiLink"
href="http://momentjs.com/docs/#/displaying/format/"
target="_blank"
translate="KIBANA-DATE_FORMAT_DOCS"
></a>
>
Date Format Documentation
</a>
</p>

<p
class="kuiSubText kuiVerticalRhythmSmall"
ng-show="controller.formValues.nameInterval.name == 'weeks'"
>
<strong translate="KIBANA-NOTE_COLON"></strong>&nbsp;
<span translate="KIBANA-WEEKLY_ISO_NOTICE"></span>
<span translate="KIBANA-SEE"></span>
<strong>Note:</strong>&nbsp;
<span>I noticed you are using weekly indices. Kibana requires ISO weeks be used in your index creation.</span>
<span>See</span>
<a
class="kuiLink"
href="https://en.wikipedia.org/wiki/ISO_week_date"
target="_blank"
translate="KIBANA-WIKI_ISO_WEEK_DATE"
></a>
>
Wikipedia: ISO Week Date
</a>
</p>
</div>
</div>

<!-- Index pattern id input -->
<div class="kuiVerticalRhythm" ng-if="controller.showAdvancedOptions">
<label
class="kuiLabel kuiVerticalRhythmSmall"
translate="KIBANA-INDEX_PATTERN_ID">
<label class="kuiLabel kuiVerticalRhythmSmall">
Index pattern ID
</label>

<div class="kuiVerticalRhythm kuiVerticalRhythmSmall">
Expand All @@ -125,26 +132,24 @@

<!-- ID help text -->
<div class="kuiVerticalRhythm">
<p
class="kuiSubText kuiVerticalRhythmSmall"
translate="KIBANA-INDEX_PATTERN_SPECIFY_ID"
></p>
<p class="kuiSubText kuiVerticalRhythmSmall">
Creates the index pattern with the specified ID.
</p>
</div>
</div>

<!-- Time field select -->
<div class="kuiVerticalRhythm">
<label class="kuiLabel kuiVerticalRhythmSmall">
<span translate="KIBANA-TIME_FILTER_FIELD_NAME"></span>
<span>Time Filter field name</span>
&nbsp;
<kbn-info info="{{ 'KIBANA-FIELD_FILTER_EVENTS_GLOBAL_TIME' | translate }}"></kbn-info>
<kbn-info info="This field will be used to filter events with the global time filter"></kbn-info>
&nbsp;
<small>
<a
class="kuiLink"
ng-click="controller.refreshTimeFieldOptions();"
translate="KIBANA-REFRESH_FIELDS"
></a>
>refresh fields</a>
</small>
</label>

Expand All @@ -170,30 +175,29 @@
ng-model="controller.formValues.expandWildcard"
>
<span class="kuiCheckBoxLabel__text">
<span translate="KIBANA-EXPAND_INDEX_PATTERN"></span>
<span translate="KIBANA-DEPRECATED"></span>
<span>Expand index pattern when searching</span>
<span>[DEPRECATED]</span>
</span>
</label>

<!-- Checkbox help text -->
<div class="kuiVerticalRhythm">
<p
class="kuiSubText kuiVerticalRhythmSmall"
translate="KIBANA-WILDCARD_DEFAULT_EXPANDED_TO_CURRENT_TIME_RANGE"
></p>
<p class="kuiSubText kuiVerticalRhythmSmall">
With this option selected, searches against any time-based index pattern that contains
a wildcard will automatically be expanded to query only the indices that contain data
within the currently selected time range.
</p>

<p class="kuiSubText kuiVerticalRhythmSmall">
<span translate="KIBANA-SEARCH_AGAINST_INDEX_PATTERN"></span>
<em translate="KIBANA-LOGSTASH_WILDCARD"></em>
<span translate="KIBANA-ACTUALLY_QUERY"></span>
<em translate="KIBANA-EXAMPLE_TIME_RANGE"></em>
<span translate="KIBANA-FALL_WITHIN_CURRENT_TIME_RANGE"></span>
Searching against the index pattern <em>logstash-*</em> will actually query
Elasticsearch for the specific matching indices (e.g. <em>logstash-2015.12.21</em>)
that fall within the current time range.
</p>

<p
class="kuiSubText kuiVerticalRhythmSmall"
translate="KIBANA-EXPAND_INDEX_PATTERN_DEPRECATION"
></p>
<p class="kuiSubText kuiVerticalRhythmSmall">
With recent changes to Elasticsearch, this option should no longer be necessary and
will likely be removed in future versions of Kibana.
</p>
</div>
</div>

Expand All @@ -211,8 +215,8 @@
>

<span class="kuiCheckBoxLabel__text">
<span translate="KIBANA-INDEX_NAME_CREATED_BY_EVENT_TIMES"></span>
<span translate="KIBANA-DEPRECATED"></span>
Use event times to create index names
<span>[DEPRECATED]</span>
</span>
</label>
</div>
Expand All @@ -225,26 +229,24 @@
<div class="kuiInfoPanel kuiInfoPanel--warning kuiVerticalRhythm">
<div class="kuiInfoPanelHeader">
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--warning fa-bolt"></span>
<span
class="kuiInfoPanelHeader__title"
translate="KIBANA-ALERT_INDEX_PATTERN_DEPRECATED"
></span>
<span class="kuiInfoPanelHeader__title">
Time-interval based index patterns are deprecated!
</span>
</div>

<div class="kuiInfoPanelBody">
<div class="kuiInfoPanelBody__message">
<span translate="KIBANA-WE"></span>
<strong translate="KIBANA-STRONGLY_RECOMMEND"></strong>
<span translate="KIBANA-WILD_CARD_PATTERN"></span>
We <strong>strongly recommend</strong> using wildcard pattern names instead of
time-interval based index patterns.
</div>
</div>
</div>

<!-- Index pattern interval select -->
<div class="kuiVerticalRhythm">
<label class="kuiLabel kuiVerticalRhythmSmall">
<span translate="KIBANA-INDEX_PATTERN_INTERVAL"></span>&nbsp;
<kbn-info info="{{ 'KIBANA-INTERVAL_INDEX_NAMES_ROTATE' | translate }}"></kbn-info>
<span>Index pattern interval</span>&nbsp;
<kbn-info info="The interval at which index names rotate."></kbn-info>
</label>

<div class="kuiVerticalRhythmSmall">
Expand Down Expand Up @@ -278,10 +280,9 @@
>
<div class="kuiInfoPanelHeader">
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--info fa-info"></span>
<span
class="kuiInfoPanelHeader__title"
translate="KIBANA-SAMPLE_ALERT"
></span>
<span class="kuiInfoPanelHeader__title">
Attempted to match the following indices and aliases:
</span>
</div>

<div class="kuiInfoPanelBody">
Expand All @@ -298,7 +299,7 @@
ng-click="controller.moreSamples(true)"
class="kuiButton kuiButton--basic"
>
<span translate="KIBANA-EXPAND_SEARCH"></span>
<span>Expand Search</span>
</button>
</div>
</div>
Expand All @@ -315,11 +316,9 @@
class="kuiInfoPanelHeader__icon kuiIcon"
ng-class="controller.existing.matches.length ? 'kuiIcon--success fa-check' : 'kuiIcon--error fa-warning'"
></span>
<span
class="kuiInfoPanelHeader__title"
translate="KIBANA-EXISTING_MATCH_PERCENT"
translate-values="{ indexExistingMatchPercent: '{{controller.existing.matchPercent}}' }"
></span>
<span class="kuiInfoPanelHeader__title">
Pattern matches {{controller.existing.matchPercent}} of existing indices and aliases
</span>
</div>

<div
Expand All @@ -340,7 +339,7 @@
type="button"
class="kuiButton kuiButton--basic"
>
<span translate="KIBANA-EXPAND_SEARCH"></span>
<span>Expand Search</span>
</button>
</div>
</div>
Expand All @@ -352,10 +351,9 @@
>
<div class="kuiInfoPanelHeader">
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--info fa-info"></span>
<span
class="kuiInfoPanelHeader__title"
translate="KIBANA-NON_MATCHING_INDICES_AND_ALIASES"
></span>
<span class="kuiInfoPanelHeader__title">
Indices and aliases that were found, but did not match the pattern:
</span>
</div>

<div class="kuiInfoPanelBody">
Expand All @@ -373,7 +371,7 @@
ng-if="controller.sampleCount < controller.existing.matches.length"
ng-click="controller.moreSamples()"
>
<span translate="KIBANA-MORE"></span>
<span>more</span>
</a>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ uiModules.get('apps/management')
return {
options: [
{
display: $translate.instant('KIBANA-INDICES_DONT_CONTAIN_TIME_FIELDS')
display: `The indices which match this index pattern don't contain any time fields.`
}
]
};
Expand All @@ -83,7 +83,7 @@ uiModules.get('apps/management')
return {
options: [
{
display: $translate.instant('KIBANA-NO_DATE_FIELD_DESIRED')
display: `I don't want to use the Time Filter`
},
...dateFields.map(field => ({
display: field.name,
Expand All @@ -95,7 +95,7 @@ uiModules.get('apps/management')
.catch(err => {
if (err instanceof IndexPatternMissingIndices) {
return {
error: $translate.instant('KIBANA-INDICES_MATCH_PATTERN')
error: 'Unable to fetch mapping. Do you have indices matching the pattern?'
};
}

Expand Down Expand Up @@ -165,12 +165,12 @@ uiModules.get('apps/management')
};
}

patternErrors.push($translate.instant('KIBANA-PATTERN_DOES_NOT_MATCH_EXIST_INDICES'));
patternErrors.push('Pattern does not match any existing indices');
const radius = Math.round(this.sampleCount / 2);
const samples = intervals.toIndexList(this.formValues.name, this.formValues.nameInterval, -radius, radius);

if (_.uniq(samples).length !== samples.length) {
patternErrors.push($translate.instant('KIBANA-INVALID_NON_UNIQUE_INDEX_NAME_CREATED'));
patternErrors.push('Invalid pattern, interval does not create unique index names');
} else {
this.samples = samples;
}
Expand Down Expand Up @@ -320,7 +320,7 @@ uiModules.get('apps/management')
loadingCount = Infinity;
}).catch(err => {
if (err instanceof IndexPatternMissingIndices) {
return notify.error($translate.instant('KIBANA-NO_INDICES_MATCHING_PATTERN'));
return notify.error('Could not locate any indices matching that pattern. Please add the index to Elasticsearch');
}

notify.fatal(err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ export function pickCreateButtonText($translate, state) {
} = state;

if (loading) {
return $translate.instant('KIBANA-LOADING');
return 'Loading';
}

if (invalidIndexName) {
return $translate.instant('KIBANA-INVALID_INDEX_PATTERN');
return 'Invalid index name pattern.';
}

if (!timeFieldOption) {
return $translate.instant('KIBANA-FIELD_IS_REQUIRED', {
fieldName: $translate.instant('KIBANA-TIME_FILTER_FIELD_NAME')
});
return 'Time Filter field name is required';
}

return $translate.instant('KIBANA-CREATE');
return 'Create';
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<p ng-if="indexPattern.timeFieldName" class="kuiText kuiVerticalRhythm">
<span class="label label-success">
<i class="fa fa-clock-o"></i><span translate="KIBANA-TIME_FILTER_FIELD_NAME"></span>: {{indexPattern.timeFieldName}}
<i class="fa fa-clock-o"></i><span>Time Filter field name</span>: {{indexPattern.timeFieldName}}
</span>
</p>

Expand Down
Loading

0 comments on commit 4acaf61

Please sign in to comment.