@ardimedia/angular-portal-azure 0.2.273 → 0.2.275

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