noi-techpark / it.bz.opendatahub.databrowser

Explore and navigate through Open Data you need to build your next service.
https://databrowser.opendatahub.com
GNU Affero General Public License v3.0
8 stars 7 forks source link

As a Content Editor I want a "Push" button, to send push notification about specific contents I'm managing. #534

Closed sseppi closed 1 month ago

sseppi commented 4 months ago

In the old Data Browser there was the possibility to send push notification about specific contents.

Image

The first real use case we have is the Push of notification about NOI News to the NOI App.

In this issue we should define and implement a generic solution, to allows us to activate this push functionality without the need to riprogramm it every time there is a new app or content that should be pushd or notified.

Open Questions

sseppi commented 4 months ago

@mrabans @RudiThoeni I've created this issue and we need to start defining how should be the generic solution. Are there other open questions that should be taken into consideration for this issue?

mrabans commented 4 months ago

@sseppi probably we have to discuss this in detail to come up with a future proof solution.

RudiThoeni commented 4 months ago

We discussed about the push functionality and the idea was to have one generic Push Endpoint where this informations has to be passed:

On Publisher Level the Push Functionality has to be activated. We thought about activating it on Dataset type.

The information (Timestap when, PushId etc...) has to ba saved on data level and displayed to the user somewhere, so he knows that a push was already sent etc....

RudiThoeni commented 3 months ago

We had a discussion where we defined:

Some UX questions emerged

pkritzinger commented 3 months ago

@RudiThoeni what do you mean with

What if more Push buttons are there (Button with Dropdown)

Could you pls specify the usecase?

sseppi commented 3 months ago

Hi @pkritzinger

in case we have two different "publishers" that allows to send push notification at two different apps (e.g. NOI App and suedtirol.info), we need to allow the user to choose where he wants to push the notification.

We thought that one possible way would be to have a dropdown menu or a checkbox that allows the user to select the applications he wants to send the push to.

Did I clarified better what we ment?

@RudiThoeni what do you mean with

What if more Push buttons are there (Button with Dropdown)

Could you pls specify the usecase?

pkritzinger commented 3 months ago

@sseppi now it's crystal clear, thanks :)

pkritzinger commented 3 months ago

@sseppi https://www.figma.com/file/DmuP6Dbv5LzkCNOXrDnWIL/2023-2024?type=design&node-id=2261%3A1911&mode=design&t=48wZalKkYcHhlrIg-1

RudiThoeni commented 3 months ago

Hi @gappc @sseppi I worked on the requested changes. Api Side: (https://github.com/noi-techpark/odh-api-core/pull/420)

Databrowser Side: (https://github.com/noi-techpark/it.bz.opendatahub.databrowser/pull/553)

When bot of this tasks are completed everything is ready to add the implementation for the push button

gappc commented 3 months ago

Hey @RudiThoeni, I saw your PR. Although I didn't look into the details, it looks already very nice :+1:

From the screenshot I think I know where you got stuck: pathparam ;)

Lets schedule a meeting and maybe do some pair programming, so we can exchange ideas and possible solutions.

sseppi commented 3 months ago

@gappc

As you can see from the previous comment of Rudi, he prepared everything is needed to implement the "Push" button. He has only one question, he would like to discuss with you.

From my point of view, the next steps are:

As agreed during the meeting, since the backend isn't still ready now, we implement only the logic to send the push, not the one to program it. I will create a dedicated issue to the Program Push functionality (#554 ).

RudiThoeni commented 2 months ago

Hi @sseppi With the great help from @gappc now it is possible to add multiple push information to each publisher in the section "PublishConfig"

on test i added now for the publishers idm-marketplace [https://api.tourism.testingmachine.eu/v1/PushData/{Id}/{_Meta.Type}/idm-marketplace] noi-communityapp [https://api.tourism.testingmachine.eu/v1/PushData/{Id}/{_Meta.Type}/noi-communityapp] (At the moment lets not use this call because it sends a push to all app users of the community app ;) This is a POST Endpoint

To perform the push the User must have the right permissions otherwise 403 is returned

If all goes well the api call returns a http 200 with a Dictionary<string, PushResponse>

    public class PushResponse
    {
        public string Id { get; set; }
        public string Publisher { get; set; }
        public DateTime Date { get; set; }
        public dynamic Result { get; set; }
    }

To be discussed: What we display when the push is done I will add some test cases where no effective push is created.... I noticed also a small bug (on a already configured PublisherConfig/PathParam deleting a PublisherConfig/PathParam inside the table only works if first i add a new one....) (write it down here for me so i don't forget it)

Will write here when everything is ready

sseppi commented 2 months ago

Hi @RudiThoeni and @gappc ,

thank you for the great work!

To be discussed: What we display when the push is done

If we have it, I think that ID and timestamp of the push could be useful, to easily debug in case of problems.

What do you think? Best Stefano

RudiThoeni commented 2 months ago

I created a Table where all push infos are stored.... and an api where all pushinfo can be retrieved.... A push info has as fixed Values an Id, Timestamp, Publisher, Result.Success If we provide the Id and the Success it should be enough, every additional info could be retrieved with the Push Api Info (which could be displayed via databrowser) --> cool we see that all begins working together )

RudiThoeni commented 2 months ago

@gappc now everything is ready to implement the button As mentioned before on idm-marketplace, noi-communityapp there are pushconfigs defined.

The endpoint the button should finally reach is POST https://api.tourism.testingmachine.eu/v1/PushData/{Id}/{Type}/{Publisher}

I added some mocks to the endpoint so we can test, it does provide this responses If all is working i will activate the effective pushes :)

{
    "idm-marketplace": {
        "Id": "f8c691e7-ac2b-4c92-8ed6-9e5c9036fde7",
        "Publisher": "idm-marketplace",
        "Date": "2024-04-05T14:18:19.5313719+02:00",
        "Result": {
            "Response": "This is a mockup response",
            "HttpStatusCode": "OK",
            "Service": "idm-marketplace",
            "Success": true
        },
        "PushObject": {
            "Id": "smgpoifad01289740e1d2f58dc1aa29288bb33",
            "Type": "odhactivitypoi"
        }
    }
}

{
    "noi-communityapp": {
        "Id": "69bad1f0-d9de-4b25-be5c-9484441e5021",
        "Publisher": "noi-communityapp",
        "Date": "2024-04-05T14:12:53.5357176+02:00",
        "Result": {
            "Messages": 1,
            "Success": true,
            "Response": "This is a mockup response",
            "Error": ""
        },
        "PushObject": {
            "Id": "smgpoifad01289740e1d2f58dc1aa29288bb33",
            "Type": "odhactivitypoi"
        }
    }
}

The Button should show only if the push was done (Result.Success true/false) and maybe provide the (Id) so that if something went wrong it could all be looked into the PushResults Api (i still have to create the view in the databrowser for this api).

gappc commented 2 months ago

@sseppi can we close this issue?

sseppi commented 2 months ago

@gappc I will test the feature together with the client and, in case of positive feedback, close it.