mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 22:57:57 +01:00
Fix RestPersistenceManager.js compilation
This commit is contained in:
parent
6a6eb8fa63
commit
b397a583d6
@ -16,6 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { $assert } from '@wisemapping/core-js';
|
import { $assert } from '@wisemapping/core-js';
|
||||||
|
import $ from 'jquery';
|
||||||
import { $msg } from './Messages';
|
import { $msg } from './Messages';
|
||||||
import PersistenceManager from './PersistenceManager';
|
import PersistenceManager from './PersistenceManager';
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
$assert(options.lockUrl, 'lockUrl can not be null');
|
$assert(options.lockUrl, 'lockUrl can not be null');
|
||||||
$assert(options.session, 'session can not be null');
|
$assert(options.session, 'session can not be null');
|
||||||
$assert(options.timestamp, 'timestamp can not be null');
|
$assert(options.timestamp, 'timestamp can not be null');
|
||||||
super()
|
super();
|
||||||
|
|
||||||
this.documentUrl = options.documentUrl;
|
this.documentUrl = options.documentUrl;
|
||||||
this.revertUrl = options.revertUrl;
|
this.revertUrl = options.revertUrl;
|
||||||
@ -53,7 +54,7 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
persistence.clearTimeout = setTimeout(() => {
|
persistence.clearTimeout = setTimeout(() => {
|
||||||
persistence.clearTimeout = null;
|
persistence.clearTimeout = null;
|
||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
} 10000);
|
}, 10000);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `${this.documentUrl.replace('{id}', mapId)}?${query}`,
|
url: `${this.documentUrl.replace('{id}', mapId)}?${query}`,
|
||||||
@ -66,17 +67,17 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
success(data, textStatus, jqXHRresponseText) {
|
success(data, textStatus, jqXHRresponseText) {
|
||||||
persistence.timestamp = data;
|
persistence.timestamp = data;
|
||||||
events.onSuccess();
|
events.onSuccess();
|
||||||
}
|
},
|
||||||
error(jqXHR, textStatus, errorThrown) {
|
error(jqXHR, textStatus, errorThrown) {
|
||||||
events.onError(persistence._buildError());
|
events.onError(persistence._buildError());
|
||||||
}
|
},
|
||||||
complete() {
|
complete() {
|
||||||
// Clear event timeout ...
|
// Clear event timeout ...
|
||||||
if (persistence.clearTimeout) {
|
if (persistence.clearTimeout) {
|
||||||
clearTimeout(persistence.clearTimeout);
|
clearTimeout(persistence.clearTimeout);
|
||||||
}
|
}
|
||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
}
|
},
|
||||||
fail(xhr, textStatus) {
|
fail(xhr, textStatus) {
|
||||||
const { responseText } = xhr;
|
const { responseText } = xhr;
|
||||||
let userMsg = { severity: 'SEVERE', message: $msg('SAVE_COULD_NOT_BE_COMPLETED') };
|
let userMsg = { severity: 'SEVERE', message: $msg('SAVE_COULD_NOT_BE_COMPLETED') };
|
||||||
@ -96,7 +97,7 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
}
|
}
|
||||||
events.onError(userMsg);
|
events.onError(userMsg);
|
||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +107,7 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
url: this.revertUrl.replace('{id}', mapId),
|
url: this.revertUrl.replace('{id}', mapId),
|
||||||
async: false,
|
async: false,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: { 'Content-Type': 'application/json; charset=utf-8', Accept: 'application/json' }
|
headers: { 'Content-Type': 'application/json; charset=utf-8', Accept: 'application/json' },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
url: this.lockUrl.replace('{id}', mapId),
|
url: this.lockUrl.replace('{id}', mapId),
|
||||||
async: false,
|
async: false,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
headers: { 'Content-Type': 'text/plain' }
|
headers: { 'Content-Type': 'text/plain' },
|
||||||
data: 'false',
|
data: 'false',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -142,10 +143,10 @@ class RESTPersistenceManager extends PersistenceManager{
|
|||||||
url: `${this.documentUrl.replace('{id}', mapId)}/xml`,
|
url: `${this.documentUrl.replace('{id}', mapId)}/xml`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
async: false,
|
async: false,
|
||||||
headers: { 'Content-Type': 'text/plain', Accept: 'application/xml' }
|
headers: { 'Content-Type': 'text/plain', Accept: 'application/xml' },
|
||||||
success(responseText) {
|
success(responseText) {
|
||||||
xml = responseText;
|
xml = responseText;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// If I could not load it from a file, hard code one.
|
// If I could not load it from a file, hard code one.
|
||||||
|
Loading…
Reference in New Issue
Block a user