@ardimedia/angular-portal-azure 0.2.2-beta

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 ADDED
@@ -0,0 +1,1342 @@
1
+ /// <reference types="angular" />
2
+ var angularportalazure;
3
+ (function (angularportalazure) {
4
+ /** Define Angular module and its dependencies */
5
+ var angularModule = angular.module('angularportalazure', [
6
+ // Angular modules
7
+ 'ngResource',
8
+ 'ngDialog'
9
+ ]);
10
+ angularModule.config([function () {
11
+ //Debug.enable('[angularportalazure-debug]');
12
+ //Debug.isWithObjects = false;
13
+ }]);
14
+ angularModule.run(function () {
15
+ //Debug.write('[angularportalazure-debug] \'angularportalazure.run\' executing.', [this]);
16
+ });
17
+ })(angularportalazure || (angularportalazure = {}));
18
+ //#region Make sure console.log is working in any case, even IE9
19
+ //if ($('html').hasClass('k-ie9')) {
20
+ // if (typeof console !== 'object') window.console = <any>{};
21
+ // if (typeof console.log !== 'object') window.console.log = function () { };
22
+ //}
23
+ //#endregion
24
+ var angularportalazure;
25
+ (function (angularportalazure) {
26
+ var Debug = (function () {
27
+ //#region Constructors
28
+ function Debug() {
29
+ }
30
+ //#endregion
31
+ //#region Methods
32
+ Debug.enable = function (key) {
33
+ Debug.isEnabled = true;
34
+ if (key) {
35
+ Debug.keys.push(key);
36
+ }
37
+ };
38
+ Debug.disable = function (key) {
39
+ if (key) {
40
+ var indexToDelete = Debug.keys.indexOf(key);
41
+ Debug.keys.splice(indexToDelete, 1);
42
+ }
43
+ if (Debug.keys.length === 0) {
44
+ Debug.isEnabled = false;
45
+ }
46
+ };
47
+ Debug.write = function (debugLine, objects) {
48
+ if ((Debug.isEnabled && Debug.keys.length === 0)
49
+ || (Debug.isEnabled && Debug.isInKeys(debugLine))) {
50
+ console.log(debugLine);
51
+ if (objects !== undefined && Debug.isWithObjects) {
52
+ objects.forEach(function (item) {
53
+ console.log(item);
54
+ });
55
+ }
56
+ return true;
57
+ }
58
+ return false;
59
+ };
60
+ /** Extract the key (e.g. [azureportal] from a string */
61
+ Debug.extractKey = function (text) {
62
+ var extractKey = '';
63
+ var firstCharacter = text.substring(0, 1);
64
+ if (firstCharacter === '[') {
65
+ // Find closing bracket
66
+ var closingPos = text.indexOf(']');
67
+ if (closingPos > 0) {
68
+ extractKey = text.substring(0, closingPos + 1);
69
+ }
70
+ }
71
+ return extractKey;
72
+ };
73
+ /** Extract the key (e.g. [azureportal] from a string */
74
+ Debug.isInKeys = function (debugLine) {
75
+ var key = Debug.extractKey(debugLine);
76
+ if (Debug.keys.indexOf(key) != -1) {
77
+ return true;
78
+ }
79
+ return false;
80
+ };
81
+ //#endregion
82
+ //#region Properties
83
+ Debug.isEnabled = false;
84
+ Debug.isWithObjects = false;
85
+ Debug.keys = new Array();
86
+ return Debug;
87
+ }());
88
+ angularportalazure.Debug = Debug;
89
+ })(angularportalazure || (angularportalazure = {}));
90
+ /// <reference path="debug.ts" />
91
+ var angularportalazure;
92
+ (function (angularportalazure) {
93
+ var UserAccount = (function () {
94
+ //#region Constructors
95
+ function UserAccount(username, firstName, lastName) {
96
+ if (firstName === void 0) { firstName = ''; }
97
+ if (lastName === void 0) { lastName = ''; }
98
+ angularportalazure.Debug.write('[angularportalazure-debug] \'UserAccount\' constructor called.', [this, username, firstName, lastName]);
99
+ this.userName = username;
100
+ this.firstName = firstName;
101
+ this.lastName = lastName;
102
+ }
103
+ Object.defineProperty(UserAccount.prototype, "firstName", {
104
+ get: function () {
105
+ return this._firstName;
106
+ },
107
+ set: function (value) {
108
+ this._firstName = value;
109
+ this._name = (this._firstName || '') + ' ' + (this._lastName || '');
110
+ },
111
+ enumerable: true,
112
+ configurable: true
113
+ });
114
+ Object.defineProperty(UserAccount.prototype, "lastName", {
115
+ get: function () {
116
+ return this._lastName;
117
+ },
118
+ set: function (value) {
119
+ this._lastName = value;
120
+ this._name = (this._firstName || '') + ' ' + (this._lastName || '');
121
+ },
122
+ enumerable: true,
123
+ configurable: true
124
+ });
125
+ Object.defineProperty(UserAccount.prototype, "name", {
126
+ get: function () {
127
+ return this._name;
128
+ },
129
+ set: function (value) {
130
+ throw new Error('[angularportalazure.UserAccount] \'name\' is a calculated value from \'firsName\' and \'lastName\'. Assignment not allowed.');
131
+ //this._name = value;
132
+ },
133
+ enumerable: true,
134
+ configurable: true
135
+ });
136
+ return UserAccount;
137
+ }());
138
+ angularportalazure.UserAccount = UserAccount;
139
+ })(angularportalazure || (angularportalazure = {}));
140
+ /// <reference path="debug.ts" />
141
+ /// <reference path="portalservice.ts" />
142
+ var angularportalazure;
143
+ (function (angularportalazure) {
144
+ var UserControlBase = (function () {
145
+ //#region Constructors
146
+ function UserControlBase(portalService) {
147
+ angularportalazure.Debug.write('[angularportalazure-debug] \'UserControlBase\' constructor called.', [this, portalService]);
148
+ this.portalService = portalService;
149
+ }
150
+ return UserControlBase;
151
+ }());
152
+ angularportalazure.UserControlBase = UserControlBase;
153
+ })(angularportalazure || (angularportalazure = {}));
154
+ /// <reference path="debug.ts" />
155
+ /// <reference path="useraccount.ts" />
156
+ /// <reference path="portalservice.ts" />
157
+ /// <reference path="usercontrolbase.ts" />
158
+ /// <reference path="iaddbladeeventargs.ts" />
159
+ var __extends = (this && this.__extends) || function (d, b) {
160
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
161
+ function __() { this.constructor = d; }
162
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
163
+ };
164
+ var angularportalazure;
165
+ (function (angularportalazure) {
166
+ var Blade = (function (_super) {
167
+ __extends(Blade, _super);
168
+ //#region Constructor
169
+ function Blade(portalService, path, title, subtitle, width) {
170
+ if (subtitle === void 0) { subtitle = ''; }
171
+ if (width === void 0) { width = 200; }
172
+ _super.call(this, portalService);
173
+ this.title = '';
174
+ this.subTitle = '';
175
+ this.width = { 'width': '0' };
176
+ this.widthStackLayout = { 'width': '50px' };
177
+ this.isInnerHtml = true;
178
+ this.statusbar = '';
179
+ this.statusbarClass = '';
180
+ //#endregion
181
+ //#region Commands
182
+ this.isCommandBrowse = false;
183
+ this.commandBrowse = function () { this.onCommandBrowse(); };
184
+ this.commandBrowseText = '';
185
+ this.isCommandCancel = false;
186
+ this.commandCancel = function () { this.onCommandCancel(); };
187
+ this.commandCancelText = '';
188
+ this.isCommandCopy = false;
189
+ this.commandCopy = function () { this.onCommandCopy(); };
190
+ this.commandCopyText = '';
191
+ this.isCommandDelete = false;
192
+ this.commandDelete = function () { this.onCommandDelete(); };
193
+ this.commandDeleteText = '';
194
+ this.isCommandDocument = false;
195
+ this.commandDocument = function () { this.onCommandDocument(); };
196
+ this.commandDocumentText = '';
197
+ this.isCommandDocument2 = false;
198
+ this.commandDocument2 = function () { this.onCommandDocument2(); };
199
+ this.commandDocument2Text = '';
200
+ this.isCommandDocument3 = false;
201
+ this.commandDocument3 = function () { this.onCommandDocument3(); };
202
+ this.commandDocument3Text = '';
203
+ this.isCommandDocument4 = false;
204
+ this.commandDocument4 = function () { this.onCommandDocument4(); };
205
+ this.commandDocument4Text = '';
206
+ this.isCommandDocument5 = false;
207
+ this.commandDocument5 = function () { this.onCommandDocument5(); };
208
+ this.commandDocument5Text = '';
209
+ this.isCommandNew = false;
210
+ this.commandNew = function () { this.onCommandNew(); };
211
+ this.commandNewText = '';
212
+ this.isCommandOrder = false;
213
+ this.commandOrder = function () { this.onCommandOrder(); };
214
+ this.commandOrderText = '';
215
+ this.isCommandRestart = false;
216
+ this.commandRestart = function () { this.onCommandRestart(); };
217
+ this.commandRestartText = '';
218
+ this.isCommandSave = false;
219
+ this.commandSave = function () { this.onCommandSave(); };
220
+ this.commandSaveText = '';
221
+ this.isCommandSearch = false;
222
+ this.commandSearch = function () { this.onCommandSearch(); };
223
+ this.commandSearchText = '';
224
+ this.isCommandStart = false;
225
+ this.commandStart = function () { this.onCommandStart(); };
226
+ this.commandStartText = '';
227
+ this.isCommandStop = false;
228
+ this.commandStop = function () { this.onCommandStop(); };
229
+ this.commandStopText = '';
230
+ this.isCommandSwap = false;
231
+ this.commandSwap = function () { this.onCommandSwap(); };
232
+ this.commandSwapText = '';
233
+ /** Obsolete */
234
+ this.navGrid = {
235
+ portalService: null,
236
+ items: [],
237
+ navigateTo: function (path) { }
238
+ };
239
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade\' constructor called.', [this, portalService, path, title, subtitle, width]);
240
+ var that = this;
241
+ this.blade = this;
242
+ this.path = path;
243
+ this.title = title;
244
+ this.subTitle = subtitle;
245
+ this.width.width = width + 'px';
246
+ this.widthStackLayout.width = width - 50 + 'px';
247
+ this.navGrid.portalService = portalService;
248
+ if (!portalService) {
249
+ throw new Error('[angularportalazure.Blade] constructor parameter \'portalService\' must be provided.');
250
+ }
251
+ if (!path) {
252
+ throw new Error('[angularportalazure.Blade] constructor parameter \'path\' must be a string.');
253
+ }
254
+ if (!title && title !== '') {
255
+ throw new Error('[angularportalazure.Blade] constructor parameter \'title\' must be a string when provided.');
256
+ }
257
+ if (!subtitle && subtitle !== '') {
258
+ throw new Error('[angularportalazure.Blade] constructor parameter \'subtitle\' must be a string when provided.');
259
+ }
260
+ if (!width && width !== 0) {
261
+ throw new Error('[angularportalazure.Blade] constructor parameter \'width\' must be a number when provided.');
262
+ }
263
+ if (width < 50) {
264
+ throw new Error('[angularportalazure.Blade] constructor parameter \'width\' must be at least 50.');
265
+ }
266
+ //#region Add BladeArea.AddBlade event listener
267
+ /** OBSOLETE: remove when all OBSOLETE code has been removed */
268
+ if (portalService instanceof angularportalazure.PortalService == false) {
269
+ return;
270
+ }
271
+ /** OBSOLETE: end */
272
+ // Register listener1
273
+ this.listener1 = that.portalService.$rootScope.$on('BladeArea.AddBlade', function (event, args) {
274
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade\' BladeArea.AddBlade event processing.', [this, event, args]);
275
+ if (args.path === that.blade.path) {
276
+ that.activate();
277
+ }
278
+ });
279
+ //#endregion
280
+ }
281
+ //#endregion
282
+ //#endregion
283
+ //#region Methods
284
+ //#region Methods
285
+ Blade.prototype.activate = function () {
286
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade.activate\' called. You could override this, but proably you should call super.activate().', [this]);
287
+ this.onActivate();
288
+ };
289
+ Blade.prototype.onActivate = function () {
290
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade.onActivate\' not overriden. You could override this.', [this]);
291
+ };
292
+ Blade.prototype.navigateTo = function (arg) {
293
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade.navigateTo\' called. You should not override this, use onNavigateTo instead.', [this, arg]);
294
+ this.onNavigateTo(arg);
295
+ };
296
+ Blade.prototype.onNavigateTo = function (arg) {
297
+ throw new Error('[angularportalazure.Blade] \'onNavigateTo\' is an abstract function. Define one in the derived class.');
298
+ };
299
+ /** close blade. */
300
+ Blade.prototype.close = function () {
301
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade.close\' called.', [this]);
302
+ this.listener1(); // Unregister listener1
303
+ if (this.portalService.bladeArea !== undefined) {
304
+ this.portalService.bladeArea.clearPath(this.path);
305
+ }
306
+ else {
307
+ throw new Error('[angularportalazure.Blade] path: \'' + this.path + '\' could not be removed, since no \'this.portalService.bladeArea\' available.');
308
+ }
309
+ };
310
+ //#endregion
311
+ //#region Commands
312
+ Blade.prototype.onCommandBrowse = function () {
313
+ throw new Error('[angularportalazure.Blade] \'onCommandBrowse\' is an abstract function. Define one in the derived class.');
314
+ };
315
+ Blade.prototype.onCommandCancel = function () {
316
+ throw new Error('[angularportalazure.Blade] \'onCommandCancel\' is an abstract function. Define one in the derived class.');
317
+ };
318
+ Blade.prototype.onCommandCopy = function () {
319
+ throw new Error('[angularportalazure.Blade] \'onCommandCopy\' is an abstract function. Define one in the derived class.');
320
+ };
321
+ Blade.prototype.onCommandDelete = function () {
322
+ throw new Error('[angularportalazure.Blade] \'onCommandDelete\' is an abstract function. Define one in the derived class.');
323
+ };
324
+ Blade.prototype.onCommandDocument = function () {
325
+ throw new Error('[angularportalazure.Blade] \'onCommandDocument\' is an abstract function. Define one in the derived class.');
326
+ };
327
+ Blade.prototype.onCommandDocument2 = function () {
328
+ throw new Error('[angularportalazure.Blade] \'onCommandDocument2\' is an abstract function. Define one in the derived class.');
329
+ };
330
+ Blade.prototype.onCommandDocument3 = function () {
331
+ throw new Error('[angularportalazure.Blade] \'onCommandDocument3\' is an abstract function. Define one in the derived class.');
332
+ };
333
+ Blade.prototype.onCommandDocument4 = function () {
334
+ throw new Error('[angularportalazure.Blade] \'onCommandDocument4\' is an abstract function. Define one in the derived class.');
335
+ };
336
+ Blade.prototype.onCommandDocument5 = function () {
337
+ throw new Error('[angularportalazure.Blade] \'onCommandDocument5\' is an abstract function. Define one in the derived class.');
338
+ };
339
+ Blade.prototype.onCommandNew = function () {
340
+ throw new Error('[angularportalazure.Blade] \'onCommandNew\' is an abstract function. Define one in the derived class.');
341
+ };
342
+ Blade.prototype.onCommandOrder = function () {
343
+ throw new Error('[angularportalazure.Blade] \'onCommandOrder\' is an abstract function. Define one in the derived class.');
344
+ };
345
+ Blade.prototype.onCommandRestart = function () {
346
+ throw new Error('[angularportalazure.Blade] \'onCommandRestart\' is an abstract function. Define one in the derived class.');
347
+ };
348
+ Blade.prototype.onCommandSave = function () {
349
+ throw new Error('[angularportalazure.Blade] \'onCommandSave\' is an abstract function. Define one in the derived class.');
350
+ };
351
+ Blade.prototype.onCommandSearch = function () {
352
+ throw new Error('[angularportalazure.Blade] \'onCommandSearch\' is an abstract function. Define one in the derived class.');
353
+ };
354
+ Blade.prototype.onCommandStart = function () {
355
+ throw new Error('[angularportalazure.Blade] \'onCommandStart\' is an abstract function. Define one in the derived class.');
356
+ };
357
+ Blade.prototype.onCommandStop = function () {
358
+ throw new Error('[angularportalazure.Blade] \'onCommandStop\' is an abstract function. Define one in the derived class.');
359
+ };
360
+ Blade.prototype.onCommandSwap = function () {
361
+ throw new Error('[angularportalazure.Blade] \'onCommandSwap\' is an abstract function. Define one in the derived class.');
362
+ };
363
+ //#endregion
364
+ //#region OBSOLETE
365
+ /** Obsolete */
366
+ Blade.prototype.setObsoleteLayoutProperites = function () {
367
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Blade.setObsoleteLayoutProperites\' called.', [this]);
368
+ this.blade.title = this.title;
369
+ this.blade.statusbar = this.statusbar;
370
+ this.blade.statusbarClass = this.statusbarClass;
371
+ this.blade.isCommandBrowse = this.isCommandBrowse;
372
+ this.blade.isCommandCancel = this.isCommandCancel;
373
+ this.blade.isCommandCopy = this.isCommandCopy;
374
+ this.blade.isCommandDelete = this.isCommandDelete;
375
+ this.blade.isCommandDocument = this.isCommandDocument;
376
+ this.blade.isCommandDocument2 = this.isCommandDocument2;
377
+ this.blade.isCommandDocument3 = this.isCommandDocument3;
378
+ this.blade.isCommandDocument4 = this.isCommandDocument4;
379
+ this.blade.isCommandDocument5 = this.isCommandDocument5;
380
+ this.blade.isCommandNew = this.isCommandNew;
381
+ this.blade.isCommandOrder = this.isCommandOrder;
382
+ this.blade.isCommandRestart = this.isCommandRestart;
383
+ this.blade.isCommandSave = this.isCommandSave;
384
+ this.blade.isCommandSearch = this.isCommandSearch;
385
+ this.blade.isCommandStart = this.isCommandStart;
386
+ this.blade.isCommandStop = this.isCommandStop;
387
+ this.blade.isCommandSwap = this.isCommandSwap;
388
+ };
389
+ /** Obsolete */
390
+ Blade.prototype.bladeClose = function () {
391
+ this.close();
392
+ };
393
+ return Blade;
394
+ }(angularportalazure.UserControlBase));
395
+ angularportalazure.Blade = Blade;
396
+ })(angularportalazure || (angularportalazure = {}));
397
+ /// <reference types="angular" />
398
+ /// <reference path="debug.ts" />
399
+ /// <reference path="blade.ts" />
400
+ /// <reference path="usercontrolbase.ts" />
401
+ /// <reference path="portalservice.ts" />
402
+ /// <reference path="iaddbladeeventargs.ts" />
403
+ var angularportalazure;
404
+ (function (angularportalazure) {
405
+ var BladeArea = (function (_super) {
406
+ __extends(BladeArea, _super);
407
+ //#region Constructors
408
+ function BladeArea(portalService) {
409
+ _super.call(this, portalService);
410
+ this.blades = new Array();
411
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea\' constructor called.', [this, portalService]);
412
+ var that = this;
413
+ // Set dependencies
414
+ this.portalService = portalService;
415
+ this.portalService.bladeArea = this;
416
+ //#region Add BladeArea.AddBlade event listener
417
+ /** OBSOLETE: remove when all OBSOLETE code has been removed */
418
+ if (portalService instanceof angularportalazure.PortalService == false) {
419
+ return;
420
+ }
421
+ /** OBSOLETE: end */
422
+ // Register listener1
423
+ this.listener1 = that.portalService.$rootScope.$on('BladeArea.AddBlade', function (event, args) {
424
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea\' BladeArea.AddBlade event processing.', [this, event, args]);
425
+ that.addBlade(args.path, args.pathSender);
426
+ });
427
+ //#endregion
428
+ }
429
+ //#endregion
430
+ //#region Methods
431
+ BladeArea.prototype.raiseAddBladeEvent = function (args) {
432
+ this.portalService.$rootScope.$broadcast('BladeArea.AddBlade', args);
433
+ };
434
+ BladeArea.prototype.setFirstBlade = function (path) {
435
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.setFirstBlade\' called.', [this, path]);
436
+ this.clearAll();
437
+ this.hidePanorama();
438
+ return this.addBlade(path);
439
+ };
440
+ /** obsolete */
441
+ BladeArea.prototype.addBlade = function (path, senderPath) {
442
+ if (senderPath === void 0) { senderPath = ''; }
443
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.addBlade\' called.', [this, senderPath, path]);
444
+ var that = this;
445
+ //#region Verify
446
+ if (path === undefined || path === '') {
447
+ return;
448
+ }
449
+ if (that.portalService.$window !== undefined) {
450
+ if (that.portalService.$window.document === undefined) {
451
+ throw new Error('[angularportalazure.BladeArea] \'this.$window.document\' undefined.');
452
+ }
453
+ var portalcontent = that.portalService.$window.document.getElementById('azureportalscroll');
454
+ if (portalcontent === null) {
455
+ throw new Error('[angularportalazure.BladeArea] HTML element with ID [azureportalscroll] not found. Maybe it is to early to call function \'BladeArea.addBlade\'.');
456
+ }
457
+ }
458
+ //#endregion
459
+ //#region Clear all children of the parent path
460
+ this.clearChild(senderPath);
461
+ //#endregion
462
+ //#region Make sure the blade is not yet show
463
+ this.blades.forEach(function (blade) {
464
+ if (blade.path === path) {
465
+ throw new Error('[angularportalazure.BladeArea] path: \'' + path + '\' will not be added. It is already added.');
466
+ }
467
+ ;
468
+ });
469
+ //#endregion
470
+ //#region Show the blade
471
+ var blade = new angularportalazure.Blade(that.portalService, path, '');
472
+ that.blades.push(blade);
473
+ //#endregion
474
+ //#region Position the blade
475
+ if (that.portalService.$window !== undefined) {
476
+ that.portalService.$window.setTimeout(function () {
477
+ var azureportalblades = that.portalService.$window.document.getElementsByClassName('azureportalblade');
478
+ var i = that.blades.length - 1;
479
+ // HACK: Sometime azureportalblades[i].offsetLeft is undefined.
480
+ // So now if it is, the user has to scroll on its own.
481
+ if (azureportalblades[i] !== undefined && azureportalblades[i].offsetLeft !== undefined) {
482
+ var sl = azureportalblades[i].offsetLeft - 30;
483
+ portalcontent.scrollLeft = sl;
484
+ }
485
+ }, 250);
486
+ }
487
+ //#endregion
488
+ return blade;
489
+ };
490
+ BladeArea.prototype.clearAll = function () {
491
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearAll\' called.', [this]);
492
+ this.blades.length = 0;
493
+ this.showPanoramaIfNoBlades();
494
+ };
495
+ BladeArea.prototype.clearPath = function (path) {
496
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearPath\' called.', [this, path]);
497
+ var that = this;
498
+ var isremoved = that.blades.some(function (blade, index) {
499
+ if (blade.path === path) {
500
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearPath\' set bladeUrls.length to: ' + index);
501
+ that.blades.length = index;
502
+ return true;
503
+ }
504
+ });
505
+ if (!isremoved) {
506
+ angularportalazure.Debug.write('>>> bladeUrls:', [that.blades]);
507
+ throw new Error('[angularportalazure.BladeArea.clearPath] path: \'' + path + '\' could not be removed, since path not found in bladeUrls.');
508
+ }
509
+ this.showPanoramaIfNoBlades();
510
+ };
511
+ BladeArea.prototype.clearLevel = function (level) {
512
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearLevel\' called.', [this, level]);
513
+ if (this.blades.length < level) {
514
+ }
515
+ if (level == 0) {
516
+ level = 1;
517
+ }
518
+ this.blades.length = level - 1;
519
+ this.showPanoramaIfNoBlades();
520
+ };
521
+ BladeArea.prototype.clearLastLevel = function () {
522
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearLastLevel\' called.', [this]);
523
+ this.clearLevel(this.blades.length);
524
+ this.showPanoramaIfNoBlades();
525
+ };
526
+ BladeArea.prototype.clearChild = function (path) {
527
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearChild\' called.', [this, path]);
528
+ var that = this;
529
+ if (path === '') {
530
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearChild\' path is empty, nothing to clear.');
531
+ return;
532
+ }
533
+ var isremoved = that.blades.some(function (blade, index) {
534
+ if (blade.path === path) {
535
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.clearChild\' set bladeUrls.length to: ' + (index + 1));
536
+ that.blades.length = index + 1;
537
+ return true;
538
+ }
539
+ });
540
+ if (!isremoved) {
541
+ angularportalazure.Debug.write('>>> bladeUrls:', [that.blades]);
542
+ throw new Error('[angularportalazure.BladeArea.clearChild] path: \'' + path + '\' could not be removed, since path not found in bladeUrls.');
543
+ }
544
+ };
545
+ BladeArea.prototype.showPanoramaIfNoBlades = function () {
546
+ if (this.blades.length === 0) {
547
+ if (this.portalService.panorama !== undefined) {
548
+ {
549
+ this.portalService.panorama.isVisible = true;
550
+ }
551
+ }
552
+ }
553
+ };
554
+ BladeArea.prototype.hidePanorama = function () {
555
+ if (this.portalService.panorama !== undefined) {
556
+ this.portalService.panorama.isVisible = false;
557
+ }
558
+ };
559
+ /** You need to call this when BladeArea is no longer used, otherwise the listener does not get removed. */
560
+ BladeArea.prototype.close = function () {
561
+ this.listener1(); // Unregister listener1
562
+ };
563
+ //#endregion
564
+ //#region OBSOLETE
565
+ BladeArea.prototype.addBladePath = function (path) {
566
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.addBladePath\' called.', [this, path]);
567
+ // Fix issue with old code
568
+ if (this.portalService.$window === undefined) {
569
+ this.portalService.$window = this.portalService;
570
+ }
571
+ this.addBlade(path);
572
+ //this.addBladeOld(path);
573
+ };
574
+ BladeArea.prototype.addBladeOld = function (path) {
575
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeArea.addBladeOld\' called.', [this, path]);
576
+ var that = this;
577
+ if (path === undefined || path == '') {
578
+ return;
579
+ }
580
+ var blade = new angularportalazure.Blade(that.portalService, path, '');
581
+ that.blades.push(blade);
582
+ var portalcontent = that.portalService.$window.document.getElementById('azureportalscroll');
583
+ that.portalService.$window.setTimeout(function () {
584
+ var azureportalblades = that.portalService.$window.document.getElementsByClassName('azureportalblade');
585
+ var i = that.blades.length - 1;
586
+ // HACK: Sometime azureportalblades[i].offsetLeft is undefined.
587
+ // So now if it is, the user has to scroll on its own.
588
+ if (azureportalblades[i] !== undefined && azureportalblades[i].offsetLeft !== undefined) {
589
+ var sl = azureportalblades[i].offsetLeft - 30;
590
+ portalcontent.scrollLeft = sl;
591
+ }
592
+ }, 250);
593
+ };
594
+ return BladeArea;
595
+ }(angularportalazure.UserControlBase));
596
+ angularportalazure.BladeArea = BladeArea;
597
+ //#region Angular Registration
598
+ (function () {
599
+ 'use strict';
600
+ angular.module('angularportalazure').service('angularportalazure.bladeArea', ['$window', BladeArea]);
601
+ })();
602
+ })(angularportalazure || (angularportalazure = {}));
603
+ /// <reference path="debug.ts" />
604
+ /// <reference path="portalservice.ts" />
605
+ /// <reference path="useraccount.ts" />
606
+ /// <reference path="usercontrolbase.ts" />
607
+ var angularportalazure;
608
+ (function (angularportalazure) {
609
+ var AvatarMenu = (function (_super) {
610
+ __extends(AvatarMenu, _super);
611
+ //#region Constructors
612
+ function AvatarMenu(portalService) {
613
+ _super.call(this, portalService);
614
+ angularportalazure.Debug.write('[angularportalazure-debug] \'AvatarMenu\' constructor called.', [this]);
615
+ }
616
+ return AvatarMenu;
617
+ }(angularportalazure.UserControlBase));
618
+ angularportalazure.AvatarMenu = AvatarMenu;
619
+ })(angularportalazure || (angularportalazure = {}));
620
+ var angularportalazure;
621
+ (function (angularportalazure) {
622
+ /** The names are used in CSS for layouting, e.g. style='mini' */
623
+ (function (TileSizes) {
624
+ TileSizes[TileSizes["small"] = 0] = "small";
625
+ TileSizes[TileSizes["mini"] = 1] = "mini";
626
+ TileSizes[TileSizes["normal"] = 2] = "normal";
627
+ TileSizes[TileSizes["herowide"] = 3] = "herowide";
628
+ })(angularportalazure.TileSizes || (angularportalazure.TileSizes = {}));
629
+ var TileSizes = angularportalazure.TileSizes;
630
+ })(angularportalazure || (angularportalazure = {}));
631
+ /// <reference path="debug.ts" />
632
+ /// <reference path="tilesizes.ts" />
633
+ var angularportalazure;
634
+ (function (angularportalazure) {
635
+ var TileSize = (function () {
636
+ //#region Constructors
637
+ function TileSize(tileSizes, width, height) {
638
+ this.tileSizes = tileSizes;
639
+ this.width = width;
640
+ this.height = height;
641
+ angularportalazure.Debug.write('[angularportalazure-debug] \'TileSize\' constructor called.', [this, tileSizes, width, height]);
642
+ }
643
+ //#endregion
644
+ //#region Methods
645
+ TileSize.getTileSizes = function () {
646
+ angularportalazure.Debug.write('[angularportalazure-debug] \'TileSize.getTileSizes\' called.', [this]);
647
+ var tileSizes = Array();
648
+ tileSizes.push(new TileSize(angularportalazure.TileSizes.small, 90, 90));
649
+ tileSizes.push(new TileSize(angularportalazure.TileSizes.mini, 180, 90));
650
+ tileSizes.push(new TileSize(angularportalazure.TileSizes.normal, 180, 180));
651
+ tileSizes.push(new TileSize(angularportalazure.TileSizes.herowide, 540, 360));
652
+ return tileSizes;
653
+ };
654
+ return TileSize;
655
+ }());
656
+ angularportalazure.TileSize = TileSize;
657
+ })(angularportalazure || (angularportalazure = {}));
658
+ /// <reference path="blade.ts" />
659
+ /// <reference path="debug.ts" />
660
+ /// <reference path="portalservice.ts" />
661
+ /// <reference path="tilesize.ts" />
662
+ var angularportalazure;
663
+ (function (angularportalazure) {
664
+ var Tile = (function () {
665
+ //#endregion
666
+ //#region Constructors
667
+ function Tile(title, bladePath, portalService) {
668
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Tile\' constructor called.', [this, title, bladePath, portalService]);
669
+ this.portalService = portalService;
670
+ this.title = title;
671
+ this.bladePath = bladePath;
672
+ this.tileSize = angularportalazure.TileSizes.normal;
673
+ }
674
+ //#endregion
675
+ //#region Methods
676
+ Tile.prototype.clicked = function () {
677
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Tile.clicked\' called.', [this]);
678
+ var blade = this.portalService.bladeArea.setFirstBlade(this.bladePath);
679
+ blade.activate();
680
+ };
681
+ return Tile;
682
+ }());
683
+ angularportalazure.Tile = Tile;
684
+ })(angularportalazure || (angularportalazure = {}));
685
+ /// <reference path="debug.ts" />
686
+ /// <reference path="tile.ts" />
687
+ /// <reference path="tilesize.ts" />
688
+ /// <reference path="tilesizes.ts" />
689
+ var angularportalazure;
690
+ (function (angularportalazure) {
691
+ var Tiles = (function () {
692
+ function Tiles() {
693
+ //#region Properties
694
+ this.showTiles = true;
695
+ this.tiles = new Array();
696
+ this.hideTileIfOnlyOne = true; // not yet evaluated in HTML, but this is the standard behavior
697
+ this.tileSizes = angularportalazure.TileSize.getTileSizes();
698
+ this.nextLeft = 0;
699
+ this.nextTop = 0;
700
+ this.columnHeightMax = 0;
701
+ }
702
+ //#endregion
703
+ //#region Methods
704
+ Tiles.prototype.addTile = function (tile) {
705
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Tiles.addTile\' called.', [this, tile]);
706
+ var tileSize = this.tileSizes[tile.tileSize];
707
+ tile.size = angularportalazure.TileSizes[tile.tileSize]; // Get CSS Name
708
+ tile.top = this.nextTop + 'px';
709
+ tile.left = this.nextLeft + 'px';
710
+ this.nextLeft += tileSize.width;
711
+ if (tileSize.height > this.columnHeightMax) {
712
+ this.columnHeightMax = tileSize.height;
713
+ }
714
+ if (this.nextLeft > 360) {
715
+ this.nextLeft = 0;
716
+ this.nextTop += this.columnHeightMax;
717
+ this.columnHeightMax = 0;
718
+ }
719
+ this.tiles.push(tile);
720
+ return tile;
721
+ };
722
+ return Tiles;
723
+ }());
724
+ angularportalazure.Tiles = Tiles;
725
+ })(angularportalazure || (angularportalazure = {}));
726
+ /// <reference path="debug.ts" />
727
+ /// <reference path="portalservice.ts" />
728
+ /// <reference path="tiles.ts" />
729
+ /// <reference path="usercontrolbase.ts" />
730
+ var angularportalazure;
731
+ (function (angularportalazure) {
732
+ var Startboard = (function (_super) {
733
+ __extends(Startboard, _super);
734
+ //#endregion
735
+ //#region Constructors
736
+ function Startboard(portalService) {
737
+ _super.call(this, portalService);
738
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Startboard\' constructor called.', [this]);
739
+ this.tiles = new angularportalazure.Tiles();
740
+ }
741
+ return Startboard;
742
+ }(angularportalazure.UserControlBase));
743
+ angularportalazure.Startboard = Startboard;
744
+ })(angularportalazure || (angularportalazure = {}));
745
+ /// <reference path="avatarmenu.ts" />
746
+ /// <reference path="debug.ts" />
747
+ /// <reference path="startboard.ts" />
748
+ /// <reference path="portalservice.ts" />
749
+ /// <reference path="usercontrolbase.ts" />
750
+ var angularportalazure;
751
+ (function (angularportalazure) {
752
+ var Panorama = (function (_super) {
753
+ __extends(Panorama, _super);
754
+ //#endregion
755
+ //#region Constructors
756
+ function Panorama(title, portalService) {
757
+ _super.call(this, portalService);
758
+ this.isVisible = true;
759
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Panorama\' constructor called.', [this, title]);
760
+ this.title = title;
761
+ this.portalService.panorama = this;
762
+ this.avatarMenu = new angularportalazure.AvatarMenu(this.portalService);
763
+ this.startboard = new angularportalazure.Startboard(this.portalService);
764
+ }
765
+ return Panorama;
766
+ }(angularportalazure.UserControlBase));
767
+ angularportalazure.Panorama = Panorama;
768
+ })(angularportalazure || (angularportalazure = {}));
769
+ /// <reference path="bladearea.ts" />
770
+ /// <reference path="usercontrolbase.ts" />
771
+ /// <reference path="debug.ts" />
772
+ /// <reference path="panorama.ts" />
773
+ /// <reference path="portalservice.ts" />
774
+ /// <reference path="tiles.ts" />
775
+ var angularportalazure;
776
+ (function (angularportalazure) {
777
+ var PortalShell = (function (_super) {
778
+ __extends(PortalShell, _super);
779
+ //#endregion
780
+ //#endregion
781
+ //#region Constructors
782
+ function PortalShell(title, portalService) {
783
+ _super.call(this, portalService);
784
+ angularportalazure.Debug.write('[angularportalazure-debug] \'PortalShell\' constructor called.', [this, title, portalService]);
785
+ this.portalService = portalService;
786
+ this.portalService.portalShell = this;
787
+ this.portalService.panorama = new angularportalazure.Panorama(title, this.portalService);
788
+ this.portalService.bladeArea = new angularportalazure.BladeArea(portalService);
789
+ this.initialize();
790
+ }
791
+ //#endregion
792
+ //#region Methods
793
+ PortalShell.prototype.initialize = function () {
794
+ angularportalazure.Debug.write('[angularportalazure-debug] \'PortalShell.initialize\' called.', [this]);
795
+ this.setObsoleteLayoutProperites();
796
+ };
797
+ PortalShell.prototype.setObsoleteLayoutProperites = function () {
798
+ angularportalazure.Debug.write('[angularportalazure-debug] \'PortalShell.setObsoleteLayoutProperites\' called.', [this]);
799
+ this.title = this.portalService.panorama.title;
800
+ this.tiles = this.portalService.panorama.startboard.tiles.tiles;
801
+ this.blades = this.portalService.bladeArea.blades;
802
+ //var bladeServiceOLD = <angularportalazure.Blade>this.portalService.$injector.get('bladeService');
803
+ //bladeServiceOLD.blades = this.portalService.bladeArea.blades;
804
+ if (this.portalService.panorama.avatarMenu.userAccount != undefined) {
805
+ this.user = {
806
+ name: this.portalService.panorama.avatarMenu.userAccount.name,
807
+ emailaddress: this.portalService.panorama.avatarMenu.userAccount.userName
808
+ };
809
+ }
810
+ if (this.portalService.bladeArea != null) {
811
+ this.portalService.bladeArea.blades.forEach(function (blade) {
812
+ blade.setObsoleteLayoutProperites();
813
+ });
814
+ }
815
+ };
816
+ return PortalShell;
817
+ }(angularportalazure.UserControlBase));
818
+ angularportalazure.PortalShell = PortalShell;
819
+ })(angularportalazure || (angularportalazure = {}));
820
+ /// <reference types="angular" />
821
+ /// <reference path="bladearea.ts" />
822
+ /// <reference path="debug.ts" />
823
+ /// <reference path="ibladeparameter.ts" />
824
+ /// <reference path="panorama.ts" />
825
+ /// <reference path="portalshell.ts" />
826
+ var angularportalazure;
827
+ (function (angularportalazure) {
828
+ var PortalService = (function () {
829
+ //#region Constructors
830
+ function PortalService($injector) {
831
+ //#endregion
832
+ //#region Properties
833
+ this.parameter = { action: 'none', itemId: 0 };
834
+ angularportalazure.Debug.write('[angularportalazure-debug] \'PortalService\' constructor called.', [this, $injector]);
835
+ this.$injector = $injector;
836
+ //this.$scope = $scope;
837
+ this.$http = $injector.get('$http');
838
+ this.$httpBackend = $injector.get('$httpBackend');
839
+ this.$q = $injector.get('$q');
840
+ this.$rootScope = $injector.get('$rootScope');
841
+ this.$window = $injector.get('$window');
842
+ this.ngDialog = $injector.get('ngDialog');
843
+ this.ngDialog.openConfirm;
844
+ }
845
+ return PortalService;
846
+ }());
847
+ angularportalazure.PortalService = PortalService;
848
+ //#region Angular Registration
849
+ (function () {
850
+ 'use strict';
851
+ angular.module('angularportalazure').service('angularportalazure.portalService', ['$injector', PortalService]);
852
+ })();
853
+ })(angularportalazure || (angularportalazure = {}));
854
+ /// <reference types="angular" />
855
+ /// <reference path="../../domain/debug.ts" />
856
+ /// <reference path="../../domain/portalservice.ts" />
857
+ var angularportalazure;
858
+ (function (angularportalazure) {
859
+ function azurePortalBlade($window, portalService) {
860
+ return {
861
+ transclude: true,
862
+ scope: { vm: '=vm' },
863
+ restrict: 'E',
864
+ templateUrl: '/node_modules/angular-portal-azure/directives/blade/blade.html',
865
+ link: function (scope, element, attrs, controller) {
866
+ angularportalazure.Debug.write('[angularportalazure-debug] \'directive:azurePortalBlade.link\' called.', [this, portalService]);
867
+ //#region the following code makes sure, that a function scope.vm.close is available
868
+ if (scope.vm === undefined) {
869
+ scope.vm = {};
870
+ }
871
+ if (scope.vm.close === undefined) {
872
+ scope.vm.close = function () {
873
+ angularportalazure.Debug.write('[angularportalazure-debug] \'directive:azurePortalBlade.close\' called.', [this, portalService]);
874
+ portalService.bladeArea.clearLastLevel();
875
+ };
876
+ }
877
+ //#endregion
878
+ }
879
+ };
880
+ }
881
+ angular.module('angularportalazure').directive('azurePortalBlade', ['$window', 'angularportalazure.portalService', azurePortalBlade]);
882
+ })(angularportalazure || (angularportalazure = {}));
883
+ // http://blogs.msdn.com/b/laurieatkinson/archive/2014/08/23/implementing-a-save-warning-in-an-angular-spa.aspx
884
+ //'use strict';
885
+ //module App.Directives {
886
+ // // USE:
887
+ // // <form name="personForm" azureportal-dirty-flag>
888
+ // interface IDirtyFlag extends ng.IDirective {
889
+ // }
890
+ // interface IDirtyFlagScope extends ng.IScope {
891
+ // personForm: ng.IFormController;
892
+ // vm: any;
893
+ // }
894
+ // class DirtyFlag implements IDirtyFlag {
895
+ // static directiveId: string = 'azureportalDirtyFlag'
896
+ // restrict: string = 'A';
897
+ // personManager: App.Services.IpersonManager;
898
+ // constructor(personManager) {
899
+ // this.personManager = personManager;
900
+ // }
901
+ // link = (scope: IDirtyFlagScope, element, attrs) => {
902
+ // var self = this;
903
+ // // When the directive is first invoked, check if the stored dirty value is true and
904
+ // // if so set the $dirty flag on the form.
905
+ // if (scope.vm.person && scope.vm.person.isDirty) {
906
+ // scope.personForm.$dirty = true;
907
+ // }
908
+ // // When the user navigates away from this view, check the value of the $dirty flag on this form.
909
+ // // If it is dirty(indicating unsaved changes), then store the id of the current person as dirty
910
+ // // using a service named personManger.
911
+ // scope.$on('$locationChangeStart'), function () {
912
+ // if (scope.personForm.$dirty) {
913
+ // self.personManager.markpersonAsDirty(scope.vm.person.personId);
914
+ // }
915
+ // });
916
+ // }
917
+ // }
918
+ // app.directive(DirtyFlag.directiveId, ['personmanager', (pm) => new DirtyFlag(pm)]);
919
+ //}
920
+ var angularportalazure;
921
+ (function (angularportalazure) {
922
+ function azurePortalHome($window, $interpolate) {
923
+ return {
924
+ scope: { vm: '=options' },
925
+ templateUrl: '/node_modules/angular-portal-azure/directives/home/home.html',
926
+ link: function (scope, element, attrs, controller) {
927
+ }
928
+ };
929
+ }
930
+ angular.module('angularportalazure').directive('azurePortalHome', ['$window', '$interpolate', azurePortalHome]);
931
+ })(angularportalazure || (angularportalazure = {}));
932
+ var angularportalazure;
933
+ (function (angularportalazure) {
934
+ function nav($window) {
935
+ return {
936
+ scope: { vm: '=viewModel' },
937
+ templateUrl: '/node_modules/angular-portal-azure/directives/nav/nav.html',
938
+ link: function (scope, element, attrs, controller) {
939
+ angular.forEach(scope.vm.navItems, function (item) {
940
+ // Set some default values, depending on existing values
941
+ if (item.isVisible == undefined) {
942
+ item.isVisible = true;
943
+ }
944
+ if (item.title == undefined || item.title == '') {
945
+ item.style = { cursor: 'default' };
946
+ }
947
+ if (item.bladePath == undefined || item.bladePath == '') {
948
+ item.style = { cursor: 'default' };
949
+ }
950
+ });
951
+ }
952
+ };
953
+ }
954
+ angular.module('angularportalazure').directive('nav', ['$window', nav]);
955
+ })(angularportalazure || (angularportalazure = {}));
956
+ var angularportalazure;
957
+ (function (angularportalazure) {
958
+ function navGrid($window) {
959
+ return {
960
+ scope: { vm: '=viewModel' },
961
+ templateUrl: '/node_modules/angular-portal-azure/directives/navgrid/navgrid.html',
962
+ link: function (scope, element, attrs, controller) {
963
+ angular.forEach(scope.vm.items, function (item) {
964
+ // Set some default values, depending on existing values
965
+ if (item.isVisible == undefined) {
966
+ item.isVisible = true;
967
+ }
968
+ if (item.title == undefined || item.title == '') {
969
+ item.style = { cursor: 'default' };
970
+ }
971
+ if (item.bladePath == undefined || item.bladePath == '') {
972
+ item.style = { cursor: 'default' };
973
+ }
974
+ });
975
+ }
976
+ };
977
+ }
978
+ angular.module('angularportalazure').directive('navGrid', ['$window', navGrid]);
979
+ })(angularportalazure || (angularportalazure = {}));
980
+ /// <reference path="bladearea.ts" />
981
+ /// <reference path="debug.ts" />
982
+ /// <reference path="iexception.ts" />
983
+ /// <reference path="portalservice.ts" />
984
+ var angularportalazure;
985
+ (function (angularportalazure) {
986
+ var BladeData = (function (_super) {
987
+ __extends(BladeData, _super);
988
+ //#region Constructor
989
+ function BladeData(portalService, path, title, subtitle, width) {
990
+ if (subtitle === void 0) { subtitle = ''; }
991
+ if (width === void 0) { width = 300; }
992
+ _super.call(this, portalService, path, title, subtitle, width);
993
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeData\' constructor called.', [this, portalService, path, title, subtitle, width]);
994
+ }
995
+ //#endregion
996
+ //#region Methods
997
+ BladeData.prototype.processException = function (data) {
998
+ var that = this;
999
+ that.statusbar = data.Message;
1000
+ that.statusbar += ' - ';
1001
+ data.Messages.forEach(function (item) {
1002
+ that.statusbar += item + ' - ';
1003
+ });
1004
+ };
1005
+ return BladeData;
1006
+ }(angularportalazure.Blade));
1007
+ angularportalazure.BladeData = BladeData;
1008
+ })(angularportalazure || (angularportalazure = {}));
1009
+ /// <reference path="bladedata.ts" />
1010
+ /// <reference path="debug.ts" />
1011
+ /// <reference path="portalservice.ts" />
1012
+ var angularportalazure;
1013
+ (function (angularportalazure) {
1014
+ var BladeDetail = (function (_super) {
1015
+ __extends(BladeDetail, _super);
1016
+ //#endregion
1017
+ //#region Constructor
1018
+ function BladeDetail(portalService, path, title, subtitle, width) {
1019
+ if (subtitle === void 0) { subtitle = ''; }
1020
+ if (width === void 0) { width = 200; }
1021
+ _super.call(this, portalService, path, title, subtitle, width);
1022
+ //#region Properties
1023
+ this.item = null;
1024
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeDetail\' constructor called.', [this, portalService, path, title, subtitle, width]);
1025
+ this.isCommandNew = true;
1026
+ this.commandNewText = 'neu';
1027
+ this.isCommandSave = true;
1028
+ this.commandSaveText = 'speichern';
1029
+ this.isCommandDelete = true;
1030
+ this.commandDeleteText = 'löschen';
1031
+ this.isCommandCancel = true;
1032
+ this.commandCancelText = 'abbrechen';
1033
+ }
1034
+ //#endregion
1035
+ //#region Methods
1036
+ BladeDetail.prototype.activate = function () {
1037
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeDetail.activate\' called.', [this]);
1038
+ var that = this;
1039
+ that.statusbar = 'Daten laden...';
1040
+ that.statusbarClass = '';
1041
+ var onActivate = that.onActivate();
1042
+ if (onActivate === null || onActivate === undefined) {
1043
+ that.statusbar = '';
1044
+ that.statusbarClass = '';
1045
+ }
1046
+ else {
1047
+ onActivate.success(function (data) {
1048
+ that.item = data;
1049
+ that.statusbar = '';
1050
+ that.statusbarClass = '';
1051
+ that.onActivated();
1052
+ }).error(function (data, status, headers, config) {
1053
+ that.item = null;
1054
+ that.statusbar = 'FEHLER: ' + data;
1055
+ that.statusbarClass = 'message-info message-off';
1056
+ that.onActivated();
1057
+ });
1058
+ }
1059
+ };
1060
+ BladeDetail.prototype.onActivate = function () {
1061
+ throw new Error('[angularportalazure.BladeDetail] \'onActivate\' is an abstract function. Define one in the derived class.');
1062
+ };
1063
+ BladeDetail.prototype.onActivated = function () {
1064
+ angularportalazure.Debug.write('[angularportalazure-debug] \'onActivated\' called. You could override this.');
1065
+ };
1066
+ BladeDetail.prototype.onCommandCancel = function () {
1067
+ this.close();
1068
+ };
1069
+ return BladeDetail;
1070
+ }(angularportalazure.BladeData));
1071
+ angularportalazure.BladeDetail = BladeDetail;
1072
+ })(angularportalazure || (angularportalazure = {}));
1073
+ /// <reference path="bladedata.ts" />
1074
+ /// <reference path="debug.ts" />
1075
+ /// <reference path="portalservice.ts" />
1076
+ var angularportalazure;
1077
+ (function (angularportalazure) {
1078
+ var BladeList = (function (_super) {
1079
+ __extends(BladeList, _super);
1080
+ //#endregion
1081
+ //#region Constructor
1082
+ function BladeList(portalService, path, title, subtitle, width) {
1083
+ if (subtitle === void 0) { subtitle = ''; }
1084
+ if (width === void 0) { width = 200; }
1085
+ _super.call(this, portalService, path, title, subtitle, width);
1086
+ //#region Properties
1087
+ this.items = [];
1088
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeList\' constructor called.', [this, portalService, path, title, subtitle, width]);
1089
+ this.isCommandNew = true;
1090
+ this.commandNewText = 'neu';
1091
+ }
1092
+ //#endregion
1093
+ //#region Methods
1094
+ BladeList.prototype.activate = function () {
1095
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeList.activate\' called.', [this]);
1096
+ var that = this;
1097
+ that.statusbar = 'Daten laden...';
1098
+ that.statusbarClass = '';
1099
+ var onActivate = that.onActivate();
1100
+ if (onActivate === null || onActivate === undefined) {
1101
+ }
1102
+ else {
1103
+ that.loadItems(onActivate);
1104
+ }
1105
+ };
1106
+ BladeList.prototype.onActivate = function () {
1107
+ throw new Error('[angularportalazure.BladeList] \'onActivate\' is an abstract function. Define one in the derived class.');
1108
+ };
1109
+ BladeList.prototype.loadItems = function (f) {
1110
+ var that = this;
1111
+ f.success(function (data) {
1112
+ that.items = data;
1113
+ that.statusbar = '';
1114
+ that.statusbarClass = '';
1115
+ }).error(function (data, status, headers, config) {
1116
+ that.statusbar = 'FEHLER: ' + data;
1117
+ that.statusbarClass = 'message-info message-off';
1118
+ });
1119
+ };
1120
+ //#region Filter
1121
+ BladeList.prototype.onFilter = function (actual, expected) {
1122
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeList.filter\' called.', [this, actual, expected]);
1123
+ //#region Documentation
1124
+ // > onFilter will be called for each item in an array
1125
+ // > If the item is an native type (string, number), the filter will be called with the native type in the parameter 'actual'
1126
+ // > If the item is an object, the filter will be called with each property of the object in the parameter 'actual'
1127
+ // > If the item is an object, the filter will also be called with the object in the parameter 'actual'
1128
+ //#endregion
1129
+ //#region Helper functions
1130
+ // Implemenation detail:
1131
+ // > We must implement the functions in code, since onFilter is not called within the scope of this class (this. not working).
1132
+ // Function to convert 'number' to 'string'
1133
+ var convertToString = function (value) {
1134
+ return value + ''; // convert to string, so the next statements will process the value as a string
1135
+ };
1136
+ // Function which figures out, if the 'expected' value is found in the 'actual' value
1137
+ var valueFound = function (actual, expected) {
1138
+ expectedSplitted.forEach(function (expectedItem, index) {
1139
+ if (actual.toLowerCase().indexOf(expectedItem) > -1) {
1140
+ expectedSplitted[index] = ''; // expected has been found, initialize it now
1141
+ }
1142
+ });
1143
+ };
1144
+ // Function to process an object
1145
+ var processObject = function (actual) {
1146
+ for (var actualProperty in actual) {
1147
+ if (actual.hasOwnProperty(actualProperty)) {
1148
+ var actualValue = actual[actualProperty];
1149
+ if (typeof actual == 'number') {
1150
+ actualValue = convertToString(actual);
1151
+ }
1152
+ if (typeof actualValue == 'string') {
1153
+ if (actualValue.indexOf('object:') > -1) {
1154
+ continue;
1155
+ }
1156
+ valueFound(actualValue, expected);
1157
+ }
1158
+ }
1159
+ else {
1160
+ // Process inherited properties
1161
+ processObject(actual[actualProperty]);
1162
+ }
1163
+ }
1164
+ };
1165
+ //#endregion
1166
+ //#region Initialize
1167
+ // Prepare 'expected' value
1168
+ expected = expected.toLowerCase();
1169
+ // Split the search string into its parts if separated by blanks
1170
+ var expectedSplitted = expected.split(' ');
1171
+ //#endregion
1172
+ //#region Process depending on type
1173
+ // Process property, typeof 'object'
1174
+ if (typeof actual == 'object') {
1175
+ processObject(actual);
1176
+ }
1177
+ // Process property, typeof 'number'
1178
+ if (typeof actual == 'number') {
1179
+ actual = convertToString(actual);
1180
+ }
1181
+ // Process property, typeof 'string'
1182
+ if (typeof actual == 'string') {
1183
+ valueFound(actual, expected);
1184
+ }
1185
+ //#endregion
1186
+ //#region Verify if all expected has been found
1187
+ var foundCount = 0;
1188
+ expectedSplitted.forEach(function (expectedItem) {
1189
+ if (expectedItem === '') {
1190
+ foundCount++;
1191
+ }
1192
+ });
1193
+ //#endregion
1194
+ //#region Return result
1195
+ if (foundCount === expectedSplitted.length) {
1196
+ return true;
1197
+ }
1198
+ else {
1199
+ return false;
1200
+ }
1201
+ ;
1202
+ //#endregion
1203
+ };
1204
+ //#endregion
1205
+ //#region OBSOLETE
1206
+ /** Obsolete */
1207
+ BladeList.prototype.setObsoleteLayoutProperites = function () {
1208
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeList.setObsoleteLayoutProperites\' called.', [this]);
1209
+ if (this.items.length !== 0) {
1210
+ this.blade.navGrid.items = this.items; //--> needed, otherwise nav html pages will no longer work.
1211
+ }
1212
+ this.blade.isNavGrid = this.isNavGrid;
1213
+ _super.prototype.setObsoleteLayoutProperites.call(this);
1214
+ };
1215
+ return BladeList;
1216
+ }(angularportalazure.BladeData));
1217
+ angularportalazure.BladeList = BladeList;
1218
+ })(angularportalazure || (angularportalazure = {}));
1219
+ /// <reference path="debug.ts" />
1220
+ /// <reference path="bladenav.ts" />
1221
+ var angularportalazure;
1222
+ (function (angularportalazure) {
1223
+ var BladeNavItem = (function () {
1224
+ //#region Constructor
1225
+ function BladeNavItem(title, bladePath, hrefPath, roles, isVisible, callback, bladeNav) {
1226
+ if (title === void 0) { title = ''; }
1227
+ if (bladePath === void 0) { bladePath = ''; }
1228
+ if (hrefPath === void 0) { hrefPath = ""; }
1229
+ if (roles === void 0) { roles = ""; }
1230
+ if (isVisible === void 0) { isVisible = true; }
1231
+ if (callback === void 0) { callback = null; }
1232
+ if (bladeNav === void 0) { bladeNav = null; }
1233
+ this.title = title;
1234
+ this.bladePath = bladePath;
1235
+ this.hrefPath = hrefPath;
1236
+ this.roles = roles;
1237
+ this.isVisible = isVisible;
1238
+ this.callback = callback;
1239
+ this.bladeNav = bladeNav;
1240
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeNavItem\' constructor called.', [this, title, bladePath, hrefPath, roles, isVisible]);
1241
+ }
1242
+ //#endregion
1243
+ //#region
1244
+ BladeNavItem.prototype.onNavItemClick = function () {
1245
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeNavItem.onNavItemClick\' called.', [this]);
1246
+ if (this.callback != null) {
1247
+ this.callback();
1248
+ }
1249
+ };
1250
+ return BladeNavItem;
1251
+ }());
1252
+ angularportalazure.BladeNavItem = BladeNavItem;
1253
+ })(angularportalazure || (angularportalazure = {}));
1254
+ /// <reference path="bladedata.ts" />
1255
+ /// <reference path="debug.ts" />
1256
+ /// <reference path="bladenavitem.ts" />
1257
+ /// <reference path="portalservice.ts" />
1258
+ var angularportalazure;
1259
+ (function (angularportalazure) {
1260
+ var BladeNav = (function (_super) {
1261
+ __extends(BladeNav, _super);
1262
+ //#endregion
1263
+ //#region Constructor
1264
+ function BladeNav(portalService, path, title, subtitle, width) {
1265
+ if (title === void 0) { title = ''; }
1266
+ if (subtitle === void 0) { subtitle = ''; }
1267
+ if (width === void 0) { width = 200; }
1268
+ _super.call(this, portalService, path, title, subtitle, width);
1269
+ //#region Properties
1270
+ this.navItems = new Array();
1271
+ this.isNav = true;
1272
+ angularportalazure.Debug.write('[angularportalazure-debug] \'BladeNav\' constructor called.', [this, portalService, path, title, subtitle, width]);
1273
+ _super.prototype.onNavigateTo = this.navigateTo;
1274
+ }
1275
+ return BladeNav;
1276
+ }(angularportalazure.BladeData));
1277
+ angularportalazure.BladeNav = BladeNav;
1278
+ })(angularportalazure || (angularportalazure = {}));
1279
+ /// <reference path="debug.ts" />
1280
+ /// <reference path="iexception.ts" />
1281
+ var angularportalazure;
1282
+ (function (angularportalazure) {
1283
+ var Exception = (function () {
1284
+ function Exception() {
1285
+ }
1286
+ Exception.convertFromWebApiException = function (ex) {
1287
+ //#region Process data to Messages
1288
+ ex.Messages = [];
1289
+ var i = 1;
1290
+ while (ex.Data[i + ''] !== undefined) {
1291
+ ex.Messages.push(ex.Data[i + '']);
1292
+ i++;
1293
+ }
1294
+ //#endregion
1295
+ //#region Process DbEntityValidationException
1296
+ if (ex.ExceptionType === 'System.Data.Entity.Validation.DbEntityValidationException') {
1297
+ ex.Type = 'DbEntityValidationException';
1298
+ }
1299
+ //#endregion
1300
+ //#region Process DbUpdateConcurrencyException
1301
+ if (ex.ExceptionType === 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException') {
1302
+ ex.Type = 'DbUpdateConcurrencyException';
1303
+ }
1304
+ //#endregion
1305
+ //#region Process ValidationsException
1306
+ // ClassName should by ExceptionType
1307
+ if (ex.ClassName.indexOf('ValidationsException') > 0) {
1308
+ ex.Type = 'ValidationsException';
1309
+ }
1310
+ //#endregion
1311
+ Exception.onConvertFromWebApiException(ex);
1312
+ };
1313
+ Exception.onConvertFromWebApiException = function (ex) {
1314
+ angularportalazure.Debug.write('[angularportalazure-debug] \'Exception.convertFromWebApiException\' not overriden. You could override this.', [this]);
1315
+ };
1316
+ return Exception;
1317
+ }());
1318
+ angularportalazure.Exception = Exception;
1319
+ })(angularportalazure || (angularportalazure = {}));
1320
+ /// <reference types="angular" />
1321
+ var angularportalazure;
1322
+ (function (angularportalazure) {
1323
+ var DataService = (function () {
1324
+ //#region Constructor
1325
+ function DataService($http, $q) {
1326
+ this.$http = $http;
1327
+ this.$q = $q;
1328
+ }
1329
+ //#endregion
1330
+ //#region Methods
1331
+ DataService.prototype.getData = function (url) {
1332
+ var that = this;
1333
+ return that.$http({ method: 'GET', url: url })
1334
+ .success(function (data, status, headers, config) {
1335
+ })
1336
+ .error(function (data, status, headers, config) {
1337
+ });
1338
+ };
1339
+ return DataService;
1340
+ }());
1341
+ angularportalazure.DataService = DataService;
1342
+ })(angularportalazure || (angularportalazure = {}));