server icon indicating copy to clipboard operation
server copied to clipboard

Dashboard endpoint to list widgets

Open PVince81 opened this issue 3 years ago • 18 comments

There is currently no way for clients to get information on the widgets right now.

  • [x] add separate endpoint for the list of widgets
  • [x] switch icon from using classes to images or icon content (not sure how it's done for other cases?)
  • [ ] sort by "mobile usable" widgets, @jancborchardt

API draft (from client perspective): /list

  • returns: list of widgets with
    • id
    • icon (as url)
    • title
    • button: name, url

/items

  • params: widget id, since (optional), limit: int
  • returns:
    • icon with status badge (e.g. in zammad notificatons)
    • first line
    • subline
    • link (absolute link to web is enough)

For second iteration

  • app id
  • object id (this is needed to e.g. open a deck card directly if deck app is installed)

From https://github.com/nextcloud/files-clients/issues/17#issuecomment-1036076355

PVince81 avatar Feb 22 '22 16:02 PVince81

  • switch icon from using classes to images or icon content (not sure how it's done for other cases?)

I'd prefer real icons (svg, png) as this is also what is used in e.g. activities and client can cache this easily.

tobiasKaminsky avatar Feb 23 '22 07:02 tobiasKaminsky

@PVince81 will get in touch with you about the server-side supporting dev @tobiasKaminsky

AndyScherzinger avatar Aug 16 '22 08:08 AndyScherzinger

Existing OCS API is: https://github.com/nextcloud/server/blob/e15270cbb9a6aa483f8d85642c267cfd3dc6d25e/apps/dashboard/lib/Controller/DashboardApiController.php#L69

tobiasKaminsky avatar Aug 17 '22 12:08 tobiasKaminsky

@icewind1991 I added a first draft version of API in first comment.

tobiasKaminsky avatar Aug 17 '22 12:08 tobiasKaminsky

@PVince81 Robin pointed out in our call that the existing api (see above) is not yet used by any widget. While this is not a problem for non-bundled apps, it is for those that we ship with NC25.

tobiasKaminsky avatar Aug 22 '22 12:08 tobiasKaminsky

does it mean we need to port the existing widgets to use that API ? @juliushaertl @eneiluj

PVince81 avatar Aug 22 '22 15:08 PVince81

Iirc @eneiluj worked on the API, so maybe he knows if it is already implemented by some apps. The backend API was supposed to be additionally available as the web frontend may still provide custom rendering.

juliusknorr avatar Aug 22 '22 15:08 juliusknorr

Initial work is at https://github.com/nextcloud/server/pull/33658

icewind1991 avatar Aug 23 '22 13:08 icewind1991

Vincent, can you make sure that at least the apps that are shipped with NC25 are compatible with new API? I expect that this is an easy job, as it only needs to output the same data on a different api :crossed_fingers:

tobiasKaminsky avatar Aug 26 '22 09:08 tobiasKaminsky

is there a list of those apps somewhere ? maybe need to grep for a string in the release tarball ?

PVince81 avatar Aug 26 '22 13:08 PVince81

Maybe https://github.com/nextcloud/server/blob/master/lib/public/Dashboard/IDashboardWidget.php and then we check which of those apps are bundled? @eneiluj do you have a better idea?

Else we can check widgets in "customize" at https://cloud.nextcloud.com/apps/dashboard

tobiasKaminsky avatar Aug 29 '22 09:08 tobiasKaminsky

  • [ ] make widgets compatible with the new API
    • [ ] user status: apps/user_status/lib/Dashboard/UserStatusWidget.php
    • [ ] recommandations: apps/recommendations/lib/Dashboard/RecommendationWidget.php
    • [ ] activity: apps/activity/lib/Dashboard/ActivityWidget.php
    • [ ] weather_status
    • [ ] recent statuses

PVince81 avatar Aug 31 '22 10:08 PVince81

Please, whenever there is a (draft) PR ping me, so I can directly test/use it on Android side, to see if every content is valid :)

tobiasKaminsky avatar Aug 31 '22 12:08 tobiasKaminsky

does it mean we need to port the existing widgets to use that API ? @juliushaertl @eneiluj

@PVince81 Yes. It is rather an extension than a port. It does not require to change anything to what exists. Widgets need to implement the new interfaces from #33658

@PVince81 Robin pointed out in our call that the existing api (see above) is not yet used by any widget. While this is not a problem for non-bundled apps, it is for those that we ship with NC25.

Yeah no app implements the IAPIWidget interface yet except integration_github (but not yet in the latest release). See https://github.com/nextcloud/integration_github/blob/master/lib/Dashboard/GithubWidget.php

Maybe https://github.com/nextcloud/server/blob/master/lib/public/Dashboard/IDashboardWidget.php and then we check which of those apps are bundled? @eneiluj do you have a better idea?

@tobiasKaminsky For the apps that implement a widget for the new dashboard, we can search for "implements IWidget" to get the list of apps.

Please, whenever there is a (draft) PR ping me, so I can directly test/use it on Android side, to see if every content is valid :)

I can implement the new interfaces from @icewind1991 in integration_github and deck this week if needed for tests.

julien-nc avatar Sep 05 '22 08:09 julien-nc

I can implement the new interfaces from @icewind1991 in integration_github and deck this week if needed for tests.

@eneiluj That be nice, especially deck since it is a nc app coming as a recommended app within Nc Hub - integration_* is less important but of course any widget that is available for the client thatnk to the immplemented interface would be great for the launch and announcement of it :)

AndyScherzinger avatar Sep 05 '22 09:09 AndyScherzinger

@tobiasKaminsky @PVince81 I'll try to implement the new dashboard APIs in some core apps this week (starting with user_status and recommandations, if someone wants to deal with the others let's coordinate here).

@icewind1991 Is it fine if I create PRs on top of your branch?

julien-nc avatar Sep 07 '22 10:09 julien-nc

Please see https://github.com/nextcloud/server/issues/221#issue-1147130186 for overview. If you do any other app, please also add it there in "other apps", so that I am aware of it, can put it on my testing server, so that Android and iOS can test with same data set.

tobiasKaminsky avatar Sep 07 '22 10:09 tobiasKaminsky

We could close this as https://github.com/nextcloud/server/pull/33658 is now merged.

sort by "mobile usable" widgets, @jancborchardt

Is that mandatory?

julien-nc avatar Sep 16 '22 11:09 julien-nc