@backstage-community/plugin-announcements 0.1.3 → 0.1.5
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,24 @@
|
|
|
1
1
|
# @backstage-community/plugin-announcements
|
|
2
2
|
|
|
3
|
+
## 0.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1909e4d: Added announcement ID to the useAsync dependency array in the AnnouncementPage component.
|
|
8
|
+
|
|
9
|
+
This fixes an issue where the AnnouncementPage component did not re-fetch the announcement details when the ID in the routing path changed. As a result the user who was on the AnnouncementPage couldn't see the details of the next announcement they accessed, e.g. from the search dialogue.
|
|
10
|
+
|
|
11
|
+
- ef67a29: Fixed bug in AnnouncementPage component where subheader spacing was missing
|
|
12
|
+
|
|
13
|
+
## 0.1.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- e282a2d: Minor improvements to README documentation
|
|
18
|
+
- Updated dependencies [e282a2d]
|
|
19
|
+
- @backstage-community/plugin-announcements-common@0.1.3
|
|
20
|
+
- @backstage-community/plugin-announcements-react@0.1.3
|
|
21
|
+
|
|
3
22
|
## 0.1.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
# announcements
|
|
2
2
|
|
|
3
|
-
The frontend for the Announcements plugin.
|
|
3
|
+
The frontend for the Announcements plugin.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
This plugin provides:
|
|
4
8
|
|
|
5
|
-
- a component to display the latest announcements, for example on a homepage
|
|
6
9
|
- pages to list, view, create, edit and delete announcements
|
|
10
|
+
- a component to display the latest announcements, for example on a homepage
|
|
11
|
+
- a component to display the latest announcement as a banner, if there is one
|
|
12
|
+
- an admin portal to manage announcements
|
|
7
13
|
|
|
8
14
|
## Installation
|
|
9
15
|
|
|
@@ -7,7 +7,7 @@ import { parseEntityRef } from '@backstage/catalog-model';
|
|
|
7
7
|
import { entityRouteRef, EntityPeekAheadPopover, EntityDisplayName } from '@backstage/plugin-catalog-react';
|
|
8
8
|
import { announcementViewRouteRef, rootRouteRef } from '../../routes.esm.js';
|
|
9
9
|
import { announcementsApiRef } from '@backstage-community/plugin-announcements-react';
|
|
10
|
-
import { Grid } from '@material-ui/core';
|
|
10
|
+
import { Grid, Typography } from '@material-ui/core';
|
|
11
11
|
import { Alert } from '@material-ui/lab';
|
|
12
12
|
|
|
13
13
|
const AnnouncementDetails = ({
|
|
@@ -20,7 +20,7 @@ const AnnouncementDetails = ({
|
|
|
20
20
|
title: "Back to announcements"
|
|
21
21
|
};
|
|
22
22
|
const publisherRef = parseEntityRef(announcement.publisher);
|
|
23
|
-
const subHeader = /* @__PURE__ */ React__default.createElement(
|
|
23
|
+
const subHeader = /* @__PURE__ */ React__default.createElement(Typography, null, "By", " ", /* @__PURE__ */ React__default.createElement(EntityPeekAheadPopover, { entityRef: announcement.publisher }, /* @__PURE__ */ React__default.createElement(Link, { to: entityLink(publisherRef) }, /* @__PURE__ */ React__default.createElement(EntityDisplayName, { entityRef: announcement.publisher, hideIcon: true }))), ", ", DateTime.fromISO(announcement.created_at).toRelative());
|
|
24
24
|
return /* @__PURE__ */ React__default.createElement(
|
|
25
25
|
InfoCard,
|
|
26
26
|
{
|
|
@@ -35,7 +35,8 @@ const AnnouncementPage = (props) => {
|
|
|
35
35
|
const announcementsApi = useApi(announcementsApiRef);
|
|
36
36
|
const { id } = useRouteRefParams(announcementViewRouteRef);
|
|
37
37
|
const { value, loading, error } = useAsync(
|
|
38
|
-
async () => announcementsApi.announcementByID(id)
|
|
38
|
+
async () => announcementsApi.announcementByID(id),
|
|
39
|
+
[id]
|
|
39
40
|
);
|
|
40
41
|
let title = props.title;
|
|
41
42
|
let content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnouncementPage.esm.js","sources":["../../../src/components/AnnouncementPage/AnnouncementPage.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 React, { ReactNode } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { DateTime } from 'luxon';\nimport {\n Progress,\n Page,\n Header,\n Content,\n MarkdownContent,\n InfoCard,\n Link,\n} from '@backstage/core-components';\nimport {\n useApi,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport {\n EntityDisplayName,\n EntityPeekAheadPopover,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { announcementViewRouteRef, rootRouteRef } from '../../routes';\nimport { announcementsApiRef } from '@backstage-community/plugin-announcements-react';\nimport { Announcement } from '@backstage-community/plugin-announcements-common';\nimport { Grid } from '@material-ui/core';\nimport { Alert } from '@material-ui/lab';\n\nconst AnnouncementDetails = ({\n announcement,\n}: {\n announcement: Announcement;\n}) => {\n const announcementsLink = useRouteRef(rootRouteRef);\n const entityLink = useRouteRef(entityRouteRef);\n const deepLink = {\n link: announcementsLink(),\n title: 'Back to announcements',\n };\n\n const publisherRef = parseEntityRef(announcement.publisher);\n const subHeader = (\n
|
|
1
|
+
{"version":3,"file":"AnnouncementPage.esm.js","sources":["../../../src/components/AnnouncementPage/AnnouncementPage.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 React, { ReactNode } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { DateTime } from 'luxon';\nimport {\n Progress,\n Page,\n Header,\n Content,\n MarkdownContent,\n InfoCard,\n Link,\n} from '@backstage/core-components';\nimport {\n useApi,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport {\n EntityDisplayName,\n EntityPeekAheadPopover,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { announcementViewRouteRef, rootRouteRef } from '../../routes';\nimport { announcementsApiRef } from '@backstage-community/plugin-announcements-react';\nimport { Announcement } from '@backstage-community/plugin-announcements-common';\nimport { Grid, Typography } from '@material-ui/core';\nimport { Alert } from '@material-ui/lab';\n\nconst AnnouncementDetails = ({\n announcement,\n}: {\n announcement: Announcement;\n}) => {\n const announcementsLink = useRouteRef(rootRouteRef);\n const entityLink = useRouteRef(entityRouteRef);\n const deepLink = {\n link: announcementsLink(),\n title: 'Back to announcements',\n };\n\n const publisherRef = parseEntityRef(announcement.publisher);\n const subHeader = (\n <Typography>\n By{' '}\n <EntityPeekAheadPopover entityRef={announcement.publisher}>\n <Link to={entityLink(publisherRef)}>\n <EntityDisplayName entityRef={announcement.publisher} hideIcon />\n </Link>\n </EntityPeekAheadPopover>\n , {DateTime.fromISO(announcement.created_at).toRelative()}\n </Typography>\n );\n\n return (\n <InfoCard\n title={announcement.title}\n subheader={subHeader}\n deepLink={deepLink}\n >\n <MarkdownContent content={announcement.body} />\n </InfoCard>\n );\n};\n\ntype AnnouncementPageProps = {\n themeId: string;\n title: string;\n subtitle?: ReactNode;\n};\n\nexport const AnnouncementPage = (props: AnnouncementPageProps) => {\n const announcementsApi = useApi(announcementsApiRef);\n const { id } = useRouteRefParams(announcementViewRouteRef);\n const { value, loading, error } = useAsync(\n async () => announcementsApi.announcementByID(id),\n [id],\n );\n\n let title = props.title;\n let content: React.ReactNode;\n\n if (loading) {\n content = <Progress />;\n } else if (error) {\n content = <Alert severity=\"error\">{error.message}</Alert>;\n } else {\n title = `${value!.title} – ${title}`;\n content = <AnnouncementDetails announcement={value!} />;\n\n const lastSeen = announcementsApi.lastSeenDate();\n const announcementCreatedAt = DateTime.fromISO(value!.created_at);\n\n if (announcementCreatedAt > lastSeen) {\n announcementsApi.markLastSeenDate(announcementCreatedAt);\n }\n }\n\n return (\n <Page themeId={props.themeId}>\n <Header title={title} subtitle={props.subtitle} />\n\n <Content>\n <Grid container justifyContent=\"center\" alignItems=\"center\">\n <Grid item sm={6}>\n {content}\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,sBAAsB,CAAC;AAAA,EAC3B;AACF,CAEM,KAAA;AACJ,EAAM,MAAA,iBAAA,GAAoB,YAAY,YAAY,CAAA;AAClD,EAAM,MAAA,UAAA,GAAa,YAAY,cAAc,CAAA;AAC7C,EAAA,MAAM,QAAW,GAAA;AAAA,IACf,MAAM,iBAAkB,EAAA;AAAA,IACxB,KAAO,EAAA;AAAA,GACT;AAEA,EAAM,MAAA,YAAA,GAAe,cAAe,CAAA,YAAA,CAAa,SAAS,CAAA;AAC1D,EAAA,MAAM,SACJ,mBAAAA,cAAA,CAAA,aAAA,CAAC,UAAW,EAAA,IAAA,EAAA,IAAA,EACP,qBACFA,cAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAuB,SAAW,EAAA,YAAA,CAAa,SAC9C,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAI,WAAW,YAAY,CAAA,EAAA,kBAC9BA,cAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,SAAW,EAAA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,KAAQ,EAAA,CAAA;AAErD,IAAM,MAAA,QAAA,GAAW,iBAAiB,YAAa,EAAA;AAC/C,IAAA,MAAM,qBAAwB,GAAA,QAAA,CAAS,OAAQ,CAAA,KAAA,CAAO,UAAU,CAAA;AAEhE,IAAA,IAAI,wBAAwB,QAAU,EAAA;AACpC,MAAA,gBAAA,CAAiB,iBAAiB,qBAAqB,CAAA;AAAA;AACzD;AAGF,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAS,EAAA,KAAA,CAAM,OACnB,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAc,QAAU,EAAA,KAAA,CAAM,QAAU,EAAA,CAAA,+CAE/C,OACC,EAAA,IAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,cAAA,EAAe,QAAS,EAAA,UAAA,EAAW,4BAChDA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,CAAA,EAAA,EACZ,OACH,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-announcements",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"main": "./dist/index.esm.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"postpack": "backstage-cli package postpack"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@backstage-community/plugin-announcements-common": "^0.1.
|
|
62
|
-
"@backstage-community/plugin-announcements-react": "^0.1.
|
|
61
|
+
"@backstage-community/plugin-announcements-common": "^0.1.3",
|
|
62
|
+
"@backstage-community/plugin-announcements-react": "^0.1.3",
|
|
63
63
|
"@backstage/catalog-model": "^1.7.2",
|
|
64
64
|
"@backstage/core-app-api": "^1.15.3",
|
|
65
65
|
"@backstage/core-compat-api": "^0.3.4",
|