2015-03-14 07:10:00 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
import window from 'window';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
import PromisesPopulator from 'Promises/User/Populator';
|
|
|
|
import {AbstractAjaxPromises} from 'Promises/AbstractAjax';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
class UserAjaxUserPromises extends AbstractAjaxPromises
|
2016-06-30 08:02:45 +08:00
|
|
|
{
|
2016-08-17 06:01:20 +08:00
|
|
|
constructor() {
|
|
|
|
super();
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.foldersTimeout = 0;
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
foldersReload(fTrigger) {
|
|
|
|
return this.abort('Folders').postRequest('Folders', fTrigger).then((data) => {
|
|
|
|
PromisesPopulator.foldersList(data.Result);
|
|
|
|
PromisesPopulator.foldersAdditionalParameters(data.Result);
|
2016-06-30 08:02:45 +08:00
|
|
|
return true;
|
2015-03-17 22:12:19 +08:00
|
|
|
});
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
foldersReloadWithTimeout(fTrigger) {
|
|
|
|
this.setTrigger(fTrigger, true);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
window.clearTimeout(this.foldersTimeout);
|
|
|
|
this.foldersTimeout = window.setTimeout(() => {
|
|
|
|
this.foldersReload(fTrigger);
|
|
|
|
}, 500);
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
folderDelete(sFolderFullNameRaw, fTrigger) {
|
|
|
|
return this.postRequest('FolderDelete', fTrigger, {
|
|
|
|
'Folder': sFolderFullNameRaw
|
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
folderCreate(sNewFolderName, sParentName, fTrigger) {
|
|
|
|
return this.postRequest('FolderCreate', fTrigger, {
|
|
|
|
'Folder': sNewFolderName,
|
|
|
|
'Parent': sParentName
|
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
folderRename(sPrevFolderFullNameRaw, sNewFolderName, fTrigger) {
|
|
|
|
return this.postRequest('FolderRename', fTrigger, {
|
|
|
|
'Folder': sPrevFolderFullNameRaw,
|
|
|
|
'NewFolderName': sNewFolderName
|
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
attachmentsActions(sAction, aHashes, fTrigger) {
|
|
|
|
return this.postRequest('AttachmentsActions', fTrigger, {
|
|
|
|
'Do': sAction,
|
|
|
|
'Hashes': aHashes
|
|
|
|
});
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
welcomeClose() {
|
|
|
|
return this.postRequest('WelcomeClose');
|
|
|
|
}
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-09-13 04:50:21 +08:00
|
|
|
export default new UserAjaxUserPromises();
|