-
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.
Migrate savedObjectManagementActionRegistry to NP plugin (#60481)
* create empty plugin + move home feature registration to it * move the so action_registry to new plugin * adapt existing calls to the registry * fix i18n namespace * fix table unit tests * update codeowners * rename plugin to match other PRs * remove registerLegacyAPI from spaces public plugin * fix typo Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
9a53c08
commit 7ab38ff
Showing
35 changed files
with
358 additions
and
192 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ | |
*/ | ||
|
||
export * from './index_pattern_management'; | ||
export * from './saved_objects_management'; |
55 changes: 0 additions & 55 deletions
55
..._ready/services/saved_objects_management/saved_objects_management_action_registry.test.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { PluginInitializerContext } from 'kibana/public'; | ||
import { SavedObjectsManagementPlugin } from './plugin'; | ||
|
||
export { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart } from './plugin'; | ||
export { | ||
ISavedObjectsManagementActionRegistry, | ||
SavedObjectsManagementAction, | ||
SavedObjectsManagementRecord, | ||
} from './services'; | ||
|
||
export function plugin(initializerContext: PluginInitializerContext) { | ||
return new SavedObjectsManagementPlugin(); | ||
} |
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,39 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { actionRegistryMock } from './services/action_registry.mock'; | ||
import { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart } from './plugin'; | ||
|
||
const createSetupContractMock = (): jest.Mocked<SavedObjectsManagementPluginSetup> => { | ||
const mock = { | ||
actionRegistry: actionRegistryMock.create(), | ||
}; | ||
return mock; | ||
}; | ||
|
||
const createStartContractMock = (): jest.Mocked<SavedObjectsManagementPluginStart> => { | ||
const mock = {}; | ||
return mock; | ||
}; | ||
|
||
export const savedObjectsManagementPluginMock = { | ||
createActionRegistry: actionRegistryMock.create, | ||
createSetupContract: createSetupContractMock, | ||
createStartContract: createStartContractMock, | ||
}; |
47 changes: 47 additions & 0 deletions
47
src/plugins/saved_objects_management/public/plugin.test.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,47 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { coreMock } from '../../../core/public/mocks'; | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
import { homePluginMock } from '../../home/public/mocks'; | ||
import { SavedObjectsManagementPlugin } from './plugin'; | ||
|
||
describe('SavedObjectsManagementPlugin', () => { | ||
let plugin: SavedObjectsManagementPlugin; | ||
|
||
beforeEach(() => { | ||
plugin = new SavedObjectsManagementPlugin(); | ||
}); | ||
|
||
describe('#setup', () => { | ||
it('registers the saved_objects feature to the home plugin', async () => { | ||
const coreSetup = coreMock.createSetup(); | ||
const homeSetup = homePluginMock.createSetupContract(); | ||
|
||
await plugin.setup(coreSetup, { home: homeSetup }); | ||
|
||
expect(homeSetup.featureCatalogue.register).toHaveBeenCalledTimes(1); | ||
expect(homeSetup.featureCatalogue.register).toHaveBeenCalledWith( | ||
expect.objectContaining({ | ||
id: 'saved_objects', | ||
}) | ||
); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.