Open antoniomuso opened 1 year ago
Would make more sense if Backstage had some sort of notification support. Sure, this could be done now using the broker and let app developers handle it themselves and later, if the notification support comes along, extend also to it.
On the other thought, why should this only be limited to users? I think tagging groups would also be a nice thing.
Don't know how hard it is to implement to be honest, but if you want to give it a try, you are most welcome to do so :) If you don't have time for that, I may take a look at some point.
How does this sound?
LGTM! I am on vacation now. When I come back, I will take a look!
Hey @antoniomuso !
Do you have any new thoughts about this? I would really like to have something like this in place especially when the new notifications plugin is under way in the backstage project. Do you have any ideas if there's ready made UI component to show suggestions for tagging? In the backend side I don't think this is very hard to accomplish
Hi @drodil, I didn't research on that. I don't think some UI component exists, but it is simple to handle using Entity catalog Api useApi(catalogApiRef)
using the .queryEntities(..)
method.
Yeah @antoniomuso it's simple to fetch the users, only problem is how it could work in the UI like it does for example here on GitHub when mentioning someone. Maybe it also requires that backend has to parse the user entities from the content to add the tags.
This also highly relates to #61 because without notifications there's not much sense to tag anyone.
With API, you can query and get all the users starting with characters you pass as input.
/**
* Gets paginated entities from the catalog.
*
* @remarks
*
* @example
*
* ```
* const response = await catalogClient.queryEntities({
* filter: [{ kind: 'group' }],
* limit: 20,
* fullTextFilter: {
* term: 'A',
* }
* orderFields: { field: 'metadata.name' order: 'asc' },
* });
* ```
*
* this will match all entities of type group having a name starting
* with 'A', ordered by name ascending.
*
* The response will contain a maximum of 20 entities. In case
* more than 20 entities exist, the response will contain a nextCursor
* property that can be used to fetch the next batch of entities.
*
* ```
* const secondBatchResponse = await catalogClient
* .queryEntities({ cursor: response.nextCursor });
* ```
*
* secondBatchResponse will contain the next batch of (maximum) 20 entities,
* together with a prevCursor property, useful to fetch the previous batch.
*
* @public
*
* @param request - Request parameters
* @param options - Additional options
*/
queryEntities(request?: QueryEntitiesRequest, options?: CatalogRequestOptions): Promise<QueryEntitiesResponse>;
In my instance, I had implemented the notification system thanks to the Action events.
Hi @drodil, I can see the react-mde which is used for MarkdownEditor now has support to load suggestions which will trigger on typing specified character (@), though it do not provide much options for UI customization but solves our need, below is quick try out screenshot.
Need your views on saving it to DB or just get it from content and notify them ?
I think it would be enough to just get it from the content and introduce a function for getting an array of entity refs starting with @
from the content in the qeta-common
package so that it can be used in both the frontend and backend. It requires a lot more effort to save them to own table separately and then update them if the content changes. Also, there needs to be support to render links to the entities in content for these mentions (probably best to use the EntityRefLink
component if possible). And, additionally we need support for the events service as mentioned in the original description of this issue. But other than that, I think the react-mde
way is the easiest and a good way forward.
Are you using the queryEntities
to find the users/groups like @antoniomuso described in one of the comments?
yes, using catalogApi.queryEntities.
Agree to not save in DB as not much use of it other than notification, one use case I can see is filtering question which has logged in user mentioned.
Yeah, that could be one use case. If it's not too much trouble to save those in DB, maybe we should do that then? Anyways we need to parse the entities from the content. And what comes to the filtering, maybe there could be a new checkbox filter related to me
or something that would search for questions with mentions to current users ownershipEntityRefs
; just to get also the user's groups included in the filter. But again, the filtering can be done later.
I would like to work on this, please check below things and let me know if missing anything:
Awesome, sounds like a plan. Some thoughts:
question_mentions
and answer_mentions
. Comments are currently only using plain text field so there's no possibility to mention people in comments. Should this be changed also to use the react-mde, WDYT? This could also be done separately from thisOtherwise, it looks like it's ready for implementation! Thanks a lot again!
Oh, another thing to point number 7: I think @antoniomuso also requested an event using the eventsService
from mentions so that would be required too apart from the notification. Minor thing to add once the whole thing is working but something to keep in mind :)
Sure @drodil, I started working on it.
Hi, I'm just worried it's not possible to tag groups and distinguish them from users if you let the default namespace and entity kind out of the mention. I hope it would work for groups as well, WDYT?
Hi @kedaroh-bh , any progress on this?
What do you think about the feature of tagging people?
USE CASE: Typing a Question/Answer you can use
@persone
with suggestions to tag a person. The tag could be an event in EventBroker. Currently, there are these action kinds:We can add to these the
tag
Action! WDYT?