From c823a914c1c95ecd8717d03317b69c7daf172982 Mon Sep 17 00:00:00 2001 From: Mihir Soni Date: Fri, 12 Mar 2021 02:40:23 -0800 Subject: [PATCH] [Rename] Refactored src/plugins/vis_type_table directory (#97) * [Rename] Refactored src/plugins/vis_type_table directory Signed-off-by: Mihir Soni --- src/plugins/vis_type_table/config.ts | 2 +- ...kibana.json => opensearch_dashboards.json} | 6 ++-- .../vis_type_table/public/_table_vis.scss | 2 +- .../public/agg_table/_agg_table.scss | 12 ++++---- .../public/agg_table/agg_table.html | 2 +- .../public/agg_table/agg_table.js | 4 +-- .../public/agg_table/agg_table.test.js | 30 +++++++++---------- .../public/agg_table/agg_table_group.html | 24 +++++++-------- .../public/agg_table/agg_table_group.js | 2 +- .../public/agg_table/agg_table_group.test.js | 22 +++++++------- .../public/components/table_vis_options.tsx | 4 +-- .../vis_type_table/public/components/utils.ts | 2 +- .../public/get_inner_angular.ts | 12 ++++---- src/plugins/vis_type_table/public/index.ts | 2 +- .../paginated_table/_table_cell_filter.scss | 10 +++---- .../paginated_table/paginated_table.html | 10 +++---- .../paginated_table/paginated_table.test.ts | 6 ++-- .../public/paginated_table/rows.js | 6 ++-- .../paginated_table/table_cell_filter.html | 4 +-- src/plugins/vis_type_table/public/plugin.ts | 12 ++++---- src/plugins/vis_type_table/public/services.ts | 8 ++--- .../vis_type_table/public/table_vis.html | 6 ++-- .../public/table_vis_controller.js | 6 ++-- .../public/table_vis_controller.test.ts | 12 ++++---- .../public/table_vis_fn.test.ts | 2 +- .../vis_type_table/public/table_vis_fn.ts | 12 ++++---- .../public/table_vis_legacy_module.ts | 14 ++++----- .../public/table_vis_response_handler.ts | 2 +- .../vis_type_table/public/table_vis_type.ts | 4 +-- .../vis_type_table/public/vis_controller.ts | 12 ++++---- src/plugins/vis_type_table/server/index.ts | 2 +- 31 files changed, 127 insertions(+), 127 deletions(-) rename src/plugins/vis_type_table/{kibana.json => opensearch_dashboards.json} (67%) diff --git a/src/plugins/vis_type_table/config.ts b/src/plugins/vis_type_table/config.ts index 6749bd83de39..0cfdee7b8bf4 100644 --- a/src/plugins/vis_type_table/config.ts +++ b/src/plugins/vis_type_table/config.ts @@ -17,7 +17,7 @@ * under the License. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import { schema, TypeOf } from '@osd/config-schema'; export const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: true }), diff --git a/src/plugins/vis_type_table/kibana.json b/src/plugins/vis_type_table/opensearch_dashboards.json similarity index 67% rename from src/plugins/vis_type_table/kibana.json rename to src/plugins/vis_type_table/opensearch_dashboards.json index b8a68909dc85..e2f050534c1e 100644 --- a/src/plugins/vis_type_table/kibana.json +++ b/src/plugins/vis_type_table/opensearch_dashboards.json @@ -1,16 +1,16 @@ { "id": "visTypeTable", - "version": "kibana", + "version": "opensearchDashboards", "server": true, "ui": true, "requiredPlugins": [ "expressions", "visualizations", "data", - "kibanaLegacy" + "opensearchDashboardsLegacy" ], "requiredBundles": [ - "kibanaUtils", + "opensearchDashboardsUtils", "share", "charts", "visDefaultEditor" diff --git a/src/plugins/vis_type_table/public/_table_vis.scss b/src/plugins/vis_type_table/public/_table_vis.scss index 8a36b9818c2a..c235f67615e2 100644 --- a/src/plugins/vis_type_table/public/_table_vis.scss +++ b/src/plugins/vis_type_table/public/_table_vis.scss @@ -9,7 +9,7 @@ } .table-vis-container { - kbn-agg-table-group > .table > tbody > tr > td { + osd-agg-table-group > .table > tbody > tr > td { border-top: 0px; } diff --git a/src/plugins/vis_type_table/public/agg_table/_agg_table.scss b/src/plugins/vis_type_table/public/agg_table/_agg_table.scss index 4bbc4eb034f8..156db063c8db 100644 --- a/src/plugins/vis_type_table/public/agg_table/_agg_table.scss +++ b/src/plugins/vis_type_table/public/agg_table/_agg_table.scss @@ -1,15 +1,15 @@ -kbn-agg-table, -kbn-agg-table-group { +osd-agg-table, +osd-agg-table-group { display: block; } -.kbnAggTable { +.osdAggTable { display: flex; flex: 1 1 auto; flex-direction: column; } -.kbnAggTable__paginated { +.osdAggTable__paginated { flex: 1 1 auto; overflow: auto; @@ -19,12 +19,12 @@ kbn-agg-table-group { } tr:hover td, - .kbnTableCellFilter { + .osdTableCellFilter { background-color: $euiColorLightestShade; } } -.kbnAggTable__controls { +.osdAggTable__controls { flex: 0 0 auto; display: flex; align-items: center; diff --git a/src/plugins/vis_type_table/public/agg_table/agg_table.html b/src/plugins/vis_type_table/public/agg_table/agg_table.html index 5107bd204828..8e8aafa83fd8 100644 --- a/src/plugins/vis_type_table/public/agg_table/agg_table.html +++ b/src/plugins/vis_type_table/public/agg_table/agg_table.html @@ -10,7 +10,7 @@ filter="filter" totalFunc="totalFunc"> -
+
{ - const tableVisModule = getInnerAngular('kibana/table_vis', core); + const tableVisModule = getInnerAngular('opensearch-dashboards/table_vis', core); initTableVisLegacyModule(tableVisModule); }; @@ -76,7 +76,7 @@ describe('Table Vis - AggTable Directive', function () { setFormatService(getFieldFormatsRegistry(core)); initAngularBootstrap(); initLocalAngular(); - angular.mock.module('kibana/table_vis'); + angular.mock.module('opensearch-dashboards/table_vis'); angular.mock.inject(($injector, config) => { settings = config; @@ -100,7 +100,7 @@ describe('Table Vis - AggTable Directive', function () { }; $scope.table = tabifiedData.metricOnly.tables[0]; - const $el = $compile('')( + const $el = $compile('')( $scope ); $scope.$digest(); @@ -113,7 +113,7 @@ describe('Table Vis - AggTable Directive', function () { test('renders nothing if the table is empty', function () { $scope.dimensions = {}; $scope.table = null; - const $el = $compile('')( + const $el = $compile('')( $scope ); $scope.$digest(); @@ -135,7 +135,7 @@ describe('Table Vis - AggTable Directive', function () { ], }; $scope.table = tabifiedData.threeTermBuckets.tables[0]; - const $el = $(''); + const $el = $(''); $compile($el)($scope); $scope.$digest(); @@ -200,11 +200,11 @@ describe('Table Vis - AggTable Directive', function () { tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative.tables[0]; $scope.showTotal = true; $scope.totalFunc = totalFunc; - const $el = $(``); + dimensions="dimensions">`); $compile($el)($scope); $scope.$digest(); @@ -255,7 +255,7 @@ describe('Table Vis - AggTable Directive', function () { describe('aggTable.toCsv()', function () { test('escapes rows and columns properly', function () { - const $el = $compile('')( + const $el = $compile('')( $scope ); $scope.$digest(); @@ -291,7 +291,7 @@ describe('Table Vis - AggTable Directive', function () { }; $scope.table = tabifiedData.threeTermBuckets.tables[0]; - const $el = $compile('')( + const $el = $compile('')( $scope ); $scope.$digest(); @@ -346,7 +346,7 @@ describe('Table Vis - AggTable Directive', function () { }; $scope.table = tabifiedData.threeTermBuckets.tables[0]; - const $el = $compile('')( + const $el = $compile('')( $scope ); $scope.$digest(); @@ -407,11 +407,11 @@ describe('Table Vis - AggTable Directive', function () { tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative.tables[0]; $scope.percentageCol = 'Average bytes'; - const $el = $(``); + >`); $compile($el)($scope); $scope.$digest(); @@ -448,7 +448,7 @@ describe('Table Vis - AggTable Directive', function () { }); test('calls _saveAs properly', function () { - const $el = $compile('')($scope); + const $el = $compile('')($scope); $scope.$digest(); const $tableScope = $el.isolateScope(); @@ -482,7 +482,7 @@ describe('Table Vis - AggTable Directive', function () { test('should use the export-title attribute', function () { const expected = 'export file name'; const $el = $compile( - `` + `` )($scope); $scope.$digest(); diff --git a/src/plugins/vis_type_table/public/agg_table/agg_table_group.html b/src/plugins/vis_type_table/public/agg_table/agg_table_group.html index 4567b80b5f66..2dcf7f125f61 100644 --- a/src/plugins/vis_type_table/public/agg_table/agg_table_group.html +++ b/src/plugins/vis_type_table/public/agg_table/agg_table_group.html @@ -1,15 +1,15 @@ - +
- {{ table.title }} + {{ table.title }}
- - + - +
- +
diff --git a/src/plugins/vis_type_table/public/agg_table/agg_table_group.js b/src/plugins/vis_type_table/public/agg_table/agg_table_group.js index fb17a558ca0d..f762a450e8a2 100644 --- a/src/plugins/vis_type_table/public/agg_table/agg_table_group.js +++ b/src/plugins/vis_type_table/public/agg_table/agg_table_group.js @@ -19,7 +19,7 @@ import aggTableGroupTemplate from './agg_table_group.html'; -export function KbnAggTableGroup(RecursionHelper) { +export function OsdAggTableGroup(RecursionHelper) { return { restrict: 'E', template: aggTableGroupTemplate, diff --git a/src/plugins/vis_type_table/public/agg_table/agg_table_group.test.js b/src/plugins/vis_type_table/public/agg_table/agg_table_group.test.js index 04cf624331d8..8f7bd88b5a7c 100644 --- a/src/plugins/vis_type_table/public/agg_table/agg_table_group.test.js +++ b/src/plugins/vis_type_table/public/agg_table/agg_table_group.test.js @@ -20,11 +20,11 @@ import $ from 'jquery'; import angular from 'angular'; import 'angular-mocks'; -import expect from '@kbn/expect'; +import expect from '@osd/expect'; import { getFieldFormatsRegistry } from '../../../data/public/test_utils'; import { coreMock } from '../../../../core/public/mocks'; -import { initAngularBootstrap } from '../../../kibana_legacy/public'; +import { initAngularBootstrap } from '../../../opensearch_dashboards_legacy/public'; import { setUiSettings } from '../../../data/public/services'; import { setFormatService } from '../services'; import { getInnerAngular } from '../get_inner_angular'; @@ -47,7 +47,7 @@ describe('Table Vis - AggTableGroup Directive', function () { }); const initLocalAngular = () => { - const tableVisModule = getInnerAngular('kibana/table_vis', core); + const tableVisModule = getInnerAngular('opensearch-dashboards/table_vis', core); initTableVisLegacyModule(tableVisModule); }; @@ -56,7 +56,7 @@ describe('Table Vis - AggTableGroup Directive', function () { setFormatService(getFieldFormatsRegistry(core)); initAngularBootstrap(); initLocalAngular(); - angular.mock.module('kibana/table_vis'); + angular.mock.module('opensearch-dashboards/table_vis'); angular.mock.inject(($injector) => { $rootScope = $injector.get('$rootScope'); $compile = $injector.get('$compile'); @@ -82,19 +82,19 @@ describe('Table Vis - AggTableGroup Directive', function () { direction: null, }; const $el = $( - '' + '' ); $compile($el)($scope); $scope.$digest(); // should create one sub-tbale - expect($el.find('kbn-agg-table').length).to.be(1); + expect($el.find('osd-agg-table').length).to.be(1); }); it('renders nothing if the table list is empty', function () { const $el = $( - '' + '' ); $scope.group = { @@ -104,7 +104,7 @@ describe('Table Vis - AggTableGroup Directive', function () { $compile($el)($scope); $scope.$digest(); - const $subTables = $el.find('kbn-agg-table'); + const $subTables = $el.find('osd-agg-table'); expect($subTables.length).to.be(0); }); @@ -123,15 +123,15 @@ describe('Table Vis - AggTableGroup Directive', function () { }; const group = ($scope.group = tabifiedData.threeTermBucketsWithSplit); const $el = $( - '' + '' ); $compile($el)($scope); $scope.$digest(); - const $subTables = $el.find('kbn-agg-table'); + const $subTables = $el.find('osd-agg-table'); expect($subTables.length).to.be(3); - const $subTableHeaders = $el.find('.kbnAggTable__groupHeader'); + const $subTableHeaders = $el.find('.osdAggTable__groupHeader'); expect($subTableHeaders.length).to.be(3); $subTableHeaders.each(function (i) { diff --git a/src/plugins/vis_type_table/public/components/table_vis_options.tsx b/src/plugins/vis_type_table/public/components/table_vis_options.tsx index c4d333134237..080b7b53e71e 100644 --- a/src/plugins/vis_type_table/public/components/table_vis_options.tsx +++ b/src/plugins/vis_type_table/public/components/table_vis_options.tsx @@ -20,8 +20,8 @@ import { get } from 'lodash'; import React, { useEffect, useMemo } from 'react'; import { EuiIconTip, EuiPanel } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@osd/i18n'; +import { FormattedMessage } from '@osd/i18n/react'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { search } from '../../../data/public'; diff --git a/src/plugins/vis_type_table/public/components/utils.ts b/src/plugins/vis_type_table/public/components/utils.ts index b97c7ccbac0f..5013c6f602fd 100644 --- a/src/plugins/vis_type_table/public/components/utils.ts +++ b/src/plugins/vis_type_table/public/components/utils.ts @@ -17,7 +17,7 @@ * under the License. */ -import { i18n } from '@kbn/i18n'; +import { i18n } from '@osd/i18n'; import { AggTypes } from '../types'; const totalAggregations = [ diff --git a/src/plugins/vis_type_table/public/get_inner_angular.ts b/src/plugins/vis_type_table/public/get_inner_angular.ts index 4e4269a1f44f..c7c72f4c948d 100644 --- a/src/plugins/vis_type_table/public/get_inner_angular.ts +++ b/src/plugins/vis_type_table/public/get_inner_angular.ts @@ -24,16 +24,16 @@ import angular from 'angular'; // required for `ngSanitize` angular module import 'angular-sanitize'; import 'angular-recursion'; -import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; -import { CoreStart, IUiSettingsClient, PluginInitializerContext } from 'kibana/public'; +import { i18nDirective, i18nFilter, I18nProvider } from '@osd/i18n/angular'; +import { CoreStart, IUiSettingsClient, PluginInitializerContext } from 'opensearch-dashboards/public'; import { initAngularBootstrap, PaginateDirectiveProvider, PaginateControlsDirectiveProvider, PrivateProvider, watchMultiDecorator, - KbnAccessibleClickProvider, -} from '../../kibana_legacy/public'; + OsdAccessibleClickProvider, +} from '../../opensearch_dashboards_legacy/public'; initAngularBootstrap(); @@ -46,7 +46,7 @@ export function getAngularModule(name: string, core: CoreStart, context: PluginI let initialized = false; -export function getInnerAngular(name = 'kibana/table_vis', core: CoreStart) { +export function getInnerAngular(name = 'opensearch-dashboards/table_vis', core: CoreStart) { if (!initialized) { createLocalPrivateModule(); createLocalI18nModule(); @@ -63,7 +63,7 @@ export function getInnerAngular(name = 'kibana/table_vis', core: CoreStart) { 'tableVisI18n', ]) .config(watchMultiDecorator) - .directive('kbnAccessibleClick', KbnAccessibleClickProvider); + .directive('osdAccessibleClick', OsdAccessibleClickProvider); } function createLocalPrivateModule() { diff --git a/src/plugins/vis_type_table/public/index.ts b/src/plugins/vis_type_table/public/index.ts index 5621fdb09477..bcf9546af486 100644 --- a/src/plugins/vis_type_table/public/index.ts +++ b/src/plugins/vis_type_table/public/index.ts @@ -17,7 +17,7 @@ * under the License. */ import './index.scss'; -import { PluginInitializerContext } from 'kibana/public'; +import { PluginInitializerContext } from 'opensearch-dashboards/public'; import { TableVisPlugin as Plugin } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/src/plugins/vis_type_table/public/paginated_table/_table_cell_filter.scss b/src/plugins/vis_type_table/public/paginated_table/_table_cell_filter.scss index 05d050362ce0..3deece36b2c6 100644 --- a/src/plugins/vis_type_table/public/paginated_table/_table_cell_filter.scss +++ b/src/plugins/vis_type_table/public/paginated_table/_table_cell_filter.scss @@ -1,10 +1,10 @@ -.kbnTableCellFilter__hover { +.osdTableCellFilter__hover { position: relative; /** * 1. Center vertically regardless of row height. */ - .kbnTableCellFilter { + .osdTableCellFilter { position: absolute; white-space: nowrap; right: 0; @@ -14,17 +14,17 @@ } &:hover { - .kbnTableCellFilter { + .osdTableCellFilter { display: inline; } - .kbnTableCellFilter__hover-show { + .osdTableCellFilter__hover-show { visibility: visible; } } } -.kbnTableCellFilter__hover-show { +.osdTableCellFilter__hover-show { // so that the cell doesn't change size on hover visibility: hidden; } diff --git a/src/plugins/vis_type_table/public/paginated_table/paginated_table.html b/src/plugins/vis_type_table/public/paginated_table/paginated_table.html index 12731eb38656..83de29a12737 100644 --- a/src/plugins/vis_type_table/public/paginated_table/paginated_table.html +++ b/src/plugins/vis_type_table/public/paginated_table/paginated_table.html @@ -2,8 +2,8 @@ ng-if="sortedRows.length" list="sortedRows" per-page-prop="perPage" - class="kbnAggTable"> -
+ class="osdAggTable"> +
- {{ table.title }} + {{ table.title }}
- - + - +
@@ -11,7 +11,7 @@ scope="col" ng-repeat="col in columns" ng-click="paginatedTable.sortColumn($index)" - kbn-accessible-click + osd-accessible-click tabindex="0" class="{{ col.class }}"> @@ -35,8 +35,8 @@ diff --git a/src/plugins/vis_type_table/public/paginated_table/paginated_table.test.ts b/src/plugins/vis_type_table/public/paginated_table/paginated_table.test.ts index de253f26ff9e..ec61a0a4efca 100644 --- a/src/plugins/vis_type_table/public/paginated_table/paginated_table.test.ts +++ b/src/plugins/vis_type_table/public/paginated_table/paginated_table.test.ts @@ -27,7 +27,7 @@ import { getAngularModule } from '../get_inner_angular'; import { initTableVisLegacyModule } from '../table_vis_legacy_module'; import { coreMock } from '../../../../core/public/mocks'; -jest.mock('../../../kibana_legacy/public/angular/angular_config', () => ({ +jest.mock('../../../opensearch_dashboards_legacy/public/angular/angular_config', () => ({ configureAppAngularModule: () => {}, })); @@ -73,7 +73,7 @@ describe('Table Vis - Paginated table', () => { const initLocalAngular = () => { const tableVisModule = getAngularModule( - 'kibana/table_vis', + 'opensearch-dashboards/table_vis', coreMock.createStart(), coreMock.createPluginInitializerContext() ); @@ -81,7 +81,7 @@ describe('Table Vis - Paginated table', () => { }; beforeEach(initLocalAngular); - beforeEach(angular.mock.module('kibana/table_vis')); + beforeEach(angular.mock.module('opensearch-dashboards/table_vis')); beforeEach( angular.mock.inject((_$rootScope_: IRootScopeService, _$compile_: ICompileService) => { diff --git a/src/plugins/vis_type_table/public/paginated_table/rows.js b/src/plugins/vis_type_table/public/paginated_table/rows.js index d8f01a10c63f..c4da812fbf87 100644 --- a/src/plugins/vis_type_table/public/paginated_table/rows.js +++ b/src/plugins/vis_type_table/public/paginated_table/rows.js @@ -22,7 +22,7 @@ import _ from 'lodash'; import angular from 'angular'; import tableCellFilterHtml from './table_cell_filter.html'; -export function KbnRows($compile) { +export function OsdRows($compile) { return { restrict: 'A', link: function ($scope, $el, attr) { @@ -33,7 +33,7 @@ export function KbnRows($compile) { function createFilterableCell(value) { const $template = $(tableCellFilterHtml); - $template.addClass('kbnTableCellFilter__hover'); + $template.addClass('osdTableCellFilter__hover'); const scope = $scope.$new(); @@ -106,7 +106,7 @@ export function KbnRows($compile) { $tr.append($cell); } - $scope.$watchMulti([attr.kbnRows, attr.kbnRowsMin], function (vals) { + $scope.$watchMulti([attr.osdRows, attr.osdRowsMin], function (vals) { let rows = vals[0]; const min = vals[1]; diff --git a/src/plugins/vis_type_table/public/paginated_table/table_cell_filter.html b/src/plugins/vis_type_table/public/paginated_table/table_cell_filter.html index 57ecb9b22161..a9185884dae5 100644 --- a/src/plugins/vis_type_table/public/paginated_table/table_cell_filter.html +++ b/src/plugins/vis_type_table/public/paginated_table/table_cell_filter.html @@ -1,9 +1,9 @@
- + , void> { ); } - public start(core: CoreStart, { data, kibanaLegacy }: TablePluginStartDependencies) { + public start(core: CoreStart, { data, opensearchDashboardsLegacy }: TablePluginStartDependencies) { setFormatService(data.fieldFormats); - setKibanaLegacy(kibanaLegacy); + setOpenSearchDashboardsLegacy(opensearchDashboardsLegacy); } } diff --git a/src/plugins/vis_type_table/public/services.ts b/src/plugins/vis_type_table/public/services.ts index b4f996f078f6..ec2cbd862d6d 100644 --- a/src/plugins/vis_type_table/public/services.ts +++ b/src/plugins/vis_type_table/public/services.ts @@ -17,14 +17,14 @@ * under the License. */ -import { createGetterSetter } from '../../kibana_utils/public'; +import { createGetterSetter } from '../../opensearch_dashboards_utils/public'; import { DataPublicPluginStart } from '../../data/public'; -import { KibanaLegacyStart } from '../../kibana_legacy/public'; +import { OpenSearchDashboardsLegacyStart } from '../../opensearch_dashboards_legacy/public'; export const [getFormatService, setFormatService] = createGetterSetter< DataPublicPluginStart['fieldFormats'] >('table data.fieldFormats'); -export const [getKibanaLegacy, setKibanaLegacy] = createGetterSetter( - 'table kibanaLegacy' +export const [getOpenSearchDashboardsLegacy, setOpenSearchDashboardsLegacy] = createGetterSetter( + 'table opensearchDashboardsLegacy' ); diff --git a/src/plugins/vis_type_table/public/table_vis.html b/src/plugins/vis_type_table/public/table_vis.html index f721b670400d..169b53390fe3 100644 --- a/src/plugins/vis_type_table/public/table_vis.html +++ b/src/plugins/vis_type_table/public/table_vis.html @@ -1,4 +1,4 @@ -
+
@@ -14,7 +14,7 @@
- - +
diff --git a/src/plugins/vis_type_table/public/table_vis_controller.js b/src/plugins/vis_type_table/public/table_vis_controller.js index 8a620df98609..ea73a8728362 100644 --- a/src/plugins/vis_type_table/public/table_vis_controller.js +++ b/src/plugins/vis_type_table/public/table_vis_controller.js @@ -29,15 +29,15 @@ export function TableVisController($scope) { /** * Recreate the entire table when: - * - the underlying data changes (esResponse) + * - the underlying data changes (opensearchResponse) * - one of the view options changes (vis.params) */ $scope.$watch('renderComplete', function () { let tableGroups = ($scope.tableGroups = null); let hasSomeRows = ($scope.hasSomeRows = null); - if ($scope.esResponse) { - tableGroups = $scope.esResponse; + if ($scope.opensearchResponse) { + tableGroups = $scope.opensearchResponse; hasSomeRows = tableGroups.tables.some(function haveRows(table) { if (table.tables) return table.tables.some(haveRows); diff --git a/src/plugins/vis_type_table/public/table_vis_controller.test.ts b/src/plugins/vis_type_table/public/table_vis_controller.test.ts index 035ca044137e..47260e33d1d5 100644 --- a/src/plugins/vis_type_table/public/table_vis_controller.test.ts +++ b/src/plugins/vis_type_table/public/table_vis_controller.test.ts @@ -38,7 +38,7 @@ const { createAggConfigs } = searchServiceMock.createStartContract().aggs; const { tabifyAggResponse } = search; -jest.mock('../../kibana_legacy/public/angular/angular_config', () => ({ +jest.mock('../../opensearch_dashboards_legacy/public/angular/angular_config', () => ({ configureAppAngularModule: () => {}, })); @@ -85,7 +85,7 @@ describe('Table Vis - Controller', () => { const initLocalAngular = () => { const tableVisModule = getAngularModule( - 'kibana/table_vis', + 'opensearch-dashboards/table_vis', coreMock.createStart(), coreMock.createPluginInitializerContext() ); @@ -93,7 +93,7 @@ describe('Table Vis - Controller', () => { }; beforeEach(initLocalAngular); - beforeEach(angular.mock.module('kibana/table_vis')); + beforeEach(angular.mock.module('opensearch-dashboards/table_vis')); beforeEach( angular.mock.inject((_$rootScope_: IRootScopeService, _$compile_: ICompileService) => { @@ -173,7 +173,7 @@ describe('Table Vis - Controller', () => { }; $el = $('
') - .attr('ng-controller', 'KbnTableVisController') + .attr('ng-controller', 'OsdTableVisController') .attr('ng-init', 'newScope(this)'); $compile($el)($rootScope); @@ -181,13 +181,13 @@ describe('Table Vis - Controller', () => { // put a response into the controller function attachEsResponseToScope(resp: object) { - $rootScope.esResponse = resp; + $rootScope.opensearchResponse = resp; $rootScope.$apply(); } // remove the response from the controller function removeEsResponseFromScope() { - delete $rootScope.esResponse; + delete $rootScope.opensearchResponse; $rootScope.renderComplete = () => {}; $rootScope.$apply(); } diff --git a/src/plugins/vis_type_table/public/table_vis_fn.test.ts b/src/plugins/vis_type_table/public/table_vis_fn.test.ts index 2471522544fd..4a6dceb837d4 100644 --- a/src/plugins/vis_type_table/public/table_vis_fn.test.ts +++ b/src/plugins/vis_type_table/public/table_vis_fn.test.ts @@ -31,7 +31,7 @@ jest.mock('./table_vis_response_handler', () => ({ describe('interpreter/functions#table', () => { const fn = functionWrapper(createTableVisFn()); const context = { - type: 'kibana_datatable', + type: 'opensearch_dashboards_datatable', rows: [{ 'col-0-1': 0 }], columns: [{ id: 'col-0-1', name: 'Count' }], }; diff --git a/src/plugins/vis_type_table/public/table_vis_fn.ts b/src/plugins/vis_type_table/public/table_vis_fn.ts index 9739a7a284e6..faa86650dd42 100644 --- a/src/plugins/vis_type_table/public/table_vis_fn.ts +++ b/src/plugins/vis_type_table/public/table_vis_fn.ts @@ -17,11 +17,11 @@ * under the License. */ -import { i18n } from '@kbn/i18n'; +import { i18n } from '@osd/i18n'; import { tableVisResponseHandler, TableContext } from './table_vis_response_handler'; -import { ExpressionFunctionDefinition, KibanaDatatable, Render } from '../../expressions/public'; +import { ExpressionFunctionDefinition, OpenSearchDashboardsDatatable, Render } from '../../expressions/public'; -export type Input = KibanaDatatable; +export type Input = OpenSearchDashboardsDatatable; interface Arguments { visConfig: string | null; @@ -39,14 +39,14 @@ interface RenderValue { } export const createTableVisFn = (): ExpressionFunctionDefinition< - 'kibana_table', + 'opensearch_dashboards_table', Input, Arguments, Render > => ({ - name: 'kibana_table', + name: 'opensearch_dashboards_table', type: 'render', - inputTypes: ['kibana_datatable'], + inputTypes: ['opensearch_dashboards_datatable'], help: i18n.translate('visTypeTable.function.help', { defaultMessage: 'Table visualization', }), diff --git a/src/plugins/vis_type_table/public/table_vis_legacy_module.ts b/src/plugins/vis_type_table/public/table_vis_legacy_module.ts index 57d8b7c448b4..a9e4792cdf89 100644 --- a/src/plugins/vis_type_table/public/table_vis_legacy_module.ts +++ b/src/plugins/vis_type_table/public/table_vis_legacy_module.ts @@ -22,20 +22,20 @@ import { IModule } from 'angular'; // @ts-ignore import { TableVisController } from './table_vis_controller.js'; // @ts-ignore -import { KbnAggTable } from './agg_table/agg_table'; +import { OsdAggTable } from './agg_table/agg_table'; // @ts-ignore -import { KbnAggTableGroup } from './agg_table/agg_table_group'; +import { OsdAggTableGroup } from './agg_table/agg_table_group'; // @ts-ignore -import { KbnRows } from './paginated_table/rows'; +import { OsdRows } from './paginated_table/rows'; // @ts-ignore import { PaginatedTable } from './paginated_table/paginated_table'; /** @internal */ export const initTableVisLegacyModule = (angularIns: IModule): void => { angularIns - .controller('KbnTableVisController', TableVisController) - .directive('kbnAggTable', KbnAggTable) - .directive('kbnAggTableGroup', KbnAggTableGroup) - .directive('kbnRows', KbnRows) + .controller('OsdTableVisController', TableVisController) + .directive('osdAggTable', OsdAggTable) + .directive('osdAggTableGroup', OsdAggTableGroup) + .directive('osdRows', OsdRows) .directive('paginatedTable', PaginatedTable); }; diff --git a/src/plugins/vis_type_table/public/table_vis_response_handler.ts b/src/plugins/vis_type_table/public/table_vis_response_handler.ts index 4bf33c876dff..b4b3040ae6c7 100644 --- a/src/plugins/vis_type_table/public/table_vis_response_handler.ts +++ b/src/plugins/vis_type_table/public/table_vis_response_handler.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Required } from '@kbn/utility-types'; +import { Required } from '@osd/utility-types'; import { getFormatService } from './services'; import { Input } from './table_vis_fn'; diff --git a/src/plugins/vis_type_table/public/table_vis_type.ts b/src/plugins/vis_type_table/public/table_vis_type.ts index 95f4f06ee611..8425440b5764 100644 --- a/src/plugins/vis_type_table/public/table_vis_type.ts +++ b/src/plugins/vis_type_table/public/table_vis_type.ts @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { CoreSetup, PluginInitializerContext } from 'kibana/public'; -import { i18n } from '@kbn/i18n'; +import { CoreSetup, PluginInitializerContext } from 'opensearch-dashboards/public'; +import { i18n } from '@osd/i18n'; import { AggGroupNames } from '../../data/public'; import { Schemas } from '../../vis_default_editor/public'; import { BaseVisTypeOptions } from '../../visualizations/public'; diff --git a/src/plugins/vis_type_table/public/vis_controller.ts b/src/plugins/vis_type_table/public/vis_controller.ts index 178180866026..27aec9e8b779 100644 --- a/src/plugins/vis_type_table/public/vis_controller.ts +++ b/src/plugins/vis_type_table/public/vis_controller.ts @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -import { CoreSetup, PluginInitializerContext } from 'kibana/public'; +import { CoreSetup, PluginInitializerContext } from 'opensearch-dashboards/public'; import angular, { IModule, auto, IRootScopeService, IScope, ICompileService } from 'angular'; import $ from 'jquery'; import { VisParams, ExprVis } from '../../visualizations/public'; import { getAngularModule } from './get_inner_angular'; -import { getKibanaLegacy } from './services'; +import { getOpenSearchDashboardsLegacy } from './services'; import { initTableVisLegacyModule } from './table_vis_legacy_module'; -const innerAngularName = 'kibana/table_vis'; +const innerAngularName = 'opensearch-dashboards/table_vis'; export function getTableVisualizationControllerClass( core: CoreSetup, @@ -64,8 +64,8 @@ export function getTableVisualizationControllerClass( } } - async render(esResponse: object, visParams: VisParams): Promise { - getKibanaLegacy().loadFontAwesome(); + async render(opensearchResponse: object, visParams: VisParams): Promise { + getOpenSearchDashboardsLegacy().loadFontAwesome(); await this.initLocalAngular(); return new Promise(async (resolve, reject) => { @@ -90,7 +90,7 @@ export function getTableVisualizationControllerClass( // the list above that it is passing through this.$scope.vis = this.vis; this.$scope.visState = { params: visParams, title: visParams.title }; - this.$scope.esResponse = esResponse; + this.$scope.opensearchResponse = opensearchResponse; this.$scope.visParams = visParams; this.$scope.renderComplete = resolve; diff --git a/src/plugins/vis_type_table/server/index.ts b/src/plugins/vis_type_table/server/index.ts index 882958a28777..677c72d950c7 100644 --- a/src/plugins/vis_type_table/server/index.ts +++ b/src/plugins/vis_type_table/server/index.ts @@ -17,7 +17,7 @@ * under the License. */ -import { PluginConfigDescriptor } from 'kibana/server'; +import { PluginConfigDescriptor } from 'opensearch-dashboards/server'; import { configSchema, ConfigSchema } from '../config';