Code Monkey home page Code Monkey logo

backstage-plugin-announcements's Introduction

Hi there 👋

I'm an experienced Backend Engineer, currently working for Grafana Labs in Stockholm, Sweden.

backstage-plugin-announcements's People

Contributors

ernestocid avatar github-actions[bot] avatar gomezcapg avatar k-phoen avatar punkle avatar velocibear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

backstage-plugin-announcements's Issues

feat: sticky announcements

Instead of checking if the user has seen the announcement, some announcements could be made sticky to be shown every time.

feat: integrate with alert-api

Integrating the announcements with the alert-api by Backstage (core-plugin-api) would allow to display them at any view. This would not require a "home" page with a provided announcement widget to be used.

Override styles?

How can I override styles of the Announcements plugin? Is there any way? Because right now it is only picking the primary color to display the header.

Announcement expiration

Hi @K-Phoen, first thanks for your excellent work with this plugin, this is very useful for broadcast information along an organization that uses backstage as devcenter. My suggestion here is creating a way to have an expiration date on announcements, so after some due date this will be expired and won't be displayed anymore

Add Announcement read permissions and (possibly) attach announcementCreatePermission to the CategoriesPage element

Hi!

thanks for the awesome plugin as it'll save us a considerable amount of time.

However, I am missing an announcementReadPermission, a read permission to the Announcements.
This would be helpful preventing guest users from creating/updating/deleting announcemnts, while still being able to view them.

Also, even if a user is not able to create new announcements, they would still be able to create categories. Would it be possible to link the announcementCreatePermission to the CategoriesPage element?
Another possible solution would be to expose the CategoriesPage so that the users of your plugin could attach any permissions they judge interesting...

Please let me know if I can help in any way! :)

Announcement Banner in absolute position

At our company, we are trying to integrate this plugin into our Backstage instance. Overall, it looks really nice, thanks for the work!

However, we found something that might be interesting to others (or maybe am I misunderstanding how it works?). We wanted to use the NewAnnouncementBanner as a kind of alert to be shown in every page. However, we expected this element to be like the AlertDisplay provided by Backstage and not a component that moves down the whole page so it can fit on the top.

After making a couple changes in the css using the Firefox inspector (basically removing the "relative" property and adjusting spacing), I got something like this:
Screenshot from 2023-02-01 14-03-17

If you think this is something more people would like to have, I can create a PR with a new component and explain how it must be placed.

bug: attempting to create an announcement without a body throws 500 error

Summary

A user will receive a 500 error when attempting to create an announcement with an empty body.

Details

image
Request failed with status 500 insert into "announcements" ("body", "created_at", "excerpt", "id", "publisher", "title") values ($1, $2, $3, $4, $5, $6) - null value in column "body" of relation "announcements" violates not-null constraint dd=[object Object] type=errorHandler pz=unknown env=unknown stage=unknown cluster=unknown length=308 name=error severity=ERROR code=23502 detail=Failing row contains (ef6e1602-513b-4a9d-aece-28b83416f73b, user:default/user, test, test, null, 2023-06-12 21:46:52.768+00). hint=undefined position=undefined internalPosition=undefined internalQuery=undefined where=undefined schema=public table=announcements column=body dataType=undefined constraint=undefined file=execMain.c line=1883 routine=ExecConstraints stack=error: insert into "announcements" ("body", "created_at", "excerpt", "id", "publisher", "title") values ($1, $2, $3, $4, $5, $6) - null value in column "body" of relation "announcements" violates not-null constraint

Solutions

  1. Make the field required
  2. Fix to allow for an empty body

Ability to disable create / delete functionality

Hi there, thanks for creating this awesome plugin! Love that you can create announcements from the app itself. On that note, I was wondering if there was any way to disable the create / delete functionality so not every user can add or delete announcements.

Latest version no longer works due to authorize error

Upgrading to the latest version I now get this error: backstage error Cannot read properties of undefined (reading 'authorize') type=errorHandler stack=TypeError: Cannot read properties of undefined (reading 'authorize')

broken on: "@k-phoen/backstage-plugin-announcements-backend": "^0.1.3",

working on: "@k-phoen/backstage-plugin-announcements-backend": "^0.0.5",

feat: announcement types

Could there be different announcement types available like info, warning and error that would then be rendered differently to catch more attention from the users?

feat: allow specifying max announcements to show

Currently only latest announcement is shown in the banner, could this be made configurable for the user to show multiple banners? Many times there can be several banners that should be shown at the same time.

[Error] After update Backstage v1.20.3

After updating the Backstage version, we are receiving the following error after running yarn tsc:

packages/backend/src/plugins/announcements.ts:12:5 - error TS2322: Type 'DatabaseService' is not assignable to type 'PluginDatabaseManager'.
  The types returned by 'getClient()' are incompatible between these types.
    Type 'Promise<import("/home/padupe/acme/backstage/node_modules/knex/types/index").Knex<any, any[]>>' is not assignable to type 'Promise<import("/home/padupe/acme/backstage/node_modules/@k-phoen/backstage-plugin-announcements-backend/node_modules/knex/types/index").Knex<any, any[]>>'.
      Type 'import("/home/padupe/acme/backstage/node_modules/knex/types/index").Knex<any, any[]>' is not assignable to type 'import("/home/padupe/acme/backstage/node_modules/@k-phoen/backstage-plugin-announcements-backend/node_modules/knex/types/index").Knex<any, any[]>'.
        The types of 'raw(...).transacting' are incompatible between these types.
          Type '(trx: import("/home/padupe/acme/backstage/node_modules/knex/types/index").Knex.Transaction<any, any[]>) => import("/home/padupe/acme/backstage/node_modules/knex/types/index").Knex.Raw<any>' is not assignable to type '(trx: import("/home/padupe/acme/backstage/node_modules/@k-phoen/backstage-plugin-announcements-backend/node_modules/knex/types/index").Knex.Transaction<any, any[]>) => import("/home/padupe/acme/backstage/node_modules/@k-phoen/backstage-plugin-announcements-backend/node_modules/knex/types/index").Knex.R...'.
            Types of parameters 'trx' and 'trx' are incompatible.
              Type 'Transaction<any, any[]>' is missing the following properties from type 'Transaction<any, any[]>': comment, except, havingNull, havingNotNull, updateFrom

12     database,
       ~~~~~~~~

  node_modules/@k-phoen/backstage-plugin-announcements-backend/dist/index.d.ts:75:5
    75     database: PluginDatabaseManager;
           ~~~~~~~~
    The expected type comes from property 'database' which is declared here on type 'AnnouncementsContextOptions'


Found 1 error in packages/backend/src/plugins/announcements.ts:12

error Command failed with exit code 2.

More Info

O.S: Ubuntu 22.04
Backstage Version: 1.20.3
Node Version: 18.16.1

To reproduce

  1. Update Backstage Version
yarn backstage-cli versions:bump
  1. Update Announcements Version
yarn backstage-cli versions:bump --pattern '@k-phoen/backstage-plugin-announcements-backend'

PSC @claudinei-ferreira

Controlled access to /announcements route path

Hi,
We are trying to integrate this plugin with our backstage announcement. WE want to keep the access to /announcements route path limited to only certain team (kind:group).
Has anyone tried this or any suggestion on how this can be achieved?

setup documentation outdated

Hello, the current documentation is not valid with this plugin.

Specifically, the setup markdown is outdated and has no examples of how to integrate with PermissionEvaluator. (Truthfully I expected this integration to be optional, as the permission plugin is not published and marked experimental)

There doesn't appear to be any documentation for the permission plugin itself either, so there's very little in the way of usable documentation for the announcements plugin at this time.

Please update the documentation with a working example. Thank you!

Submit Announcement should redirect to AnnouncementsPage

Currently the onSubmit only displays an alert. As a user this may be confusing and cause a duplicate submission. It would be better if the onSubmit redirected to the Announcements page to show the user their card has been added.

feat: Convert the display name value from name to title

I would like to ask the plug-in developer to change the displayed user field from name to title? Because the name value we are using now is the employee's job number, we cannot see the employee's name. And it also supports using title as the display name in backstage.

feat: metrics and stats on announcements

Would it be possible to get some metrics like total views on an announcement? That would really help to know how "successful" an announcement is.

Maybe showing X views at the bottom of the announcement

React Router >6.3 - Error: useRoutes() may be used only in the context of a <Router> component

Thanks for the great plugin!

However, with updated dependencies "/announcements" crashes.

Reproduction steps

  1. Update dependencies, e.g. with "react-router-dom": "^6.3.0" -> installs 6.7
  2. Navigate to "/announcements"
  3. Get an error page
Error
useRoutes() may be used only in the context of a <Router> component.
Call Stack
 invariant
  node_modules/react-router/index.js:71:20
 useRoutes
  node_modules/react-router/index.js:675:35
 Routes
  node_modules/react-router/index.js:922:10
 renderWithHooks
  node_modules/react-dom/cjs/react-dom.development.js:14985:18
 mountIndeterminateComponent
  node_modules/react-dom/cjs/react-dom.development.js:17811:13
 beginWork
  node_modules/react-dom/cjs/react-dom.development.js:19049:16
 HTMLUnknownElement.callCallback
  node_modules/react-dom/cjs/react-dom.development.js:3945:14
 Object.invokeGuardedCallbackDev
  node_modules/react-dom/cjs/react-dom.development.js:3994:16
 invokeGuardedCallback
  node_modules/react-dom/cjs/react-dom.development.js:4056:31
 beginWork$1
  node_modules/react-dom/cjs/react-dom.development.js:23959:7

useRoutes() may be used only in the context of a <Router> component.

Workaround

In root package.json, add a resolution for react-router-dom:

{
  "resolutions": {
      "@types/react": "^17",
      "@types/react-dom": "^17",
      "@backstage/core-components": "^0.12.3",
      "@backstage/backend-common": "^0.18.1",
      "react-router-dom": "~6.3.0"
    }
  }

Suspected cause

import { Routes, Route } from 'react-router'; in Router.tsx should be import { Routes, Route } from 'react-router-dom';

Announcements search issue

Hi,

I have a problem with announcements search integration. It seems that search factory is not able to build index cause by lacking of API endpoint exposed by router.

I had to add this code to make it work:

export default async function createPlugin({
  logger,
  database,
  permissions,
}: PluginEnvironment): Promise<Router> {
  const announcementsContext = await buildAnnouncementsContext({
    logger: logger,
    database: database,
    permissions: permissions
  });

  const router = await createRouter(announcementsContext);

  // TODO: seems that there is an error in plugin
  router.get(
    '/',
    async (
      req,
      res,
    ) => {
        const list = await announcementsContext.persistenceContext.announcementsStore.announcements({});
        return res.json(list.results);
    },
  );
  return router;
}

plugin version: "@k-phoen/backstage-plugin-announcements-backend": "^0.2.0",

Question - Consider additional maintainers?

I've been watching this repository for a while now and believe it has a lot of potential to impact Backstage.

There are many open issues and PRs pending review that include either good ideas or nice feature enhancements with little response from the maintainer.

What do you think about adding additional maintainers? I prefer to leverage and contribute to this repo instead of building our own internally.

Bug: AnnouncementsCard link only working on title

When clicking an annoucement in the AnnouncementsCard, then it works only when clicking directly on the title - but the cursor changes already earlier to a pointer, as well as the background color changes to grey, indicating that it can be clicked and this click triggers nothing.

Announcement collator failing

Collating documents for announcements failed: ResponseError: Request failed with 404 Error type=plugin documentType=announcements

Stacktrace:

at async AnnouncementsClient.announcements (node_modules/@k-phoen/backstage-plugin-announcements-backend/dist/index.cjs.js:151:12)
[1]     at async AnnouncementCollatorFactory.execute (node_modules/@k-phoen/backstage-plugin-announcements-backend/dist/index.cjs.js:171:21)

Package versions
"@k-phoen/backstage-plugin-announcements": "^0.1.0",
"@k-phoen/backstage-plugin-announcements-backend": "^0.2.0",

feat: restrict visibility of announcement per URL

Feature would be to be able to set URL where different announcements are shown. For example one could specify /catalog/* for an announcement and then that announcement would only be shown when the user navigates to any catalog page. This would allow users to create announcements that are only for specific parts of the application.

Broadcast announcements through other communication tools

It would be nice to broadcast the announcement created through this plugin to other communication tools like email, google spaces, and Slack channels.
My suggestion is to use backstage backend events to publish an event when an announcement is created. Then an event subscriber would handle the integration with the other communication tools.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.