@backstage-community/plugin-announcements 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @backstage-community/plugin-announcements
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7ad0cd0: Fixes an issue where an empty list of userOwnershipRefs causes excessive api calls to the catalog when creating a new announcement.
8
+ - Updated dependencies [7ad0cd0]
9
+ - @backstage-community/plugin-announcements-react@0.9.1
10
+
11
+ ## 0.10.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 0ab4439: Updated the New Frontend System NavItem to use the `RecordVoiceOverIcon` instead of the `NotificationsIcon` to avoid confusion with the Backstage Notifications NavItem
16
+ - 1a08ba6: Fixed an issue where your would get a "Routing context not available" error when using the New Frontend System
17
+
3
18
  ## 0.10.0
4
19
 
5
20
  ### Minor Changes
@@ -1,14 +1,14 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { compatWrapper } from '@backstage/core-compat-api';
2
3
  import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
3
4
 
4
5
  const entityAnnouncementsCard = EntityCardBlueprint.make({
5
6
  name: "announcements",
6
7
  params: {
7
8
  filter: "kind:component,system",
8
- loader: async () => {
9
- const { AnnouncementsCard } = await import('../components/AnnouncementsCard/index.esm.js');
10
- return /* @__PURE__ */ jsx(AnnouncementsCard, {});
11
- }
9
+ loader: async () => import('../components/AnnouncementsCard/index.esm.js').then(
10
+ (m) => compatWrapper(/* @__PURE__ */ jsx(m.AnnouncementsCard, {}))
11
+ )
12
12
  }
13
13
  });
14
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\n\n/**\n * @alpha\n */\nexport const entityAnnouncementsCard = EntityCardBlueprint.make({\n name: 'announcements',\n params: {\n filter: 'kind:component,system',\n loader: async () => {\n const { AnnouncementsCard } = await import(\n '../components/AnnouncementsCard'\n );\n\n return <AnnouncementsCard />;\n },\n },\n});\n"],"names":[],"mappings":";;;AAoBa,MAAA,uBAAA,GAA0B,oBAAoB,IAAK,CAAA;AAAA,EAC9D,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,uBAAA;AAAA,IACR,QAAQ,YAAY;AAClB,MAAA,MAAM,EAAE,iBAAA,EAAsB,GAAA,MAAM,OAClC,8CACF,CAAA;AAEA,MAAA,2BAAQ,iBAAkB,EAAA,EAAA,CAAA;AAAA;AAC5B;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { compatWrapper } from '@backstage/core-compat-api';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\n\n/**\n * @alpha\n */\nexport const entityAnnouncementsCard = EntityCardBlueprint.make({\n name: 'announcements',\n params: {\n filter: 'kind:component,system',\n loader: async () =>\n import('../components/AnnouncementsCard').then(m =>\n compatWrapper(<m.AnnouncementsCard />),\n ),\n },\n});\n"],"names":[],"mappings":";;;;AAqBa,MAAA,uBAAA,GAA0B,oBAAoB,IAAK,CAAA;AAAA,EAC9D,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,uBAAA;AAAA,IACR,MAAQ,EAAA,YACN,OAAO,8CAAiC,CAAE,CAAA,IAAA;AAAA,MAAK,OAC7C,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,iBAAA,EAAF,EAAoB,CAAE;AAAA;AACvC;AAEN,CAAC;;;;"}
@@ -1,13 +1,13 @@
1
1
  import { NavItemBlueprint } from '@backstage/frontend-plugin-api/';
2
2
  import { convertLegacyRouteRef } from '@backstage/core-compat-api';
3
3
  import { rootRouteRef } from '../routes.esm.js';
4
- import NotificationsIcon from '@material-ui/icons/Notifications';
4
+ import RecordVoiceOverIcon from '@material-ui/icons/RecordVoiceOver';
5
5
 
6
6
  const announcementsNavItem = NavItemBlueprint.make({
7
7
  params: {
8
8
  title: "Announcements",
9
9
  routeRef: convertLegacyRouteRef(rootRouteRef),
10
- icon: NotificationsIcon
10
+ icon: RecordVoiceOverIcon
11
11
  }
12
12
  });
13
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"navItems.esm.js","sources":["../../src/alpha/navItems.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { NavItemBlueprint } from '@backstage/frontend-plugin-api/';\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { rootRouteRef } from '../routes';\nimport NotificationsIcon from '@material-ui/icons/Notifications';\n\n/**\n * @alpha\n */\nexport const announcementsNavItem = NavItemBlueprint.make({\n params: {\n title: 'Announcements',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n icon: NotificationsIcon,\n },\n});\n\nexport default [announcementsNavItem];\n"],"names":[],"mappings":";;;;;AAuBa,MAAA,oBAAA,GAAuB,iBAAiB,IAAK,CAAA;AAAA,EACxD,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,eAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,IAAM,EAAA;AAAA;AAEV,CAAC;;;;"}
1
+ {"version":3,"file":"navItems.esm.js","sources":["../../src/alpha/navItems.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { NavItemBlueprint } from '@backstage/frontend-plugin-api/';\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { rootRouteRef } from '../routes';\nimport RecordVoiceOverIcon from '@material-ui/icons/RecordVoiceOver';\n\n/**\n * @alpha\n */\nexport const announcementsNavItem = NavItemBlueprint.make({\n params: {\n title: 'Announcements',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n icon: RecordVoiceOverIcon,\n },\n});\n\nexport default [announcementsNavItem];\n"],"names":[],"mappings":";;;;;AAuBa,MAAA,oBAAA,GAAuB,iBAAiB,IAAK,CAAA;AAAA,EACxD,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,eAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,IAAM,EAAA;AAAA;AAEV,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { convertLegacyRouteRef } from '@backstage/core-compat-api';
2
+ import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
3
3
  import { PageBlueprint } from '@backstage/frontend-plugin-api';
4
4
  import { rootRouteRef } from '../routes.esm.js';
5
5
 
@@ -7,10 +7,7 @@ const announcementsPage = PageBlueprint.make({
7
7
  params: {
8
8
  defaultPath: "/announcements",
9
9
  routeRef: convertLegacyRouteRef(rootRouteRef),
10
- loader: async () => {
11
- const { Router } = await import('../components/Router.esm.js');
12
- return /* @__PURE__ */ jsx(Router, {});
13
- }
10
+ loader: async () => import('../components/Router.esm.js').then((m) => compatWrapper(/* @__PURE__ */ jsx(m.Router, {})))
14
11
  }
15
12
  });
16
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"pages.esm.js","sources":["../../src/alpha/pages.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { PageBlueprint } from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../routes';\n\n/**\n * @alpha\n */\nexport const announcementsPage = PageBlueprint.make({\n params: {\n defaultPath: '/announcements',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: async () => {\n const { Router } = await import('../components/Router');\n return <Router />;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,iBAAA,GAAoB,cAAc,IAAK,CAAA;AAAA,EAClD,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,gBAAA;AAAA,IACb,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,QAAQ,YAAY;AAClB,MAAA,MAAM,EAAE,MAAA,EAAW,GAAA,MAAM,OAAO,6BAAsB,CAAA;AACtD,MAAA,2BAAQ,MAAO,EAAA,EAAA,CAAA;AAAA;AACjB;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"pages.esm.js","sources":["../../src/alpha/pages.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport { PageBlueprint } from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../routes';\n\n/**\n * @alpha\n */\nexport const announcementsPage = PageBlueprint.make({\n params: {\n defaultPath: '/announcements',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: async () =>\n import('../components/Router').then(m => compatWrapper(<m.Router />)),\n },\n});\n"],"names":[],"mappings":";;;;;AAyBa,MAAA,iBAAA,GAAoB,cAAc,IAAK,CAAA;AAAA,EAClD,MAAQ,EAAA;AAAA,IACN,WAAa,EAAA,gBAAA;AAAA,IACb,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,MAAQ,EAAA,YACN,OAAO,6BAAsB,CAAE,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,aAAA,iBAAe,GAAA,CAAA,CAAA,CAAE,MAAF,EAAA,EAAS,CAAE,CAAC;AAAA;AAE1E,CAAC;;;;"}
package/dist/alpha.esm.js CHANGED
@@ -7,7 +7,7 @@ import { announcementsPage } from './alpha/pages.esm.js';
7
7
  import { rootRouteRef } from './routes.esm.js';
8
8
 
9
9
  var alpha = createFrontendPlugin({
10
- id: "announcements",
10
+ pluginId: "announcements",
11
11
  routes: convertLegacyRouteRefs({
12
12
  root: rootRouteRef
13
13
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { convertLegacyRouteRefs } from '@backstage/core-compat-api';\nimport {\n createFrontendPlugin,\n FrontendPlugin,\n} from '@backstage/frontend-plugin-api';\nimport { announcementsApiExtension } from './alpha/apis';\nimport { entityAnnouncementsCard } from './alpha/entityCards';\nimport { announcementsNavItem } from './alpha/navItems';\nimport { announcementsPage } from './alpha/pages';\nimport { rootRouteRef } from './routes';\n\n/**\n * @alpha\n */\nexport default createFrontendPlugin({\n id: 'announcements',\n routes: convertLegacyRouteRefs({\n root: rootRouteRef,\n }),\n extensions: [\n announcementsApiExtension,\n entityAnnouncementsCard,\n announcementsPage,\n announcementsNavItem,\n ],\n}) as FrontendPlugin;\n"],"names":[],"mappings":";;;;;;;;AA6BA,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,eAAA;AAAA,EACJ,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,IAAM,EAAA;AAAA,GACP,CAAA;AAAA,EACD,UAAY,EAAA;AAAA,IACV,yBAAA;AAAA,IACA,uBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { convertLegacyRouteRefs } from '@backstage/core-compat-api';\nimport {\n createFrontendPlugin,\n FrontendPlugin,\n} from '@backstage/frontend-plugin-api';\nimport { announcementsApiExtension } from './alpha/apis';\nimport { entityAnnouncementsCard } from './alpha/entityCards';\nimport { announcementsNavItem } from './alpha/navItems';\nimport { announcementsPage } from './alpha/pages';\nimport { rootRouteRef } from './routes';\n\n/**\n * @alpha\n */\nexport default createFrontendPlugin({\n pluginId: 'announcements',\n routes: convertLegacyRouteRefs({\n root: rootRouteRef,\n }),\n extensions: [\n announcementsApiExtension,\n entityAnnouncementsCard,\n announcementsPage,\n announcementsNavItem,\n ],\n}) as FrontendPlugin;\n"],"names":[],"mappings":";;;;;;;;AA6BA,YAAe,oBAAqB,CAAA;AAAA,EAClC,QAAU,EAAA,eAAA;AAAA,EACV,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,IAAM,EAAA;AAAA,GACP,CAAA;AAAA,EACD,UAAY,EAAA;AAAA,IACV,yBAAA;AAAA,IACA,uBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA;AAEJ,CAAC,CAAA;;;;"}
@@ -27,7 +27,7 @@ function OnBehalfTeamDropdown({
27
27
  return [identity.userEntityRef, ...identity.ownershipEntityRefs];
28
28
  }, [identityApi]);
29
29
  const { entities: teams, loading: teamsLoading } = useCatalogEntities(
30
- userOwns ?? [],
30
+ userOwns,
31
31
  // refs
32
32
  "",
33
33
  // searchTerm
@@ -1 +1 @@
1
- {"version":3,"file":"OnBehalfTeamDropdown.esm.js","sources":["../../../src/components/AnnouncementForm/OnBehalfTeamDropdown.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport TextField from '@mui/material/TextField';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n useAnnouncementsTranslation,\n useCatalogEntities,\n} from '@backstage-community/plugin-announcements-react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useMemo } from 'react';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\n\ntype OnBehalfTeamDropdownProps = {\n selectedTeam: string;\n onChange: (team: string) => void;\n};\n\nfunction getTeamDisplayName(team: any): string {\n if (team.kind && team.kind.toLowerCase() === 'group') {\n return team.spec?.profile?.displayName ?? '';\n }\n return '';\n}\n\nexport default function OnBehalfTeamDropdown({\n selectedTeam,\n onChange,\n}: OnBehalfTeamDropdownProps) {\n const { t } = useAnnouncementsTranslation();\n const identityApi = useApi(identityApiRef);\n\n const { value: userOwns } = useAsync(async () => {\n const identity = await identityApi.getBackstageIdentity();\n return [identity.userEntityRef, ...identity.ownershipEntityRefs];\n }, [identityApi]);\n\n const { entities: teams, loading: teamsLoading } = useCatalogEntities(\n userOwns ?? [], // refs\n '', // searchTerm\n 25, // limit\n 'Group', // kind\n );\n\n const teamOptions = useMemo(() => {\n return teams.map(team => ({\n entityRef: stringifyEntityRef(team),\n displayName: getTeamDisplayName(team),\n }));\n }, [teams]);\n\n const selectedTeamOption = useMemo(() => {\n return teamOptions.find(team => team.entityRef === selectedTeam) || null;\n }, [teamOptions, selectedTeam]);\n\n return (\n <Autocomplete\n value={selectedTeamOption}\n onChange={(_, newValue) => {\n onChange(newValue?.entityRef || '');\n }}\n options={teamOptions}\n getOptionLabel={team => team.entityRef}\n loading={teamsLoading}\n id=\"team-dropdown-field\"\n renderOption={(props, team) => (\n <Box component=\"li\" {...props}>\n <Box sx={{ display: 'flex', flexDirection: 'column' }}>\n <Typography variant=\"body1\">{team.entityRef}</Typography>\n {team.displayName && (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {team.displayName}\n </Typography>\n )}\n </Box>\n </Box>\n )}\n renderInput={params => (\n <TextField\n {...params}\n id=\"team\"\n label={t('announcementForm.onBehalfOf')}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {teamsLoading ? (\n <CircularProgress color=\"inherit\" size={20} />\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCA,SAAS,mBAAmB,IAAmB,EAAA;AAC7C,EAAA,IAAI,KAAK,IAAQ,IAAA,IAAA,CAAK,IAAK,CAAA,WAAA,OAAkB,OAAS,EAAA;AACpD,IAAO,OAAA,IAAA,CAAK,IAAM,EAAA,OAAA,EAAS,WAAe,IAAA,EAAA;AAAA;AAE5C,EAAO,OAAA,EAAA;AACT;AAEA,SAAwB,oBAAqB,CAAA;AAAA,EAC3C,YAAA;AAAA,EACA;AACF,CAA8B,EAAA;AAC5B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,2BAA4B,EAAA;AAC1C,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EAAA,MAAM,EAAE,KAAA,EAAO,QAAS,EAAA,GAAI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,EAAA,EAAI,WAAU,IAAM,EAAA,GAAG,KACtB,EAAA,QAAA,kBAAA,IAAA,CAAC,OAAI,EAAI,EAAA,EAAE,SAAS,MAAQ,EAAA,aAAA,EAAe,UACzC,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAS,EAAA,QAAA,EAAA,IAAA,CAAK,SAAU,EAAA,CAAA;AAAA,QAC3C,IAAA,CAAK,+BACH,GAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,SAAU,EAAA,KAAA,EAAM,gBACjC,EAAA,QAAA,EAAA,IAAA,CAAK,WACR,EAAA;AAAA,OAAA,EAEJ,CACF,EAAA,CAAA;AAAA,MAEF,aAAa,CACX,MAAA,qBAAA,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACE,GAAG,MAAA;AAAA,UACJ,EAAG,EAAA,MAAA;AAAA,UACH,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,UACtC,UAAY,EAAA;AAAA,YACV,GAAG,MAAO,CAAA,UAAA;AAAA,YACV,8BAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,cAAA,YAAA,uBACE,gBAAiB,EAAA,EAAA,KAAA,EAAM,SAAU,EAAA,IAAA,EAAM,IAAI,CAC1C,GAAA,IAAA;AAAA,cACH,OAAO,UAAW,CAAA;AAAA,aACrB,EAAA;AAAA;AAEJ;AAAA;AACF;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"OnBehalfTeamDropdown.esm.js","sources":["../../../src/components/AnnouncementForm/OnBehalfTeamDropdown.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport TextField from '@mui/material/TextField';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n useAnnouncementsTranslation,\n useCatalogEntities,\n} from '@backstage-community/plugin-announcements-react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useMemo } from 'react';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\n\ntype OnBehalfTeamDropdownProps = {\n selectedTeam: string;\n onChange: (team: string) => void;\n};\n\nfunction getTeamDisplayName(team: any): string {\n if (team.kind && team.kind.toLowerCase() === 'group') {\n return team.spec?.profile?.displayName ?? '';\n }\n return '';\n}\n\nexport default function OnBehalfTeamDropdown({\n selectedTeam,\n onChange,\n}: OnBehalfTeamDropdownProps) {\n const { t } = useAnnouncementsTranslation();\n const identityApi = useApi(identityApiRef);\n\n const { value: userOwns } = useAsync(async () => {\n const identity = await identityApi.getBackstageIdentity();\n return [identity.userEntityRef, ...identity.ownershipEntityRefs];\n }, [identityApi]);\n\n const { entities: teams, loading: teamsLoading } = useCatalogEntities(\n userOwns, // refs\n '', // searchTerm\n 25, // limit\n 'Group', // kind\n );\n\n const teamOptions = useMemo(() => {\n return teams.map(team => ({\n entityRef: stringifyEntityRef(team),\n displayName: getTeamDisplayName(team),\n }));\n }, [teams]);\n\n const selectedTeamOption = useMemo(() => {\n return teamOptions.find(team => team.entityRef === selectedTeam) || null;\n }, [teamOptions, selectedTeam]);\n\n return (\n <Autocomplete\n value={selectedTeamOption}\n onChange={(_, newValue) => {\n onChange(newValue?.entityRef || '');\n }}\n options={teamOptions}\n getOptionLabel={team => team.entityRef}\n loading={teamsLoading}\n id=\"team-dropdown-field\"\n renderOption={(props, team) => (\n <Box component=\"li\" {...props}>\n <Box sx={{ display: 'flex', flexDirection: 'column' }}>\n <Typography variant=\"body1\">{team.entityRef}</Typography>\n {team.displayName && (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {team.displayName}\n </Typography>\n )}\n </Box>\n </Box>\n )}\n renderInput={params => (\n <TextField\n {...params}\n id=\"team\"\n label={t('announcementForm.onBehalfOf')}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {teamsLoading ? (\n <CircularProgress color=\"inherit\" size={20} />\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCA,SAAS,mBAAmB,IAAmB,EAAA;AAC7C,EAAA,IAAI,KAAK,IAAQ,IAAA,IAAA,CAAK,IAAK,CAAA,WAAA,OAAkB,OAAS,EAAA;AACpD,IAAO,OAAA,IAAA,CAAK,IAAM,EAAA,OAAA,EAAS,WAAe,IAAA,EAAA;AAAA;AAE5C,EAAO,OAAA,EAAA;AACT;AAEA,SAAwB,oBAAqB,CAAA;AAAA,EAC3C,YAAA;AAAA,EACA;AACF,CAA8B,EAAA;AAC5B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,2BAA4B,EAAA;AAC1C,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EAAA,MAAM,EAAE,KAAA,EAAO,QAAS,EAAA,GAAI,SAAS,YAAY;AAC/C,IAAM,MAAA,QAAA,GAAW,MAAM,WAAA,CAAY,oBAAqB,EAAA;AACxD,IAAA,OAAO,CAAC,QAAA,CAAS,aAAe,EAAA,GAAG,SAAS,mBAAmB,CAAA;AAAA,GACjE,EAAG,CAAC,WAAW,CAAC,CAAA;AAEhB,EAAA,MAAM,EAAE,QAAA,EAAU,KAAO,EAAA,OAAA,EAAS,cAAiB,GAAA,kBAAA;AAAA,IACjD,QAAA;AAAA;AAAA,IACA,EAAA;AAAA;AAAA,IACA,EAAA;AAAA;AAAA,IACA;AAAA;AAAA,GACF;AAEA,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AA,CAAK,WACR,EAAA;AAAA,OAAA,EAEJ,CACF,EAAA,CAAA;AAAA,MAEF,aAAa,CACX,MAAA,qBAAA,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACE,GAAG,MAAA;AAAA,UACJ,EAAG,EAAA,MAAA;AAAA,UACH,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,UACtC,UAAY,EAAA;AAAA,YACV,GAAG,MAAO,CAAA,UAAA;AAAA,YACV,8BAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,cAAA,YAAA,uBACE,gBAAiB,EAAA,EAAA,KAAA,EAAM,SAAU,EAAA,IAAA,EAAM,IAAI,CAC1C,GAAA,IAAA;AAAA,cACH,OAAO,UAAW,CAAA;AAAA,aACrB,EAAA;AAAA;AAEJ;AAAA;AACF;AAAA,GAEJ;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-announcements",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "main": "./dist/index.esm.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@backstage-community/plugin-announcements-common": "^0.7.0",
65
- "@backstage-community/plugin-announcements-react": "^0.9.0",
65
+ "@backstage-community/plugin-announcements-react": "^0.9.1",
66
66
  "@backstage/catalog-model": "^1.7.5",
67
67
  "@backstage/core-app-api": "^1.18.0",
68
68
  "@backstage/core-compat-api": "^0.4.4",