Implement new dashboard APIs
closes #4451
requires https://github.com/nextcloud/server/pull/33658
In progress
Codecov Report
Base: 41.74% // Head: 41.86% // Increases project coverage by +0.11% :tada:
Coverage data is based on head (
00f337e) compared to base (f76f274). Patch has no changes to coverable lines.
:exclamation: Current head 00f337e differs from pull request most recent head 9768191. Consider uploading reports for the commit 9768191 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #4474 +/- ##
============================================
+ Coverage 41.74% 41.86% +0.11%
- Complexity 338 348 +10
============================================
Files 226 226
Lines 5603 5659 +56
Branches 738 738
============================================
+ Hits 2339 2369 +30
- Misses 3264 3290 +26
| Flag | Coverage Δ | |
|---|---|---|
| javascript | 31.42% <ø> (ø) |
|
| php | 69.18% <ø> (-0.58%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...oud/apps/calendar/lib/Dashboard/CalendarWidget.php | 80.64% <0.00%> (-19.36%) |
:arrow_down: |
| ...ud/apps/calendar/lib/Controller/ViewController.php | 82.50% <0.00%> (-17.50%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@ChristophWurst I just realized Calendar supports NC >= 22. The new APIs will only be there from 25. How do you wanna deal with that? Bump the min NC version to 25?
Needed for https://github.com/nextcloud/calendar/pull/4459 anyway
@ChristophWurst I'm stuck in getting the next occurrence of the events instead of DTSTART. I don't want to implement an overkill method when something simple might already exist :grin:. Could you point me to places to understand how it's done by the frontend widget? Do I have to compute it from the event repetition rules?
@tcitworld True that, thanks for the remark.
@tobiasKaminsky please tell me if you can work with this response format:
<data>
<calendar>
<element>
<subtitle>in 5 days</subtitle>
<title>Test</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=59d30b6c-5a31-4d28-b1d6-c8f928180e96</link>
<iconUrl>data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjMyIiB3aWR0aD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjOTc1MEE0Ii8+PC9zdmc+</iconUrl>
<sinceId>1666051200</sinceId>
</element>
<element>
<subtitle>in 8 days</subtitle>
<title>terretrrt</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=f56c7bbd-8f0a-4d88-b63e-dbeb76c72ec2</link>
<iconUrl>data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjMyIiB3aWR0aD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjOTc1MEE0Ii8+PC9zdmc+</iconUrl>
<sinceId>1666310400</sinceId>
</element>
<element>
<subtitle>in 9 days</subtitle>
<title>tesd</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=1821edd2-7cb4-47a5-84c4-8d8a75c0db9f</link>
<iconUrl>data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjMyIiB3aWR0aD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjMDA4MmM5Ii8+PC9zdmc+</iconUrl>
<sinceId>1666396800</sinceId>
</element>
<element>
<subtitle>in 10 days</subtitle>
<title>rers</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=d335eaea-6490-4968-936a-eccd32b04a3b</link>
<iconUrl>data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjMyIiB3aWR0aD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjMDA4MmM5Ii8+PC9zdmc+</iconUrl>
<sinceId>1666598400</sinceId>
</element>
<element>
<subtitle>in 10 days</subtitle>
<title>sdfsdfd</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=750acdde-8eaa-4cac-ba25-50d79011945d</link>
<iconUrl>data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjMyIiB3aWR0aD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjQzk4ODc5Ii8+PC9zdmc+</iconUrl>
<sinceId>1666483200</sinceId>
</element>
</calendar>
</data>
the icon url is now a base64 encoded svg with the calendar colour.
- [x] Thinking about this some more I haven't properly implemented the limit param. Reworking tomorrow.
Changed the limit to only use the max 14 across all calendars
iconUrl must be a real URL :S
A dummy svg with replaced background color would work:
<svg width="64mm" height="64mm" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
<path style="color:#000;overflow:visible;fill:red;stroke:none;stroke-width:0;paint-order:markers fill stroke" d="M0 0h64v64H0z"/>
</svg>
Testing is possible with:
curl -k -H 'OCS-APIRequest: true' -u username:password http://your_base_url/ocs/v2.php/apps/dashboard/api/v1/widget-items -v
Testing is possible
Nice. Could you test this icon URLs this way as a non-admin user?
Testing is possible
Nice. Could you test this icon URLs this way as a non-admin user?
will do
For my user bob who is not an admin it works well.
<calendar>
<element>
<subtitle>in 4 days</subtitle>
<title>fdsddsf</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=e68c5668-c777-4069-bfc4-186113621b0d</link>
<iconUrl>http://nextcloud.local/index.php/apps/calendar/public/getCalendarDotSvg/%230082c9</iconUrl>
<sinceId>1666051200</sinceId>
</element>
<element>
<subtitle>in 7 days</subtitle>
<title>dsfdfsdfs</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=fb1883be-abad-4b3e-ba4a-df92180d5fab</link>
<iconUrl>http://nextcloud.local/index.php/apps/calendar/public/getCalendarDotSvg/%230082c9</iconUrl>
<sinceId>1666310400</sinceId>
</element>
<element>
<subtitle>in 10 days</subtitle>
<title>fdsfddsffdsdfssdsdfsdfsfddsf</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=48ec3b78-68f4-4278-be9d-799715fb04f1</link>
<iconUrl>http://nextcloud.local/index.php/apps/calendar/public/getCalendarDotSvg/%230082c9</iconUrl>
<sinceId>1666569600</sinceId>
</element>
<element>
<subtitle>in 11 days</subtitle>
<title>dssdadsasadasd</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=f2980c2e-5f8f-4153-9a41-9f90f55c6d8a</link>
<iconUrl>http://nextcloud.local/index.php/apps/calendar/public/getCalendarDotSvg/%23499AA2</iconUrl>
<sinceId>1666656000</sinceId>
</element>
<element>
<subtitle>in 12 days</subtitle>
<title>dsadsasdasadsad</title>
<link>http://nextcloud.local/index.php/apps/calendar/?objectId=bbd0e106-1473-4f0f-97ef-6270695616dc</link>
<iconUrl>http://nextcloud.local/index.php/apps/calendar/public/getCalendarDotSvg/%23499AA2</iconUrl>
<sinceId>1666742400</sinceId>
</element>
</calendar>
and the icons work and are in the right colour.
The only thing I'm unsure about is the DataDownloadResponse. Avatars use a FileDisplayResponse for example.
@tobiasKaminsky pls review!