mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-18 01:16:56 +00:00
change notebook status: dirty, new
This commit is contained in:
10
node_modules/notebook.js
generated
vendored
10
node_modules/notebook.js
generated
vendored
@@ -434,6 +434,7 @@ var Notebook = {
|
||||
var me = this;
|
||||
|
||||
// 服务器没有, 但是是发送更新的, 所以需要作为添加
|
||||
// 情况很少见
|
||||
if(notebookSyncInfo.changeNeedAdds) {
|
||||
var needAddNotebooks = notebookSyncInfo.changeNeedAdds;
|
||||
for(var i in needAddNotebooks) {
|
||||
@@ -442,6 +443,7 @@ var Notebook = {
|
||||
}
|
||||
}
|
||||
|
||||
// pull
|
||||
// 处理添加的, 更新的, 这里前端统一重新渲染!!
|
||||
var adds = notebookSyncInfo.adds;
|
||||
if (!isEmpty(adds) || !isEmpty(notebookSyncInfo.updates)) {
|
||||
@@ -452,11 +454,15 @@ var Notebook = {
|
||||
Web.reloadNotebook();
|
||||
}
|
||||
|
||||
// push
|
||||
if (!isEmpty(notebookSyncInfo.changeAdds)) {
|
||||
console.log(' has changeAdds notebook')
|
||||
console.log(notebookSyncInfo.changeAdds)
|
||||
console.log(' has changeAdds notebook', notebookSyncInfo.changeAdds);
|
||||
Web.addChangeNotebook(notebookSyncInfo.changeAdds);
|
||||
}
|
||||
if (!isEmpty(notebookSyncInfo.changeUpdates)) {
|
||||
console.log(' has changeUpdates notebook', notebookSyncInfo.changeUpdates);
|
||||
Web.updateChangeNotebook(notebookSyncInfo.changeUpdates);
|
||||
}
|
||||
|
||||
if (!isEmpty(notebookSyncInfo.deletes)) {
|
||||
// 处理删除的
|
||||
|
20
node_modules/sync.js
generated
vendored
20
node_modules/sync.js
generated
vendored
@@ -32,7 +32,7 @@ syncProgress 设置
|
||||
var Sync = {
|
||||
// 同步的信息, 返回给调用者
|
||||
_syncInfo: {
|
||||
notebook: {changeAdds: [], changeConflicts: [], adds: [], deletes: [], updates: []},
|
||||
notebook: {changeAdds: [], changeConflicts: [], adds: [], deletes: [], updates: [], changeUpdates: []},
|
||||
note: {changeAdds: [], changeConflicts: [], adds: [], deletes: [], updates: [], conflicts: [], errors: []},
|
||||
tag: {}
|
||||
},
|
||||
@@ -84,7 +84,7 @@ var Sync = {
|
||||
|
||||
// 同步信息
|
||||
me._syncInfo = {
|
||||
notebook: {ok: false, changeAdds: [], changeConflicts: [], changeNeedAdds: [], adds: [], deletes: [], updates: []},
|
||||
notebook: {ok: false, changeAdds: [], changeConflicts: [], changeNeedAdds: [], adds: [], deletes: [], updates: [], changeUpdates: []},
|
||||
note: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeUpdates:[], changeNeedAdds: [], deletes: [], updates: [], conflicts: [], errors: []},
|
||||
tag: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
||||
};
|
||||
@@ -884,8 +884,8 @@ var Sync = {
|
||||
} else if(newNotebook.Msg == 'notExists') {
|
||||
// 服务器端没有, 那么要作为添加
|
||||
// 可能服务器上已删除, 此时应该要作为添加而不是更新
|
||||
me._syncInfo.notebook.changeNeedAdds.push(notebook);
|
||||
// me.fixSynced('notebook', 'changeNeedAdds', notebook);
|
||||
// me._syncInfo.notebook.changeNeedAdds.push(notebook);
|
||||
me.fixSynced('notebook', 'changeNeedAdds', notebook);
|
||||
}
|
||||
|
||||
// me.checkNeedIncSyncAgain(newNotebook.Usn);
|
||||
@@ -894,17 +894,15 @@ var Sync = {
|
||||
else {
|
||||
// 更新
|
||||
// TODO 后端updateNotebook只要传Usn回来即可
|
||||
console.log(" 返回来的notebook" + newNotebook.Title)
|
||||
console.log(" 返回来的notebook " + newNotebook.Title)
|
||||
|
||||
Notebook.updateNotebookForceForSendChange(notebook.NotebookId, newNotebook, function() {
|
||||
if(notebook.LocalIsNew) {
|
||||
// 没用
|
||||
me._syncInfo.notebook.changeAdds.push(newNotebook);
|
||||
// me.fixSynced('notebook', 'changeAdds', newNotebook);
|
||||
// me._syncInfo.notebook.changeAdds.push(newNotebook);
|
||||
me.fixSynced('notebook', 'changeAdds', newNotebook);
|
||||
} else {
|
||||
// 没用
|
||||
// me._syncInfo.notebook.updates.push(newNotebook);
|
||||
me.fixSynced('notebook', 'updates', newNotebook);
|
||||
// me._syncInfo.notebook.changeUpdates.push(newNotebook);
|
||||
me.fixSynced('notebook', 'changeUpdates', newNotebook);
|
||||
}
|
||||
|
||||
// 这里才cb(), 因为先添加父, 再添加子
|
||||
|
5
node_modules/web.js
generated
vendored
5
node_modules/web.js
generated
vendored
@@ -57,7 +57,10 @@ var Web = {
|
||||
},
|
||||
addChangeNotebook: function(notebooks) {
|
||||
var me = this;
|
||||
me.Notebook.addChange(notebooks);
|
||||
me.Notebook.addChanges(notebooks);
|
||||
},
|
||||
updateChangeNotebook: function (notebooks) {
|
||||
this.Notebook.updateChanges(notebooks);
|
||||
},
|
||||
/*
|
||||
fixNotebookConflicts: function(notebookInfo) {
|
||||
|
Reference in New Issue
Block a user