-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [Vis] TableVis uses local angular (#50759) * TableVis uses local angular * Clean up * Fix TS * Update angular_config * Fix export * Update render_app.ts * Cetralize ui deps * Fix loading KbnTableVisController in Dashboard * Fix graph * Rename const * Add table vis mocks * Fix kbn_top_nav * Add TS for test * Complete conversion paginated_table test to Jest * Convert table_vis_controller test to Jest * Convert table_vis_controller test to Jest * Create agg_table.test.ts * Fix mocha tests * Refactoring * Remove module dep * Remove LegacyDependenciesPlugin * Move file * Fix path * Fix path * Fix TS * Fix Jest test * Fix TS * Revert "Fix TS" This reverts commit 4cff6f6.
- Loading branch information
1 parent
542b94a
commit 83fb4f6
Showing
21 changed files
with
1,473 additions
and
866 deletions.
There are no files selected for viewing
193 changes: 0 additions & 193 deletions
193
src/legacy/core_plugins/vis_type_table/public/__tests__/table_vis_controller.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
src/legacy/core_plugins/vis_type_table/public/get_inner_angular.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// inner angular imports | ||
// these are necessary to bootstrap the local angular. | ||
// They can stay even after NP cutover | ||
import angular from 'angular'; | ||
import 'ui/angular-bootstrap'; | ||
import 'angular-recursion'; | ||
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; | ||
import { CoreStart, LegacyCoreStart, IUiSettingsClient } from 'kibana/public'; | ||
import { | ||
PrivateProvider, | ||
PaginateDirectiveProvider, | ||
PaginateControlsDirectiveProvider, | ||
watchMultiDecorator, | ||
KbnAccessibleClickProvider, | ||
StateManagementConfigProvider, | ||
configureAppAngularModule, | ||
} from './legacy_imports'; | ||
|
||
const thirdPartyAngularDependencies = ['ngSanitize', 'ui.bootstrap', 'RecursionHelper']; | ||
|
||
export function getAngularModule(name: string, core: CoreStart) { | ||
const uiModule = getInnerAngular(name, core); | ||
configureAppAngularModule(uiModule, core as LegacyCoreStart, true); | ||
return uiModule; | ||
} | ||
|
||
let initialized = false; | ||
|
||
export function getInnerAngular(name = 'kibana/table_vis', core: CoreStart) { | ||
if (!initialized) { | ||
createLocalPrivateModule(); | ||
createLocalI18nModule(); | ||
createLocalConfigModule(core.uiSettings); | ||
createLocalPaginateModule(); | ||
initialized = true; | ||
} | ||
return angular | ||
.module(name, [ | ||
...thirdPartyAngularDependencies, | ||
'tableVisPaginate', | ||
'tableVisConfig', | ||
'tableVisPrivate', | ||
'tableVisI18n', | ||
]) | ||
.config(watchMultiDecorator) | ||
.directive('kbnAccessibleClick', KbnAccessibleClickProvider); | ||
} | ||
|
||
function createLocalPrivateModule() { | ||
angular.module('tableVisPrivate', []).provider('Private', PrivateProvider); | ||
} | ||
|
||
function createLocalConfigModule(uiSettings: IUiSettingsClient) { | ||
angular | ||
.module('tableVisConfig', ['tableVisPrivate']) | ||
.provider('stateManagementConfig', StateManagementConfigProvider) | ||
.provider('config', function() { | ||
return { | ||
$get: () => ({ | ||
get: (value: string) => { | ||
return uiSettings ? uiSettings.get(value) : undefined; | ||
}, | ||
// set method is used in agg_table mocha test | ||
set: (key: string, value: string) => { | ||
return uiSettings ? uiSettings.set(key, value) : undefined; | ||
}, | ||
}), | ||
}; | ||
}); | ||
} | ||
|
||
function createLocalI18nModule() { | ||
angular | ||
.module('tableVisI18n', []) | ||
.provider('i18n', I18nProvider) | ||
.filter('i18n', i18nFilter) | ||
.directive('i18nId', i18nDirective); | ||
} | ||
|
||
function createLocalPaginateModule() { | ||
angular | ||
.module('tableVisPaginate', []) | ||
.directive('paginate', PaginateDirectiveProvider) | ||
.directive('paginateControls', PaginateControlsDirectiveProvider); | ||
} |
Oops, something went wrong.