New push method, with base implementation of delete client side

This commit is contained in:
nathangray
2020-01-23 11:03:29 -07:00
parent ff50df67d0
commit 76a5793a0a
5 changed files with 60 additions and 106 deletions

View File

@ -204,28 +204,26 @@ export abstract class EgwApp
}
/**
* Push method receives push notification about updates to entries from the application
* Handle a push notification about entry changes from the websocket
*
* It can use the extra _data parameter to determine if the client has read access to
* the entry - if an update of the list is necessary.
*
* @param _type either 'update', 'edit', 'delete', 'add' or null
* @param pushData
* @param {string} pushData.app application name
* @param {(string|number)} pushData.id id of entry to refresh or null
* @param {string} pushData.type either 'update', 'edit', 'delete', 'add' or null
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: requires full reload for proper sorting
* @param _app application name incl. sub-type eg. "projectmanager-element"
* @param _id id of entry to refresh or null
* @param _data eg. owner or responsible to decide if update is necessary
* @returns {undefined}
* @param {object|null} pushData.acl Extra data for determining relevance. eg: owner or responsible to decide if update is necessary
* @param {number} pushData.account_id User that caused the notification
*/
push(_type : string, _app : string, _id : string|number, _data? : any)
push(pushData)
{
// only handle delete by default, for simple case of uid === "$app::$id"
if (_type === 'delete')
if (pushData.type === 'delete')
{
egw(window).refresh('', _app, _id, "delete");
egw.dataStoreUID(pushData.app + '::' + pushData.id, null);
}
}