Skip to content

Commit 85aea35

Browse files
authored
Deangularize and typescriptify ui/saved_object (#51562)
1 parent 06eeb59 commit 85aea35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1297
-838
lines changed

src/legacy/core_plugins/kibana/public/dashboard/__tests__/get_saved_dashboard_mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ export function getSavedDashboardMock(
4141
getQuery: () => ({ query: '', language: 'kuery' }),
4242
getFilters: () => [],
4343
...config,
44-
};
44+
} as SavedObjectDashboard;
4545
}

src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
State,
3636
AppStateClass as TAppStateClass,
3737
KbnUrl,
38-
SaveOptions,
38+
SavedObjectSaveOpts,
3939
unhashUrl,
4040
} from './legacy_imports';
4141
import { FilterStateManager, IndexPattern } from '../../../data/public';
@@ -608,7 +608,7 @@ export class DashboardAppController {
608608
* @return {Promise}
609609
* @resolved {String} - The id of the doc
610610
*/
611-
function save(saveOptions: SaveOptions): Promise<SaveResult> {
611+
function save(saveOptions: SavedObjectSaveOpts): Promise<SaveResult> {
612612
return saveDashboard(angular.toJson, timefilter, dashboardStateManager, saveOptions)
613613
.then(function(id) {
614614
if (id) {

src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const legacyChrome = chrome;
3030
export { State } from 'ui/state_management/state';
3131
export { AppState } from 'ui/state_management/app_state';
3232
export { AppStateClass } from 'ui/state_management/app_state';
33-
export { SaveOptions } from 'ui/saved_objects/saved_object';
33+
export { SavedObjectSaveOpts } from 'ui/saved_objects/types';
3434
export { npSetup, npStart } from 'ui/new_platform';
3535
export { SavedObjectRegistryProvider } from 'ui/saved_objects';
3636
export { IPrivate } from 'ui/private';

src/legacy/core_plugins/kibana/public/dashboard/lib/save_dashboard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { TimefilterContract } from 'src/plugins/data/public';
21-
import { SaveOptions } from '../legacy_imports';
21+
import { SavedObjectSaveOpts } from '../legacy_imports';
2222
import { updateSavedDashboard } from './update_saved_dashboard';
2323
import { DashboardStateManager } from '../dashboard_state_manager';
2424

@@ -34,7 +34,7 @@ export function saveDashboard(
3434
toJson: (obj: any) => string,
3535
timeFilter: TimefilterContract,
3636
dashboardStateManager: DashboardStateManager,
37-
saveOptions: SaveOptions
37+
saveOptions: SavedObjectSaveOpts
3838
): Promise<string> {
3939
dashboardStateManager.saveState();
4040

src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { SavedObject } from 'ui/saved_objects/saved_object';
20+
import { SavedObject } from 'ui/saved_objects/types';
2121
import { SearchSourceContract } from '../../../../../ui/public/courier';
2222
import { esFilters, Query, RefreshInterval } from '../../../../../../plugins/data/public';
2323

src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import './saved_dashboard';
2222
import { uiModules } from 'ui/modules';
2323
import { SavedObjectLoader, SavedObjectsClientProvider } from 'ui/saved_objects';
2424
import { savedObjectManagementRegistry } from '../../management/saved_object_registry';
25+
import { npStart } from '../../../../../ui/public/new_platform';
2526

2627
const module = uiModules.get('app/dashboard');
2728

@@ -35,7 +36,7 @@ savedObjectManagementRegistry.register({
3536
});
3637

3738
// This is the only thing that gets injected into controllers
38-
module.service('savedDashboards', function (Private, SavedDashboard, kbnUrl, chrome) {
39+
module.service('savedDashboards', function (Private, SavedDashboard) {
3940
const savedObjectClient = Private(SavedObjectsClientProvider);
40-
return new SavedObjectLoader(SavedDashboard, kbnUrl, chrome, savedObjectClient);
41+
return new SavedObjectLoader(SavedDashboard, savedObjectClient, npStart.core.chrome);
4142
});

src/legacy/core_plugins/kibana/public/discover/__tests__/directives/discover_field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('discoverField', function () {
3232
let $scope;
3333
let indexPattern;
3434
let $elem;
35-
beforeEach(() => pluginInstance.initializeServices(true));
35+
beforeEach(() => pluginInstance.initializeServices());
3636
beforeEach(() => pluginInstance.initializeInnerAngular());
3737
beforeEach(ngMock.module('app/discover'));
3838
beforeEach(ngMock.inject(function (Private, $rootScope, $compile) {

src/legacy/core_plugins/kibana/public/discover/__tests__/directives/field_chooser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('discover field chooser directives', function () {
7070
on-remove-field="removeField"
7171
></disc-field-chooser>
7272
`);
73-
beforeEach(() => pluginInstance.initializeServices(true));
73+
beforeEach(() => pluginInstance.initializeServices());
7474
beforeEach(() => pluginInstance.initializeInnerAngular());
7575

7676
beforeEach(ngMock.module('app/discover', ($provide) => {

src/legacy/core_plugins/kibana/public/discover/angular/context/query_parameters/__tests__/action_add_filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { npStart } from 'ui/new_platform';
2727

2828
describe('context app', function () {
2929
beforeEach(() => pluginInstance.initializeInnerAngular());
30-
beforeEach(() => pluginInstance.initializeServices(true));
30+
beforeEach(() => pluginInstance.initializeServices());
3131
beforeEach(ngMock.module('app/discover'));
3232
beforeEach(ngMock.module(function createServiceStubs($provide) {
3333
$provide.value('indexPatterns', createIndexPatternsStub());

src/legacy/core_plugins/kibana/public/discover/angular/context/query_parameters/__tests__/action_set_predecessor_count.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { getQueryParameterActions } from '../actions';
2626

2727
describe('context app', function () {
2828
beforeEach(() => pluginInstance.initializeInnerAngular());
29-
beforeEach(() => pluginInstance.initializeServices(true));
29+
beforeEach(() => pluginInstance.initializeServices());
3030
beforeEach(ngMock.module('app/discover'));
3131

3232
describe('action setPredecessorCount', function () {

0 commit comments

Comments
 (0)