@osimatic/helpers-js 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data_table.js +1 -1
- package/details_sub_array.js +16 -18
- package/file.js +1 -1
- package/flash_message.js +1 -1
- package/network.js +8 -4
- package/package.json +1 -1
package/data_table.js
CHANGED
|
@@ -284,7 +284,7 @@ class DataTable {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
if (error == null) {
|
|
287
|
-
return this.displayErrorMessage(div, (typeof defaultMessage != 'undefined' ? defaultMessage : labelErrorOccured));
|
|
287
|
+
return this.displayErrorMessage(div, (typeof defaultMessage != 'undefined' ? defaultMessage : (typeof labelErrorOccured != 'undefined' ? labelErrorOccured : 'Une erreur s’est produite.')));
|
|
288
288
|
}
|
|
289
289
|
return this.displayErrorMessage(div, 'Critères sélectionnés incorrect.');
|
|
290
290
|
}
|
package/details_sub_array.js
CHANGED
|
@@ -5,7 +5,7 @@ class DetailsSubArray {
|
|
|
5
5
|
return tr.closest('table').find('thead tr').children().length;
|
|
6
6
|
}
|
|
7
7
|
function displayErrorRow(tr) {
|
|
8
|
-
tr.after($('<tr class="text-error"><td colspan="'+getNbColumns(tr)+'">'+labelErrorOccured+'</td></tr>'));
|
|
8
|
+
tr.after($('<tr class="text-error"><td colspan="'+getNbColumns(tr)+'">'+(typeof labelErrorOccured != 'undefined' ? labelErrorOccured : 'Une erreur s’est produite.')+'</td></tr>'));
|
|
9
9
|
}
|
|
10
10
|
function displayDetailsRow(tr, content) {
|
|
11
11
|
var trContent = $(''
|
|
@@ -74,14 +74,15 @@ class DetailsSubArray {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
function onComplete() {
|
|
78
|
+
hideLoading(link);
|
|
79
|
+
setHideDetailsLink(link);
|
|
80
|
+
//link.attr('disabled', false).button('reset');
|
|
81
|
+
}
|
|
82
|
+
|
|
77
83
|
//link.attr('disabled', true).button('loading');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
method: 'GET',
|
|
81
|
-
headers: HTTPRequest.getHeaders(),
|
|
82
|
-
cache: false,
|
|
83
|
-
dataType: 'json',
|
|
84
|
-
success: function (jsonObj) {
|
|
84
|
+
HTTPRequest.get(link.data('url_details'), {},
|
|
85
|
+
(jsonObj) => {
|
|
85
86
|
if (jsonObj == null) {
|
|
86
87
|
if (typeof callbackOnDetailsActionRequestError != 'undefined' && callbackOnDetailsActionRequestError != null) {
|
|
87
88
|
callbackOnDetailsActionRequestError(link);
|
|
@@ -94,24 +95,21 @@ class DetailsSubArray {
|
|
|
94
95
|
if (typeof callbackOnDetailsActionRequestSuccess != 'undefined' && callbackOnDetailsActionRequestSuccess != null) {
|
|
95
96
|
displayDetailsRow(link.closest('tr'), callbackOnDetailsActionRequestSuccess(jsonObj, link));
|
|
96
97
|
}
|
|
97
|
-
},
|
|
98
|
-
error: function (jqxhr, status, exception) {
|
|
99
|
-
console.log('Detail request failure. Status: '+status+' ; Exception: '+exception);
|
|
100
98
|
|
|
99
|
+
onComplete();
|
|
100
|
+
},
|
|
101
|
+
() => {
|
|
101
102
|
if (typeof callbackOnDetailsActionRequestError != 'undefined' && callbackOnDetailsActionRequestError != null) {
|
|
102
103
|
callbackOnDetailsActionRequestError(link);
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
link.closest('tr').after($('<tr class="error"><td colspan="6" class="center">'+labelErrorOccured+'</td></tr>'));
|
|
107
|
+
link.closest('tr').after($('<tr class="error"><td colspan="6" class="center">'+(typeof labelErrorOccured != 'undefined' ? labelErrorOccured : 'Une erreur s’est produite.')+'</td></tr>'));
|
|
108
|
+
|
|
109
|
+
onComplete();
|
|
107
110
|
//window.location.replace(decodeURIComponent(urlRetour));
|
|
108
111
|
},
|
|
109
|
-
|
|
110
|
-
hideLoading(link);
|
|
111
|
-
setHideDetailsLink(link);
|
|
112
|
-
//link.attr('disabled', false).button('reset');
|
|
113
|
-
}
|
|
114
|
-
});
|
|
112
|
+
);
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
table.find('a.details_link').each(function(idx, link) {
|
package/file.js
CHANGED
package/flash_message.js
CHANGED
|
@@ -31,7 +31,7 @@ class FlashMessage {
|
|
|
31
31
|
/** @deprecated **/
|
|
32
32
|
static displayRequestFailure(status, exception, modal) {
|
|
33
33
|
console.log('request failure. Status: ', status, ' Exception: ', exception);
|
|
34
|
-
this.display('danger', typeof labelErrorOccured != 'undefined' ? labelErrorOccured :
|
|
34
|
+
this.display('danger', typeof labelErrorOccured != 'undefined' ? labelErrorOccured : 'Une erreur s’est produite.', false, modal);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
package/network.js
CHANGED
|
@@ -14,7 +14,7 @@ class HTTPRequest {
|
|
|
14
14
|
this.headers[key] = value;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static getHeaders() {
|
|
17
|
+
static getHeaders(asObject) {
|
|
18
18
|
//if (typeof httpHeaders != 'undefined') {
|
|
19
19
|
// return httpHeaders;
|
|
20
20
|
//}
|
|
@@ -23,6 +23,10 @@ class HTTPRequest {
|
|
|
23
23
|
this.headers = {};
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
if (typeof asObject != 'undefined' && asObject) {
|
|
27
|
+
return this.headers;
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
let httpHeaders = new Headers();
|
|
27
31
|
Object.entries(this.headers).forEach(([key, value]) => {
|
|
28
32
|
httpHeaders.append(key, value);
|
|
@@ -108,7 +112,7 @@ class HTTPRequest {
|
|
|
108
112
|
$.ajax({
|
|
109
113
|
type: 'GET',
|
|
110
114
|
url: url,
|
|
111
|
-
headers: HTTPRequest.getHeaders(),
|
|
115
|
+
headers: HTTPRequest.getHeaders(true),
|
|
112
116
|
dataType: 'json',
|
|
113
117
|
cache: false,
|
|
114
118
|
success: (data) => successCallback(data),
|
|
@@ -187,7 +191,7 @@ class HTTPRequest {
|
|
|
187
191
|
let ajaxOptions = {
|
|
188
192
|
type: 'GET',
|
|
189
193
|
url: url,
|
|
190
|
-
headers: HTTPRequest.getHeaders(),
|
|
194
|
+
headers: HTTPRequest.getHeaders(true),
|
|
191
195
|
cache: false,
|
|
192
196
|
xhrFields: {
|
|
193
197
|
responseType: 'blob'
|
|
@@ -275,7 +279,7 @@ class HTTPRequest {
|
|
|
275
279
|
$.ajax({
|
|
276
280
|
type: 'POST',
|
|
277
281
|
url: url,
|
|
278
|
-
headers: HTTPRequest.getHeaders(),
|
|
282
|
+
headers: HTTPRequest.getHeaders(true),
|
|
279
283
|
dataType: 'json', // 22/09/2020 : à voir si cette ligne pose pb (utilisé pour requete import et peut être d'autres
|
|
280
284
|
data: formData,
|
|
281
285
|
cache: false,
|