mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
8669c3c0d2
Summary: Depends on D20652. Ref T4900. When the user presses "R", send a list of cards currently visible on the client and their version numbers. On the server: - Compare the client verisons to the server versions so we can skip updates for objects which have not changed. (For now, the client version is always "1" and the server version is always "2", so this doesn't do anything meaningful, and every card is always updated.) - Compare the client visible set to the server visible set and "remove" any cards which have been removed from the board. I believe this means that "R" always puts the board into the right state (except for some issues with client orderings not being fully handled yet). It's not tremendously efficient, but we can make versioning better (using the largest object transaction ID) to improve that and loading the page in the first place doesn't take all that long so even sending down the full visible set shouldn't be a huge problem. Test Plan: - In window A, removed a card from a board. - In window B, pressed "R" and saw the removal reflected on the client. - (Also added cards, edited cards, etc., and didn't catch anything exploding.) Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T4900 Differential Revision: https://secure.phabricator.com/D20653
69 lines
1.3 KiB
JavaScript
69 lines
1.3 KiB
JavaScript
/**
|
|
* @provides javelin-workboard-card-template
|
|
* @requires javelin-install
|
|
* @javelin
|
|
*/
|
|
|
|
JX.install('WorkboardCardTemplate', {
|
|
|
|
construct: function(phid) {
|
|
this._phid = phid;
|
|
this._vectors = {};
|
|
this._headerKeys = {};
|
|
|
|
this.setObjectProperties({});
|
|
},
|
|
|
|
properties: {
|
|
objectProperties: null
|
|
},
|
|
|
|
members: {
|
|
_phid: null,
|
|
_html: null,
|
|
_vectors: null,
|
|
_headerKeys: null,
|
|
|
|
getPHID: function() {
|
|
return this._phid;
|
|
},
|
|
|
|
getVersion: function() {
|
|
// TODO: For now, just return a constant version number.
|
|
return 1;
|
|
},
|
|
|
|
setNodeHTMLTemplate: function(html) {
|
|
this._html = html;
|
|
return this;
|
|
},
|
|
|
|
setSortVector: function(order, vector) {
|
|
this._vectors[order] = vector;
|
|
return this;
|
|
},
|
|
|
|
getSortVector: function(order) {
|
|
return this._vectors[order];
|
|
},
|
|
|
|
setHeaderKey: function(order, key) {
|
|
this._headerKeys[order] = key;
|
|
return this;
|
|
},
|
|
|
|
getHeaderKey: function(order) {
|
|
return this._headerKeys[order];
|
|
},
|
|
|
|
newNode: function() {
|
|
return JX.$H(this._html).getFragment().firstChild;
|
|
},
|
|
|
|
setObjectProperty: function(key, value) {
|
|
this.getObjectProperties()[key] = value;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
});
|