mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Translate context and docs * Fix issues * Fix issues * Fix issues
This commit is contained in:
parent
c7c6097305
commit
ae37523a54
5 changed files with 110 additions and 47 deletions
|
@ -21,7 +21,7 @@ import _ from 'lodash';
|
|||
|
||||
import { SearchSourceProvider } from 'ui/courier';
|
||||
|
||||
export function fetchAnchorProvider(indexPatterns, Private) {
|
||||
export function fetchAnchorProvider(indexPatterns, Private, i18n) {
|
||||
const SearchSource = Private(SearchSourceProvider);
|
||||
|
||||
return async function fetchAnchor(
|
||||
|
@ -54,7 +54,9 @@ export function fetchAnchorProvider(indexPatterns, Private) {
|
|||
const response = await searchSource.fetch();
|
||||
|
||||
if (_.get(response, ['hits', 'total'], 0) < 1) {
|
||||
throw new Error('Failed to load anchor document.');
|
||||
throw new Error(i18n('kbn.context.failedToLoadAnchorDocumentErrorDescription', {
|
||||
defaultMessage: 'Failed to load anchor document.'
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
<div class="kuiLocalNav">
|
||||
<div class="kuiLocalNavRow">
|
||||
<div class="kuiLocalNavRow__section">
|
||||
<div class="kuiLocalTitle" role="heading" aria-level="1">
|
||||
Surrounding Documents in {{ contextApp.state.queryParameters.indexPatternId }}
|
||||
</div>
|
||||
<div
|
||||
class="kuiLocalTitle"
|
||||
role="heading"
|
||||
aria-level="1"
|
||||
i18n-id="kbn.context.surroundingDocumentsDescription"
|
||||
i18n-default-message="Surrounding Documents in {indexPatternId}"
|
||||
i18n-values="{
|
||||
indexPatternId: contextApp.state.queryParameters.indexPatternId
|
||||
}"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kuiLocalNavRow kuiLocalNavRow--secondary">
|
||||
|
@ -25,31 +32,46 @@
|
|||
<div class="kuiInfoPanel kuiInfoPanel--error kuiVerticalRhythm">
|
||||
<div class="kuiInfoPanelHeader">
|
||||
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--error fa-warning"></span>
|
||||
<span class="kuiInfoPanelHeader__title">
|
||||
Failed to load the anchor document
|
||||
</span>
|
||||
<span
|
||||
class="kuiInfoPanelHeader__title"
|
||||
i18n-id="kbn.context.failedToLoadAnchorDocumentDescription"
|
||||
i18n-default-message="Failed to load the anchor document"
|
||||
></span>
|
||||
</div>
|
||||
|
||||
<div class="kuiInfoPanelBody">
|
||||
<div
|
||||
class="kuiInfoPanelBody__message"
|
||||
ng-if="contextApp.state.loadingStatus.anchor.reason === contextApp.constants.FAILURE_REASONS.INVALID_TIEBREAKER"
|
||||
i18n-id="kbn.context.noSearchableTiebreakerFieldDescription"
|
||||
i18n-default-message="No searchable tiebreaker field could be found in the index pattern {indexPatternId}. Please change the advanced setting {tieBreakerFields} to include a valid field for this index pattern."
|
||||
i18n-values="{
|
||||
indexPatternId: contextApp.state.queryParameters.indexPatternId,
|
||||
html_tieBreakerFields: '<code>context:tieBreakerFields</code>'
|
||||
}"
|
||||
>
|
||||
No searchable tiebreaker field could be found in the index pattern
|
||||
{{ contextApp.state.queryParameters.indexPatternId}}.
|
||||
|
||||
Please change the advanced setting
|
||||
<code>context:tieBreakerFields</code> to include a valid field for this
|
||||
index pattern.
|
||||
</div>
|
||||
<div
|
||||
class="kuiInfoPanelBody__message"
|
||||
ng-if="contextApp.state.loadingStatus.anchor.reason === contextApp.constants.FAILURE_REASONS.UNKNOWN"
|
||||
>
|
||||
Please reload or visit
|
||||
<a ng-href="{{ contextApp.state.navigation.discover.url }}">Discover</a>
|
||||
to select a valid anchor document.
|
||||
</div>
|
||||
<span
|
||||
i18n-id="kbn.context.reloadPageDescription.reloadOrVisitTextMessage"
|
||||
i18n-default-message="Please reload or visit"
|
||||
i18n-description="Part of composite text kbn.context.reloadPageDescription.reloadOrVisitTextMessage + kbn.context.reloadPageDescription.discoverLinkText + kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage"
|
||||
></span>
|
||||
<a
|
||||
ng-href="{{ contextApp.state.navigation.discover.url }}"
|
||||
i18n-id="kbn.context.reloadPageDescription.discoverLinkText"
|
||||
i18n-default-message="Discover"
|
||||
i18n-description="Part of composite text kbn.context.reloadPageDescription.reloadOrVisitTextMessage + kbn.context.reloadPageDescription.discoverLinkText + kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage"
|
||||
></a>
|
||||
<span
|
||||
i18n-id="kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage"
|
||||
i18n-default-message="to select a valid anchor document."
|
||||
i18n-description="Part of composite text kbn.context.reloadPageDescription.reloadOrVisitTextMessage + kbn.context.reloadPageDescription.discoverLinkText + kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +92,13 @@
|
|||
icon="'fa-chevron-up'"
|
||||
ng-click="contextApp.actions.fetchMorePredecessorRows()"
|
||||
>
|
||||
Load {{ contextApp.state.queryParameters.defaultStepSize }} more
|
||||
<span
|
||||
i18n-id="kbn.context.loadMoreDescription"
|
||||
i18n-default-message="Load {defaultStepSize} more"
|
||||
i18n-values="{
|
||||
defaultStepSize: contextApp.state.queryParameters.defaultStepSize
|
||||
}"
|
||||
></span>
|
||||
</context-loading-button>
|
||||
<context-size-picker
|
||||
count="contextApp.state.queryParameters.predecessorCount"
|
||||
|
@ -78,7 +106,10 @@
|
|||
is-disabled="contextApp.state.loadingStatus.anchor.status !== contextApp.constants.LOADING_STATUS.LOADED"
|
||||
on-change-count="contextApp.actions.fetchGivenPredecessorRows"
|
||||
></context-size-picker>
|
||||
<span>newer documents</span>
|
||||
<span
|
||||
i18n-id="kbn.context.newerDocumentsDescription"
|
||||
i18n-default-message="newer documents"
|
||||
></span>
|
||||
<span
|
||||
class="kuiStatusText kuiStatusText--warning"
|
||||
ng-if="(contextApp.state.loadingStatus.predecessors.status === contextApp.constants.LOADING_STATUS.LOADED)
|
||||
|
@ -101,9 +132,11 @@
|
|||
].includes(contextApp.state.loadingStatus.anchor.status)"
|
||||
class="kuiPanel kuiPanel--centered kuiVerticalRhythm"
|
||||
>
|
||||
<div class="kuiTableInfo">
|
||||
Loading…
|
||||
</div>
|
||||
<div
|
||||
class="kuiTableInfo"
|
||||
i18n-id="kbn.context.loadingDescription"
|
||||
i18n-default-message="Loading…"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
|
@ -136,7 +169,13 @@
|
|||
icon="'fa-chevron-down'"
|
||||
ng-click="contextApp.actions.fetchMoreSuccessorRows()"
|
||||
>
|
||||
Load {{ contextApp.state.queryParameters.defaultStepSize }} more
|
||||
<span
|
||||
i18n-id="kbn.context.loadMoreDescription"
|
||||
i18n-default-message="Load {defaultStepSize} more"
|
||||
i18n-values="{
|
||||
defaultStepSize: contextApp.state.queryParameters.defaultStepSize
|
||||
}"
|
||||
></span>
|
||||
</context-loading-button>
|
||||
<context-size-picker
|
||||
count="contextApp.state.queryParameters.successorCount"
|
||||
|
@ -144,7 +183,10 @@
|
|||
is-disabled="contextApp.state.loadingStatus.anchor.status !== contextApp.constants.LOADING_STATUS.LOADED"
|
||||
on-change-count="contextApp.actions.fetchGivenSuccessorRows"
|
||||
></context-size-picker>
|
||||
<div>older documents</div>
|
||||
<div
|
||||
i18n-id="kbn.context.olderDocumentsDescription"
|
||||
i18n-default-message="older documents"
|
||||
></div>
|
||||
<span
|
||||
class="kuiStatusText kuiStatusText--warning"
|
||||
ng-if="(contextApp.state.loadingStatus.successors.status === contextApp.constants.LOADING_STATUS.LOADED)
|
||||
|
|
|
@ -137,6 +137,7 @@ function ContextAppController($scope, config, Private) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
function createInitialState(defaultStepSize, tieBreakerField, discoverUrl) {
|
||||
return {
|
||||
queryParameters: createInitialQueryParametersState(defaultStepSize, tieBreakerField),
|
||||
|
|
|
@ -27,7 +27,7 @@ import { fetchContextProvider } from '../api/context';
|
|||
import { QueryParameterActionsProvider } from '../query_parameters';
|
||||
import { FAILURE_REASONS, LOADING_STATUS } from './constants';
|
||||
|
||||
export function QueryActionsProvider(courier, Private, Promise) {
|
||||
export function QueryActionsProvider(courier, Private, Promise, i18n) {
|
||||
const fetchAnchor = Private(fetchAnchorProvider);
|
||||
const { fetchPredecessors, fetchSuccessors } = Private(fetchContextProvider);
|
||||
const {
|
||||
|
@ -81,7 +81,9 @@ export function QueryActionsProvider(courier, Private, Promise) {
|
|||
(error) => {
|
||||
setFailedStatus(state)('anchor', { error });
|
||||
toastNotifications.addDanger({
|
||||
title: 'Unable to load the anchor document',
|
||||
title: i18n('kbn.context.unableToLoadAnchorDocumentDescription', {
|
||||
defaultMessage: 'Unable to load the anchor document'
|
||||
}),
|
||||
text: <MarkdownSimple>{error.message}</MarkdownSimple>,
|
||||
});
|
||||
throw error;
|
||||
|
@ -125,7 +127,9 @@ export function QueryActionsProvider(courier, Private, Promise) {
|
|||
(error) => {
|
||||
setFailedStatus(state)('predecessors', { error });
|
||||
toastNotifications.addDanger({
|
||||
title: 'Unable to load documents',
|
||||
title: i18n('kbn.context.unableToLoadDocumentDescription', {
|
||||
defaultMessage: 'Unable to load documents'
|
||||
}),
|
||||
text: <MarkdownSimple>{error.message}</MarkdownSimple>,
|
||||
});
|
||||
throw error;
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
<div class="kuiLocalNav">
|
||||
<div class="kuiLocalNavRow">
|
||||
<div class="kuiLocalNavRow__section">
|
||||
<div class="kuiLocalTitle">
|
||||
Single Document
|
||||
</div>
|
||||
<div
|
||||
class="kuiLocalTitle"
|
||||
i18n-id="kbn.doc.singleDocumentTitle"
|
||||
i18n-default-message="Single Document"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kuiLocalNavRow kuiLocalNavRow--secondary">
|
||||
|
@ -17,7 +19,9 @@
|
|||
<div
|
||||
class="kuiLocalTab kuiLocalTab-isSelected"
|
||||
ng-if="!hit"
|
||||
>Unknown Id</div>
|
||||
i18n-id="kbn.doc.unknownIdTitle"
|
||||
i18n-default-message="Unknown Id"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -28,14 +32,18 @@
|
|||
<div class="kuiInfoPanel kuiInfoPanel--error kuiVerticalRhythm">
|
||||
<div class="kuiInfoPanelHeader">
|
||||
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--error fa-warning"></span>
|
||||
<span class="kuiInfoPanelHeader__title">
|
||||
Failed to locate document
|
||||
</span>
|
||||
<span
|
||||
class="kuiInfoPanelHeader__title"
|
||||
i18n-id="kbn.doc.failedToLocateDocumentDescription"
|
||||
i18n-default-message="Failed to locate document"
|
||||
></span>
|
||||
</div>
|
||||
<div class="kuiInfoPanelBody">
|
||||
<div class="kuiInfoPanelBody__message">
|
||||
Unfortunately I could not find any documents matching that id, of that type, in that index. I tried really hard. I wanted it to be there. Sometimes I swear documents grow legs and just walk out of the index. Sneaky. I wish I could offer some advice here, something to make you feel better
|
||||
</div>
|
||||
<div
|
||||
class="kuiInfoPanelBody__message"
|
||||
i18n-id="kbn.doc.couldNotFindDocumentsDescription"
|
||||
i18n-default-message="Unfortunately I could not find any documents matching that id, of that type, in that index. I tried really hard. I wanted it to be there. Sometimes I swear documents grow legs and just walk out of the index. Sneaky. I wish I could offer some advice here, something to make you feel better"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -45,14 +53,18 @@
|
|||
<div class="kuiInfoPanel kuiInfoPanel--error kuiVerticalRhythm">
|
||||
<div class="kuiInfoPanelHeader">
|
||||
<span class="kuiInfoPanelHeader__icon kuiIcon kuiIcon--error fa-warning"></span>
|
||||
<span class="kuiInfoPanelHeader__title">
|
||||
Failed to execute query
|
||||
</span>
|
||||
<span
|
||||
class="kuiInfoPanelHeader__title"
|
||||
i18n-id="kbn.doc.failedToExecuteQueryDescription"
|
||||
i18n-default-message="Failed to execute query"
|
||||
></span>
|
||||
</div>
|
||||
<div class="kuiInfoPanelBody">
|
||||
<div class="kuiInfoPanelBody__message">
|
||||
Oh no. Something went very wrong. Its not just that I couldn't find your document, I couldn't even try. The index was missing, or the type. Go check out Elasticsearch, something isn't quite right here.
|
||||
</div>
|
||||
<div
|
||||
class="kuiInfoPanelBody__message"
|
||||
i18n-id="kbn.doc.somethingWentWrongDescription"
|
||||
i18n-default-message="Oh no. Something went very wrong. Its not just that I couldn't find your document, I couldn't even try. The index was missing, or the type. Go check out Elasticsearch, something isn't quite right here."
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -60,9 +72,11 @@
|
|||
<!-- loading -->
|
||||
<div class="kuiViewContentItem" ng-if="status === undefined">
|
||||
<div class="kuiPanel kuiPanel--centered">
|
||||
<div class="kuiTableInfo">
|
||||
Loading…
|
||||
</div>
|
||||
<div
|
||||
class="kuiTableInfo"
|
||||
i18n-id="kbn.doc.loadingDescription"
|
||||
i18n-default-message="Loading…"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue