cronapp-framework-js 1.0.4 → 1.0.5
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/components/crn-calendar.components.json +69 -0
- package/components/crn-chart.components.json +33 -0
- package/components/crn-cron-scheduler.components.json +53 -0
- package/components/crn-wizard.components.json +1 -0
- package/dist/js/app.js +1 -1
- package/dist/js/controllers.js +1 -1
- package/dist/js/directives.js +1 -1
- package/dist/js/upload.service.js +1 -1
- package/js/app.js +271 -381
- package/js/controllers.js +189 -208
- package/js/directives.js +4928 -4933
- package/js/upload.service.js +2 -2
- package/package.json +2 -2
- package/components/crn-figma-component.components.json +0 -10
- package/img/cron-icon/crn-figma-component.svg +0 -5
package/js/app.js
CHANGED
|
@@ -20,8 +20,7 @@ var cronappModules = [
|
|
|
20
20
|
'ui.tinymce',
|
|
21
21
|
'ngCookies',
|
|
22
22
|
'kendo.directives',
|
|
23
|
-
'sync.service'
|
|
24
|
-
'cronapp.frontboost'
|
|
23
|
+
'sync.service'
|
|
25
24
|
];
|
|
26
25
|
|
|
27
26
|
if (window.customModules) {
|
|
@@ -52,362 +51,294 @@ var customizeRoute = () => {
|
|
|
52
51
|
var app = (function() {
|
|
53
52
|
customizeRoute();
|
|
54
53
|
return angular.module('MyApp', cronappModules)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
54
|
+
.constant('LOCALES', {
|
|
55
|
+
'locales': {
|
|
56
|
+
'pt_br': 'Portugues (Brasil)',
|
|
57
|
+
'en_us': 'English'
|
|
58
|
+
},
|
|
59
|
+
'preferredLocale': 'pt_br',
|
|
60
|
+
'urlPrefix': ''
|
|
61
|
+
})
|
|
62
|
+
.config(['$locationProvider', function($locationProvider) {
|
|
63
|
+
$locationProvider.hashPrefix('');
|
|
64
|
+
}])
|
|
65
|
+
.config([
|
|
66
|
+
'$httpProvider',
|
|
67
|
+
function($httpProvider) {
|
|
68
|
+
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
|
69
|
+
}
|
|
70
|
+
])
|
|
71
|
+
.config( [
|
|
72
|
+
'$compileProvider',
|
|
73
|
+
function( $compileProvider )
|
|
74
|
+
{
|
|
75
|
+
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|javascript|chrome-extension):/);
|
|
76
|
+
}
|
|
77
|
+
])
|
|
78
|
+
.config(function($stateProvider, $urlRouterProvider, NotificationProvider) {
|
|
79
|
+
NotificationProvider.setOptions({
|
|
80
|
+
delay: 5000,
|
|
81
|
+
startTop: 20,
|
|
82
|
+
startRight: 10,
|
|
83
|
+
verticalSpacing: 20,
|
|
84
|
+
horizontalSpacing: 20,
|
|
85
|
+
positionX: 'right',
|
|
86
|
+
positionY: 'top',
|
|
87
|
+
templateUrl: 'node_modules/cronapp-framework-js/components/templates/angular-ui-notification.template.html'
|
|
88
|
+
});
|
|
89
|
+
window.NotificationProviderOptions = NotificationProvider.options;
|
|
90
|
+
window.stateProviderDefine.handle($stateProvider);
|
|
91
|
+
|
|
92
|
+
// For any unmatched url, redirect to /state1
|
|
93
|
+
$urlRouterProvider.otherwise("/error/404");
|
|
94
|
+
})
|
|
95
|
+
.factory('originPath', ['$location', function($location) {
|
|
96
|
+
var originPath = {
|
|
97
|
+
request: function(config) {
|
|
98
|
+
config.headers['origin-path'] = $location.path();
|
|
99
|
+
return config;
|
|
96
100
|
}
|
|
101
|
+
};
|
|
102
|
+
return originPath;
|
|
103
|
+
}])
|
|
104
|
+
.config(
|
|
105
|
+
['$logProvider',
|
|
106
|
+
function ($logProvider) {
|
|
107
|
+
$logProvider.debugEnabled(false);
|
|
108
|
+
}]
|
|
109
|
+
)
|
|
110
|
+
.config(['$httpProvider', function($httpProvider) {
|
|
111
|
+
$httpProvider.interceptors.push('originPath');
|
|
112
|
+
}])
|
|
113
|
+
.config(function($translateProvider, tmhDynamicLocaleProvider) {
|
|
114
|
+
|
|
115
|
+
$translateProvider.uniformLanguageTag('bcp47');
|
|
116
|
+
$translateProvider.useLoader('customTranslateLoader', {
|
|
117
|
+
files: [{
|
|
118
|
+
prefix: 'i18n/locale_',
|
|
119
|
+
suffix: '.json'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
prefix: 'node_modules/cronapp-framework-js/i18n/locale_',
|
|
123
|
+
suffix: '.json'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
prefix: 'node_modules/cronapi-js/i18n/locale_',
|
|
127
|
+
suffix: '.json'
|
|
128
|
+
}]
|
|
129
|
+
});
|
|
97
130
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
localStorage.setItem("_u", JSON.stringify(data));
|
|
105
|
-
$rootScope.session = JSON.parse(localStorage._u);
|
|
106
|
-
} else {
|
|
107
|
-
// Sorry! No Web Storage support.
|
|
108
|
-
// The home page may not work if it depends
|
|
109
|
-
// on the logged user data
|
|
110
|
-
}
|
|
131
|
+
$translateProvider
|
|
132
|
+
.registerAvailableLanguageKeys(
|
|
133
|
+
window.translations.localesKeys,
|
|
134
|
+
window.translations.localesRef
|
|
135
|
+
)
|
|
136
|
+
.determinePreferredLanguage();
|
|
111
137
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
window.location = $state.href('home', {}, { absolute: true });
|
|
119
|
-
}
|
|
138
|
+
var locale = (window.navigator.userLanguage || window.navigator.language).replace('-', '_').toLowerCase();
|
|
139
|
+
$translateProvider.use(locale);
|
|
140
|
+
$translateProvider.preferredLanguage(locale);
|
|
141
|
+
$translateProvider.fallbackLanguage('en_us');
|
|
120
142
|
|
|
121
|
-
|
|
122
|
-
$scope.cronapi.forceCloseAllModal();
|
|
123
|
-
}
|
|
143
|
+
$translateProvider.useSanitizeValueStrategy('escaped');
|
|
124
144
|
|
|
125
|
-
|
|
126
|
-
if ($scope.blockly && $scope.blockly.events && $scope.blockly.events.onLogin && $scope.blockly.events.onLogin instanceof Function) {
|
|
127
|
-
$scope.blockly.events.onLogin();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}])
|
|
133
|
-
.config(['$locationProvider', function($locationProvider) {
|
|
134
|
-
$locationProvider.hashPrefix('');
|
|
135
|
-
}])
|
|
136
|
-
.config([
|
|
137
|
-
'$httpProvider',
|
|
138
|
-
function($httpProvider) {
|
|
139
|
-
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
|
140
|
-
}
|
|
141
|
-
])
|
|
142
|
-
.config( [
|
|
143
|
-
'$compileProvider',
|
|
144
|
-
function( $compileProvider )
|
|
145
|
-
{
|
|
146
|
-
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|javascript|chrome-extension):/);
|
|
147
|
-
}
|
|
148
|
-
])
|
|
149
|
-
.config(function($stateProvider, $urlRouterProvider, NotificationProvider) {
|
|
150
|
-
NotificationProvider.setOptions({
|
|
151
|
-
delay: 5000,
|
|
152
|
-
startTop: 20,
|
|
153
|
-
startRight: 10,
|
|
154
|
-
verticalSpacing: 20,
|
|
155
|
-
horizontalSpacing: 20,
|
|
156
|
-
positionX: 'right',
|
|
157
|
-
positionY: 'top',
|
|
158
|
-
templateUrl: 'node_modules/cronapp-framework-js/components/templates/angular-ui-notification.template.html'
|
|
159
|
-
});
|
|
160
|
-
window.NotificationProviderOptions = NotificationProvider.options;
|
|
161
|
-
window.stateProviderDefine.handle($stateProvider);
|
|
162
|
-
|
|
163
|
-
// For any unmatched url, redirect to /state1
|
|
164
|
-
$urlRouterProvider.otherwise("/error/404");
|
|
165
|
-
})
|
|
166
|
-
.factory('originPath', ['$location', function($location) {
|
|
167
|
-
var originPath = {
|
|
168
|
-
request: function(config) {
|
|
169
|
-
config.headers['origin-path'] = $location.path();
|
|
170
|
-
return config;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
return originPath;
|
|
174
|
-
}])
|
|
175
|
-
.config(
|
|
176
|
-
['$logProvider',
|
|
177
|
-
function ($logProvider) {
|
|
178
|
-
$logProvider.debugEnabled(true);
|
|
179
|
-
}]
|
|
180
|
-
)
|
|
181
|
-
.config(function($translateProvider, tmhDynamicLocaleProvider) {
|
|
182
|
-
|
|
183
|
-
$translateProvider.uniformLanguageTag('bcp47');
|
|
184
|
-
$translateProvider.useLoader('customTranslateLoader', {
|
|
185
|
-
files: [{
|
|
186
|
-
prefix: 'i18n/locale_',
|
|
187
|
-
suffix: '.json'
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
prefix: 'node_modules/cronapp-framework-js/i18n/locale_',
|
|
191
|
-
suffix: '.json'
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
prefix: 'node_modules/cronapi-js/i18n/locale_',
|
|
195
|
-
suffix: '.json'
|
|
196
|
-
}]
|
|
197
|
-
});
|
|
145
|
+
tmhDynamicLocaleProvider.localeLocationPattern('node_modules/angular-i18n/angular-locale_{{locale}}.js');
|
|
198
146
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
var locale = (window.navigator.userLanguage || window.navigator.language).replace('-', '_').toLowerCase();
|
|
207
|
-
$translateProvider.use(locale);
|
|
208
|
-
$translateProvider.preferredLanguage(locale);
|
|
209
|
-
$translateProvider.fallbackLanguage('en_us');
|
|
210
|
-
|
|
211
|
-
$translateProvider.useSanitizeValueStrategy('escaped');
|
|
212
|
-
|
|
213
|
-
tmhDynamicLocaleProvider.localeLocationPattern('node_modules/angular-i18n/angular-locale_{{locale}}.js');
|
|
214
|
-
|
|
215
|
-
if (moment)
|
|
216
|
-
moment.locale(locale);
|
|
217
|
-
})
|
|
218
|
-
.config(function($sceProvider) {
|
|
219
|
-
$sceProvider.enabled(false);
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
.directive('crnValue', ['$parse', function($parse) {
|
|
223
|
-
return {
|
|
224
|
-
restrict: 'A',
|
|
225
|
-
require: '^ngModel',
|
|
226
|
-
link: function(scope, element, attr, ngModelCtrl) {
|
|
227
|
-
var evaluatedValue;
|
|
228
|
-
if (attr.value) {
|
|
229
|
-
evaluatedValue = attr.value;
|
|
230
|
-
} else {
|
|
231
|
-
evaluatedValue = $parse(attr.crnValue)(scope);
|
|
232
|
-
}
|
|
147
|
+
if (moment)
|
|
148
|
+
moment.locale(locale);
|
|
149
|
+
})
|
|
150
|
+
.config(function($sceProvider) {
|
|
151
|
+
$sceProvider.enabled(false);
|
|
152
|
+
})
|
|
233
153
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
154
|
+
.directive('crnValue', ['$parse', function($parse) {
|
|
155
|
+
return {
|
|
156
|
+
restrict: 'A',
|
|
157
|
+
require: '^ngModel',
|
|
158
|
+
link: function(scope, element, attr, ngModelCtrl) {
|
|
159
|
+
var evaluatedValue;
|
|
160
|
+
if (attr.value) {
|
|
161
|
+
evaluatedValue = attr.value;
|
|
162
|
+
} else {
|
|
163
|
+
evaluatedValue = $parse(attr.crnValue)(scope);
|
|
164
|
+
}
|
|
241
165
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
166
|
+
element.attr("data-evaluated", JSON.stringify(evaluatedValue));
|
|
167
|
+
element.bind("click", function(event) {
|
|
168
|
+
scope.$apply(function() {
|
|
169
|
+
ngModelCtrl.$setViewValue(evaluatedValue);
|
|
170
|
+
$(element).data('changed', true);
|
|
171
|
+
}.bind(element));
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
scope.$watch(function(){return ngModelCtrl.$modelValue}, function(value, old){
|
|
175
|
+
if (value !== old) {
|
|
176
|
+
var dataEvaluated = element.attr("data-evaluated");
|
|
177
|
+
var changed = $(element).data('changed');
|
|
178
|
+
$(element).data('changed', false);
|
|
179
|
+
if (!changed) {
|
|
180
|
+
if (value && JSON.stringify(''+value) === dataEvaluated) {
|
|
181
|
+
$(element)[0].checked = true
|
|
182
|
+
} else {
|
|
183
|
+
$(element)[0].checked = false;
|
|
184
|
+
}
|
|
252
185
|
}
|
|
253
186
|
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}])
|
|
259
|
-
|
|
260
|
-
.decorator("$xhrFactory", [
|
|
261
|
-
"$delegate", "$injector",
|
|
262
|
-
function($delegate, $injector) {
|
|
263
|
-
return function(method, url) {
|
|
264
|
-
var xhr = $delegate(method, url);
|
|
265
|
-
var $http = $injector.get("$http");
|
|
266
|
-
var callConfig = $http.pendingRequests[$http.pendingRequests.length - 1];
|
|
267
|
-
if (angular.isFunction(callConfig.onProgress))
|
|
268
|
-
xhr.upload.addEventListener("progress",callConfig.onProgress);
|
|
269
|
-
return xhr;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
270
189
|
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
$("form").kendoValidator({
|
|
286
|
-
errorTemplate: '<span class="k-widget k-tooltip-validation k-x-invalid-msg-block">#=message#</span>',
|
|
287
|
-
messages:{
|
|
288
|
-
required: ''
|
|
190
|
+
}])
|
|
191
|
+
|
|
192
|
+
.decorator("$xhrFactory", [
|
|
193
|
+
"$delegate", "$injector",
|
|
194
|
+
function($delegate, $injector) {
|
|
195
|
+
return function(method, url) {
|
|
196
|
+
var xhr = $delegate(method, url);
|
|
197
|
+
var $http = $injector.get("$http");
|
|
198
|
+
var callConfig = $http.pendingRequests[$http.pendingRequests.length - 1];
|
|
199
|
+
if (angular.isFunction(callConfig.onProgress))
|
|
200
|
+
xhr.upload.addEventListener("progress",callConfig.onProgress);
|
|
201
|
+
return xhr;
|
|
202
|
+
};
|
|
289
203
|
}
|
|
290
|
-
|
|
204
|
+
])
|
|
205
|
+
// General controller
|
|
206
|
+
.controller('PageController', function($controller, $scope, $stateParams, $location, $http, $rootScope, $translate, Notification, UploadService, $timeout, $state, ReportService, DashboardService) {
|
|
207
|
+
// save state params into scope
|
|
208
|
+
$scope.params = $stateParams;
|
|
209
|
+
$scope.$http = $http;
|
|
210
|
+
$scope.Notification = Notification;
|
|
211
|
+
$scope.UploadService = UploadService;
|
|
212
|
+
$scope.$state = $state;
|
|
213
|
+
|
|
214
|
+
app.registerEventsCronapi($scope, $translate, $location);
|
|
215
|
+
|
|
216
|
+
$("form").kendoValidator({
|
|
217
|
+
errorTemplate: '<span class="k-widget k-tooltip-validation k-x-invalid-msg-block">#=message#</span>',
|
|
218
|
+
messages:{
|
|
219
|
+
required: ''
|
|
220
|
+
}
|
|
221
|
+
});
|
|
291
222
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
223
|
+
$rootScope.getReport = function(reportName, params, config) {
|
|
224
|
+
ReportService.openReport(reportName, params, config);
|
|
225
|
+
};
|
|
295
226
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
227
|
+
$rootScope.getDashboard = function(dashboardName, params, config) {
|
|
228
|
+
DashboardService.openDashboard(dashboardName, params, config);
|
|
229
|
+
};
|
|
299
230
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
231
|
+
// Query string params
|
|
232
|
+
var queryStringParams = $location.search();
|
|
233
|
+
for (var key in queryStringParams) {
|
|
234
|
+
if (queryStringParams.hasOwnProperty(key)) {
|
|
235
|
+
$scope.params[key] = queryStringParams[key];
|
|
236
|
+
}
|
|
305
237
|
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
try {
|
|
309
|
-
var contextAfterPageController = $controller('AfterPageController', { $scope: $scope });
|
|
310
|
-
app.copyContext(contextAfterPageController, this, 'AfterPageController');
|
|
311
|
-
} catch(e) {}
|
|
312
238
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
});
|
|
239
|
+
try {
|
|
240
|
+
var contextAfterPageController = $controller('AfterPageController', { $scope: $scope });
|
|
241
|
+
app.copyContext(contextAfterPageController, this, 'AfterPageController');
|
|
242
|
+
} catch(e) {}
|
|
319
243
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
// <li ng-class="{ active: $state.includes('contacts.list') }"> will set the <li>
|
|
325
|
-
// to active whenever 'contacts.list' or one of its decendents is active.
|
|
326
|
-
FrontBoostAuthenticationService.init();
|
|
327
|
-
|
|
328
|
-
$rootScope.$state = $state;
|
|
329
|
-
$rootScope.$stateParams = $stateParams;
|
|
330
|
-
|
|
331
|
-
const $stateChangeError = function(error) {
|
|
332
|
-
if (error) {
|
|
333
|
-
const errorMessage = error.toString();
|
|
334
|
-
if (error.type === 6 && error.detail?.config?.url?.includes("=_.view.html") ) {
|
|
335
|
-
$state.go('login');
|
|
336
|
-
}
|
|
337
|
-
else if (errorMessage.includes('=404')) {
|
|
338
|
-
$state.go('404');
|
|
244
|
+
$timeout(function () {
|
|
245
|
+
// Verify if the 'afterPageRender' event is defined and it is a function (it can be a string pointing to a non project blockly) and run it.
|
|
246
|
+
if ($scope.blockly && $scope.blockly.events && $scope.blockly.events.afterPageRender && $scope.blockly.events.afterPageRender instanceof Function) {
|
|
247
|
+
$scope.blockly.events.afterPageRender();
|
|
339
248
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
.run(function($rootScope, $state, $stateParams, $timeout, $transitions) {
|
|
254
|
+
// It's very handy to add references to $state and $stateParams to the $rootScope
|
|
255
|
+
// so that you can access them from any scope within your applications.For example,
|
|
256
|
+
// <li ng-class="{ active: $state.includes('contacts.list') }"> will set the <li>
|
|
257
|
+
// to active whenever 'contacts.list' or one of its decendents is active.
|
|
258
|
+
$rootScope.$state = $state;
|
|
259
|
+
$rootScope.$stateParams = $stateParams;
|
|
260
|
+
|
|
261
|
+
const $stateChangeError = function(error) {
|
|
262
|
+
if (error) {
|
|
263
|
+
const errorMessage = error.toString();
|
|
264
|
+
if (error.type === 6 && error.detail.config.url.includes("=_.view.html") ) {
|
|
265
|
+
$state.go('login');
|
|
266
|
+
}
|
|
267
|
+
else if (errorMessage.includes('=404')) {
|
|
268
|
+
$state.go('404');
|
|
269
|
+
}
|
|
270
|
+
else if (errorMessage.includes('=403')) {
|
|
271
|
+
$state.go('403');
|
|
272
|
+
}
|
|
273
|
+
else if (errorMessage.includes('=401')) {
|
|
274
|
+
localStorage.removeItem('_u');
|
|
275
|
+
$state.go('loginReturnUrl', { "returnUrl" : window.location.hash });
|
|
276
|
+
} else {
|
|
277
|
+
$state.go('404');
|
|
278
|
+
}
|
|
346
279
|
} else {
|
|
347
280
|
$state.go('404');
|
|
348
281
|
}
|
|
349
|
-
}
|
|
350
|
-
$state.go('404');
|
|
351
|
-
}
|
|
352
|
-
};
|
|
282
|
+
};
|
|
353
283
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
284
|
+
const $stateChangeSuccess = function(currentRoute) {
|
|
285
|
+
$timeout(() => {
|
|
286
|
+
let systemName = $('#projectName').length ? $('#projectName').val() : $('h1:first').length && $('h1:first').text().trim().length ? $('h1:first').text().trim() : '';
|
|
357
287
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
288
|
+
const urlPattern = /\/(?:.(?!\/))+$/gm;
|
|
289
|
+
let currentWindow = window.location.hash;
|
|
290
|
+
let pageName;
|
|
361
291
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
292
|
+
if ((m = urlPattern.exec(currentWindow)) !== null) {
|
|
293
|
+
m.forEach(match => pageName = match);
|
|
294
|
+
} else {
|
|
295
|
+
pageName = currentRoute.name
|
|
296
|
+
}
|
|
367
297
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
298
|
+
let isCrud = $('form[crn-datasource]').length;
|
|
299
|
+
let prettyPageName = window.camelCaseToSentenceCase(window.toCamelCase(pageName.split('?')[0].replace("/", "")));
|
|
300
|
+
// Get the H1 or H2 text to concat with the App name to set the title page
|
|
301
|
+
if (isCrud) {
|
|
302
|
+
if ($('h1.title').length){
|
|
303
|
+
prettyPageName = $('h1.title').text();
|
|
304
|
+
} else if ($('h2.title').length){
|
|
305
|
+
prettyPageName = $('h2.title').text();
|
|
306
|
+
}
|
|
376
307
|
}
|
|
377
|
-
}
|
|
378
308
|
|
|
379
|
-
|
|
309
|
+
let title = '';
|
|
380
310
|
|
|
381
|
-
|
|
311
|
+
title = prettyPageName + (systemName.length ? ' - ' + systemName : '' );
|
|
382
312
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
313
|
+
$rootScope.viewTitle = title || currentRoute.name;
|
|
314
|
+
$rootScope.viewTitleOnly = prettyPageName || currentRoute.name;
|
|
315
|
+
$rootScope.systemName = systemName;
|
|
316
|
+
let $mainLinks = $('.main-nav-link');
|
|
317
|
+
if ($mainLinks && $mainLinks.length && $($('.main-nav-link').get(0)).is(":visible")) {
|
|
318
|
+
$(".main-access").focus();
|
|
319
|
+
// $($('.main-nav-link').get(0)).focus();
|
|
320
|
+
// $($('.main-nav-link').get(0)).blur();
|
|
321
|
+
} else {
|
|
322
|
+
let $inputsMain = $('[role=main]').find('input');
|
|
323
|
+
if ($inputsMain && $inputsMain.length) {
|
|
324
|
+
let cantFocus = ['date', 'datetime', 'time'];
|
|
325
|
+
let $firstInput = $($inputsMain[0]);
|
|
326
|
+
if ( !cantFocus.includes($firstInput.data('type')) ) {
|
|
327
|
+
$firstInput.focus();
|
|
328
|
+
}
|
|
398
329
|
}
|
|
399
330
|
}
|
|
400
|
-
}
|
|
401
331
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
332
|
+
$rootScope.renderFinished = true;
|
|
333
|
+
registerComponentScripts();
|
|
334
|
+
});
|
|
335
|
+
};
|
|
406
336
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
337
|
+
$transitions.onSuccess({}, (transition) => $stateChangeSuccess(transition.to()));
|
|
338
|
+
$state.defaultErrorHandler(error => $stateChangeError(error));
|
|
339
|
+
})
|
|
410
340
|
.config(function($httpProvider) {
|
|
341
|
+
$httpProvider.defaults.withCredentials = true;
|
|
411
342
|
// Create an interceptor to handle CSRF tokens (consistent with other implementations)
|
|
412
343
|
$httpProvider.interceptors.push(function() {
|
|
413
344
|
return {
|
|
@@ -473,11 +404,11 @@ app.registerEventsCronapi = function($scope, $translate, $location) {
|
|
|
473
404
|
$scope.params = {};
|
|
474
405
|
|
|
475
406
|
let makeCopy = (from, to) => {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
407
|
+
for (let key in from) {
|
|
408
|
+
if (from.hasOwnProperty(key)) {
|
|
409
|
+
to[key] = from[key];
|
|
410
|
+
}
|
|
479
411
|
}
|
|
480
|
-
}
|
|
481
412
|
};
|
|
482
413
|
makeCopy($stateParams, $scope.params);
|
|
483
414
|
makeCopy(queryStringParams, $scope.params);
|
|
@@ -513,47 +444,6 @@ app.registerEventsCronapi = function($scope, $translate, $location) {
|
|
|
513
444
|
}
|
|
514
445
|
};
|
|
515
446
|
|
|
516
|
-
app.registerFrontBoostFunctions = function ($scope, FrontBoostCommandService, $log) {
|
|
517
|
-
$scope.handleFrontBoostCommand = async function (encodedPayload) {
|
|
518
|
-
try {
|
|
519
|
-
const decodedPayload = atob(encodedPayload);
|
|
520
|
-
const payload = JSON.parse(decodedPayload);
|
|
521
|
-
|
|
522
|
-
if (payload && payload.actions) {
|
|
523
|
-
// Create the context. This object will be mutated by each command in the sequence.
|
|
524
|
-
const context = {
|
|
525
|
-
vars: $scope.vars,
|
|
526
|
-
params: $scope.params,
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
// Execute commands sequentially.
|
|
530
|
-
for (const rawAction of payload.actions) {
|
|
531
|
-
if (rawAction && rawAction.command) {
|
|
532
|
-
try {
|
|
533
|
-
await FrontBoostCommandService.handleCommand($scope, rawAction.command, context);
|
|
534
|
-
} catch (error) {
|
|
535
|
-
$log.error('Error processing FrontBoost command:', error);
|
|
536
|
-
break;
|
|
537
|
-
}
|
|
538
|
-
} else {
|
|
539
|
-
$log.warn('Skipping invalid command object in payload:', rawAction);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// Safely apply the mutated context back to the scope.
|
|
544
|
-
$scope.$evalAsync(() => {
|
|
545
|
-
$scope.params = context.params;
|
|
546
|
-
$scope.vars = context.vars;
|
|
547
|
-
});
|
|
548
|
-
} else {
|
|
549
|
-
$log.error('Invalid command structure: missing commands property');
|
|
550
|
-
}
|
|
551
|
-
} catch (error) {
|
|
552
|
-
$log.error('Error processing FrontBoost command:', error);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
|
|
557
447
|
app.copyContext = function(fromContext, toContext, controllerName) {
|
|
558
448
|
if (fromContext) {
|
|
559
449
|
for (var item in fromContext) {
|
|
@@ -605,8 +495,8 @@ app.factory('customTranslateLoader', function ($http, $q) {
|
|
|
605
495
|
};
|
|
606
496
|
|
|
607
497
|
var deferred = $q.defer(),
|
|
608
|
-
|
|
609
|
-
|
|
498
|
+
promises = [],
|
|
499
|
+
length = options.files.length;
|
|
610
500
|
|
|
611
501
|
for (var i = 0; i < length; i++) {
|
|
612
502
|
promises.push(load({
|
|
@@ -618,7 +508,7 @@ app.factory('customTranslateLoader', function ($http, $q) {
|
|
|
618
508
|
|
|
619
509
|
$q.all(promises).then(function (data) {
|
|
620
510
|
var length = data.length,
|
|
621
|
-
|
|
511
|
+
mergedData = {};
|
|
622
512
|
|
|
623
513
|
for (var i = 0; i < length; i++) {
|
|
624
514
|
for (var key in data[i]) {
|
|
@@ -638,7 +528,7 @@ app.factory('customTranslateLoader', function ($http, $q) {
|
|
|
638
528
|
});
|
|
639
529
|
|
|
640
530
|
window.safeApply = function(fn) {
|
|
641
|
-
var phase = this.$root
|
|
531
|
+
var phase = this.$root.$$phase;
|
|
642
532
|
if (phase === '$apply' || phase === '$digest') {
|
|
643
533
|
if (fn && (typeof(fn) === 'function')) {
|
|
644
534
|
fn();
|
|
@@ -652,15 +542,15 @@ window.toCamelCase = function(str) {
|
|
|
652
542
|
if (str !== null) {
|
|
653
543
|
// Lower cases the string
|
|
654
544
|
return str.toLowerCase()
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
545
|
+
// Replaces any - or _ or . characters with a space
|
|
546
|
+
.replace( /[-_\.]+/g, ' ')
|
|
547
|
+
// Removes any non alphanumeric characters
|
|
548
|
+
.replace( /[^\w\s]/g, '')
|
|
549
|
+
// Uppercases the first character in each group immediately following a space
|
|
550
|
+
// (delimited by spaces)
|
|
551
|
+
.replace( / (.)/g, function($1) { return $1.toUpperCase(); })
|
|
552
|
+
// Removes spaces
|
|
553
|
+
.replace( / /g, '' );
|
|
664
554
|
}
|
|
665
555
|
return str;
|
|
666
556
|
};
|