Skip to content

Commit

Permalink
New platform move doc table and doc viewer to kibana\discover (elasti…
Browse files Browse the repository at this point in the history
…c#34231)

* Moved doc table to kibana/discover

* moved doc viewer to Kibana app (used by docs and discover)

* Moved
- saved object finder
- paginated selectable list
from partiasls to directives/partials

* Moved paginate controls directive to directives/partials
  • Loading branch information
lizozom authored and Liza Katz committed Apr 7, 2019
1 parent d6889c0 commit 9aa0a87
Show file tree
Hide file tree
Showing 52 changed files with 92 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { showOptionsPopover } from './top_nav/show_options_popover';
import { showNewVisModal } from '../visualize/wizard';
import { showShareContextMenu, ShareContextMenuExtensionsRegistryProvider } from 'ui/share';
import { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query';
import * as filterActions from 'ui/doc_table/actions/filter';
import * as filterActions from 'plugins/kibana/discover/doc_table/actions/filter';
import { FilterManagerProvider } from 'ui/filter_manager';
import { EmbeddableFactoriesRegistryProvider } from 'ui/embeddable/embeddable_factories_registry';
import { ContextMenuActionsRegistryProvider } from 'ui/embeddable';
Expand Down
1 change: 1 addition & 0 deletions src/legacy/core_plugins/kibana/public/discover/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@import 'components/fetch_error/index';
@import 'components/field_chooser/index';
@import 'directives/index';
@import 'doc_table/index';

@import 'hacks';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ import _ from 'lodash';
import React from 'react';
import angular from 'angular';
import chrome from 'ui/chrome';
import { getSort } from 'ui/doc_table/lib/get_sort';
import * as columnActions from 'ui/doc_table/actions/columns';
import * as filterActions from 'ui/doc_table/actions/filter';
import dateMath from '@elastic/datemath';
import 'ui/doc_table';

// doc table
import '../doc_table';
import { getSort } from '../doc_table/lib/get_sort';
import * as columnActions from '../doc_table/actions/columns';
import * as filterActions from '../doc_table/actions/filter';

import 'ui/listen';
import 'ui/visualize';
import 'ui/fixed_scroll';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { addFilter } from '../../actions/filter';
import { FilterManagerProvider } from '../../../filter_manager';
import { FilterManagerProvider } from 'ui/filter_manager';
import StubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import NoDigestPromises from 'test_utils/no_digest_promises';
import expect from '@kbn/expect';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import angular from 'angular';
import expect from '@kbn/expect';
import _ from 'lodash';
import ngMock from 'ng_mock';
import '../../private';
import 'ui/private';
import '..';
import FixturesStubbedSearchSourceProvider from 'fixtures/stubbed_search_source';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<span>
<span
i18n-id="common.ui.docTable.tableHeader.timeHeaderCellTitle"
i18n-id="kbn.docTable.tableHeader.timeHeaderCellTitle"
i18n-default-message="Time"
></span>
<button
Expand All @@ -17,7 +17,7 @@
ng-class="headerClass(indexPattern.timeFieldName)"
role="button"
ng-click="cycleSortOrder(indexPattern.timeFieldName)"
tooltip="{{ ::'common.ui.docTable.tableHeader.sortByTimeTooltip' | i18n: {defaultMessage: 'Sort by time'} }}"
tooltip="{{ ::'kbn.docTable.tableHeader.sortByTimeTooltip' | i18n: {defaultMessage: 'Sort by time'} }}"
></button>
</span>
</th>
Expand Down Expand Up @@ -46,8 +46,8 @@
ng-click="onRemoveColumn(name)"
ng-if="canRemoveColumn(name)"
tooltip-append-to-body="1"
tooltip="{{ ::'common.ui.docTable.tableHeader.removeColumnButtonTooltip' | i18n: {defaultMessage: 'Remove column'} }}"
aria-label="{{ 'common.ui.docTable.tableHeader.removeColumnButtonAriaLabel' | i18n: {
tooltip="{{ ::'kbn.docTable.tableHeader.removeColumnButtonTooltip' | i18n: {defaultMessage: 'Remove column'} }}"
aria-label="{{ 'kbn.docTable.tableHeader.removeColumnButtonAriaLabel' | i18n: {
defaultMessage: 'Remove {columnName} column',
values: {columnName: name}
} }}"
Expand All @@ -58,8 +58,8 @@
ng-click="moveColumnLeft(name)"
ng-if="canMoveColumnLeft(name)"
tooltip-append-to-body="1"
tooltip="{{ ::'common.ui.docTable.tableHeader.moveColumnLeftButtonTooltip' | i18n: {defaultMessage: 'Move column to the left'} }}"
aria-label="{{ 'common.ui.docTable.tableHeader.moveColumnLeftButtonAriaLabel' | i18n: {
tooltip="{{ ::'kbn.docTable.tableHeader.moveColumnLeftButtonTooltip' | i18n: {defaultMessage: 'Move column to the left'} }}"
aria-label="{{ 'kbn.docTable.tableHeader.moveColumnLeftButtonAriaLabel' | i18n: {
defaultMessage: 'Move {columnName} column to the left',
values: {columnName: name}
} }}"
Expand All @@ -69,8 +69,8 @@
ng-click="moveColumnRight(name)"
ng-if="canMoveColumnRight(name)"
tooltip-append-to-body="1"
tooltip="{{ ::'common.ui.docTable.tableHeader.moveColumnRightButtonTooltip' | i18n: {defaultMessage: 'Move column to the right'} }}"
aria-label="{{ 'common.ui.docTable.tableHeader.moveColumnRightButtonAriaLabel' | i18n: {
tooltip="{{ ::'kbn.docTable.tableHeader.moveColumnRightButtonTooltip' | i18n: {defaultMessage: 'Move column to the right'} }}"
aria-label="{{ 'kbn.docTable.tableHeader.moveColumnRightButtonAriaLabel' | i18n: {
defaultMessage: 'Move {columnName} column to the right',
values: {columnName: name}
} }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

import _ from 'lodash';
import '../../filters/short_dots';
import 'ui/filters/short_dots';
import headerHtml from './table_header.html';
import { uiModules } from '../../modules';
import { uiModules } from 'ui/modules';
const module = uiModules.get('app/discover');


Expand Down Expand Up @@ -49,7 +49,7 @@ module.directive('kbnTableHeader', function (shortDotsFilter, i18n) {

$scope.tooltip = function (column) {
if (!$scope.isSortableColumn(column)) return '';
return i18n('common.ui.docTable.tableHeader.sortByColumnTooltip', {
return i18n('kbn.docTable.tableHeader.sortByColumnTooltip', {
defaultMessage: 'Sort by {columnName}',
values: { columnName: shortDotsFilter(column) },
});
Expand Down Expand Up @@ -126,12 +126,12 @@ module.directive('kbnTableHeader', function (shortDotsFilter, i18n) {

const [currentColumnName, currentDirection = 'asc'] = $scope.sortOrder;
if(name === currentColumnName && currentDirection === 'asc') {
return i18n('common.ui.docTable.tableHeader.sortByColumnDescendingAriaLabel', {
return i18n('kbn.docTable.tableHeader.sortByColumnDescendingAriaLabel', {
defaultMessage: 'Sort {columnName} descending',
values: { columnName: name },
});
}
return i18n('common.ui.docTable.tableHeader.sortByColumnAscendingAriaLabel', {
return i18n('kbn.docTable.tableHeader.sortByColumnAscendingAriaLabel', {
defaultMessage: 'Sort {columnName} ascending',
values: { columnName: name },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import _ from 'lodash';
import $ from 'jquery';
import rison from 'rison-node';
import '../../doc_viewer';
import '../../filters/uriescape';
import '../../filters/short_dots';
import { noWhiteSpace } from '../../../../core_plugins/kibana/common/utils/no_white_space';
import 'plugins/kibana/doc_viewer';
import 'ui/filters/uriescape';
import 'ui/filters/short_dots';
import { noWhiteSpace } from '../../../../common/utils/no_white_space';
import openRowHtml from './table_row/open.html';
import detailsHtml from './table_row/details.html';
import { uiModules } from '../../modules';
import { uiModules } from 'ui/modules';
import { disableFilter } from '@kbn/es-query';
import { dispatchRenderComplete } from '../../render_complete';
import { dispatchRenderComplete } from 'ui/render_complete';

const module = uiModules.get('app/discover');

Expand All @@ -46,8 +46,8 @@ const MIN_LINE_LENGTH = 20;
* ```
*/
module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl, config) {
const cellTemplate = _.template(noWhiteSpace(require('ui/doc_table/components/table_row/cell.html')));
const truncateByHeightTemplate = _.template(noWhiteSpace(require('ui/partials/truncate_by_height.html')));
const cellTemplate = _.template(noWhiteSpace(require('../components/table_row/cell.html')));
const truncateByHeightTemplate = _.template(noWhiteSpace(require('../components/table_row/truncate_by_height.html')));

return {
restrict: 'A',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
class="fa fa-search-plus kbnDocTableRowFilterButton"
data-column="<%- column %>"
tooltip-append-to-body="1"
tooltip="{{ ::'common.ui.docTable.tableRow.filterForValueButtonTooltip' | i18n: {defaultMessage: 'Filter for value'} }}"
aria-label="{{ ::'common.ui.docTable.tableRow.filterForValueButtonAriaLabel' | i18n: {defaultMessage: 'Filter for value'} }}"
tooltip="{{ ::'kbn.docTable.tableRow.filterForValueButtonTooltip' | i18n: {defaultMessage: 'Filter for value'} }}"
aria-label="{{ ::'kbn.docTable.tableRow.filterForValueButtonAriaLabel' | i18n: {defaultMessage: 'Filter for value'} }}"
></button>

<button
ng-click="inlineFilter($event, '-')"
class="fa fa-search-minus kbnDocTableRowFilterButton"
data-column="<%- column %>"
tooltip="{{ ::'common.ui.docTable.tableRow.filterOutValueButtonTooltip' | i18n: {defaultMessage: 'Filter out value'} }}"
aria-label="{{ ::'common.ui.docTable.tableRow.filterOutValueButtonAriaLabel' | i18n: {defaultMessage: 'Filter out value'} }}"
tooltip="{{ ::'kbn.docTable.tableRow.filterOutValueButtonTooltip' | i18n: {defaultMessage: 'Filter out value'} }}"
aria-label="{{ ::'kbn.docTable.tableRow.filterOutValueButtonAriaLabel' | i18n: {defaultMessage: 'Filter out value'} }}"
tooltip-append-to-body="1"
></button>
<% } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<h4
class="euiTitle euiTitle--xsmall"
i18n-id="common.ui.docTable.tableRow.detailHeading"
i18n-id="kbn.docTable.tableRow.detailHeading"
i18n-default-message="Expanded document"
></h4>
</div>
Expand All @@ -22,7 +22,7 @@
data-test-subj="docTableRowAction"
ng-href="{{ getContextAppHref() }}"
ng-if="indexPattern.isTimeBased()"
i18n-id="common.ui.docTable.tableRow.viewSurroundingDocumentsLinkText"
i18n-id="kbn.docTable.tableRow.viewSurroundingDocumentsLinkText"
i18n-default-message="View surrounding documents"
></a>
</div>
Expand All @@ -31,7 +31,7 @@
class="euiLink"
data-test-subj="docTableRowAction"
ng-href="#/doc/{{indexPattern.id}}/{{row._index}}/{{row._type}}/?id={{row._id | uriescape}}"
i18n-id="common.ui.docTable.tableRow.viewSingleDocumentLinkText"
i18n-id="kbn.docTable.tableRow.viewSingleDocumentLinkText"
i18n-default-message="View single document"
></a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<button
class="euiButtonIcon euiButtonIcon--text"
aria-expanded="{{!!open}}"
aria-label="{{ ::'common.ui.docTable.tableRow.toggleRowDetailsButtonAriaLabel' | i18n: {defaultMessage: 'Toggle row details'} }}"
aria-label="{{ ::'kbn.docTable.tableRow.toggleRowDetailsButtonAriaLabel' | i18n: {defaultMessage: 'Toggle row details'} }}"
>
<icon ng-if="open" type="'arrowDown'" size="'s'"></icon>
<icon ng-if="!open" type="'arrowRight'" size="'s'"></icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<div class="euiSpacer euiSpacer--m"></div>

<p
i18n-id="common.ui.docTable.noResultsTitle"
i18n-id="kbn.docTable.noResultsTitle"
i18n-default-message="No results found"
>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ import { getSort } from './lib/get_sort';
import './infinite_scroll';
import './components/table_header';
import './components/table_row';
import { dispatchRenderComplete } from '../render_complete';
import { uiModules } from '../modules';
import { getRequestInspectorStats, getResponseInspectorStats } from '../courier/utils/courier_inspector_utils';
import { dispatchRenderComplete } from 'ui/render_complete';
import { uiModules } from 'ui/modules';
import 'ui/pager_control';
import 'ui/pager';
import { getRequestInspectorStats, getResponseInspectorStats } from 'ui/courier/utils/courier_inspector_utils';

import { getLimitedSearchResultsMessage } from './doc_table_strings';

uiModules.get('kibana')
uiModules.get('app/discover')
.directive('docTable', function (config, Notifier, getAppState, pagerFactory, $filter, courier, i18n) {
return {
restrict: 'E',
Expand Down Expand Up @@ -135,10 +137,10 @@ uiModules.get('kibana')
let inspectorRequest = undefined;
if (_.has($scope, 'inspectorAdapters.requests')) {
$scope.inspectorAdapters.requests.reset();
const title = i18n('common.ui.docTable.inspectorRequestDataTitle', {
const title = i18n('kbn.docTable.inspectorRequestDataTitle', {
defaultMessage: 'Data',
});
const description = i18n('common.ui.docTable.inspectorRequestDescription', {
const description = i18n('kbn.docTable.inspectorRequestDescription', {
defaultMessage: 'This request queries Elasticsearch to fetch the data for the search.',
});
inspectorRequest = $scope.inspectorAdapters.requests.start(title, { description });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { i18n } from '@kbn/i18n';
* @param resultCount {Number}
*/
export function getLimitedSearchResultsMessage(resultCount) {
return i18n.translate('common.ui.docTable.limitedSearchResultLabel',
return i18n.translate('kbn.docTable.limitedSearchResultLabel',
{ defaultMessage: 'Limited to {resultCount} results. Refine your search.', values: { resultCount } }
);
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import $ from 'jquery';
import { uiModules } from '../modules';
import { uiModules } from 'ui/modules';
const module = uiModules.get('app/discover');

module.directive('kbnInfiniteScroll', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import angular from 'angular';
import _ from 'lodash';
import { SearchSource } from 'ui/courier';
import * as columnActions from 'ui/doc_table/actions/columns';
import {
ContainerState,
Embeddable,
Expand All @@ -32,6 +31,7 @@ import { Filters, Query } from 'ui/embeddable/types';
import { RequestAdapter } from 'ui/inspector/adapters';
import { Adapters } from 'ui/inspector/types';
import { getTime } from 'ui/timefilter/get_time';
import * as columnActions from '../doc_table/actions/columns';
import { SavedSearch } from '../types';
import searchTemplate from './search_template.html';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import 'ui/doc_table';
import '../doc_table';

import { i18n } from '@kbn/i18n';
import { EmbeddableFactory } from 'ui/embeddable';
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/kibana/public/discover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import './directives';
import 'ui/collapsible_sidebar';
import './components/field_chooser/field_chooser';
import './controllers/discover';
import 'ui/doc_table/components/table_row';
import './doc_table/components/table_row';
import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';

FeatureCatalogueRegistryProvider.register(i18n => {
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/kibana/public/doc/controllers/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import 'ui/notify';
import 'ui/courier';
import 'ui/doc_viewer';
import 'ui/index_patterns';
import html from '../index.html';
import uiRoutes from 'ui/routes';
import { uiModules } from 'ui/modules';
import { timefilter } from 'ui/timefilter';
import { getRootBreadcrumbs } from '../../discover/breadcrumbs';
import 'plugins/kibana/doc_viewer';
import { getRootBreadcrumbs } from 'plugins/kibana/discover/breadcrumbs';

const app = uiModules.get('apps/doc', [
'kibana/notify',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ import angular from 'angular';
import _ from 'lodash';
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import '../../private';
import 'ui/private';

import { DocViewsRegistryProvider } from '../../registry/doc_views';
import { uiRegistry } from '../../registry/_registry';
import '..';
import { DocViewsRegistryProvider } from 'ui/registry/doc_views';
import { uiRegistry } from 'ui/registry/_registry';

describe('docViewer', function () {
let stubRegistry;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/

import $ from 'jquery';
import { uiModules } from '../modules';
import { DocViewsRegistryProvider } from '../registry/doc_views';
import { uiModules } from 'ui/modules';
import { DocViewsRegistryProvider } from 'ui/registry/doc_views';

import '../render_directive';
import 'ui/render_directive';

uiModules.get('kibana')
uiModules.get('apps/discover')
.directive('docViewer', function (config, Private) {
const docViews = Private(DocViewsRegistryProvider);
return {
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/legacy/core_plugins/kibana/public/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
// Management styles
@import './management/index';

// Doc Viewer
@import './doc_viewer/index';

// Dashboard styles
// MUST STAY AT THE BOTTOM BECAUSE OF DARK THEME IMPORTS
@import './dashboard/index';
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/

import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
import 'ui/pager_control';
import 'ui/pager';
import 'ui/directives/kbn_href';
import { uiModules } from 'ui/modules';
import { timefilter } from 'ui/timefilter';
Expand Down
Loading

0 comments on commit 9aa0a87

Please sign in to comment.