@ardimedia/angular-portal-azure 0.2.346 → 0.3.0

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/apn.js DELETED
@@ -1,1908 +0,0 @@
1
- "use strict";
2
- /// <reference types="angular" />
3
- var angularportalazure;
4
- (function (angularportalazure) {
5
- /** Define Angular module and its dependencies */
6
- var angularModule = angular.module('angularportalazure', [
7
- // Angular modules
8
- 'ngResource',
9
- 'ngDialog',
10
- 'pascalprecht.translate',
11
- 'angulartics',
12
- 'angulartics.google.analytics'
13
- ]);
14
- /** Configure Angular: $translateProvider */
15
- angularModule.config(['$translateProvider', function ($translateProvider) {
16
- $translateProvider.useSanitizeValueStrategy('escape');
17
- $translateProvider.fallbackLanguage('de');
18
- $translateProvider.use(readCookie('SAMPLE_TRANSLATE_LANG_KEY'));
19
- }]);
20
- angularModule.config([function () {
21
- }]);
22
- angularModule.run(function () {
23
- });
24
- /** Read cookie */
25
- function readCookie(cookieName) {
26
- var cookieNameEQ = cookieName + '=';
27
- var cookies = document.cookie.split(';');
28
- for (var i = 0; i < cookies.length; i++) {
29
- var cookie = cookies[i];
30
- while (cookie.charAt(0) === ' ') {
31
- cookie = cookie.substring(1, cookie.length);
32
- }
33
- if (cookie.indexOf(cookieNameEQ) === 0) {
34
- return cookie.substring(cookieNameEQ.length, cookie.length);
35
- }
36
- }
37
- return null;
38
- }
39
- })(angularportalazure || (angularportalazure = {}));
40
- var angularportalazure;
41
- (function (angularportalazure) {
42
- var UserAccount = /** @class */ (function () {
43
- // #region Constructor
44
- function UserAccount(username, firstName, lastName) {
45
- if (firstName === void 0) { firstName = ''; }
46
- if (lastName === void 0) { lastName = ''; }
47
- this.userName = username;
48
- this.firstName = firstName;
49
- this.lastName = lastName;
50
- }
51
- Object.defineProperty(UserAccount.prototype, "firstName", {
52
- get: function () {
53
- return this._firstName;
54
- },
55
- set: function (value) {
56
- this._firstName = value;
57
- this._name = (this._firstName || '') + ' ' + (this._lastName || '');
58
- },
59
- enumerable: false,
60
- configurable: true
61
- });
62
- Object.defineProperty(UserAccount.prototype, "lastName", {
63
- get: function () {
64
- return this._lastName;
65
- },
66
- set: function (value) {
67
- this._lastName = value;
68
- this._name = (this._firstName || '') + ' ' + (this._lastName || '');
69
- },
70
- enumerable: false,
71
- configurable: true
72
- });
73
- Object.defineProperty(UserAccount.prototype, "name", {
74
- get: function () {
75
- return this._name;
76
- },
77
- set: function (value) {
78
- throw new Error('[angularportalazure.UserAccount] \'name\' is a calculated value from \'firsName\' and \'lastName\'. Assignment not allowed.');
79
- },
80
- enumerable: false,
81
- configurable: true
82
- });
83
- return UserAccount;
84
- }());
85
- angularportalazure.UserAccount = UserAccount;
86
- })(angularportalazure || (angularportalazure = {}));
87
- // #region Declarations
88
- /// <reference path="useraccount.ts" />
89
- /// <reference path="portalservice.ts" />
90
- // #endregion
91
- var angularportalazure;
92
- (function (angularportalazure) {
93
- var UserControlBase = /** @class */ (function () {
94
- // #region Constructor
95
- function UserControlBase($scope, portalService) {
96
- this.statusBar = '';
97
- this.statusBarClass = '';
98
- this.$scope = $scope;
99
- this.portalService = portalService;
100
- }
101
- // #endregion
102
- // #region Methods
103
- /** angular1: $onInit(), $onChanges(changesObj), $doCheck(), $onDestroy(), $postLink() */
104
- UserControlBase.prototype.$onDestroy = function () {
105
- this.removeWindowResizeListener();
106
- };
107
- /** angular2: ngOnChanges(), ngOnInit, ngDoCheck, ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy */
108
- UserControlBase.prototype.ngOnDestroy = function () {
109
- this.removeWindowResizeListener();
110
- };
111
- /** Override */
112
- UserControlBase.prototype.onActivate = function () {
113
- };
114
- /** Override */
115
- UserControlBase.prototype.onActivated = function () {
116
- };
117
- UserControlBase.prototype.removeWindowResizeListener = function () {
118
- if (this.windowResizeHandler !== undefined) {
119
- this.portalService.$window.removeEventListener('resize', this.windowResizeHandler);
120
- }
121
- };
122
- UserControlBase.prototype.setupWindowResizeListener = function (callback) {
123
- // http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing
124
- var id;
125
- this.portalService.$window.addEventListener('resize', this.windowResizeHandler = function () {
126
- clearTimeout(id);
127
- id = setTimeout(function () { callback(); }, 50);
128
- });
129
- };
130
- UserControlBase.prototype.isNumberUndefinedNullOr0 = function (value) {
131
- if (value && value > 0) {
132
- return false;
133
- }
134
- else {
135
- return true;
136
- }
137
- };
138
- UserControlBase.prototype.isObjectNullUndefinedOrEmpty = function (value) {
139
- if (value == null) {
140
- return true;
141
- }
142
- if (value == undefined) {
143
- return true;
144
- }
145
- if (value && Object.keys(value).length > 0) {
146
- return false;
147
- }
148
- else {
149
- return true;
150
- }
151
- };
152
- UserControlBase.prototype.isStringNullOrEmpty = function (value) {
153
- if (value && value.replace(' ', '').length > 0) {
154
- return false;
155
- }
156
- else {
157
- return true;
158
- }
159
- };
160
- UserControlBase.prototype.getRandomString = function (length) {
161
- if (length === void 0) { length = 20; }
162
- return 'a' + Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).replace('.', '').replace('(e+', '').replace(')', '').slice(1);
163
- };
164
- // #region Set StatusBar
165
- UserControlBase.prototype.clearStatusBar = function () {
166
- this.statusBar = '';
167
- this.statusBarClass = '';
168
- };
169
- UserControlBase.prototype.setStatusBar = function (text, style) {
170
- this.statusBar = text ? text : '';
171
- this.statusBarClass = style ? style : '';
172
- };
173
- UserControlBase.prototype.setStatusBarCopyData = function () {
174
- this.statusBar = 'Daten kopieren...';
175
- this.statusBarClass = 'apa-statusbar-info';
176
- };
177
- UserControlBase.prototype.setStatusBarLoadData = function () {
178
- this.statusBar = 'Daten laden...';
179
- this.statusBarClass = 'apa-statusbar-info';
180
- };
181
- UserControlBase.prototype.setStatusBarSaveData = function () {
182
- this.statusBar = 'Daten speichern...';
183
- this.statusBarClass = 'apa-statusbar-info';
184
- };
185
- UserControlBase.prototype.setStatusBarDeleteData = function () {
186
- this.statusBar = 'Daten löschen...';
187
- this.statusBarClass = 'apa-statusbar-info';
188
- };
189
- UserControlBase.prototype.setStatusBarDeleteDataCanceled = function () {
190
- this.statusBar = 'Löschen abgebrochen.';
191
- this.statusBarClass = 'apa-statusbar-info';
192
- };
193
- UserControlBase.prototype.setStatusBarInfo = function (text) {
194
- this.statusBar = text;
195
- this.statusBarClass = 'apa-statusbar-info';
196
- };
197
- UserControlBase.prototype.setStatusBarError = function (text) {
198
- this.statusBar = text;
199
- this.statusBarClass = 'apa-statusbar-error';
200
- };
201
- UserControlBase.prototype.setStatusBarNoDataFound = function () {
202
- this.statusBar = 'Keine Daten gefunden!';
203
- this.statusBarClass = 'apa-statusbar-error';
204
- };
205
- UserControlBase.prototype.setStatusBarException = function (exception) {
206
- this.statusBar = angularportalazure.Exception.getOneLineMessage(exception);
207
- this.statusBarClass = 'apa-statusbar-error';
208
- };
209
- return UserControlBase;
210
- }());
211
- angularportalazure.UserControlBase = UserControlBase;
212
- })(angularportalazure || (angularportalazure = {}));
213
- // #region Declarations
214
- var __extends = (this && this.__extends) || (function () {
215
- var extendStatics = function (d, b) {
216
- extendStatics = Object.setPrototypeOf ||
217
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
218
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
219
- return extendStatics(d, b);
220
- };
221
- return function (d, b) {
222
- extendStatics(d, b);
223
- function __() { this.constructor = d; }
224
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
225
- };
226
- })();
227
- /// <reference types="angular" />
228
- /// <reference path="portalservice.ts" />
229
- /// <reference path="useraccount.ts" />
230
- /// <reference path="usercontrolbase.ts" />
231
- /// <reference path="iaddbladeeventargs.ts" />
232
- // #endregion
233
- var angularportalazure;
234
- (function (angularportalazure) {
235
- var Blade = /** @class */ (function (_super) {
236
- __extends(Blade, _super);
237
- // #region Constructor
238
- function Blade($scope, portalService, path, title, subtitle, width) {
239
- if (subtitle === void 0) { subtitle = ''; }
240
- if (width === void 0) { width = 200; }
241
- var _this = _super.call(this, $scope, portalService) || this;
242
- // #endregion
243
- // #region Properties
244
- /** HACK: 2016-11-06/hp
245
- [angular-portal-blade] needs [this] as the controller.
246
- We don't know how to provide [this] to the directive.
247
- So we came up with this [vm] property.*/
248
- _this.vm = {};
249
- _this.visibility = 'collapse';
250
- _this.title = '';
251
- _this.subTitle = '';
252
- _this.width = { 'width': '0' };
253
- _this.widthStackLayout = { 'width': '50px' };
254
- _this.isInnerHtml = true;
255
- // #endregion
256
- // #endregion
257
- // #region Commands
258
- _this.isCommandBrowse = false;
259
- _this.isCommandBrowseEnabled = true;
260
- _this.commandBrowse = function () { _this.onCommandBrowse(); };
261
- _this.commandBrowseText = '';
262
- _this.isCommandCancel = false;
263
- _this.isCommandCancelEnabled = true;
264
- _this.commandCancel = function () { _this.onCommandCancel(); };
265
- _this.commandCancelText = '';
266
- _this.isCommandCopy = false;
267
- _this.isCommandCopyEnabled = true;
268
- _this.commandCopy = function () { _this.onCommandCopy(); };
269
- _this.commandCopyText = '';
270
- _this.isCommandDelete = false;
271
- _this.isCommandDeleteEnabled = true;
272
- _this.commandDelete = function () { _this.onCommandDelete(); };
273
- _this.commandDeleteText = '';
274
- _this.isCommandDocument = false;
275
- _this.isCommandDocumentEnabled = true;
276
- _this.commandDocument = function () { _this.onCommandDocument(); };
277
- _this.commandDocumentText = '';
278
- _this.isCommandDocument2 = false;
279
- _this.isCommandDocument2Enabled = true;
280
- _this.commandDocument2 = function () { _this.onCommandDocument2(); };
281
- _this.commandDocument2Text = '';
282
- _this.isCommandDocument3 = false;
283
- _this.isCommandDocument3Enabled = true;
284
- _this.commandDocument3 = function () { _this.onCommandDocument3(); };
285
- _this.commandDocument3Text = '';
286
- _this.isCommandDocument4 = false;
287
- _this.isCommandDocument4Enabled = true;
288
- _this.commandDocument4 = function () { _this.onCommandDocument4(); };
289
- _this.commandDocument4Text = '';
290
- _this.isCommandDocument5 = false;
291
- _this.isCommandDocument5Enabled = true;
292
- _this.commandDocument5 = function () { _this.onCommandDocument5(); };
293
- _this.commandDocument5Text = '';
294
- _this.isCommandNew = false;
295
- _this.isCommandNewEnabled = true;
296
- _this.commandNew = function () { _this.onCommandNew(); };
297
- _this.commandNewText = '';
298
- _this.isCommandOrder = false;
299
- _this.isCommandOrderEnabled = true;
300
- _this.commandOrder = function () { _this.onCommandOrder(); };
301
- _this.commandOrderText = '';
302
- _this.isCommandRestart = false;
303
- _this.isCommandRestartEnabled = true;
304
- _this.commandRestart = function () { _this.onCommandRestart(); };
305
- _this.commandRestartText = '';
306
- _this.isCommandSave = false;
307
- _this.isCommandSaveEnabled = true;
308
- _this.commandSave = function () { _this.onCommandSave(); };
309
- _this.commandSaveText = '';
310
- _this.isCommandSearch = false;
311
- _this.isCommandSearchEnabled = true;
312
- _this.commandSearch = function () { _this.onCommandSearch(); };
313
- _this.commandSearchText = '';
314
- _this.isCommandStart = false;
315
- _this.isCommandStartEnabled = true;
316
- _this.commandStart = function () { _this.onCommandStart(); };
317
- _this.commandStartText = '';
318
- _this.isCommandStop = false;
319
- _this.isCommandStopEnabled = true;
320
- _this.commandStop = function () { _this.onCommandStop(); };
321
- _this.commandStopText = '';
322
- _this.isCommandSwap = false;
323
- _this.isCommandSwapEnabled = true;
324
- _this.commandSwap = function () { _this.onCommandSwap(); };
325
- _this.commandSwapText = '';
326
- _this.isCommandExcel = false;
327
- _this.isCommandExcelEnabled = true;
328
- _this.commandExcel = function () { _this.onCommandExcel(); };
329
- _this.commandExcelText = '';
330
- _this.vm = _this;
331
- _this.path = path;
332
- _this.title = title;
333
- _this.subTitle = subtitle;
334
- _this.width.width = width + 'px';
335
- _this.widthStackLayout.width = width - 50 + 'px'; // 50 = padding (left and right)
336
- if (!portalService) {
337
- throw new Error('[angularportalazure.Blade] constructor parameter \'portalService\' must be provided.');
338
- }
339
- if (!path) {
340
- throw new Error('[angularportalazure.Blade] constructor parameter \'path\' must be a string.');
341
- }
342
- if (!title && title !== '') {
343
- throw new Error('[angularportalazure.Blade] constructor parameter \'title\' must be a string when provided.');
344
- }
345
- if (!subtitle && subtitle !== '') {
346
- throw new Error('[angularportalazure.Blade] constructor parameter \'subtitle\' must be a string when provided.');
347
- }
348
- if (!width && width !== 0) {
349
- throw new Error('[angularportalazure.Blade] constructor parameter \'width\' must be a number when provided.');
350
- }
351
- if (width < 50) {
352
- throw new Error('[angularportalazure.Blade] constructor parameter \'width\' must be at least 50.');
353
- }
354
- // Set 'this.portalService.areaBlades.blades[index]' to 'this'
355
- // 'this.portalService.areaBlades.blades[index]' was generated during AddBlade
356
- _this.portalService.areaBlades.blades.forEach(function (blade, index) {
357
- if (blade.path != null && _this.path != null && blade.path.toLowerCase() === _this.path.toLowerCase()) {
358
- _this.portalService.areaBlades.blades[index] = _this;
359
- }
360
- });
361
- _this.setupWindowResizeListener(function () { _this.setBladeHeights(); });
362
- _this.setBladeHeights();
363
- return _this;
364
- }
365
- Object.defineProperty(Blade.prototype, "path", {
366
- get: function () {
367
- return this._path;
368
- },
369
- // For the moment we do distinguish between lower and upper case path name
370
- set: function (newPath) {
371
- if (newPath == null) {
372
- return;
373
- }
374
- this._path = newPath.toLowerCase();
375
- },
376
- enumerable: false,
377
- configurable: true
378
- });
379
- // #endregion
380
- // #region Methods
381
- Blade.prototype.activate = function () {
382
- this.onActivate();
383
- this.onActivated();
384
- };
385
- Blade.prototype.navigateTo = function (path) {
386
- this.onNavigateTo(path);
387
- };
388
- /** Must be overridden. */
389
- Blade.prototype.onNavigateTo = function (value) {
390
- throw new Error('[angularportalazure.Blade] \'onNavigateTo\' is an abstract function. Define one in the derived class.');
391
- };
392
- // At the moment we do not distinguish between lower and upper case path name
393
- Blade.prototype.comparePaths = function (path1, path2) {
394
- if (path1 == null) {
395
- return false;
396
- }
397
- if (path2 == null) {
398
- return false;
399
- }
400
- if (path1.toLowerCase() === path2.toLowerCase()) {
401
- return true;
402
- }
403
- else {
404
- return false;
405
- }
406
- };
407
- /** close blade. */
408
- Blade.prototype.close = function () {
409
- if (!this.onClose) {
410
- return; // do not close blade
411
- }
412
- if (this.portalService.areaBlades !== undefined) {
413
- this.portalService.areaBlades.clearPath(this.path);
414
- }
415
- else {
416
- throw new Error('[angularportalazure.Blade] path: \'' + this.path + '\' could not be removed, since no \'this.portalService.areaBlades\' available.');
417
- }
418
- };
419
- /** Override */
420
- Blade.prototype.onClose = function () {
421
- return true;
422
- };
423
- // #region Commands
424
- Blade.prototype.onCommandBrowse = function () {
425
- throw new Error('[angularportalazure.Blade] \'onCommandBrowse\' is an abstract function. Define one in the derived class.');
426
- };
427
- Blade.prototype.onCommandCancel = function () {
428
- throw new Error('[angularportalazure.Blade] \'onCommandCancel\' is an abstract function. Define one in the derived class.');
429
- };
430
- Blade.prototype.onCommandCopy = function () {
431
- throw new Error('[angularportalazure.Blade] \'onCommandCopy\' is an abstract function. Define one in the derived class.');
432
- };
433
- Blade.prototype.onCommandDelete = function () {
434
- throw new Error('[angularportalazure.Blade] \'onCommandDelete\' is an abstract function. Define one in the derived class.');
435
- };
436
- Blade.prototype.onCommandDocument = function () {
437
- throw new Error('[angularportalazure.Blade] \'onCommandDocument\' is an abstract function. Define one in the derived class.');
438
- };
439
- Blade.prototype.onCommandDocument2 = function () {
440
- throw new Error('[angularportalazure.Blade] \'onCommandDocument2\' is an abstract function. Define one in the derived class.');
441
- };
442
- Blade.prototype.onCommandDocument3 = function () {
443
- throw new Error('[angularportalazure.Blade] \'onCommandDocument3\' is an abstract function. Define one in the derived class.');
444
- };
445
- Blade.prototype.onCommandDocument4 = function () {
446
- throw new Error('[angularportalazure.Blade] \'onCommandDocument4\' is an abstract function. Define one in the derived class.');
447
- };
448
- Blade.prototype.onCommandDocument5 = function () {
449
- throw new Error('[angularportalazure.Blade] \'onCommandDocument5\' is an abstract function. Define one in the derived class.');
450
- };
451
- Blade.prototype.onCommandNew = function () {
452
- throw new Error('[angularportalazure.Blade] \'onCommandNew\' is an abstract function. Define one in the derived class.');
453
- };
454
- Blade.prototype.onCommandOrder = function () {
455
- throw new Error('[angularportalazure.Blade] \'onCommandOrder\' is an abstract function. Define one in the derived class.');
456
- };
457
- Blade.prototype.onCommandRestart = function () {
458
- throw new Error('[angularportalazure.Blade] \'onCommandRestart\' is an abstract function. Define one in the derived class.');
459
- };
460
- Blade.prototype.onCommandSave = function () {
461
- throw new Error('[angularportalazure.Blade] \'onCommandSave\' is an abstract function. Define one in the derived class.');
462
- };
463
- Blade.prototype.onCommandSearch = function () {
464
- throw new Error('[angularportalazure.Blade] \'onCommandSearch\' is an abstract function. Define one in the derived class.');
465
- };
466
- Blade.prototype.onCommandStart = function () {
467
- throw new Error('[angularportalazure.Blade] \'onCommandStart\' is an abstract function. Define one in the derived class.');
468
- };
469
- Blade.prototype.onCommandStop = function () {
470
- throw new Error('[angularportalazure.Blade] \'onCommandStop\' is an abstract function. Define one in the derived class.');
471
- };
472
- Blade.prototype.onCommandSwap = function () {
473
- throw new Error('[angularportalazure.Blade] \'onCommandSwap\' is an abstract function. Define one in the derived class.');
474
- };
475
- Blade.prototype.onCommandExcel = function () {
476
- throw new Error('[angularportalazure.Blade] \'onCommandExcel\' is an abstract function. Define one in the derived class.');
477
- };
478
- // #endregion
479
- // #endregion
480
- /** Change title, as soon as watchExpression changes. watchExpression is either a variable ore an expression, e.g. [name1 + name2] */
481
- Blade.prototype.setTitle = function (watchExpression, func) {
482
- var _this = this;
483
- if (this.watcherTitle === undefined) {
484
- if (this.$scope !== null) {
485
- // angular1
486
- this.watcherTitle = this.$scope.$watch(watchExpression, function () { func(); });
487
- this.$scope.$on('$destroy', function () { _this.watcherTitle(); });
488
- }
489
- else {
490
- // angular2
491
- console.log('[Blade.setTitle()] not supported for angular2. use [ngOnChanges] instead.');
492
- }
493
- }
494
- };
495
- Blade.prototype.setBladeHeights = function () {
496
- this.bladeContentHeight = this.portalService.$window.innerHeight - 40 - 125; // 40 = topbar, 125 = blade header
497
- this.bladeContentHeightInner = this.bladeContentHeight - 50 - 3; // 50 = padding (top and bottom), somehow we miss 3px
498
- // this.portalService.$timeout(() => {
499
- // }, 50);
500
- };
501
- return Blade;
502
- }(angularportalazure.UserControlBase));
503
- angularportalazure.Blade = Blade;
504
- })(angularportalazure || (angularportalazure = {}));
505
- // #region Imports
506
- /// <reference types="angular" />
507
- /// <reference path="blade.ts" />
508
- /// <reference path="usercontrolbase.ts" />
509
- /// <reference path="portalservice.ts" />
510
- /// <reference path="iaddbladeeventargs.ts" />
511
- // #endregion
512
- var angularportalazure;
513
- (function (angularportalazure) {
514
- var AreaBlades = /** @class */ (function (_super) {
515
- __extends(AreaBlades, _super);
516
- function AreaBlades($scope, portalService) {
517
- var _this = _super.call(this, $scope, portalService) || this;
518
- _this.blades = new Array();
519
- _this.portalScroll = _this.portalService.$window.document.getElementById('apa-portal-scroll');
520
- _this.setupAddBladeListener();
521
- _this.setupShowHideNotificationAreaListener();
522
- _this.setupWindowResizeListener(function () { _this.setPortalScrollCss(); });
523
- return _this;
524
- }
525
- // #endregion
526
- // #region Methods
527
- AreaBlades.prototype.raiseBladeOnActivateEvent = function (args) {
528
- var isEventRaised = false;
529
- this.blades.forEach(function (blade) {
530
- if (blade.path.toLowerCase() === args.path.toLowerCase()) {
531
- // Raise event onActivate
532
- blade.onActivate();
533
- isEventRaised = true;
534
- return;
535
- }
536
- });
537
- };
538
- AreaBlades.prototype.raiseAddBladeEvent = function (args) {
539
- var isBladeAlreadyShown = false;
540
- this.blades.forEach(function (blade) {
541
- if (blade.path.toLowerCase() === args.path.toLowerCase()) {
542
- // Blade is already shown, just activate it again
543
- blade.onActivate();
544
- isBladeAlreadyShown = true;
545
- return;
546
- }
547
- });
548
- if (!isBladeAlreadyShown) {
549
- // Add the blade, since it is not yet shown
550
- this.portalService.$rootScope.$broadcast('AreaBlades.AddBlade', args);
551
- }
552
- };
553
- AreaBlades.prototype.setFirstBlade = function (path) {
554
- this.clearAll();
555
- this.hidePanorama();
556
- return this.addBlade(path);
557
- };
558
- AreaBlades.prototype.addBlade = function (path, senderPath) {
559
- var _this = this;
560
- if (senderPath === void 0) { senderPath = ''; }
561
- if (path == null) {
562
- return;
563
- }
564
- if (senderPath == null) {
565
- return;
566
- }
567
- var portalcontent = null;
568
- this.portalService.$analytics.pageTrack(path.toLowerCase());
569
- path = path.toLowerCase();
570
- senderPath = senderPath.toLowerCase();
571
- // #region Verify
572
- if (path === undefined || path === '') {
573
- return;
574
- }
575
- if (this.portalService.$window !== undefined) {
576
- if (this.portalService.$window.document === undefined) {
577
- throw new Error('[angularportalazure.AreaBlades] \'this.$window.document\' undefined.');
578
- }
579
- portalcontent = this.portalService.$window.document.getElementById('apa-portal-scroll');
580
- if (portalcontent === null) {
581
- throw new Error('[angularportalazure.AreaBlades] HTML element with ID [apa-portal-scroll] not found. Maybe it is to early to call function \'BladeArea.addBlade\'.');
582
- }
583
- }
584
- // #endregion
585
- // #region Clear all children of the parent path
586
- this.clearChild(senderPath);
587
- // #endregion
588
- // #region Make sure the blade is not yet show
589
- this.blades.forEach(function (blade) {
590
- // we do not distinguish between lower and upper case path name
591
- if (blade.comparePaths(blade.path, path)) {
592
- throw new Error('[angularportalazure.AreaBlades] path: \'' + path + '\' will not be added. It is already added.');
593
- }
594
- });
595
- // #endregion
596
- // #region Show the blade
597
- var blade = new angularportalazure.Blade(this.$scope, this.portalService, path, '');
598
- this.blades.push(blade);
599
- // #endregion
600
- // #region Position the blade
601
- if (this.portalService.$window !== undefined) {
602
- this.portalService.$window.setTimeout(function () {
603
- var azureportalblades = _this.portalService.$window.document.getElementsByClassName('azureportalblade');
604
- var i = _this.blades.length - 1;
605
- // HACK: Sometime azureportalblades[i].offsetLeft is undefined.
606
- // So now if it is, the user has to scroll on its own.
607
- if (azureportalblades[i] !== undefined && azureportalblades[i].offsetLeft !== undefined) {
608
- var sl = azureportalblades[i].offsetLeft - 30;
609
- portalcontent.scrollLeft = sl;
610
- }
611
- }, 250);
612
- }
613
- // #endregion
614
- return blade;
615
- };
616
- AreaBlades.prototype.clearAll = function () {
617
- this.blades.length = 0;
618
- this.showPanoramaIfNoBlades();
619
- };
620
- AreaBlades.prototype.clearPath = function (path) {
621
- var _this = this;
622
- // we do not distinguish between lower and upper case path name
623
- path = path.toLowerCase();
624
- var isremoved = this.blades.some(function (blade, index) {
625
- if (blade.comparePaths(blade.path, path)) {
626
- _this.blades.length = index;
627
- return true;
628
- }
629
- });
630
- if (!isremoved && this.portalService.areaNotification.path === path) {
631
- this.portalService.areaNotification.hide();
632
- isremoved = true;
633
- }
634
- if (!isremoved) {
635
- throw new Error('[angularportalazure.AreaBlades.clearPath] path: \'' + path + '\' could not be removed, since path not found in bladeUrls.');
636
- }
637
- this.showPanoramaIfNoBlades();
638
- };
639
- AreaBlades.prototype.clearLevel = function (level) {
640
- if (this.blades.length < level) {
641
- throw new Error('[angularportalazure.AreaBlades] level: \'' + level + '\' could not be cleard, since only \'' + this.blades.length + '\' available.');
642
- }
643
- if (level === 0) {
644
- level = 1;
645
- }
646
- this.blades.length = level - 1;
647
- this.showPanoramaIfNoBlades();
648
- };
649
- AreaBlades.prototype.clearLastLevel = function () {
650
- this.clearLevel(this.blades.length);
651
- this.showPanoramaIfNoBlades();
652
- };
653
- AreaBlades.prototype.clearChild = function (path) {
654
- var _this = this;
655
- path = path.toLowerCase();
656
- if (path === '') {
657
- return;
658
- }
659
- var isremoved = this.blades.some(function (blade, index) {
660
- // we do not distinguish between lower and upper case path name
661
- if (blade.comparePaths(blade.path, path)) {
662
- _this.blades.length = index + 1;
663
- return true;
664
- }
665
- });
666
- if (!isremoved) {
667
- throw new Error('[angularportalazure.AreaBlades.clearChild] path: \'' + path + '\' could not be removed, since path not found in bladeUrls.');
668
- }
669
- };
670
- AreaBlades.prototype.showPanoramaIfNoBlades = function () {
671
- if (this.blades.length === 0) {
672
- if (this.portalService.panorama !== undefined) {
673
- {
674
- this.portalService.panorama.isVisible = true;
675
- }
676
- }
677
- }
678
- };
679
- AreaBlades.prototype.hidePanorama = function () {
680
- if (this.portalService.panorama !== undefined) {
681
- this.portalService.panorama.isVisible = false;
682
- }
683
- };
684
- /** We need to call this when AreaBlades is no longer used, otherwise the listener does not get removed. */
685
- AreaBlades.prototype.close = function () {
686
- // Unregister Listeners
687
- this.addBladeListener();
688
- this.areaNotificationShowListener();
689
- this.areaNotificationHideListener();
690
- };
691
- // #endregion
692
- AreaBlades.prototype.setPortalScrollCss = function () {
693
- this.portalScroll.style.marginRight = this.portalService.areaNotification.widthAreaUsed + 'px';
694
- };
695
- AreaBlades.prototype.setupShowHideNotificationAreaListener = function () {
696
- var _this = this;
697
- this.areaNotificationShowListener = this.portalService.$rootScope.$on('AreaNotification.Show', function (event, args) {
698
- _this.setPortalScrollCss();
699
- });
700
- this.areaNotificationHideListener = this.portalService.$rootScope.$on('AreaNotification.Hide', function (event, args) {
701
- _this.setPortalScrollCss();
702
- });
703
- };
704
- AreaBlades.prototype.setupAddBladeListener = function () {
705
- var _this = this;
706
- this.addBladeListener = this.portalService.$rootScope.$on('AreaBlades.AddBlade', function (event, args) {
707
- _this.addBlade(args.path, args.pathSender);
708
- });
709
- };
710
- // #region Constructor
711
- AreaBlades.$inject = ['$scope', 'angularportalazure.portalService'];
712
- return AreaBlades;
713
- }(angularportalazure.UserControlBase));
714
- angularportalazure.AreaBlades = AreaBlades;
715
- angular.module('angularportalazure').service('angularportalazure.areaBlades', AreaBlades);
716
- })(angularportalazure || (angularportalazure = {}));
717
- // #region Declarations
718
- /// <reference path="blade.ts" />
719
- /// <reference path="areablades.ts" />
720
- /// <reference path="portalservice.ts" />
721
- /// <reference path="usercontrolbase.ts" />
722
- // #endregion
723
- var angularportalazure;
724
- (function (angularportalazure) {
725
- var BladeData = /** @class */ (function (_super) {
726
- __extends(BladeData, _super);
727
- // #region Constructor
728
- function BladeData($scope, portalService, path, title, subtitle, width) {
729
- if (subtitle === void 0) { subtitle = ''; }
730
- if (width === void 0) { width = 300; }
731
- var _this = _super.call(this, $scope, portalService, path, title, subtitle, width) || this;
732
- // #endregion
733
- // #region Properties
734
- _this.item = {};
735
- _this.items = [];
736
- return _this;
737
- }
738
- // #endregion
739
- // #region newItem
740
- BladeData.prototype.newItem = function (func) {
741
- var _this = this;
742
- this.onNewItem();
743
- func().then(function (data) {
744
- _this.isCommandDeleteEnabled = false;
745
- _this.item = data;
746
- _this.onNewedItem();
747
- }).catch(function (ex) {
748
- _this.setStatusBarException(ex);
749
- _this.onNewItemException(ex);
750
- });
751
- };
752
- /** Extension point */
753
- BladeData.prototype.onNewItem = function () {
754
- };
755
- /** Extension point */
756
- BladeData.prototype.onNewedItem = function () {
757
- };
758
- /** Extension point */
759
- BladeData.prototype.onNewItemException = function (ex) {
760
- };
761
- // #endregion
762
- // #region loadItem
763
- BladeData.prototype.loadItem = function (func) {
764
- var _this = this;
765
- this.visibility = 'collapse';
766
- this.setStatusBarLoadData();
767
- this.onLoadItem();
768
- func().then(function (data) {
769
- _this.visibility = 'visible';
770
- _this.clearStatusBar();
771
- _this.item = data;
772
- _this.onLoadedItem();
773
- }).catch(function (ex) {
774
- _this.setStatusBarException(ex);
775
- _this.onLoadItemException(ex);
776
- });
777
- };
778
- /** Extension point */
779
- BladeData.prototype.onLoadItem = function () {
780
- };
781
- /** Extension point */
782
- BladeData.prototype.onLoadedItem = function () {
783
- };
784
- /** Extension point */
785
- BladeData.prototype.onLoadItemException = function (ex) {
786
- };
787
- // #endregion
788
- // #region loadItems
789
- BladeData.prototype.loadItems = function (func) {
790
- var _this = this;
791
- this.visibility = 'collapse';
792
- this.setStatusBarLoadData();
793
- this.onLoadItems();
794
- func().then(function (data) {
795
- _this.visibility = 'visible';
796
- _this.clearStatusBar();
797
- _this.items = data;
798
- _this.onLoadedItems();
799
- }).catch(function (ex) {
800
- _this.setStatusBarException(ex);
801
- _this.onLoadItemsException(ex);
802
- });
803
- };
804
- /** Extension point */
805
- BladeData.prototype.onLoadItems = function () {
806
- };
807
- /** Extension point */
808
- BladeData.prototype.onLoadedItems = function () {
809
- };
810
- /** Extension point */
811
- BladeData.prototype.onLoadItemsException = function (ex) {
812
- };
813
- // #endregion
814
- // #region saveItem
815
- /**
816
- * Default behavior for saving an entity.
817
- * - validates this.ngForm. if not valid, returns without saving
818
- * - call this.setStatusBarSaveData();
819
- * - set this.isCommandSaveEnabled = false
820
- * - call this.onSaveItem()
821
- * - call the provided function
822
- * THEN
823
- * - call this.clearStatusBar()
824
- * - set this.isCommandSaveEnabled = true
825
- * - set this.item to the saved data
826
- * - call this.onSavedItem()
827
- * - returns the saved data
828
- * CATCH
829
- * - set this.isCommandSaveEnabled = true
830
- * - call this.setStatusBarException
831
- * - call this.onLoadItemsException
832
- */
833
- BladeData.prototype.saveItem = function (func, ngForm) {
834
- var _this = this;
835
- if (ngForm === void 0) { ngForm = undefined; }
836
- if (!this.isFormValid(ngForm) && this.onSaveItemFormValidation()) {
837
- return;
838
- }
839
- this.setStatusBarSaveData();
840
- this.isCommandSaveEnabled = false;
841
- this.onSaveItem();
842
- return func().then(function (data) {
843
- _this.clearStatusBar();
844
- _this.isCommandSaveEnabled = true;
845
- _this.item = data;
846
- _this.onSavedItem();
847
- return data;
848
- }).catch(function (ex) {
849
- _this.isCommandSaveEnabled = true;
850
- _this.setStatusBarException(ex);
851
- _this.onLoadItemsException(ex);
852
- });
853
- };
854
- /** Extension point */
855
- BladeData.prototype.onSaveItem = function () {
856
- };
857
- /** Extension point */
858
- BladeData.prototype.onSavedItem = function () {
859
- };
860
- /** Extension point */
861
- BladeData.prototype.onSaveItemException = function (ex) {
862
- };
863
- // #endregion
864
- // #region saveObject
865
- /**
866
- * Default behavior for saving any object.
867
- * - validates this.ngForm. if not valid, returns without saving
868
- * - call this.setStatusBarSaveData();
869
- * - set this.isCommandSaveEnabled = false
870
- * - call this.onSaveObject()
871
- * - call the provided function
872
- * THEN
873
- * - call this.clearStatusBar()
874
- * - set this.isCommandSaveEnabled = true
875
- * - call this.onSavedObject()
876
- * - returns the saved data
877
- * CATCH
878
- * - set this.isCommandSaveEnabled = true
879
- * - call this.setStatusBarException
880
- * - call this.onLoadItemsException
881
- */
882
- BladeData.prototype.saveObject = function (func, ngForm) {
883
- var _this = this;
884
- if (ngForm === void 0) { ngForm = undefined; }
885
- if (!this.isFormValid(ngForm) && this.onSaveObjectFormValidation()) {
886
- return;
887
- }
888
- this.setStatusBarSaveData();
889
- this.isCommandSaveEnabled = false;
890
- this.onSaveObject();
891
- return func().then(function (data) {
892
- _this.clearStatusBar();
893
- _this.isCommandSaveEnabled = true;
894
- _this.onSavedObject();
895
- return data;
896
- }).catch(function (ex) {
897
- _this.isCommandSaveEnabled = true;
898
- _this.setStatusBarException(ex);
899
- _this.onLoadItemsException(ex);
900
- });
901
- };
902
- /** Extension point */
903
- BladeData.prototype.onSaveObject = function () {
904
- };
905
- /** Extension point */
906
- BladeData.prototype.onSavedObject = function () {
907
- };
908
- /** Extension point */
909
- BladeData.prototype.onSaveObjectException = function (ex) {
910
- };
911
- // #endregion
912
- // #region deleteItem
913
- BladeData.prototype.deleteItem = function (func, ngForm) {
914
- var _this = this;
915
- if (ngForm === void 0) { ngForm = undefined; }
916
- if (!this.isFormValid(ngForm) && this.onDeleteItemFormValidation()) {
917
- return;
918
- }
919
- this.setStatusBarDeleteData();
920
- this.isCommandDeleteEnabled = false;
921
- this.onDeleteItem();
922
- return func().then(function (data) {
923
- _this.clearStatusBar();
924
- _this.isCommandDeleteEnabled = true;
925
- _this.item = data;
926
- if (_this.onDeletedItem()) {
927
- _this.close();
928
- }
929
- ;
930
- return data;
931
- }).catch(function (ex) {
932
- _this.isCommandDeleteEnabled = true;
933
- _this.setStatusBarException(ex);
934
- _this.onLoadItemsException(ex);
935
- });
936
- };
937
- /** Extension point */
938
- BladeData.prototype.onDeleteItem = function () {
939
- };
940
- /** Extension point
941
- * return value indicates if the current blade should be closed or not.
942
- */
943
- BladeData.prototype.onDeletedItem = function () {
944
- return true; // close the current blade
945
- };
946
- /** Extension point */
947
- BladeData.prototype.onDeletedObjectException = function (ex) {
948
- };
949
- // #endregion
950
- // #region execute WebApi function
951
- /**
952
- * Default behavior for executing
953
- * - validates ngForm. if not valid, returns without executing
954
- * - call this.setStatusBarInfo();
955
- * - set this.isCommandStartEnabled = false
956
- * - call this.onExecute()
957
- * - call the provided function
958
- * THEN
959
- * - call this.clearStatusBar()
960
- * - set this.isCommandStartEnabled = true
961
- * - call this.onExecuted()
962
- * - returns the data
963
- * CATCH
964
- * - set this.isCommandStartEnabled = true
965
- * - call this.setStatusBarException
966
- * - call this.onExecuteException
967
- */
968
- BladeData.prototype.execute = function (message, func, ngForm) {
969
- var _this = this;
970
- if (ngForm === void 0) { ngForm = undefined; }
971
- if (!this.isFormValid(ngForm) && this.onSaveItemFormValidation()) {
972
- return;
973
- }
974
- this.setStatusBarInfo(message);
975
- this.isCommandStartEnabled = false;
976
- this.onExecute();
977
- return func().then(function (data) {
978
- _this.clearStatusBar();
979
- _this.isCommandStartEnabled = true;
980
- _this.onExecuted();
981
- return data;
982
- }).catch(function (ex) {
983
- _this.isCommandStartEnabled = true;
984
- _this.setStatusBarException(ex);
985
- _this.onExecuteException(ex);
986
- });
987
- };
988
- /** Extension point */
989
- BladeData.prototype.onExecute = function () {
990
- };
991
- /** Extension point */
992
- BladeData.prototype.onExecuted = function () {
993
- };
994
- /** Extension point */
995
- BladeData.prototype.onExecuteException = function (ex) {
996
- };
997
- // #endregion
998
- // #region Form Validation
999
- BladeData.prototype.isFormValid = function (ngForm) {
1000
- if (ngForm === void 0) { ngForm = undefined; }
1001
- // angularjs
1002
- if (!this.formblade.$valid) {
1003
- this.setStatusBarError('Formular nicht gültig.');
1004
- //console.log(this.formblade);
1005
- return false;
1006
- }
1007
- // angular (2+)
1008
- if (ngForm !== undefined) {
1009
- if (!ngForm.valid) {
1010
- return false;
1011
- }
1012
- }
1013
- return true;
1014
- };
1015
- /** Extension point */
1016
- BladeData.prototype.onSaveItemFormValidation = function () {
1017
- return true;
1018
- };
1019
- /** Extension point */
1020
- BladeData.prototype.onSaveObjectFormValidation = function () {
1021
- return true;
1022
- };
1023
- /** Extension point */
1024
- BladeData.prototype.onDeleteItemFormValidation = function () {
1025
- return true;
1026
- };
1027
- return BladeData;
1028
- }(angularportalazure.Blade));
1029
- angularportalazure.BladeData = BladeData;
1030
- })(angularportalazure || (angularportalazure = {}));
1031
- // #region Declarations
1032
- /// <reference path="bladedata.ts" />
1033
- /// <reference path="bladenavitem.ts" />
1034
- /// <reference path="portalservice.ts" />
1035
- // #endregion
1036
- var angularportalazure;
1037
- (function (angularportalazure) {
1038
- var BladeNav = /** @class */ (function (_super) {
1039
- __extends(BladeNav, _super);
1040
- // #region Constructor
1041
- function BladeNav($scope, portalService, path, title, subtitle, width) {
1042
- if (title === void 0) { title = ''; }
1043
- if (subtitle === void 0) { subtitle = ''; }
1044
- if (width === void 0) { width = 315; }
1045
- var _this = _super.call(this, $scope, portalService, path, title, subtitle, width) || this;
1046
- // #endregion
1047
- // #region Properties
1048
- //items: Array<angularportalazure.BladeNavItem> = new Array<angularportalazure.BladeNavItem>();
1049
- _this.isNav = true;
1050
- _this.isInnerHtml = false;
1051
- return _this;
1052
- }
1053
- // #endregion
1054
- // #region Methods
1055
- BladeNav.prototype.onNavigateTo = function (path) {
1056
- if (path === '') {
1057
- return;
1058
- }
1059
- this.portalService.areaBlades.raiseAddBladeEvent({ path: path, pathSender: this.path });
1060
- };
1061
- return BladeNav;
1062
- }(angularportalazure.BladeData));
1063
- angularportalazure.BladeNav = BladeNav;
1064
- })(angularportalazure || (angularportalazure = {}));
1065
- // #region Declarations
1066
- /// <reference path="bladenav.ts" />
1067
- // #endregion
1068
- var angularportalazure;
1069
- (function (angularportalazure) {
1070
- var BladeNavItem = /** @class */ (function () {
1071
- // #region Constructor
1072
- function BladeNavItem(title, cssClass, bladePath, hrefPath, roles, isVisible, callback, bladeNav) {
1073
- if (title === void 0) { title = ''; }
1074
- if (cssClass === void 0) { cssClass = ''; }
1075
- if (bladePath === void 0) { bladePath = ''; }
1076
- if (hrefPath === void 0) { hrefPath = ''; }
1077
- if (roles === void 0) { roles = ''; }
1078
- if (isVisible === void 0) { isVisible = true; }
1079
- if (callback === void 0) { callback = null; }
1080
- if (bladeNav === void 0) { bladeNav = null; }
1081
- this.title = title;
1082
- this.cssClass = cssClass;
1083
- this.bladePath = bladePath;
1084
- this.hrefPath = hrefPath;
1085
- this.roles = roles;
1086
- this.isVisible = isVisible;
1087
- this.callback = callback;
1088
- this.bladeNav = bladeNav;
1089
- }
1090
- // #endregion
1091
- // #region Methods
1092
- BladeNavItem.prototype.onNavItemClick = function () {
1093
- if (this.callback != null) {
1094
- this.callback();
1095
- }
1096
- };
1097
- return BladeNavItem;
1098
- }());
1099
- angularportalazure.BladeNavItem = BladeNavItem;
1100
- })(angularportalazure || (angularportalazure = {}));
1101
- // #region Declarations
1102
- /// <reference path="blade.ts" />
1103
- /// <reference path="bladedata.ts" />
1104
- /// <reference path="bladenavitem.ts" />
1105
- /// <reference path="portalservice.ts" />
1106
- /// <reference path="usercontrolbase.ts" />
1107
- // #endregion
1108
- var angularportalazure;
1109
- (function (angularportalazure) {
1110
- var AreaNotification = /** @class */ (function (_super) {
1111
- __extends(AreaNotification, _super);
1112
- // #region Constructor
1113
- function AreaNotification($scope, portalService) {
1114
- var _this = _super.call(this, $scope, portalService) || this;
1115
- // #endregion
1116
- // #region Properties
1117
- _this.path = '';
1118
- _this.widthAreaUsed = 0;
1119
- _this._width = 250;
1120
- _this._backgroundColor = '#32383f';
1121
- _this.areaNotification = _this.portalService.$window.document.getElementById('apa-notification-area');
1122
- _this.hide();
1123
- _this.setupWindowResizeListener(function () { _this.calcualteCssStyles(); });
1124
- return _this;
1125
- }
1126
- Object.defineProperty(AreaNotification.prototype, "width", {
1127
- get: function () {
1128
- return this._width;
1129
- },
1130
- set: function (value) {
1131
- this._width = value;
1132
- this.calcualteCssStyles();
1133
- },
1134
- enumerable: false,
1135
- configurable: true
1136
- });
1137
- Object.defineProperty(AreaNotification.prototype, "backgroundColor", {
1138
- get: function () {
1139
- return this._backgroundColor;
1140
- },
1141
- set: function (value) {
1142
- this._backgroundColor = value;
1143
- this.calcualteCssStyles();
1144
- },
1145
- enumerable: false,
1146
- configurable: true
1147
- });
1148
- // #endregion
1149
- // #region Methods
1150
- AreaNotification.prototype.hide = function () {
1151
- // Do not hide on false
1152
- if (!this.onHide) {
1153
- return;
1154
- }
1155
- this.path = '';
1156
- this.widthAreaUsed = 0;
1157
- this.areaNotification.style.display = 'none';
1158
- this.portalService.$rootScope.$broadcast('AreaNotification.Hide');
1159
- };
1160
- AreaNotification.prototype.show = function (width) {
1161
- if (width === void 0) { width = 250; }
1162
- this.onShow();
1163
- this.width = width;
1164
- this.widthAreaUsed = 1; // Indicate to the calcualteCssStyles function, that we need to set this value
1165
- this.calcualteCssStyles();
1166
- this.areaNotification.style.display = 'inline-block';
1167
- this.portalService.$rootScope.$broadcast('AreaNotification.Show');
1168
- this.onShowed();
1169
- };
1170
- /* Override */
1171
- AreaNotification.prototype.onHide = function () {
1172
- return true;
1173
- };
1174
- /* Override */
1175
- AreaNotification.prototype.onShow = function () {
1176
- };
1177
- /* Override */
1178
- AreaNotification.prototype.onShowed = function () {
1179
- };
1180
- AreaNotification.prototype.calcualteCssStyles = function () {
1181
- this.areaNotification.style.position = 'absolute';
1182
- this.areaNotification.style.top = '0';
1183
- this.areaNotification.style.height = '100%';
1184
- this.areaNotification.style.backgroundColor = this.backgroundColor;
1185
- this.areaNotification.style.borderLeft = '2px solid gray';
1186
- this.areaNotification.style.width = this.width + 'px';
1187
- this.areaNotification.style.left = this.portalService.$window.innerWidth - this.width + 'px';
1188
- if (this.widthAreaUsed !== 0) {
1189
- this.widthAreaUsed = this.width;
1190
- }
1191
- };
1192
- return AreaNotification;
1193
- }(angularportalazure.UserControlBase));
1194
- angularportalazure.AreaNotification = AreaNotification;
1195
- })(angularportalazure || (angularportalazure = {}));
1196
- // #region Declarations
1197
- /// <reference path="blade.ts" />
1198
- /// <reference path="portalservice.ts" />
1199
- /// <reference path="useraccount.ts" />
1200
- /// <reference path="usercontrolbase.ts" />
1201
- // #endregion
1202
- var angularportalazure;
1203
- (function (angularportalazure) {
1204
- var AvatarMenu = /** @class */ (function (_super) {
1205
- __extends(AvatarMenu, _super);
1206
- // #region Constructor
1207
- function AvatarMenu($scope, portalService) {
1208
- return _super.call(this, $scope, portalService) || this;
1209
- }
1210
- return AvatarMenu;
1211
- }(angularportalazure.UserControlBase));
1212
- angularportalazure.AvatarMenu = AvatarMenu;
1213
- })(angularportalazure || (angularportalazure = {}));
1214
- var angularportalazure;
1215
- (function (angularportalazure) {
1216
- /** The names are used in CSS for layouting, e.g. style='mini' */
1217
- var TileSizes;
1218
- (function (TileSizes) {
1219
- TileSizes[TileSizes["small"] = 0] = "small";
1220
- TileSizes[TileSizes["mini"] = 1] = "mini";
1221
- TileSizes[TileSizes["normal"] = 2] = "normal";
1222
- TileSizes[TileSizes["herowide"] = 3] = "herowide";
1223
- })(TileSizes = angularportalazure.TileSizes || (angularportalazure.TileSizes = {}));
1224
- })(angularportalazure || (angularportalazure = {}));
1225
- // #region Declarations
1226
- /// <reference path="tilesizes.ts" />
1227
- // #endregion
1228
- var angularportalazure;
1229
- (function (angularportalazure) {
1230
- var TileSize = /** @class */ (function () {
1231
- // #region Constructor
1232
- function TileSize(tileSizes, width, height) {
1233
- this.tileSizes = tileSizes;
1234
- this.width = width;
1235
- this.height = height;
1236
- }
1237
- // #endregion
1238
- // #region Methods
1239
- TileSize.getTileSizes = function () {
1240
- var tileSizes = Array();
1241
- tileSizes.push(new TileSize(angularportalazure.TileSizes.small, 90, 90));
1242
- tileSizes.push(new TileSize(angularportalazure.TileSizes.mini, 180, 90));
1243
- tileSizes.push(new TileSize(angularportalazure.TileSizes.normal, 180, 180));
1244
- tileSizes.push(new TileSize(angularportalazure.TileSizes.herowide, 540, 360));
1245
- return tileSizes;
1246
- };
1247
- return TileSize;
1248
- }());
1249
- angularportalazure.TileSize = TileSize;
1250
- })(angularportalazure || (angularportalazure = {}));
1251
- // #region Declarations
1252
- /// <reference path="blade.ts" />
1253
- /// <reference path="portalservice.ts" />
1254
- /// <reference path="tilesize.ts" />
1255
- // #endregion
1256
- var angularportalazure;
1257
- (function (angularportalazure) {
1258
- var Tile = /** @class */ (function () {
1259
- // #region Constructor
1260
- function Tile(title, bladePath, portalService) {
1261
- this.portalService = portalService;
1262
- this.title = title;
1263
- this.bladePath = bladePath;
1264
- this.tileSize = angularportalazure.TileSizes.normal;
1265
- }
1266
- Object.defineProperty(Tile.prototype, "bladePath", {
1267
- // #region bladePath
1268
- get: function () {
1269
- return this._bladePath;
1270
- },
1271
- // For the moment we do not distinguish between lower and upper case path name
1272
- set: function (newBladePath) {
1273
- this._bladePath = newBladePath.toLowerCase();
1274
- },
1275
- enumerable: false,
1276
- configurable: true
1277
- });
1278
- // #endregion
1279
- // #region Methods
1280
- Tile.prototype.clicked = function () {
1281
- this.portalService.areaBlades.setFirstBlade(this.bladePath);
1282
- };
1283
- return Tile;
1284
- }());
1285
- angularportalazure.Tile = Tile;
1286
- })(angularportalazure || (angularportalazure = {}));
1287
- // #region Declarations
1288
- /// <reference path="tile.ts" />
1289
- /// <reference path="tilesize.ts" />
1290
- /// <reference path="tilesizes.ts" />
1291
- // #endregion
1292
- var angularportalazure;
1293
- (function (angularportalazure) {
1294
- var Tiles = /** @class */ (function () {
1295
- function Tiles() {
1296
- // #region Properties
1297
- this.showTiles = true;
1298
- this.tiles = new Array();
1299
- this.isTilesLoaded = false;
1300
- this.hideTileIfOnlyOne = true; // not yet evaluated in HTML, but this is the standard behavior
1301
- this.tileSizes = angularportalazure.TileSize.getTileSizes();
1302
- this.nextLeft = 0;
1303
- this.nextTop = 0;
1304
- this.columnHeightMax = 0;
1305
- // #endregion
1306
- }
1307
- // #endregion
1308
- // #region Methods
1309
- Tiles.prototype.addTile = function (tile) {
1310
- this.isTilesLoaded = true;
1311
- var tileSize = this.tileSizes[tile.tileSize];
1312
- tile.size = angularportalazure.TileSizes[tile.tileSize]; // Get CSS Name
1313
- tile.top = this.nextTop + 'px';
1314
- tile.left = this.nextLeft + 'px';
1315
- this.nextLeft += tileSize.width;
1316
- if (tileSize.height > this.columnHeightMax) {
1317
- this.columnHeightMax = tileSize.height;
1318
- }
1319
- if (this.nextLeft > 540) {
1320
- this.nextLeft = 0;
1321
- this.nextTop += this.columnHeightMax;
1322
- this.columnHeightMax = 0;
1323
- }
1324
- this.tiles.push(tile);
1325
- return tile;
1326
- };
1327
- return Tiles;
1328
- }());
1329
- angularportalazure.Tiles = Tiles;
1330
- })(angularportalazure || (angularportalazure = {}));
1331
- // #region Declarations
1332
- /// <reference path="portalservice.ts" />
1333
- /// <reference path="tiles.ts" />
1334
- /// <reference path="usercontrolbase.ts" />
1335
- // #endregion
1336
- var angularportalazure;
1337
- (function (angularportalazure) {
1338
- var Startboard = /** @class */ (function (_super) {
1339
- __extends(Startboard, _super);
1340
- // #region Constructor
1341
- function Startboard($scope, portalService) {
1342
- var _this = _super.call(this, $scope, portalService) || this;
1343
- _this.tiles = new angularportalazure.Tiles();
1344
- return _this;
1345
- }
1346
- return Startboard;
1347
- }(angularportalazure.UserControlBase));
1348
- angularportalazure.Startboard = Startboard;
1349
- })(angularportalazure || (angularportalazure = {}));
1350
- // #region Declarations
1351
- /// <reference path="avatarmenu.ts" />
1352
- /// <reference path="startboard.ts" />
1353
- /// <reference path="portalservice.ts" />
1354
- /// <reference path="usercontrolbase.ts" />
1355
- // #endregion
1356
- var angularportalazure;
1357
- (function (angularportalazure) {
1358
- var Panorama = /** @class */ (function (_super) {
1359
- __extends(Panorama, _super);
1360
- // #endregion
1361
- // #region Constructor
1362
- function Panorama($scope, title, portalService) {
1363
- var _this = _super.call(this, $scope, portalService) || this;
1364
- _this.isVisible = true;
1365
- _this.title = title;
1366
- _this.portalService.panorama = _this;
1367
- _this.avatarMenu = new angularportalazure.AvatarMenu(_this.$scope, _this.portalService);
1368
- _this.startboard = new angularportalazure.Startboard(_this.$scope, _this.portalService);
1369
- return _this;
1370
- }
1371
- return Panorama;
1372
- }(angularportalazure.UserControlBase));
1373
- angularportalazure.Panorama = Panorama;
1374
- })(angularportalazure || (angularportalazure = {}));
1375
- // #region Declarations
1376
- /// <reference path="areablades.ts" />
1377
- /// <reference path="usercontrolbase.ts" />
1378
- /// <reference path="panorama.ts" />
1379
- /// <reference path="portalservice.ts" />
1380
- /// <reference path="tiles.ts" />
1381
- // #endregion
1382
- var angularportalazure;
1383
- (function (angularportalazure) {
1384
- var PortalShell = /** @class */ (function () {
1385
- // #region Constructor
1386
- function PortalShell(portalService, title) {
1387
- if (title === void 0) { title = null; }
1388
- this.portalService = portalService;
1389
- this.portalService = portalService;
1390
- this.portalService.panorama = new angularportalazure.Panorama(null, title, this.portalService);
1391
- if (title === '' || title === null || title === undefined) {
1392
- this.portalService.panorama.title = this.portalService.$window.location.hostname.toLowerCase();
1393
- }
1394
- else {
1395
- this.portalService.panorama.title = title;
1396
- }
1397
- }
1398
- return PortalShell;
1399
- }());
1400
- angularportalazure.PortalShell = PortalShell;
1401
- })(angularportalazure || (angularportalazure = {}));
1402
- // #region Declarations
1403
- /// <reference types="angular" />
1404
- /// <reference types="angulartics" />
1405
- /// <reference path="areanotification.ts" />
1406
- /// <reference path="areablades.ts" />
1407
- /// <reference path="blade.ts" />
1408
- /// <reference path="bladeparameter.ts" />
1409
- /// <reference path="panorama.ts" />
1410
- /// <reference path="portalshell.ts" />
1411
- // #endregion
1412
- var angularportalazure;
1413
- (function (angularportalazure) {
1414
- var PortalService = /** @class */ (function () {
1415
- function PortalService($injector) {
1416
- // #endregion
1417
- // #region Properties
1418
- this.parameter = { action: 'none', itemId: 0 };
1419
- this.$injector = $injector;
1420
- this.$http = $injector.get('$http');
1421
- this.$httpBackend = $injector.get('$httpBackend');
1422
- this.$q = $injector.get('$q');
1423
- this.$rootScope = $injector.get('$rootScope');
1424
- this.$window = $injector.get('$window');
1425
- this.$analytics = $injector.get('$analytics');
1426
- this.$timeout = $injector.get('$timeout');
1427
- this.$translate = $injector.get('$translate');
1428
- this.ngDialog = $injector.get('ngDialog');
1429
- }
1430
- // #region Constructor
1431
- PortalService.$inject = ['$injector'];
1432
- return PortalService;
1433
- }());
1434
- angularportalazure.PortalService = PortalService;
1435
- angular.module('angularportalazure').service('angularportalazure.portalService', PortalService);
1436
- })(angularportalazure || (angularportalazure = {}));
1437
- /// <reference types="angular" />
1438
- /// <reference path="../../domain/portalservice.ts" />
1439
- var angularportalazure;
1440
- (function (angularportalazure) {
1441
- AngularPortalBladeController.$inject = ['angularportalazure.portalService'];
1442
- function AngularPortalBladeController(portalService) {
1443
- var _this = this;
1444
- this.$onInit = function () {
1445
- _this.close = function () { };
1446
- };
1447
- }
1448
- var angularPortalBlade = {
1449
- transclude: true,
1450
- templateUrl: '/node_modules/@ardimedia/angular-portal-azure/directives/blade/blade.html',
1451
- controller: AngularPortalBladeController,
1452
- bindings: {
1453
- vm: '='
1454
- }
1455
- };
1456
- angular.module('angularportalazure').component('angularPortalBlade', angularPortalBlade);
1457
- })(angularportalazure || (angularportalazure = {}));
1458
- var angularportalazure;
1459
- (function (angularportalazure) {
1460
- var angularPortalGrid = {
1461
- transclude: true,
1462
- templateUrl: '/node_modules/@ardimedia/angular-portal-azure/directives/bladegrid/bladegrid.html',
1463
- controller: function () { },
1464
- bindings: {
1465
- vm: '='
1466
- }
1467
- };
1468
- angular.module('angularportalazure').component('angularPortalGrid', angularPortalGrid);
1469
- })(angularportalazure || (angularportalazure = {}));
1470
- var angularportalazure;
1471
- (function (angularportalazure) {
1472
- AngularPortalHomeController.$inject = ['$scope', 'angularportalazure.portalService'];
1473
- function AngularPortalHomeController($scope, portalService) {
1474
- this.$onInit = function () {
1475
- portalService.areaNotification = new angularportalazure.AreaNotification($scope, portalService);
1476
- portalService.areaBlades = new angularportalazure.AreaBlades($scope, portalService);
1477
- };
1478
- }
1479
- var angularPortalHome = {
1480
- templateUrl: '/node_modules/@ardimedia/angular-portal-azure/directives/home/home.html',
1481
- controller: AngularPortalHomeController,
1482
- bindings: {
1483
- vm: '='
1484
- }
1485
- };
1486
- angular.module('angularportalazure').component('angularPortalHome', angularPortalHome);
1487
- })(angularportalazure || (angularportalazure = {}));
1488
- var angularportalazure;
1489
- (function (angularportalazure) {
1490
- var angularPortalNav = {
1491
- transclude: true,
1492
- templateUrl: '/node_modules/@ardimedia/angular-portal-azure/directives/nav/nav.html',
1493
- controller: function () { },
1494
- bindings: {
1495
- vm: '='
1496
- }
1497
- };
1498
- angular.module('angularportalazure').component('angularPortalNav', angularPortalNav);
1499
- })(angularportalazure || (angularportalazure = {}));
1500
- // #region Declarations
1501
- /// <reference path="bladedata.ts" />
1502
- /// <reference path="portalservice.ts" />
1503
- // #endregion
1504
- var angularportalazure;
1505
- (function (angularportalazure) {
1506
- var BladeDetail = /** @class */ (function (_super) {
1507
- __extends(BladeDetail, _super);
1508
- // #region Constructor
1509
- function BladeDetail($scope, portalService, path, title, subtitle, width) {
1510
- if (subtitle === void 0) { subtitle = ''; }
1511
- if (width === void 0) { width = 200; }
1512
- var _this = _super.call(this, $scope, portalService, path, title, subtitle, width) || this;
1513
- // #endregion
1514
- // #region Properties
1515
- _this.item = {};
1516
- _this.commandNewText = 'neu';
1517
- _this.commandSaveText = 'speichern';
1518
- _this.commandDeleteText = 'löschen';
1519
- _this.commandCancelText = 'abbrechen';
1520
- return _this;
1521
- }
1522
- // #endregion
1523
- // #region Methods
1524
- BladeDetail.prototype.onCommandCancel = function () {
1525
- this.close();
1526
- };
1527
- return BladeDetail;
1528
- }(angularportalazure.BladeData));
1529
- angularportalazure.BladeDetail = BladeDetail;
1530
- })(angularportalazure || (angularportalazure = {}));
1531
- // #region Declarations
1532
- /// <reference path="bladedata.ts" />
1533
- /// <reference path="portalservice.ts" />
1534
- // #endregion
1535
- var angularportalazure;
1536
- (function (angularportalazure) {
1537
- var BladeGrid = /** @class */ (function (_super) {
1538
- __extends(BladeGrid, _super);
1539
- // #region Constructor
1540
- function BladeGrid($scope, portalService, path, title, subtitle, width) {
1541
- if (subtitle === void 0) { subtitle = ''; }
1542
- if (width === void 0) { width = 200; }
1543
- return _super.call(this, $scope, portalService, path, title, subtitle, width) || this;
1544
- }
1545
- // #endregion
1546
- // #region Properties
1547
- //items: T[] = [];
1548
- // #endregion
1549
- // #region Methods
1550
- //loadItems(func: () => any | angular.IPromise<any> | Promise<any>): void {
1551
- // this.onLoadItems();
1552
- // func().then((data: any) => {
1553
- // this.items = data;
1554
- // this.onLoadedItems();
1555
- // }).catch((exception: angularportalazure.Exception) => {
1556
- // this.setStatusBarException(exception);
1557
- // });
1558
- //}
1559
- // #region Filter
1560
- BladeGrid.prototype.onFilter = function (actual, expected) {
1561
- // #region Documentation
1562
- // > onFilter will be called for each item in an array
1563
- // > If the item is an native type (string, number), the filter will be called with the native type in the parameter 'actual'
1564
- // > If the item is an object, the filter will be called with each property of the object in the parameter 'actual'
1565
- // > If the item is an object, the filter will also be called with the object in the parameter 'actual'
1566
- // #endregion
1567
- // #region Helper functions
1568
- // Implementation detail:
1569
- // > We implemented the following functions with in-line-functions, since onFilter is not called within the scope of a class (this. not working).
1570
- // Function to convert 'number' to 'string'
1571
- var convertToString = function (value) {
1572
- return value + ''; // convert to string, so the next statements will process the value as a string
1573
- };
1574
- // Function which figures out, if the 'expected' value is found in the 'actual' value
1575
- var valueFound = function (actual, expected) {
1576
- expectedSplitted.forEach(function (expectedItem, index) {
1577
- if (actual.toLowerCase().indexOf(expectedItem) > -1) {
1578
- expectedSplitted[index] = ''; // expected has been found, initialize it now
1579
- }
1580
- });
1581
- };
1582
- // Function to process an object
1583
- var processObject = function (actual) {
1584
- for (var actualProperty in actual) {
1585
- if (actual.hasOwnProperty(actualProperty)) {
1586
- var actualValue = actual[actualProperty];
1587
- if (typeof actual === 'number') {
1588
- actualValue = convertToString(actual);
1589
- }
1590
- if (typeof actualValue === 'string') {
1591
- if (actualValue.indexOf('object:') > -1) {
1592
- continue;
1593
- }
1594
- valueFound(actualValue, expected);
1595
- }
1596
- }
1597
- else {
1598
- // Process inherited properties
1599
- processObject(actual[actualProperty]);
1600
- }
1601
- }
1602
- };
1603
- // #endregion
1604
- // #region Initialize
1605
- // Prepare 'expected' value
1606
- expected = expected.toLowerCase();
1607
- // Split the search string into its parts if separated by blanks
1608
- var expectedSplitted = expected.split(' ');
1609
- // #endregion
1610
- // #region Process depending on type
1611
- // Process property, typeof 'object'
1612
- if (typeof actual === 'object') {
1613
- processObject(actual);
1614
- }
1615
- // Process property, typeof 'number'
1616
- if (typeof actual === 'number') {
1617
- actual = convertToString(actual);
1618
- }
1619
- // Process property, typeof 'string'
1620
- if (typeof actual === 'string') {
1621
- valueFound(actual, expected);
1622
- }
1623
- // #endregion
1624
- // #region Verify if all expected has been found
1625
- var foundCount = 0;
1626
- expectedSplitted.forEach(function (expectedItem) {
1627
- if (expectedItem === '') { // all expectedSplitted.items which have been found, are initialized to '' (see above)
1628
- foundCount++;
1629
- }
1630
- });
1631
- // #endregion
1632
- // #region Return result
1633
- if (foundCount === expectedSplitted.length) {
1634
- return true;
1635
- }
1636
- else {
1637
- return false;
1638
- }
1639
- // #endregion
1640
- };
1641
- return BladeGrid;
1642
- }(angularportalazure.BladeData));
1643
- angularportalazure.BladeGrid = BladeGrid;
1644
- })(angularportalazure || (angularportalazure = {}));
1645
- var angularportalazure;
1646
- (function (angularportalazure) {
1647
- var Debug = /** @class */ (function () {
1648
- // #region Constructor
1649
- function Debug() {
1650
- }
1651
- // #endregion
1652
- // #region Methods
1653
- Debug.enable = function (key) {
1654
- Debug.isEnabled = true;
1655
- if (key) {
1656
- Debug.keys.push(key);
1657
- }
1658
- };
1659
- Debug.disable = function (key) {
1660
- if (key) {
1661
- var indexToDelete = Debug.keys.indexOf(key);
1662
- Debug.keys.splice(indexToDelete, 1);
1663
- }
1664
- if (Debug.keys.length === 0) {
1665
- Debug.isEnabled = false;
1666
- }
1667
- };
1668
- Debug.write = function (debugLine, objects) {
1669
- if ((Debug.isEnabled && Debug.keys.length === 0)
1670
- || (Debug.isEnabled && Debug.isInKeys(debugLine))) {
1671
- console.log(debugLine);
1672
- if (objects !== undefined && Debug.isWithObjects) {
1673
- objects.forEach(function (item) {
1674
- console.log(item);
1675
- });
1676
- }
1677
- return true;
1678
- }
1679
- return false;
1680
- };
1681
- /** Extract the key (e.g. [azureportal] from a string */
1682
- Debug.extractKey = function (text) {
1683
- var extractKey = '';
1684
- var firstCharacter = text.substring(0, 1);
1685
- if (firstCharacter === '[') {
1686
- // Find closing bracket
1687
- var closingPos = text.indexOf(']');
1688
- if (closingPos > 0) {
1689
- extractKey = text.substring(0, closingPos + 1);
1690
- }
1691
- }
1692
- return extractKey;
1693
- };
1694
- /** Extract the key (e.g. [azureportal] from a string */
1695
- Debug.isInKeys = function (debugLine) {
1696
- var key = Debug.extractKey(debugLine);
1697
- if (Debug.keys.indexOf(key) !== -1) {
1698
- return true;
1699
- }
1700
- return false;
1701
- };
1702
- // #endregion
1703
- // #region Properties
1704
- Debug.isEnabled = false;
1705
- Debug.isWithObjects = false;
1706
- Debug.keys = new Array();
1707
- return Debug;
1708
- }());
1709
- angularportalazure.Debug = Debug;
1710
- })(angularportalazure || (angularportalazure = {}));
1711
- var angularportalazure;
1712
- (function (angularportalazure) {
1713
- var ValidationResultDotNet = /** @class */ (function () {
1714
- function ValidationResultDotNet() {
1715
- }
1716
- return ValidationResultDotNet;
1717
- }());
1718
- angularportalazure.ValidationResultDotNet = ValidationResultDotNet;
1719
- var ExceptionDotNet = /** @class */ (function () {
1720
- function ExceptionDotNet() {
1721
- }
1722
- return ExceptionDotNet;
1723
- }());
1724
- angularportalazure.ExceptionDotNet = ExceptionDotNet;
1725
- var ArgumentNullException = /** @class */ (function (_super) {
1726
- __extends(ArgumentNullException, _super);
1727
- function ArgumentNullException() {
1728
- return _super !== null && _super.apply(this, arguments) || this;
1729
- }
1730
- return ArgumentNullException;
1731
- }(ExceptionDotNet));
1732
- angularportalazure.ArgumentNullException = ArgumentNullException;
1733
- var EntityValidationException = /** @class */ (function (_super) {
1734
- __extends(EntityValidationException, _super);
1735
- function EntityValidationException() {
1736
- return _super !== null && _super.apply(this, arguments) || this;
1737
- }
1738
- return EntityValidationException;
1739
- }(ExceptionDotNet));
1740
- angularportalazure.EntityValidationException = EntityValidationException;
1741
- /**
1742
- * @deprecated ValidationsExceptionDotNet should be replaced by EntityValidationException
1743
- */
1744
- var ValidationsExceptionDotNet = /** @class */ (function (_super) {
1745
- __extends(ValidationsExceptionDotNet, _super);
1746
- function ValidationsExceptionDotNet() {
1747
- return _super !== null && _super.apply(this, arguments) || this;
1748
- }
1749
- return ValidationsExceptionDotNet;
1750
- }(EntityValidationException));
1751
- angularportalazure.ValidationsExceptionDotNet = ValidationsExceptionDotNet;
1752
- })(angularportalazure || (angularportalazure = {}));
1753
- // #region Declarations
1754
- /// <reference path="exceptiondotnet.ts" />
1755
- // #endregion
1756
- var angularportalazure;
1757
- (function (angularportalazure) {
1758
- var Exception = /** @class */ (function (_super) {
1759
- __extends(Exception, _super);
1760
- function Exception() {
1761
- return _super !== null && _super.apply(this, arguments) || this;
1762
- }
1763
- // #endregion
1764
- // #region Static Methods
1765
- Exception.getOneLineMessage = function (exception) {
1766
- var message = '';
1767
- if (exception.Message !== undefined) {
1768
- if (exception.Message.toLowerCase().indexOf('cannot insert duplicate key in object') >= 0
1769
- || exception.Message.toLowerCase().indexOf('the duplicate key value is') >= 0) {
1770
- console.debug(exception.Message);
1771
- return 'Datensatz mit gleichem Key (Schlüssel) bereits vorhanden!';
1772
- }
1773
- if (exception.Message.toLowerCase().indexOf('the delete statement conflicted with the reference constraint') >= 0) {
1774
- console.debug(exception.Message);
1775
- return 'Datensatz kann nicht gelöscht werden, da noch abhängige Daten vorhanden sind!';
1776
- }
1777
- if (exception.Message.toLowerCase().indexOf('see the inner exception for details') >= 0) {
1778
- // Frist innerException
1779
- var innerException = exception.InnerException;
1780
- if (exception.InnerException.Message.toLowerCase().indexOf('see the inner exception for details') >= 0) {
1781
- // Second innerException
1782
- var innerException_1 = exception.InnerException.InnerException;
1783
- if (exception.InnerException.InnerException.Message.toLowerCase().indexOf('see the inner exception for details') >= 0) {
1784
- // Third innerException
1785
- var innerException_2 = exception.InnerException.InnerException.InnerException;
1786
- }
1787
- }
1788
- console.debug(exception);
1789
- return innerException.Message;
1790
- }
1791
- message = message + exception.Message + ' ';
1792
- return message;
1793
- }
1794
- if (exception.Messages !== undefined) {
1795
- if (exception.Messages.length > 0) {
1796
- message = '';
1797
- exception.Messages.forEach(function (item, index) {
1798
- if (index > 0) {
1799
- message = message + ' - ';
1800
- }
1801
- message = message + item;
1802
- });
1803
- return message;
1804
- }
1805
- }
1806
- if (exception.ExceptionMessage !== undefined && exception.ExceptionMessage.toLowerCase().indexOf('see the inner exception for details') < 0) {
1807
- message = message + ': ' + exception.ExceptionMessage + ' ';
1808
- return message;
1809
- }
1810
- if (exception.ExceptionMessage !== undefined && exception.ExceptionMessage.toLowerCase().indexOf('see the inner exception for details') >= 0) {
1811
- if (exception.InnerException !== undefined) {
1812
- if (exception.InnerException.InnerException !== undefined) {
1813
- message = message + ': ' + exception.InnerException.InnerException.ExceptionMessage + ' ';
1814
- return message;
1815
- }
1816
- else {
1817
- message = message + ': ' + exception.InnerException.ExceptionMessage + ' ';
1818
- return message;
1819
- }
1820
- }
1821
- }
1822
- // Default handler
1823
- console.debug(exception);
1824
- message = message + ': JavaScript-Fehler oder Probleme mit der Internetverbindung. Weitere Informationen im Log (change log to full = debug). ' + exception;
1825
- return message;
1826
- };
1827
- // TODO:2018-10-10/hp: [angular.IHttpPromiseCallbackArg<angularportalazure.Exception>] should be Response
1828
- Exception.prepareException = function (response) {
1829
- var exception = angularportalazure.Exception.createException();
1830
- // #region Process (Angular 1) response.data.Data
1831
- if (response.data !== undefined && response.data.Data !== undefined) {
1832
- exception = angularportalazure.Exception.processResponseData(exception, response.data.Data);
1833
- }
1834
- // #endregion
1835
- // #region Process (Angular 2) response.json().Data (EntityValidationException, etc.)
1836
- else if (response.json !== undefined && response.json().Data != undefined) {
1837
- exception = angularportalazure.Exception.processResponseData(exception, response.json().Data);
1838
- }
1839
- // #endregion
1840
- // #region Process (Angular 2) response._body
1841
- else if (response._body !== undefined) {
1842
- var body = JSON.parse(response._body);
1843
- if (body.Message) {
1844
- exception.Message = body.Message;
1845
- }
1846
- }
1847
- // #endregion
1848
- // #region Process (Angular 2) response.InnerException.InnerException.Message
1849
- else if (response.json !== undefined && response.json !== null
1850
- && response.json().InnerException !== undefined && response.json().InnerException !== null
1851
- && response.json().InnerException.InnerException !== undefined && response.json().InnerException.InnerException !== null) {
1852
- exception.Message = response.json().InnerException.InnerException.Message;
1853
- }
1854
- // #endregion
1855
- //exception.convertResponse(response);
1856
- exception.Url = response.url;
1857
- exception.Status = response.status;
1858
- exception.StatusText = response.statusText;
1859
- return exception;
1860
- };
1861
- Exception.createException = function () {
1862
- var exception = new angularportalazure.Exception();
1863
- exception.Messages = [];
1864
- return exception;
1865
- };
1866
- //private static processResponseWithData(exception: angularportalazure.Exception, response: angular.IHttpPromiseCallbackArg<angularportalazure.Exception>): angularportalazure.Exception {
1867
- // console.debug('angularportalazure.Exception.processResponseWithData');
1868
- // // #region Convert data to Messages
1869
- // if (response.data.Data === undefined) {
1870
- // exception.Messages.push('No further information found in [response.data.Data].');
1871
- // exception.Messages.push('No further information found in [response.data.Data].');
1872
- // } else {
1873
- // let i = 1;
1874
- // while (response.data.Data[i + ''] !== undefined) {
1875
- // console.debug('Add to exception.Messages : ' + response.data.Data[i + '']);
1876
- // exception.Messages.push(response.data.Data[i + '']);
1877
- // i++;
1878
- // }
1879
- // }
1880
- // // #endregion
1881
- // return exception;
1882
- //}
1883
- Exception.processResponseData = function (exception, data) {
1884
- var i = 1;
1885
- while (data[i + ''] !== undefined) {
1886
- exception.Messages.push(data[i + '']);
1887
- i++;
1888
- }
1889
- return exception;
1890
- };
1891
- return Exception;
1892
- }(angularportalazure.ValidationsExceptionDotNet));
1893
- angularportalazure.Exception = Exception;
1894
- })(angularportalazure || (angularportalazure = {}));
1895
- ///// <reference types="angular" />
1896
- //namespace angularportalazure {
1897
- // export class DataService {
1898
- // // #region Constructor
1899
- // constructor(public $http: angular.IHttpService, public $q: angular.IQService) {
1900
- // }
1901
- // // #endregion
1902
- // // #region Methods
1903
- // getData(url: string): angular.IPromise<any> {
1904
- // return this.$http({ method: 'GET', url: url });
1905
- // }
1906
- // // #endregion
1907
- // }
1908
- //}