Skip to content

Commit

Permalink
[Rename] Refactored src/plugins/vis_type_table directory (#97)
Browse files Browse the repository at this point in the history
* [Rename] Refactored src/plugins/vis_type_table directory

Signed-off-by: Mihir Soni <[email protected]>
  • Loading branch information
mihirsoni authored and kavilla committed Mar 19, 2021
1 parent a8a09d3 commit b88e2f9
Show file tree
Hide file tree
Showing 31 changed files with 127 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/plugins/vis_type_table/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_table/public/_table_vis.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions src/plugins/vis_type_table/public/agg_table/_agg_table.scss
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_table/public/agg_table/agg_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
filter="filter"
totalFunc="totalFunc">

<div class="kbnAggTable__controls">
<div class="osdAggTable__controls">
<small
i18n-id="visTypeTable.aggTable.exportLabel"
i18n-default-message="Export:"
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_type_table/public/agg_table/agg_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import _ from 'lodash';
import { CSV_SEPARATOR_SETTING, CSV_QUOTE_VALUES_SETTING } from '../../../share/public';
import aggTableTemplate from './agg_table.html';
import { getFormatService } from '../services';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

export function KbnAggTable(config, RecursionHelper) {
export function OsdAggTable(config, RecursionHelper) {
return {
restrict: 'E',
template: aggTableTemplate,
Expand Down
30 changes: 15 additions & 15 deletions src/plugins/vis_type_table/public/agg_table/agg_table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { round } from 'lodash';

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 { UI_SETTINGS } from '../../../data/public/';
import { CSV_SEPARATOR_SETTING, CSV_QUOTE_VALUES_SETTING } from '../../../share/public';
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('Table Vis - AggTable Directive', function () {
let settings;

const initLocalAngular = () => {
const tableVisModule = getInnerAngular('kibana/table_vis', core);
const tableVisModule = getInnerAngular('opensearch-dashboards/table_vis', core);
initTableVisLegacyModule(tableVisModule);
};

Expand All @@ -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;

Expand All @@ -100,7 +100,7 @@ describe('Table Vis - AggTable Directive', function () {
};
$scope.table = tabifiedData.metricOnly.tables[0];

const $el = $compile('<kbn-agg-table table="table" dimensions="dimensions"></kbn-agg-table>')(
const $el = $compile('<osd-agg-table table="table" dimensions="dimensions"></osd-agg-table>')(
$scope
);
$scope.$digest();
Expand All @@ -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('<kbn-agg-table table="table" dimensions="dimensions"></kbn-agg-table>')(
const $el = $compile('<osd-agg-table table="table" dimensions="dimensions"></osd-agg-table>')(
$scope
);
$scope.$digest();
Expand All @@ -135,7 +135,7 @@ describe('Table Vis - AggTable Directive', function () {
],
};
$scope.table = tabifiedData.threeTermBuckets.tables[0];
const $el = $('<kbn-agg-table table="table" dimensions="dimensions"></kbn-agg-table>');
const $el = $('<osd-agg-table table="table" dimensions="dimensions"></osd-agg-table>');
$compile($el)($scope);
$scope.$digest();

Expand Down Expand Up @@ -200,11 +200,11 @@ describe('Table Vis - AggTable Directive', function () {
tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative.tables[0];
$scope.showTotal = true;
$scope.totalFunc = totalFunc;
const $el = $(`<kbn-agg-table
const $el = $(`<osd-agg-table
table="table"
show-total="showTotal"
total-func="totalFunc"
dimensions="dimensions"></kbn-agg-table>`);
dimensions="dimensions"></osd-agg-table>`);
$compile($el)($scope);
$scope.$digest();

Expand Down Expand Up @@ -255,7 +255,7 @@ describe('Table Vis - AggTable Directive', function () {

describe('aggTable.toCsv()', function () {
test('escapes rows and columns properly', function () {
const $el = $compile('<kbn-agg-table table="table" dimensions="dimensions"></kbn-agg-table>')(
const $el = $compile('<osd-agg-table table="table" dimensions="dimensions"></osd-agg-table>')(
$scope
);
$scope.$digest();
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('Table Vis - AggTable Directive', function () {
};
$scope.table = tabifiedData.threeTermBuckets.tables[0];

const $el = $compile('<kbn-agg-table table="table" dimensions="dimensions"></kbn-agg-table>')(
const $el = $compile('<osd-agg-table table="table" dimensions="dimensions"></osd-agg-table>')(
$scope
);
$scope.$digest();
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('Table Vis - AggTable Directive', function () {
};
$scope.table = tabifiedData.threeTermBuckets.tables[0];

const $el = $compile('<kbn-agg-table table="table" dimensions="dimensions"></kbn-agg-table>')(
const $el = $compile('<osd-agg-table table="table" dimensions="dimensions"></osd-agg-table>')(
$scope
);
$scope.$digest();
Expand Down Expand Up @@ -407,11 +407,11 @@ describe('Table Vis - AggTable Directive', function () {
tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative.tables[0];
$scope.percentageCol = 'Average bytes';

const $el = $(`<kbn-agg-table
const $el = $(`<osd-agg-table
table="table"
dimensions="dimensions"
percentage-col="percentageCol"
></kbn-agg-table>`);
></osd-agg-table>`);

$compile($el)($scope);
$scope.$digest();
Expand Down Expand Up @@ -448,7 +448,7 @@ describe('Table Vis - AggTable Directive', function () {
});

test('calls _saveAs properly', function () {
const $el = $compile('<kbn-agg-table table="table" dimensions="dimensions">')($scope);
const $el = $compile('<osd-agg-table table="table" dimensions="dimensions">')($scope);
$scope.$digest();

const $tableScope = $el.isolateScope();
Expand Down Expand Up @@ -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(
`<kbn-agg-table table="table" dimensions="dimensions" export-title="exportTitle">`
`<osd-agg-table table="table" dimensions="dimensions" export-title="exportTitle">`
)($scope);
$scope.$digest();

Expand Down
24 changes: 12 additions & 12 deletions src/plugins/vis_type_table/public/agg_table/agg_table_group.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<table ng-if="rows" class="table kbnAggTable__group" ng-repeat="table in rows">
<table ng-if="rows" class="table osdAggTable__group" ng-repeat="table in rows">
<thead>
<tr>
<th ng-if="table.tables" scope="col">
<span class="kbnAggTable__groupHeader">{{ table.title }}</span>
<span class="osdAggTable__groupHeader">{{ table.title }}</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<kbn-agg-table-group
<osd-agg-table-group
ng-if="table.tables"
group="table"
filter="filter"
Expand All @@ -19,8 +19,8 @@
export-title="exportTitle"
percentage-col="percentageCol"
show-total="showTotal"
total-func="totalFunc"></kbn-agg-table-group>
<kbn-agg-table
total-func="totalFunc"></osd-agg-table-group>
<osd-agg-table
ng-if="table.rows"
filter="filter"
table="table"
Expand All @@ -31,24 +31,24 @@
percentage-col="percentageCol"
show-total="showTotal"
total-func="totalFunc">
</kbn-agg-table>
</osd-agg-table>
</td>
</tr>
</tbody>
</table>

<table ng-if="columns" class="table kbnAggTable__group">
<table ng-if="columns" class="table osdAggTable__group">
<thead>
<tr>
<th ng-repeat="table in columns" ng-if="table.tables" scope="col">
<span class="kbnAggTable__groupHeader">{{ table.title }}</span>
<span class="osdAggTable__groupHeader">{{ table.title }}</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td ng-repeat="table in columns">
<kbn-agg-table-group
<osd-agg-table-group
ng-if="table.tables"
filter="filter"
group="table"
Expand All @@ -58,8 +58,8 @@
export-title="exportTitle"
show-total="showTotal"
percentage-col="percentageCol"
total-func="totalFunc"></kbn-agg-table-group>
<kbn-agg-table
total-func="totalFunc"></osd-agg-table-group>
<osd-agg-table
ng-if="table.rows"
filter="filter"
table="table"
Expand All @@ -70,7 +70,7 @@
show-total="showTotal"
percentage-col="percentageCol"
total-func="totalFunc">
</kbn-agg-table>
</osd-agg-table>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import aggTableGroupTemplate from './agg_table_group.html';

export function KbnAggTableGroup(RecursionHelper) {
export function OsdAggTableGroup(RecursionHelper) {
return {
restrict: 'E',
template: aggTableGroupTemplate,
Expand Down
22 changes: 11 additions & 11 deletions src/plugins/vis_type_table/public/agg_table/agg_table_group.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
};

Expand All @@ -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');
Expand All @@ -82,19 +82,19 @@ describe('Table Vis - AggTableGroup Directive', function () {
direction: null,
};
const $el = $(
'<kbn-agg-table-group dimensions="dimensions" group="group"></kbn-agg-table-group>'
'<osd-agg-table-group dimensions="dimensions" group="group"></osd-agg-table-group>'
);

$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 = $(
'<kbn-agg-table-group dimensions="dimensions" group="group"></kbn-agg-table-group>'
'<osd-agg-table-group dimensions="dimensions" group="group"></osd-agg-table-group>'
);

$scope.group = {
Expand All @@ -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);
});

Expand All @@ -123,15 +123,15 @@ describe('Table Vis - AggTableGroup Directive', function () {
};
const group = ($scope.group = tabifiedData.threeTermBucketsWithSplit);
const $el = $(
'<kbn-agg-table-group dimensions="dimensions" group="group"></kbn-agg-table-group>'
'<osd-agg-table-group dimensions="dimensions" group="group"></osd-agg-table-group>'
);
$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) {
Expand Down
Loading

0 comments on commit b88e2f9

Please sign in to comment.