org: migrate to new composability API

This commit is contained in:
Patrik Oldsberg
2021-02-02 20:22:07 +01:00
parent b712841d61
commit 0269f4fd91
5 changed files with 48 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-org': patch
---
Migrate to new composability API, exporting the plugin instance as `orgPlugin`, and the entity cards as `EntityGroupProfileCard`, `EntityMembersListCard`, `EntityOwnershipCard`, and `EntityUserProfileCard`.
+2 -2
View File
@@ -14,6 +14,6 @@
* limitations under the License.
*/
import { createDevApp } from '@backstage/dev-utils';
import { plugin } from '../src/plugin';
import { orgPlugin } from '../src/plugin';
createDevApp().registerPlugin(plugin).render();
createDevApp().registerPlugin(orgPlugin).render();
+8 -1
View File
@@ -13,5 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { plugin } from './plugin';
export {
orgPlugin,
orgPlugin as plugin,
EntityGroupProfileCard,
EntityMembersListCard,
EntityOwnershipCard,
EntityUserProfileCard,
} from './plugin';
export * from './components';
+2 -2
View File
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { plugin } from './plugin';
import { orgPlugin } from './plugin';
describe('groups', () => {
it('should export plugin', () => {
expect(plugin).toBeDefined();
expect(orgPlugin).toBeDefined();
});
});
+31 -2
View File
@@ -13,8 +13,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createPlugin } from '@backstage/core';
import { createComponentExtension, createPlugin } from '@backstage/core';
export const plugin = createPlugin({
export const orgPlugin = createPlugin({
id: 'org',
});
export const EntityGroupProfileCard = orgPlugin.provide(
createComponentExtension({
component: {
lazy: () => import('./components').then(m => m.GroupProfileCard),
},
}),
);
export const EntityMembersListCard = orgPlugin.provide(
createComponentExtension({
component: {
lazy: () => import('./components').then(m => m.MembersListCard),
},
}),
);
export const EntityOwnershipCard = orgPlugin.provide(
createComponentExtension({
component: {
lazy: () => import('./components').then(m => m.OwnershipCard),
},
}),
);
export const EntityUserProfileCard = orgPlugin.provide(
createComponentExtension({
component: {
lazy: () => import('./components').then(m => m.UserProfileCard),
},
}),
);