|
@@ -150,7 +150,41 @@ angular.module('app', [
|
150
|
150
|
|
151
|
151
|
$urlRouterProvider.otherwise('/');
|
152
|
152
|
}])
|
153
|
|
- .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate) {
|
|
153
|
+ .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', 'luRequest', '$mdDialog',
|
|
154
|
+ function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate, luRequest, $mdDialog) {
|
|
155
|
+
|
|
156
|
+ var apiVersion = null;
|
|
157
|
+
|
|
158
|
+ function apiVersionChanged(oldVersion, newVersion) {
|
|
159
|
+ $mdDialog.show(
|
|
160
|
+ $mdDialog.alert()
|
|
161
|
+ .title(AppUtilsBusiness.tr('common.updateDetected.title'))
|
|
162
|
+ .textContent(AppUtilsBusiness.tr('common.updateDetected.text', {oldVersion: oldVersion, newVersion: newVersion}))
|
|
163
|
+ .ok(AppUtilsBusiness.tr('common.ok')));
|
|
164
|
+ }
|
|
165
|
+
|
|
166
|
+ luRequest.addHook('resolve', function(url, method, dataGet, dataPost, luBusyGroups, data)
|
|
167
|
+ {
|
|
168
|
+ if (apiVersion == null) {
|
|
169
|
+ apiVersion = data.version;
|
|
170
|
+ }
|
|
171
|
+ else if (data.version != null && data.version != apiVersion) {
|
|
172
|
+ apiVersionChanged(apiVersion, data.version);
|
|
173
|
+ apiVersion = data.version;
|
|
174
|
+ }
|
|
175
|
+ });
|
|
176
|
+
|
|
177
|
+ luRequest.addHook('reject', function(url, method, dataGet, dataPost, luBusyGroups, error)
|
|
178
|
+ {
|
|
179
|
+ if (apiVersion == null) {
|
|
180
|
+ apiVersion = error.data.version;
|
|
181
|
+ }
|
|
182
|
+ else if (error.data.version != null && error.data.version != apiVersion) {
|
|
183
|
+ apiVersionChanged(apiVersion, error.data.version);
|
|
184
|
+ apiVersion = error.data.version;
|
|
185
|
+ }
|
|
186
|
+ });
|
|
187
|
+
|
154
|
188
|
$translate('common.appName').then(function() {
|
155
|
189
|
for (var i = 0; i < ssSideNav.sections.length; ++i) {
|
156
|
190
|
var a = ssSideNav.sections[i];
|
|
@@ -171,6 +205,7 @@ angular.module('app', [
|
171
|
205
|
}, function (error) {
|
172
|
206
|
console.error(error);
|
173
|
207
|
});
|
|
208
|
+
|
174
|
209
|
$transitions.onEnter({}, function($transitions)
|
175
|
210
|
{
|
176
|
211
|
var toState = $transitions.$to();
|