ARCHIVED, new Dashboard is in the server
Перейти к файлу
Jan C. Borchardt 0d3a4f4874
Merge pull request #78 from nextcloud/repo-archive
Archive old dashboard app
2020-10-16 13:12:57 +02:00
.tx Fix tx config 2018-02-12 22:56:58 +01:00
appinfo adding composer 2018-12-17 23:41:54 -01:00
css cleaner headers 2018-07-17 15:10:13 -01:00
documentation presentation 2018-10-16 10:10:24 +02:00
img php7 + cleaning of old app 2018-07-13 10:43:29 -01:00
js fixing stuff 2018-10-10 10:42:19 +02:00
l10n [tx-robot] updated from transifex 2020-10-14 02:28:56 +00:00
lib fixing a crash with empty <dashboard> in info.xml 2018-12-17 23:43:31 -01:00
screenshots new screenshot 2018-06-27 10:05:18 -01:00
templates cleaner headers 2018-07-17 15:10:13 -01:00
.gitignore removed from git 2018-07-17 15:52:16 -01:00
.scrutinizer.yml cleaning 2018-07-17 15:54:36 -01:00
CHANGELOG.md php7 + cleaning of old app 2018-07-13 10:43:29 -01:00
COPYING 4.0.1 2017-07-23 19:13:25 +02:00
Makefile adding composer 2018-12-17 23:41:54 -01:00
README.md Archive old dashboard app 2020-10-13 08:11:28 +02:00
composer.json adding composer 2018-12-17 23:41:54 -01:00
composer.lock adding composer 2018-12-17 23:41:54 -01:00
fortunes 3rd design 2018-06-26 08:55:39 -01:00
package.json save/load grid 2018-06-19 20:16:50 -01:00

README.md

Archived repository

The dashboard app was rewritten as part of Nextcloud 20 and is now part of the server repository. Please head there for issue reporting and the app code.

Quick guide on how to build the app from git:

 $ git clone -b gridstack https://github.com/nextcloud/dashboard.git
 $ cd dashboard
 $ make npm

How to create a Widget:

  1. getId() returns a unique ID of the widget
  2. getName() returns the name of the widget
  3. getDescription() returns a description of the widget
  4. getTemplate() returns information about the template to load and css/js:
  5. widgetSetup() returns optional information like size of the widget, additional menu entries and background jobs:
  6. loadWidget($config) is called on external request (cf. requestWidget()). $config is an array that contains the current setup of the widget
  7. requestWidget(WidgetRequest $request) is called after the loadWidget() after a new.requestWidget(object, callback) from JavaScript
  • Add to appinfo/info.xml:
	<dashboard>
		<widget>OCA\YourApp\Widgets\MyFirstWidget</widget>
		<widget>OCA\YourApp\Widgets\AnOtherWidget</widget>
	</dashboard>

Event & Push

You can (almost) instantly push payload from Nextcloud to your widget:

  • define the method to be called in the widgetSetup() array:
   'push'  =>  'your-javascript-function-to-call-on-event
  • call the API from your PHP:
OCA\Dashboard\Api\v1\Dashboard::createEvent('your_widget_id', 'user_id', payload_in_JSON);
  • the method set in widgetSetup()['push'] will receive the payload.

Note: you can manually generate events using the command line:

 ./occ dashboard:push widgetid userid payload

You can, this way, modify the displayed fortune for any user:

./occ dashboard:push fortunes cult "{\"fortune\": \"foobar\"}"

See the wiki, in particular this page about how the fortune widget works, for more background.