1 | import { ɵɵdefineInjectable, Injectable, ɵɵinject, Component, Input, Directive, forwardRef, EventEmitter, Output, Host, ContentChild, HostListener, ElementRef, Optional, Pipe, NgModule, SecurityContext, NgZone } from '@angular/core';
|
2 | import { faSort, faSortUp, faSortDown } from '@fortawesome/free-solid-svg-icons';
|
3 | import { NG_VALIDATORS, FormsModule } from '@angular/forms';
|
4 | import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
5 | import { TranslateService } from '@ngx-translate/core';
|
6 | import { Subject, Observable } from 'rxjs';
|
7 | import { takeUntil, share, filter, map } from 'rxjs/operators';
|
8 | import { CommonModule, DatePipe } from '@angular/common';
|
9 | import { NgbActiveModal, NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
10 | import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
11 | import { DomSanitizer } from '@angular/platform-browser';
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | class JhiModuleConfig {
|
32 | constructor() {
|
33 | this.sortIcon = faSort;
|
34 | this.sortAscIcon = faSortUp;
|
35 | this.sortDescIcon = faSortDown;
|
36 | this.i18nEnabled = false;
|
37 | this.defaultI18nLang = 'en';
|
38 | this.noi18nMessage = 'translation-not-found';
|
39 | this.alertAsToast = false;
|
40 | this.alertTimeout = 5000;
|
41 | this.classBadgeTrue = 'badge badge-success';
|
42 | this.classBadgeFalse = 'badge badge-danger';
|
43 | this.classTrue = 'fa fa-lg fa-check text-success';
|
44 | this.classFalse = 'fa fa-lg fa-times text-danger';
|
45 | }
|
46 | }
|
47 | JhiModuleConfig.ɵprov = ɵɵdefineInjectable({ factory: function JhiModuleConfig_Factory() { return new JhiModuleConfig(); }, token: JhiModuleConfig, providedIn: "root" });
|
48 | JhiModuleConfig.decorators = [
|
49 | { type: Injectable, args: [{
|
50 | providedIn: 'root'
|
51 | },] }
|
52 | ];
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | class JhiConfigService {
|
73 | constructor(moduleConfig) {
|
74 | this.CONFIG_OPTIONS = Object.assign(Object.assign({}, new JhiModuleConfig()), moduleConfig);
|
75 | }
|
76 | getConfig() {
|
77 | return this.CONFIG_OPTIONS;
|
78 | }
|
79 | }
|
80 | JhiConfigService.ɵprov = ɵɵdefineInjectable({ factory: function JhiConfigService_Factory() { return new JhiConfigService(ɵɵinject(JhiModuleConfig)); }, token: JhiConfigService, providedIn: "root" });
|
81 | JhiConfigService.decorators = [
|
82 | { type: Injectable, args: [{
|
83 | providedIn: 'root'
|
84 | },] }
|
85 | ];
|
86 | JhiConfigService.ctorParameters = () => [
|
87 | { type: JhiModuleConfig }
|
88 | ];
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | class JhiItemCountComponent {
|
112 | constructor(config) {
|
113 | this.i18nEnabled = config.CONFIG_OPTIONS.i18nEnabled;
|
114 | }
|
115 | |
116 |
|
117 |
|
118 | i18nValues() {
|
119 | const first = (this.page - 1) * this.itemsPerPage === 0 ? 1 : (this.page - 1) * this.itemsPerPage + 1;
|
120 | const second = this.page * this.itemsPerPage < this.total ? this.page * this.itemsPerPage : this.total;
|
121 | return {
|
122 | first,
|
123 | second,
|
124 | total: this.total
|
125 | };
|
126 | }
|
127 | }
|
128 | JhiItemCountComponent.decorators = [
|
129 | { type: Component, args: [{
|
130 | selector: 'jhi-item-count',
|
131 | template: `
|
132 | <div *ngIf="i18nEnabled; else noI18n" class="info jhi-item-count" jhiTranslate="global.item-count" [translateValues]="i18nValues()">
|
133 | /* [attr.translateValues] is used to get entire values in tests */
|
134 | </div>
|
135 | <ng-template #noI18n class="info jhi-item-count">
|
136 | Showing
|
137 | {{ (page - 1) * itemsPerPage == 0 ? 1 : (page - 1) * itemsPerPage + 1 }}
|
138 | - {{ page * itemsPerPage < total ? page * itemsPerPage : total }} of {{ total }} items.
|
139 | </ng-template>
|
140 | `
|
141 | },] }
|
142 | ];
|
143 | JhiItemCountComponent.ctorParameters = () => [
|
144 | { type: JhiConfigService }
|
145 | ];
|
146 | JhiItemCountComponent.propDecorators = {
|
147 | page: [{ type: Input }],
|
148 | total: [{ type: Input }],
|
149 | itemsPerPage: [{ type: Input }]
|
150 | };
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 | class JhiBooleanComponent {
|
229 | constructor(configService) {
|
230 | this.config = configService.getConfig();
|
231 | }
|
232 | ngOnInit() {
|
233 | if (this.textTrue === undefined) {
|
234 | if (this.classTrue === undefined) {
|
235 | this.classTrue = this.config.classTrue;
|
236 | }
|
237 | }
|
238 | else {
|
239 | if (this.classTrue === undefined) {
|
240 | this.classTrue = this.config.classBadgeTrue;
|
241 | }
|
242 | }
|
243 | if (this.textFalse === undefined) {
|
244 | if (this.classFalse === undefined) {
|
245 | this.classFalse = this.config.classFalse;
|
246 | }
|
247 | }
|
248 | else {
|
249 | if (this.classFalse === undefined) {
|
250 | this.classFalse = this.config.classBadgeFalse;
|
251 | }
|
252 | }
|
253 | }
|
254 | }
|
255 | JhiBooleanComponent.decorators = [
|
256 | { type: Component, args: [{
|
257 | selector: 'jhi-boolean',
|
258 | template: `
|
259 | <span [ngClass]="value ? classTrue : classFalse" [innerHtml]="value ? textTrue : textFalse"> </span>
|
260 | `
|
261 | },] }
|
262 | ];
|
263 | JhiBooleanComponent.ctorParameters = () => [
|
264 | { type: JhiConfigService }
|
265 | ];
|
266 | JhiBooleanComponent.propDecorators = {
|
267 | value: [{ type: Input }],
|
268 | classTrue: [{ type: Input }],
|
269 | classFalse: [{ type: Input }],
|
270 | textTrue: [{ type: Input }],
|
271 | textFalse: [{ type: Input }]
|
272 | };
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 | function numberOfBytes(base64String) {
|
312 | function endsWith(suffix, str) {
|
313 | return str.includes(suffix, str.length - suffix.length);
|
314 | }
|
315 | function paddingSize(value) {
|
316 | if (endsWith('==', value)) {
|
317 | return 2;
|
318 | }
|
319 | if (endsWith('=', value)) {
|
320 | return 1;
|
321 | }
|
322 | return 0;
|
323 | }
|
324 | return (base64String.length / 4) * 3 - paddingSize(base64String);
|
325 | }
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 | class JhiMaxbytesValidatorDirective {
|
346 | constructor() { }
|
347 | validate(c) {
|
348 | return c.value && numberOfBytes(c.value) > this.jhiMaxbytes
|
349 | ? {
|
350 | maxbytes: {
|
351 | valid: false
|
352 | }
|
353 | }
|
354 | : null;
|
355 | }
|
356 | }
|
357 | JhiMaxbytesValidatorDirective.decorators = [
|
358 | { type: Directive, args: [{
|
359 | selector: '[jhiMaxbytes][ngModel]',
|
360 |
|
361 | providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMaxbytesValidatorDirective), multi: true }]
|
362 | },] }
|
363 | ];
|
364 | JhiMaxbytesValidatorDirective.ctorParameters = () => [];
|
365 | JhiMaxbytesValidatorDirective.propDecorators = {
|
366 | jhiMaxbytes: [{ type: Input }]
|
367 | };
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 | class JhiMinbytesValidatorDirective {
|
388 | constructor() { }
|
389 | validate(c) {
|
390 | return c.value && numberOfBytes(c.value) < this.jhiMinbytes
|
391 | ? {
|
392 | minbytes: {
|
393 | valid: false
|
394 | }
|
395 | }
|
396 | : null;
|
397 | }
|
398 | }
|
399 | JhiMinbytesValidatorDirective.decorators = [
|
400 | { type: Directive, args: [{
|
401 | selector: '[jhiMinbytes][ngModel]',
|
402 |
|
403 | providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMinbytesValidatorDirective), multi: true }]
|
404 | },] }
|
405 | ];
|
406 | JhiMinbytesValidatorDirective.ctorParameters = () => [];
|
407 | JhiMinbytesValidatorDirective.propDecorators = {
|
408 | jhiMinbytes: [{ type: Input }]
|
409 | };
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 | class JhiMaxValidatorDirective {
|
430 | constructor() { }
|
431 | validate(c) {
|
432 | return c.value === undefined || c.value === null || c.value <= this.jhiMax
|
433 | ? null
|
434 | : {
|
435 | max: {
|
436 | valid: false
|
437 | }
|
438 | };
|
439 | }
|
440 | }
|
441 | JhiMaxValidatorDirective.decorators = [
|
442 | { type: Directive, args: [{
|
443 | selector: '[jhiMax][ngModel]',
|
444 |
|
445 | providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMaxValidatorDirective), multi: true }]
|
446 | },] }
|
447 | ];
|
448 | JhiMaxValidatorDirective.ctorParameters = () => [];
|
449 | JhiMaxValidatorDirective.propDecorators = {
|
450 | jhiMax: [{ type: Input }]
|
451 | };
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 | class JhiMinValidatorDirective {
|
472 | constructor() { }
|
473 | validate(c) {
|
474 | return c.value === undefined || c.value === null || c.value >= this.jhiMin
|
475 | ? null
|
476 | : {
|
477 | min: {
|
478 | valid: false
|
479 | }
|
480 | };
|
481 | }
|
482 | }
|
483 | JhiMinValidatorDirective.decorators = [
|
484 | { type: Directive, args: [{
|
485 | selector: '[jhiMin][ngModel]',
|
486 |
|
487 | providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMinValidatorDirective), multi: true }]
|
488 | },] }
|
489 | ];
|
490 | JhiMinValidatorDirective.ctorParameters = () => [];
|
491 | JhiMinValidatorDirective.propDecorators = {
|
492 | jhiMin: [{ type: Input }]
|
493 | };
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 | class JhiSortDirective {
|
514 | constructor() {
|
515 | this.predicateChange = new EventEmitter();
|
516 | this.ascendingChange = new EventEmitter();
|
517 | }
|
518 | sort(field) {
|
519 | this.ascending = field !== this.predicate ? true : !this.ascending;
|
520 | this.predicate = field;
|
521 | this.predicateChange.emit(field);
|
522 | this.ascendingChange.emit(this.ascending);
|
523 | this.callback();
|
524 | }
|
525 | }
|
526 | JhiSortDirective.decorators = [
|
527 | { type: Directive, args: [{
|
528 | selector: '[jhiSort]'
|
529 | },] }
|
530 | ];
|
531 | JhiSortDirective.ctorParameters = () => [];
|
532 | JhiSortDirective.propDecorators = {
|
533 | predicate: [{ type: Input }],
|
534 | ascending: [{ type: Input }],
|
535 | callback: [{ type: Input }],
|
536 | predicateChange: [{ type: Output }],
|
537 | ascendingChange: [{ type: Output }]
|
538 | };
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 | class JhiSortByDirective {
|
559 | constructor(jhiSort, configService) {
|
560 | this.jhiSort = jhiSort;
|
561 | this.jhiSort = jhiSort;
|
562 | const config = configService.getConfig();
|
563 | this.sortIcon = config.sortIcon;
|
564 | this.sortAscIcon = config.sortAscIcon;
|
565 | this.sortDescIcon = config.sortDescIcon;
|
566 | }
|
567 | ngAfterContentInit() {
|
568 | if (this.jhiSort.predicate && this.jhiSort.predicate !== '_score' && this.jhiSort.predicate === this.jhiSortBy) {
|
569 | this.updateIconDefinition(this.iconComponent, this.jhiSort.ascending ? this.sortAscIcon : this.sortDescIcon);
|
570 | this.jhiSort.activeIconComponent = this.iconComponent;
|
571 | }
|
572 | }
|
573 | onClick() {
|
574 | if (this.jhiSort.predicate && this.jhiSort.predicate !== '_score') {
|
575 | this.jhiSort.sort(this.jhiSortBy);
|
576 | this.updateIconDefinition(this.jhiSort.activeIconComponent, this.sortIcon);
|
577 | this.updateIconDefinition(this.iconComponent, this.jhiSort.ascending ? this.sortAscIcon : this.sortDescIcon);
|
578 | this.jhiSort.activeIconComponent = this.iconComponent;
|
579 | }
|
580 | }
|
581 | updateIconDefinition(iconComponent, icon) {
|
582 | if (iconComponent) {
|
583 | iconComponent.icon = icon.iconName;
|
584 | iconComponent.render();
|
585 | }
|
586 | }
|
587 | }
|
588 | JhiSortByDirective.decorators = [
|
589 | { type: Directive, args: [{
|
590 | selector: '[jhiSortBy]'
|
591 | },] }
|
592 | ];
|
593 | JhiSortByDirective.ctorParameters = () => [
|
594 | { type: JhiSortDirective, decorators: [{ type: Host }] },
|
595 | { type: JhiConfigService }
|
596 | ];
|
597 | JhiSortByDirective.propDecorators = {
|
598 | jhiSortBy: [{ type: Input }],
|
599 | iconComponent: [{ type: ContentChild, args: [FaIconComponent, { static: true },] }],
|
600 | onClick: [{ type: HostListener, args: ['click',] }]
|
601 | };
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 | class JhiLanguageService {
|
641 | constructor(translateService, configService) {
|
642 | this.translateService = translateService;
|
643 | this.configService = configService;
|
644 | this.currentLang = 'en';
|
645 | }
|
646 | init() {
|
647 | const config = this.configService.getConfig();
|
648 | this.currentLang = config.defaultI18nLang;
|
649 | this.translateService.setDefaultLang(this.currentLang);
|
650 | this.translateService.use(this.currentLang);
|
651 | }
|
652 | changeLanguage(languageKey) {
|
653 | this.currentLang = languageKey;
|
654 | this.configService.CONFIG_OPTIONS.defaultI18nLang = languageKey;
|
655 | this.translateService.use(this.currentLang);
|
656 | }
|
657 | |
658 |
|
659 |
|
660 | getCurrent() {
|
661 | return Promise.resolve(this.currentLang);
|
662 | }
|
663 | getCurrentLanguage() {
|
664 | return this.currentLang;
|
665 | }
|
666 | }
|
667 | JhiLanguageService.ɵprov = ɵɵdefineInjectable({ factory: function JhiLanguageService_Factory() { return new JhiLanguageService(ɵɵinject(TranslateService), ɵɵinject(JhiConfigService)); }, token: JhiLanguageService, providedIn: "root" });
|
668 | JhiLanguageService.decorators = [
|
669 | { type: Injectable, args: [{
|
670 | providedIn: 'root'
|
671 | },] }
|
672 | ];
|
673 | JhiLanguageService.ctorParameters = () => [
|
674 | { type: TranslateService },
|
675 | { type: JhiConfigService }
|
676 | ];
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 | class JhiTranslateDirective {
|
700 | constructor(configService, el, translateService) {
|
701 | this.configService = configService;
|
702 | this.el = el;
|
703 | this.translateService = translateService;
|
704 | this.directiveDestroyed = new Subject();
|
705 | }
|
706 | ngOnInit() {
|
707 | const enabled = this.configService.getConfig().i18nEnabled;
|
708 | if (enabled) {
|
709 | this.translateService.onLangChange.pipe(takeUntil(this.directiveDestroyed)).subscribe(() => {
|
710 | this.getTranslation();
|
711 | });
|
712 | }
|
713 | }
|
714 | ngOnChanges() {
|
715 | const enabled = this.configService.getConfig().i18nEnabled;
|
716 | if (enabled) {
|
717 | this.getTranslation();
|
718 | }
|
719 | }
|
720 | ngOnDestroy() {
|
721 | this.directiveDestroyed.next();
|
722 | this.directiveDestroyed.complete();
|
723 | }
|
724 | getTranslation() {
|
725 | this.translateService
|
726 | .get(this.jhiTranslate, this.translateValues)
|
727 | .pipe(takeUntil(this.directiveDestroyed))
|
728 | .subscribe(value => {
|
729 | this.el.nativeElement.innerHTML = value;
|
730 | }, () => {
|
731 | return `${this.configService.getConfig().noi18nMessage}[${this.jhiTranslate}]`;
|
732 | });
|
733 | }
|
734 | }
|
735 | JhiTranslateDirective.decorators = [
|
736 | { type: Directive, args: [{
|
737 | selector: '[jhiTranslate]'
|
738 | },] }
|
739 | ];
|
740 | JhiTranslateDirective.ctorParameters = () => [
|
741 | { type: JhiConfigService },
|
742 | { type: ElementRef },
|
743 | { type: TranslateService, decorators: [{ type: Optional }] }
|
744 | ];
|
745 | JhiTranslateDirective.propDecorators = {
|
746 | jhiTranslate: [{ type: Input }],
|
747 | translateValues: [{ type: Input }]
|
748 | };
|
749 |
|
750 | class JhiMissingTranslationHandler {
|
751 | constructor(configService) {
|
752 | this.configService = configService;
|
753 | }
|
754 | handle(params) {
|
755 | const key = params.key;
|
756 | return `${this.configService.getConfig().noi18nMessage}[${key}]`;
|
757 | }
|
758 | }
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | class JhiThreadModalComponent {
|
798 | constructor(activeModal) {
|
799 | this.activeModal = activeModal;
|
800 | this.threadDumpAll = 0;
|
801 | this.threadDumpBlocked = 0;
|
802 | this.threadDumpRunnable = 0;
|
803 | this.threadDumpTimedWaiting = 0;
|
804 | this.threadDumpWaiting = 0;
|
805 | }
|
806 | ngOnInit() {
|
807 | this.threadDump.forEach(value => {
|
808 | if (value.threadState === 'RUNNABLE') {
|
809 | this.threadDumpRunnable += 1;
|
810 | }
|
811 | else if (value.threadState === 'WAITING') {
|
812 | this.threadDumpWaiting += 1;
|
813 | }
|
814 | else if (value.threadState === 'TIMED_WAITING') {
|
815 | this.threadDumpTimedWaiting += 1;
|
816 | }
|
817 | else if (value.threadState === 'BLOCKED') {
|
818 | this.threadDumpBlocked += 1;
|
819 | }
|
820 | });
|
821 | this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + this.threadDumpTimedWaiting + this.threadDumpBlocked;
|
822 | }
|
823 | getBadgeClass(threadState) {
|
824 | if (threadState === 'RUNNABLE') {
|
825 | return 'badge-success';
|
826 | }
|
827 | else if (threadState === 'WAITING') {
|
828 | return 'badge-info';
|
829 | }
|
830 | else if (threadState === 'TIMED_WAITING') {
|
831 | return 'badge-warning';
|
832 | }
|
833 | else if (threadState === 'BLOCKED') {
|
834 | return 'badge-danger';
|
835 | }
|
836 | }
|
837 | }
|
838 | JhiThreadModalComponent.decorators = [
|
839 | { type: Component, args: [{
|
840 | selector: 'jhi-thread-modal',
|
841 | template: `
|
842 | <div class="modal-header">
|
843 | <h4 class="modal-title" jhiTranslate="metrics.jvm.threads.dump.title">Threads dump</h4>
|
844 | <button type="button" class="close" (click)="activeModal.dismiss('closed')">×</button>
|
845 | </div>
|
846 | <div class="modal-body">
|
847 | <span class="badge badge-primary" (click)="threadDumpFilter = {}">
|
848 | All <span class="badge badge-pill badge-default">{{ threadDumpAll }}</span> </span
|
849 | >
|
850 | <span class="badge badge-success" (click)="threadDumpFilter = { threadState: 'RUNNABLE' }">
|
851 | Runnable <span class="badge badge-pill badge-default">{{ threadDumpRunnable }}</span> </span
|
852 | >
|
853 | <span class="badge badge-info" (click)="threadDumpFilter = { threadState: 'WAITING' }"
|
854 | >Waiting <span class="badge badge-pill badge-default">{{ threadDumpWaiting }}</span></span
|
855 | >
|
856 | <span class="badge badge-warning" (click)="threadDumpFilter = { threadState: 'TIMED_WAITING' }">
|
857 | Timed Waiting <span class="badge badge-pill badge-default">{{ threadDumpTimedWaiting }}</span> </span
|
858 | >
|
859 | <span class="badge badge-danger" (click)="threadDumpFilter = { threadState: 'BLOCKED' }"
|
860 | >Blocked <span class="badge badge-pill badge-default">{{ threadDumpBlocked }}</span></span
|
861 | >
|
862 | <div class="mt-2"> </div>
|
863 | Filter
|
864 | <input type="text" [(ngModel)]="threadDumpFilter" class="form-control" />
|
865 | <div class="pad" *ngFor="let entry of (threadDump | pureFilter: threadDumpFilter:'lockName' | keys)">
|
866 | <h6>
|
867 | <span class="badge" [ngClass]="getBadgeClass(entry.value.threadState)">{{ entry.value.threadState }}</span
|
868 | > {{ entry.value.threadName }}
|
869 | (ID
|
870 | {{ entry.value.threadId }})
|
871 | <a (click)="entry.show = !entry.show" href="javascript:void(0);">
|
872 | <span [hidden]="entry.show" jhiTranslate="metrics.jvm.threads.dump.show">Show StackTrace</span>
|
873 | <span [hidden]="!entry.show" jhiTranslate="metrics.jvm.threads.dump.hide">Hide StackTrace</span>
|
874 | </a>
|
875 | </h6>
|
876 | <div class="card" [hidden]="!entry.show">
|
877 | <div class="card-body">
|
878 | <div *ngFor="let st of (entry.value.stackTrace | keys)" class="break">
|
879 | <samp
|
880 | >{{ st.value.className }}.{{ st.value.methodName }}(<code
|
881 | >{{ st.value.fileName }}:{{ st.value.lineNumber }}</code
|
882 | >)</samp
|
883 | >
|
884 | <span class="mt-1"></span>
|
885 | </div>
|
886 | </div>
|
887 | </div>
|
888 | <table class="table table-sm table-responsive">
|
889 | <thead>
|
890 | <tr>
|
891 | <th jhiTranslate="metrics.jvm.threads.dump.blockedtime">Blocked Time</th>
|
892 | <th jhiTranslate="metrics.jvm.threads.dump.blockedcount">Blocked Count</th>
|
893 | <th jhiTranslate="metrics.jvm.threads.dump.waitedtime">Waited Time</th>
|
894 | <th jhiTranslate="metrics.jvm.threads.dump.waitedcount">Waited Count</th>
|
895 | <th jhiTranslate="metrics.jvm.threads.dump.lockname">Lock Name</th>
|
896 | </tr>
|
897 | </thead>
|
898 | <tbody>
|
899 | <tr>
|
900 | <td>{{ entry.value.blockedTime }}</td>
|
901 | <td>{{ entry.value.blockedCount }}</td>
|
902 | <td>{{ entry.value.waitedTime }}</td>
|
903 | <td>{{ entry.value.waitedCount }}</td>
|
904 | <td class="thread-dump-modal-lock" title="{{ entry.value.lockName }}">
|
905 | <code>{{ entry.value.lockName }}</code>
|
906 | </td>
|
907 | </tr>
|
908 | </tbody>
|
909 | </table>
|
910 | </div>
|
911 | </div>
|
912 | <div class="modal-footer">
|
913 | <button type="button" class="btn btn-secondary float-left" data-dismiss="modal" (click)="activeModal.dismiss('closed')">
|
914 | Done
|
915 | </button>
|
916 | </div>
|
917 | `
|
918 | },] }
|
919 | ];
|
920 | JhiThreadModalComponent.ctorParameters = () => [
|
921 | { type: NgbActiveModal }
|
922 | ];
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 | class JhiJvmMemoryComponent {
|
943 | }
|
944 | JhiJvmMemoryComponent.decorators = [
|
945 | { type: Component, args: [{
|
946 | selector: 'jhi-jvm-memory',
|
947 | template: `
|
948 | <h4 jhiTranslate="metrics.jvm.memory.title">Memory</h4>
|
949 | <div *ngIf="!updating">
|
950 | <div *ngFor="let entry of (jvmMemoryMetrics | keys)">
|
951 | <span *ngIf="entry.value.max != -1; else other">
|
952 | <span>{{ entry.key }}</span> ({{ entry.value.used / 1048576 | number: '1.0-0' }}M /
|
953 | {{ entry.value.max / 1048576 | number: '1.0-0' }}M)
|
954 | </span>
|
955 | <div>Committed : {{ entry.value.committed / 1048576 | number: '1.0-0' }}M</div>
|
956 | <ng-template #other
|
957 | ><span
|
958 | ><span>{{ entry.key }}</span> {{ entry.value.used / 1048576 | number: '1.0-0' }}M</span
|
959 | >
|
960 | </ng-template>
|
961 | <ngb-progressbar
|
962 | *ngIf="entry.value.max != -1"
|
963 | type="success"
|
964 | [value]="(100 * entry.value.used) / entry.value.max"
|
965 | [striped]="true"
|
966 | [animated]="false"
|
967 | >
|
968 | <span>{{ (entry.value.used * 100) / entry.value.max | number: '1.0-0' }}%</span>
|
969 | </ngb-progressbar>
|
970 | </div>
|
971 | </div>
|
972 | `
|
973 | },] }
|
974 | ];
|
975 | JhiJvmMemoryComponent.propDecorators = {
|
976 | jvmMemoryMetrics: [{ type: Input }],
|
977 | updating: [{ type: Input }]
|
978 | };
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 | class JhiJvmThreadsComponent {
|
999 | constructor(modalService) {
|
1000 | this.modalService = modalService;
|
1001 | }
|
1002 | ngOnInit() {
|
1003 | this.threadStats = {
|
1004 | threadDumpRunnable: 0,
|
1005 | threadDumpWaiting: 0,
|
1006 | threadDumpTimedWaiting: 0,
|
1007 | threadDumpBlocked: 0,
|
1008 | threadDumpAll: 0
|
1009 | };
|
1010 | this.threadData.forEach(value => {
|
1011 | if (value.threadState === 'RUNNABLE') {
|
1012 | this.threadStats.threadDumpRunnable += 1;
|
1013 | }
|
1014 | else if (value.threadState === 'WAITING') {
|
1015 | this.threadStats.threadDumpWaiting += 1;
|
1016 | }
|
1017 | else if (value.threadState === 'TIMED_WAITING') {
|
1018 | this.threadStats.threadDumpTimedWaiting += 1;
|
1019 | }
|
1020 | else if (value.threadState === 'BLOCKED') {
|
1021 | this.threadStats.threadDumpBlocked += 1;
|
1022 | }
|
1023 | });
|
1024 | this.threadStats.threadDumpAll =
|
1025 | this.threadStats.threadDumpRunnable +
|
1026 | this.threadStats.threadDumpWaiting +
|
1027 | this.threadStats.threadDumpTimedWaiting +
|
1028 | this.threadStats.threadDumpBlocked;
|
1029 | }
|
1030 | open() {
|
1031 | const modalRef = this.modalService.open(JhiThreadModalComponent);
|
1032 | modalRef.componentInstance.threadDump = this.threadData;
|
1033 | }
|
1034 | }
|
1035 | JhiJvmThreadsComponent.decorators = [
|
1036 | { type: Component, args: [{
|
1037 | selector: 'jhi-jvm-threads',
|
1038 | template: `
|
1039 | <h4 jhiTranslate="metrics.jvm.threads.title">Threads</h4>
|
1040 | <span><span jhiTranslate="metrics.jvm.threads.runnable">Runnable</span> {{ threadStats.threadDumpRunnable }}</span>
|
1041 | <ngb-progressbar
|
1042 | [value]="threadStats.threadDumpRunnable"
|
1043 | [max]="threadStats.threadDumpAll"
|
1044 | [striped]="true"
|
1045 | [animated]="false"
|
1046 | type="success"
|
1047 | >
|
1048 | <span>{{ (threadStats.threadDumpRunnable * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
|
1049 | </ngb-progressbar>
|
1050 | <span><span jhiTranslate="metrics.jvm.threads.timedwaiting">Timed Waiting</span> ({{ threadStats.threadDumpTimedWaiting }})</span>
|
1051 | <ngb-progressbar
|
1052 | [value]="threadStats.threadDumpTimedWaiting"
|
1053 | [max]="threadStats.threadDumpAll"
|
1054 | [striped]="true"
|
1055 | [animated]="false"
|
1056 | type="warning"
|
1057 | >
|
1058 | <span>{{ (threadStats.threadDumpTimedWaiting * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
|
1059 | </ngb-progressbar>
|
1060 | <span><span jhiTranslate="metrics.jvm.threads.waiting">Waiting</span> ({{ threadStats.threadDumpWaiting }})</span>
|
1061 | <ngb-progressbar
|
1062 | [value]="threadStats.threadDumpWaiting"
|
1063 | [max]="threadStats.threadDumpAll"
|
1064 | [striped]="true"
|
1065 | [animated]="false"
|
1066 | type="warning"
|
1067 | >
|
1068 | <span>{{ (threadStats.threadDumpWaiting * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
|
1069 | </ngb-progressbar>
|
1070 | <span><span jhiTranslate="metrics.jvm.threads.blocked">Blocked</span> ({{ threadStats.threadDumpBlocked }})</span>
|
1071 | <ngb-progressbar
|
1072 | [value]="threadStats.threadDumpBlocked"
|
1073 | [max]="threadStats.threadDumpAll"
|
1074 | [striped]="true"
|
1075 | [animated]="false"
|
1076 | type="success"
|
1077 | >
|
1078 | <span>{{ (threadStats.threadDumpBlocked * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
|
1079 | </ngb-progressbar>
|
1080 | <div>Total: {{ threadStats.threadDumpAll }}</div>
|
1081 | <button class="hand btn btn-primary btn-sm" (click)="open()" data-toggle="modal" data-target="#threadDump">
|
1082 | <span>Expand</span>
|
1083 | </button>
|
1084 | `
|
1085 | },] }
|
1086 | ];
|
1087 | JhiJvmThreadsComponent.ctorParameters = () => [
|
1088 | { type: NgbModal }
|
1089 | ];
|
1090 | JhiJvmThreadsComponent.propDecorators = {
|
1091 | threadData: [{ type: Input }]
|
1092 | };
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 | class JhiMetricsCacheComponent {
|
1113 | filterNaN(input) {
|
1114 | if (isNaN(input)) {
|
1115 | return 0;
|
1116 | }
|
1117 | return input;
|
1118 | }
|
1119 | }
|
1120 | JhiMetricsCacheComponent.decorators = [
|
1121 | { type: Component, args: [{
|
1122 | selector: 'jhi-metrics-cache',
|
1123 | template: `
|
1124 | <h3 jhiTranslate="metrics.cache.title">Cache statistics</h3>
|
1125 | <div class="table-responsive" *ngIf="!updating">
|
1126 | <table class="table table-striped">
|
1127 | <thead>
|
1128 | <tr>
|
1129 | <th jhiTranslate="metrics.cache.cachename">Cache name</th>
|
1130 | <th class="text-right" data-translate="metrics.cache.hits">Cache Hits</th>
|
1131 | <th class="text-right" data-translate="metrics.cache.misses">Cache Misses</th>
|
1132 | <th class="text-right" data-translate="metrics.cache.gets">Cache Gets</th>
|
1133 | <th class="text-right" data-translate="metrics.cache.puts">Cache Puts</th>
|
1134 | <th class="text-right" data-translate="metrics.cache.removals">Cache Removals</th>
|
1135 | <th class="text-right" data-translate="metrics.cache.evictions">Cache Evictions</th>
|
1136 | <th class="text-right" data-translate="metrics.cache.hitPercent">Cache Hit %</th>
|
1137 | <th class="text-right" data-translate="metrics.cache.missPercent">Cache Miss %</th>
|
1138 | </tr>
|
1139 | </thead>
|
1140 | <tbody>
|
1141 | <tr *ngFor="let entry of (cacheMetrics | keys)">
|
1142 | <td>{{ entry.key }}</td>
|
1143 | <td class="text-right">{{ entry.value['cache.gets.hit'] }}</td>
|
1144 | <td class="text-right">{{ entry.value['cache.gets.miss'] }}</td>
|
1145 | <td class="text-right">{{ entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'] }}</td>
|
1146 | <td class="text-right">{{ entry.value['cache.puts'] }}</td>
|
1147 | <td class="text-right">{{ entry.value['cache.removals'] }}</td>
|
1148 | <td class="text-right">{{ entry.value['cache.evictions'] }}</td>
|
1149 | <td class="text-right">
|
1150 | {{
|
1151 | filterNaN(
|
1152 | (100 * entry.value['cache.gets.hit']) / (entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'])
|
1153 | ) | number: '1.0-4'
|
1154 | }}
|
1155 | </td>
|
1156 | <td class="text-right">
|
1157 | {{
|
1158 | filterNaN(
|
1159 | (100 * entry.value['cache.gets.miss']) /
|
1160 | (entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'])
|
1161 | ) | number: '1.0-4'
|
1162 | }}
|
1163 | </td>
|
1164 | </tr>
|
1165 | </tbody>
|
1166 | </table>
|
1167 | </div>
|
1168 | `
|
1169 | },] }
|
1170 | ];
|
1171 | JhiMetricsCacheComponent.propDecorators = {
|
1172 | cacheMetrics: [{ type: Input }],
|
1173 | updating: [{ type: Input }]
|
1174 | };
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 | class JhiMetricsDatasourceComponent {
|
1195 | filterNaN(input) {
|
1196 | if (isNaN(input)) {
|
1197 | return 0;
|
1198 | }
|
1199 | return input;
|
1200 | }
|
1201 | }
|
1202 | JhiMetricsDatasourceComponent.decorators = [
|
1203 | { type: Component, args: [{
|
1204 | selector: 'jhi-metrics-datasource',
|
1205 | template: `
|
1206 | <h3 jhiTranslate="metrics.datasource.title">DataSource statistics (time in millisecond)</h3>
|
1207 | <div class="table-responsive" *ngIf="!updating">
|
1208 | <table class="table table-striped">
|
1209 | <thead>
|
1210 | <tr>
|
1211 | <th>
|
1212 | <span jhiTranslate="metrics.datasource.usage">Connection Pool Usage</span> (active:
|
1213 | {{ datasourceMetrics.active.value }}, min: {{ datasourceMetrics.min.value }}, max:
|
1214 | {{ datasourceMetrics.max.value }}, idle: {{ datasourceMetrics.idle.value }})
|
1215 | </th>
|
1216 | <th class="text-right" jhiTranslate="metrics.datasource.count">Count</th>
|
1217 | <th class="text-right" jhiTranslate="metrics.datasource.mean">Mean</th>
|
1218 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.min">Min</th>
|
1219 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p50">p50</th>
|
1220 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p75">p75</th>
|
1221 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p95">p95</th>
|
1222 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p99">p99</th>
|
1223 | <th class="text-right" jhiTranslate="metrics.datasource.max">Max</th>
|
1224 | </tr>
|
1225 | </thead>
|
1226 | <tbody>
|
1227 | <tr>
|
1228 | <td>Acquire</td>
|
1229 | <td class="text-right">{{ datasourceMetrics.acquire.count }}</td>
|
1230 | <td class="text-right">{{ filterNaN(datasourceMetrics.acquire.mean) | number: '1.0-2' }}</td>
|
1231 | <td class="text-right">{{ datasourceMetrics.acquire['0.0'] | number: '1.0-3' }}</td>
|
1232 | <td class="text-right">{{ datasourceMetrics.acquire['0.5'] | number: '1.0-3' }}</td>
|
1233 | <td class="text-right">{{ datasourceMetrics.acquire['0.75'] | number: '1.0-3' }}</td>
|
1234 | <td class="text-right">{{ datasourceMetrics.acquire['0.95'] | number: '1.0-3' }}</td>
|
1235 | <td class="text-right">{{ datasourceMetrics.acquire['0.99'] | number: '1.0-3' }}</td>
|
1236 | <td class="text-right">{{ filterNaN(datasourceMetrics.acquire.max) | number: '1.0-2' }}</td>
|
1237 | </tr>
|
1238 | <tr>
|
1239 | <td>Creation</td>
|
1240 | <td class="text-right">{{ datasourceMetrics.creation.count }}</td>
|
1241 | <td class="text-right">{{ filterNaN(datasourceMetrics.creation.mean) | number: '1.0-2' }}</td>
|
1242 | <td class="text-right">{{ datasourceMetrics.creation['0.0'] | number: '1.0-3' }}</td>
|
1243 | <td class="text-right">{{ datasourceMetrics.creation['0.5'] | number: '1.0-3' }}</td>
|
1244 | <td class="text-right">{{ datasourceMetrics.creation['0.75'] | number: '1.0-3' }}</td>
|
1245 | <td class="text-right">{{ datasourceMetrics.creation['0.95'] | number: '1.0-3' }}</td>
|
1246 | <td class="text-right">{{ datasourceMetrics.creation['0.99'] | number: '1.0-3' }}</td>
|
1247 | <td class="text-right">{{ filterNaN(datasourceMetrics.creation.max) | number: '1.0-2' }}</td>
|
1248 | </tr>
|
1249 | <tr>
|
1250 | <td>Usage</td>
|
1251 | <td class="text-right">{{ datasourceMetrics.usage.count }}</td>
|
1252 | <td class="text-right">{{ filterNaN(datasourceMetrics.usage.mean) | number: '1.0-2' }}</td>
|
1253 | <td class="text-right">{{ datasourceMetrics.usage['0.0'] | number: '1.0-3' }}</td>
|
1254 | <td class="text-right">{{ datasourceMetrics.usage['0.5'] | number: '1.0-3' }}</td>
|
1255 | <td class="text-right">{{ datasourceMetrics.usage['0.75'] | number: '1.0-3' }}</td>
|
1256 | <td class="text-right">{{ datasourceMetrics.usage['0.95'] | number: '1.0-3' }}</td>
|
1257 | <td class="text-right">{{ datasourceMetrics.usage['0.99'] | number: '1.0-3' }}</td>
|
1258 | <td class="text-right">{{ filterNaN(datasourceMetrics.usage.max) | number: '1.0-2' }}</td>
|
1259 | </tr>
|
1260 | </tbody>
|
1261 | </table>
|
1262 | </div>
|
1263 | `
|
1264 | },] }
|
1265 | ];
|
1266 | JhiMetricsDatasourceComponent.propDecorators = {
|
1267 | datasourceMetrics: [{ type: Input }],
|
1268 | updating: [{ type: Input }]
|
1269 | };
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 | class JhiMetricsEndpointsRequestsComponent {
|
1290 | }
|
1291 | JhiMetricsEndpointsRequestsComponent.decorators = [
|
1292 | { type: Component, args: [{
|
1293 | selector: 'jhi-metrics-endpoints-requests',
|
1294 | template: `
|
1295 | <h3>Endpoints requests (time in millisecond)</h3>
|
1296 | <div class="table-responsive" *ngIf="!updating">
|
1297 | <table class="table table-striped">
|
1298 | <thead>
|
1299 | <tr>
|
1300 | <th>Method</th>
|
1301 | <th>Endpoint url</th>
|
1302 | <th class="text-right">Count</th>
|
1303 | <th class="text-right">Mean</th>
|
1304 | </tr>
|
1305 | </thead>
|
1306 | <tbody>
|
1307 | <ng-container *ngFor="let entry of (endpointsRequestsMetrics | keys)">
|
1308 | <tr *ngFor="let method of (entry.value | keys)">
|
1309 | <td>{{ method.key }}</td>
|
1310 | <td>{{ entry.key }}</td>
|
1311 | <td class="text-right">{{ method.value.count }}</td>
|
1312 | <td class="text-right">{{ method.value.mean | number: '1.0-3' }}</td>
|
1313 | </tr>
|
1314 | </ng-container>
|
1315 | </tbody>
|
1316 | </table>
|
1317 | </div>
|
1318 | `
|
1319 | },] }
|
1320 | ];
|
1321 | JhiMetricsEndpointsRequestsComponent.propDecorators = {
|
1322 | endpointsRequestsMetrics: [{ type: Input }],
|
1323 | updating: [{ type: Input }]
|
1324 | };
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 | class JhiMetricsGarbageCollectorComponent {
|
1345 | }
|
1346 | JhiMetricsGarbageCollectorComponent.decorators = [
|
1347 | { type: Component, args: [{
|
1348 | selector: 'jhi-metrics-garbagecollector',
|
1349 | template: `
|
1350 | <div class="row">
|
1351 | <div class="col-md-4">
|
1352 | <div *ngIf="garbageCollectorMetrics">
|
1353 | <span>
|
1354 | GC Live Data Size/GC Max Data Size ({{
|
1355 | garbageCollectorMetrics['jvm.gc.live.data.size'] / 1048576 | number: '1.0-0'
|
1356 | }}M / {{ garbageCollectorMetrics['jvm.gc.max.data.size'] / 1048576 | number: '1.0-0' }}M)</span
|
1357 | >
|
1358 | <ngb-progressbar
|
1359 | [max]="garbageCollectorMetrics['jvm.gc.max.data.size']"
|
1360 | [value]="garbageCollectorMetrics['jvm.gc.live.data.size']"
|
1361 | [striped]="true"
|
1362 | [animated]="false"
|
1363 | type="success"
|
1364 | >
|
1365 | <span
|
1366 | >{{
|
1367 | (100 * garbageCollectorMetrics['jvm.gc.live.data.size']) / garbageCollectorMetrics['jvm.gc.max.data.size']
|
1368 | | number: '1.0-2'
|
1369 | }}%</span
|
1370 | >
|
1371 | </ngb-progressbar>
|
1372 | </div>
|
1373 | </div>
|
1374 | <div class="col-md-4">
|
1375 | <div *ngIf="garbageCollectorMetrics">
|
1376 | <span>
|
1377 | GC Memory Promoted/GC Memory Allocated ({{
|
1378 | garbageCollectorMetrics['jvm.gc.memory.promoted'] / 1048576 | number: '1.0-0'
|
1379 | }}M / {{ garbageCollectorMetrics['jvm.gc.memory.allocated'] / 1048576 | number: '1.0-0' }}M)</span
|
1380 | >
|
1381 | <ngb-progressbar
|
1382 | [max]="garbageCollectorMetrics['jvm.gc.memory.allocated']"
|
1383 | [value]="garbageCollectorMetrics['jvm.gc.memory.promoted']"
|
1384 | [striped]="true"
|
1385 | [animated]="false"
|
1386 | type="success"
|
1387 | >
|
1388 | <span
|
1389 | >{{
|
1390 | (100 * garbageCollectorMetrics['jvm.gc.memory.promoted']) /
|
1391 | garbageCollectorMetrics['jvm.gc.memory.allocated'] | number: '1.0-2'
|
1392 | }}%</span
|
1393 | >
|
1394 | </ngb-progressbar>
|
1395 | </div>
|
1396 | </div>
|
1397 | <div class="col-md-4">
|
1398 | <div class="row" *ngIf="garbageCollectorMetrics">
|
1399 | <div class="col-md-9">Classes loaded</div>
|
1400 | <div class="col-md-3 text-right">{{ garbageCollectorMetrics.classesLoaded }}</div>
|
1401 | </div>
|
1402 | <div class="row" *ngIf="garbageCollectorMetrics">
|
1403 | <div class="col-md-9">Classes unloaded</div>
|
1404 | <div class="col-md-3 text-right">{{ garbageCollectorMetrics.classesUnloaded }}</div>
|
1405 | </div>
|
1406 | </div>
|
1407 | <div class="table-responsive" *ngIf="!updating && garbageCollectorMetrics">
|
1408 | <table class="table table-striped">
|
1409 | <thead>
|
1410 | <tr>
|
1411 | <th></th>
|
1412 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.count">Count</th>
|
1413 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.mean">Mean</th>
|
1414 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.min">Min</th>
|
1415 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p50">p50</th>
|
1416 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p75">p75</th>
|
1417 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p95">p95</th>
|
1418 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.p99">p99</th>
|
1419 | <th class="text-right" jhiTranslate="metrics.servicesstats.table.max">Max</th>
|
1420 | </tr>
|
1421 | </thead>
|
1422 | <tbody>
|
1423 | <tr>
|
1424 | <td>jvm.gc.pause</td>
|
1425 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause'].count }}</td>
|
1426 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause'].mean | number: '1.0-3' }}</td>
|
1427 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.0'] | number: '1.0-3' }}</td>
|
1428 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.5'] | number: '1.0-3' }}</td>
|
1429 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.75'] | number: '1.0-3' }}</td>
|
1430 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.95'] | number: '1.0-3' }}</td>
|
1431 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.99'] | number: '1.0-3' }}</td>
|
1432 | <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause'].max | number: '1.0-3' }}</td>
|
1433 | </tr>
|
1434 | </tbody>
|
1435 | </table>
|
1436 | </div>
|
1437 | </div>
|
1438 | `
|
1439 | },] }
|
1440 | ];
|
1441 | JhiMetricsGarbageCollectorComponent.propDecorators = {
|
1442 | garbageCollectorMetrics: [{ type: Input }],
|
1443 | updating: [{ type: Input }]
|
1444 | };
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 | class JhiMetricsHttpRequestComponent {
|
1465 | filterNaN(input) {
|
1466 | if (isNaN(input)) {
|
1467 | return 0;
|
1468 | }
|
1469 | return input;
|
1470 | }
|
1471 | }
|
1472 | JhiMetricsHttpRequestComponent.decorators = [
|
1473 | { type: Component, args: [{
|
1474 | selector: 'jhi-metrics-request',
|
1475 | template: `
|
1476 | <h3 jhiTranslate="metrics.jvm.http.title">HTTP requests (time in millisecond)</h3>
|
1477 | <table class="table table-striped" *ngIf="!updating">
|
1478 | <thead>
|
1479 | <tr>
|
1480 | <th jhiTranslate="metrics.jvm.http.table.code">Code</th>
|
1481 | <th jhiTranslate="metrics.jvm.http.table.count">Count</th>
|
1482 | <th class="text-right" jhiTranslate="metrics.jvm.http.table.mean">Mean</th>
|
1483 | <th class="text-right" jhiTranslate="metrics.jvm.http.table.max">Max</th>
|
1484 | </tr>
|
1485 | </thead>
|
1486 | <tbody>
|
1487 | <tr *ngFor="let entry of (requestMetrics['percode'] | keys)">
|
1488 | <td>{{ entry.key }}</td>
|
1489 | <td>
|
1490 | <ngb-progressbar
|
1491 | [max]="requestMetrics['all'].count"
|
1492 | [value]="entry.value.count"
|
1493 | [striped]="true"
|
1494 | [animated]="false"
|
1495 | type="success"
|
1496 | >
|
1497 | <span>{{ entry.value.count }}</span>
|
1498 | </ngb-progressbar>
|
1499 | </td>
|
1500 | <td class="text-right">
|
1501 | {{ filterNaN(entry.value.mean) | number: '1.0-2' }}
|
1502 | </td>
|
1503 | <td class="text-right">{{ entry.value.max | number: '1.0-2' }}</td>
|
1504 | </tr>
|
1505 | </tbody>
|
1506 | </table>
|
1507 | `
|
1508 | },] }
|
1509 | ];
|
1510 | JhiMetricsHttpRequestComponent.propDecorators = {
|
1511 | requestMetrics: [{ type: Input }],
|
1512 | updating: [{ type: Input }]
|
1513 | };
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 | class JhiMetricsSystemComponent {
|
1534 | convertMillisecondsToDuration(ms) {
|
1535 | const times = {
|
1536 | year: 31557600000,
|
1537 | month: 2629746000,
|
1538 | day: 86400000,
|
1539 | hour: 3600000,
|
1540 | minute: 60000,
|
1541 | second: 1000
|
1542 | };
|
1543 | let timeString = '';
|
1544 | for (const key in times) {
|
1545 | if (Math.floor(ms / times[key]) > 0) {
|
1546 | let plural = '';
|
1547 | if (Math.floor(ms / times[key]) > 1) {
|
1548 | plural = 's';
|
1549 | }
|
1550 | timeString += Math.floor(ms / times[key]).toString() + ' ' + key.toString() + plural + ' ';
|
1551 | ms = ms - times[key] * Math.floor(ms / times[key]);
|
1552 | }
|
1553 | }
|
1554 | return timeString;
|
1555 | }
|
1556 | }
|
1557 | JhiMetricsSystemComponent.decorators = [
|
1558 | { type: Component, args: [{
|
1559 | selector: 'jhi-metrics-system',
|
1560 | template: `
|
1561 | <h4>System</h4>
|
1562 | <div class="row" *ngIf="!updating">
|
1563 | <div class="col-md-4">Uptime</div>
|
1564 | <div class="col-md-8 text-right">{{ convertMillisecondsToDuration(systemMetrics['process.uptime']) }}</div>
|
1565 | </div>
|
1566 | <div class="row" *ngIf="!updating">
|
1567 | <div class="col-md-4">Start time</div>
|
1568 | <div class="col-md-8 text-right">{{ systemMetrics['process.start.time'] | date: 'full' }}</div>
|
1569 | </div>
|
1570 | <div class="row" *ngIf="!updating">
|
1571 | <div class="col-md-9">Process CPU usage</div>
|
1572 | <div class="col-md-3 text-right">{{ 100 * systemMetrics['process.cpu.usage'] | number: '1.0-2' }} %</div>
|
1573 | </div>
|
1574 | <ngb-progressbar
|
1575 | [value]="100 * systemMetrics['process.cpu.usage']"
|
1576 | [striped]="true"
|
1577 | [animated]="false"
|
1578 | type="success"
|
1579 | *ngIf="!updating"
|
1580 | >
|
1581 | <span>{{ 100 * systemMetrics['process.cpu.usage'] | number: '1.0-2' }} %</span>
|
1582 | </ngb-progressbar>
|
1583 | <div class="row" *ngIf="!updating">
|
1584 | <div class="col-md-9">System CPU usage</div>
|
1585 | <div class="col-md-3 text-right">{{ 100 * systemMetrics['system.cpu.usage'] | number: '1.0-2' }} %</div>
|
1586 | </div>
|
1587 | <ngb-progressbar
|
1588 | [value]="100 * systemMetrics['system.cpu.usage']"
|
1589 | [striped]="true"
|
1590 | [animated]="false"
|
1591 | type="success"
|
1592 | *ngIf="!updating"
|
1593 | >
|
1594 | <span>{{ 100 * systemMetrics['system.cpu.usage'] | number: '1.0-2' }} %</span>
|
1595 | </ngb-progressbar>
|
1596 | <div class="row" *ngIf="!updating">
|
1597 | <div class="col-md-9">System CPU count</div>
|
1598 | <div class="col-md-3 text-right">{{ systemMetrics['system.cpu.count'] }}</div>
|
1599 | </div>
|
1600 | <div class="row" *ngIf="!updating">
|
1601 | <div class="col-md-9">System 1m Load average</div>
|
1602 | <div class="col-md-3 text-right">{{ systemMetrics['system.load.average.1m'] | number: '1.0-2' }}</div>
|
1603 | </div>
|
1604 | <div class="row" *ngIf="!updating">
|
1605 | <div class="col-md-9">Process files max</div>
|
1606 | <div class="col-md-3 text-right">{{ systemMetrics['process.files.max'] | number: '1.0-0' }}</div>
|
1607 | </div>
|
1608 | <div class="row" *ngIf="!updating">
|
1609 | <div class="col-md-9">Process files open</div>
|
1610 | <div class="col-md-3 text-right">{{ systemMetrics['process.files.open'] | number: '1.0-0' }}</div>
|
1611 | </div>
|
1612 | `
|
1613 | },] }
|
1614 | ];
|
1615 | JhiMetricsSystemComponent.propDecorators = {
|
1616 | systemMetrics: [{ type: Input }],
|
1617 | updating: [{ type: Input }]
|
1618 | };
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 | class JhiCapitalizePipe {
|
1639 | transform(input) {
|
1640 | if (input !== null) {
|
1641 | input = input.toLowerCase();
|
1642 | }
|
1643 | return input.substring(0, 1).toUpperCase() + input.substring(1);
|
1644 | }
|
1645 | }
|
1646 | JhiCapitalizePipe.decorators = [
|
1647 | { type: Pipe, args: [{ name: 'capitalize' },] }
|
1648 | ];
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 | class JhiFilterPipe {
|
1669 | transform(input, filter, field) {
|
1670 | if (typeof filter === 'undefined' || filter === '') {
|
1671 | return input;
|
1672 | }
|
1673 |
|
1674 | const currentFilter = typeof filter === 'function' ? filter() : filter;
|
1675 | if (typeof currentFilter === 'number') {
|
1676 | return input.filter(this.filterByNumber(currentFilter, field));
|
1677 | }
|
1678 | if (typeof currentFilter === 'boolean') {
|
1679 | return input.filter(this.filterByBoolean(currentFilter, field));
|
1680 | }
|
1681 | if (typeof currentFilter === 'string') {
|
1682 | return input.filter(this.filterByString(currentFilter, field));
|
1683 | }
|
1684 | if (typeof currentFilter === 'object') {
|
1685 |
|
1686 | return input.filter(this.filterByObject(currentFilter));
|
1687 | }
|
1688 |
|
1689 | return input.filter(this.filterDefault(currentFilter, field));
|
1690 | }
|
1691 | filterByNumber(filter, field) {
|
1692 | return value => (value && !filter) || (typeof value === 'object' && field)
|
1693 | ? value[field] && typeof value[field] === 'number' && value[field] === filter
|
1694 | : typeof value === 'number' && value === filter;
|
1695 | }
|
1696 | filterByBoolean(filter, field) {
|
1697 | return value => typeof value === 'object' && field
|
1698 | ? value[field] && typeof value[field] === 'boolean' && value[field] === filter
|
1699 | : typeof value === 'boolean' && value === filter;
|
1700 | }
|
1701 | filterByString(filter, field) {
|
1702 | return value => (value && !filter) || (typeof value === 'object' && field)
|
1703 | ? value[field] && typeof value[field] === 'string' && value[field].toLowerCase().includes(filter.toLowerCase())
|
1704 | : typeof value === 'string' && value.toLowerCase().includes(filter.toLowerCase());
|
1705 | }
|
1706 | filterDefault(filter, field) {
|
1707 | return value => ((value && !filter) || (typeof value === 'object' && field) ? value[field] && filter === value : filter === value);
|
1708 | }
|
1709 | filterByObject(filter) {
|
1710 | return value => {
|
1711 | const keys = Object.keys(filter);
|
1712 | let isMatching = false;
|
1713 |
|
1714 | for (const key of keys) {
|
1715 | if (typeof filter[key] === 'number') {
|
1716 | isMatching = this.filterByNumber(filter[key])(value[key]);
|
1717 | }
|
1718 | else if (typeof filter[key] === 'boolean') {
|
1719 | isMatching = this.filterByBoolean(filter[key])(value[key]);
|
1720 | }
|
1721 | else if (typeof filter[key] === 'string') {
|
1722 | isMatching = this.filterByString(filter[key])(value[key]);
|
1723 | }
|
1724 | else {
|
1725 | isMatching = this.filterDefault(filter[key])(value[key]);
|
1726 | }
|
1727 | }
|
1728 | return isMatching;
|
1729 | };
|
1730 | }
|
1731 | }
|
1732 | JhiFilterPipe.decorators = [
|
1733 | { type: Pipe, args: [{ name: 'filter', pure: false },] }
|
1734 | ];
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 | class JhiKeysPipe {
|
1755 | transform(value) {
|
1756 | const keys = [];
|
1757 | const valueKeys = Object.keys(value);
|
1758 | for (const key of valueKeys) {
|
1759 | keys.push({ key, value: value[key] });
|
1760 | }
|
1761 | return keys;
|
1762 | }
|
1763 | }
|
1764 | JhiKeysPipe.decorators = [
|
1765 | { type: Pipe, args: [{ name: 'keys' },] }
|
1766 | ];
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 | class JhiOrderByPipe {
|
1787 | transform(values, predicate = '', reverse = false) {
|
1788 | if (predicate === '') {
|
1789 | return reverse ? values.sort().reverse() : values.sort();
|
1790 | }
|
1791 | return values.sort((a, b) => {
|
1792 | if (a[predicate] < b[predicate]) {
|
1793 | return reverse ? 1 : -1;
|
1794 | }
|
1795 | else if (b[predicate] < a[predicate]) {
|
1796 | return reverse ? -1 : 1;
|
1797 | }
|
1798 | return 0;
|
1799 | });
|
1800 | }
|
1801 | }
|
1802 | JhiOrderByPipe.decorators = [
|
1803 | { type: Pipe, args: [{ name: 'orderBy' },] }
|
1804 | ];
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 | class JhiPureFilterPipe extends JhiFilterPipe {
|
1825 | transform(input, filter, field) {
|
1826 | return super.transform(input, filter, field);
|
1827 | }
|
1828 | }
|
1829 | JhiPureFilterPipe.decorators = [
|
1830 | { type: Pipe, args: [{ name: 'pureFilter' },] }
|
1831 | ];
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 | class JhiTruncateCharactersPipe {
|
1852 | transform(input, chars, breakOnWord) {
|
1853 | if (isNaN(chars)) {
|
1854 | return input;
|
1855 | }
|
1856 | if (chars <= 0) {
|
1857 | return '';
|
1858 | }
|
1859 | if (input && input.length > chars) {
|
1860 | input = input.substring(0, chars);
|
1861 | if (!breakOnWord) {
|
1862 | const lastspace = input.lastIndexOf(' ');
|
1863 |
|
1864 | if (lastspace !== -1) {
|
1865 | input = input.substr(0, lastspace);
|
1866 | }
|
1867 | }
|
1868 | else {
|
1869 | while (input.endsWith(' ')) {
|
1870 | input = input.substr(0, input.length - 1);
|
1871 | }
|
1872 | }
|
1873 | return input + '...';
|
1874 | }
|
1875 | return input;
|
1876 | }
|
1877 | }
|
1878 | JhiTruncateCharactersPipe.decorators = [
|
1879 | { type: Pipe, args: [{ name: 'truncateCharacters' },] }
|
1880 | ];
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 | class JhiTruncateWordsPipe {
|
1901 | transform(input, words) {
|
1902 | if (isNaN(words)) {
|
1903 | return input;
|
1904 | }
|
1905 | if (words <= 0) {
|
1906 | return '';
|
1907 | }
|
1908 | if (input) {
|
1909 | const inputWords = input.split(/\s+/);
|
1910 | if (inputWords.length > words) {
|
1911 | input = inputWords.slice(0, words).join(' ') + '...';
|
1912 | }
|
1913 | }
|
1914 | return input;
|
1915 | }
|
1916 | }
|
1917 | JhiTruncateWordsPipe.decorators = [
|
1918 | { type: Pipe, args: [{ name: 'truncateWords' },] }
|
1919 | ];
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 | const JHI_PIPES = [
|
1940 | JhiCapitalizePipe,
|
1941 | JhiFilterPipe,
|
1942 | JhiKeysPipe,
|
1943 | JhiOrderByPipe,
|
1944 | JhiPureFilterPipe,
|
1945 | JhiTruncateCharactersPipe,
|
1946 | JhiTruncateWordsPipe
|
1947 | ];
|
1948 | const JHI_DIRECTIVES = [
|
1949 | JhiMaxValidatorDirective,
|
1950 | JhiMinValidatorDirective,
|
1951 | JhiMaxbytesValidatorDirective,
|
1952 | JhiMinbytesValidatorDirective,
|
1953 | JhiSortDirective,
|
1954 | JhiSortByDirective
|
1955 | ];
|
1956 | const JHI_COMPONENTS = [
|
1957 | JhiItemCountComponent,
|
1958 | JhiBooleanComponent,
|
1959 | JhiJvmMemoryComponent,
|
1960 | JhiJvmThreadsComponent,
|
1961 | JhiMetricsHttpRequestComponent,
|
1962 | JhiMetricsEndpointsRequestsComponent,
|
1963 | JhiMetricsCacheComponent,
|
1964 | JhiMetricsDatasourceComponent,
|
1965 | JhiMetricsSystemComponent,
|
1966 | JhiMetricsGarbageCollectorComponent,
|
1967 | JhiThreadModalComponent
|
1968 | ];
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 | function translatePartialLoader(http) {
|
1989 | return new TranslateHttpLoader(http, 'i18n/', `.json?buildTimestamp=${process.env.BUILD_TIMESTAMP}`);
|
1990 | }
|
1991 | function missingTranslationHandler(configService) {
|
1992 | return new JhiMissingTranslationHandler(configService);
|
1993 | }
|
1994 | class NgJhipsterModule {
|
1995 | static forRoot(moduleConfig) {
|
1996 | return {
|
1997 | ngModule: NgJhipsterModule,
|
1998 | providers: [{ provide: JhiModuleConfig, useValue: moduleConfig }],
|
1999 | };
|
2000 | }
|
2001 | }
|
2002 | NgJhipsterModule.decorators = [
|
2003 | { type: NgModule, args: [{
|
2004 | imports: [CommonModule, NgbModule, FormsModule],
|
2005 | declarations: [...JHI_PIPES, ...JHI_DIRECTIVES, ...JHI_COMPONENTS, JhiTranslateDirective],
|
2006 | entryComponents: [JhiThreadModalComponent],
|
2007 | exports: [...JHI_PIPES, ...JHI_DIRECTIVES, ...JHI_COMPONENTS, JhiTranslateDirective, CommonModule],
|
2008 | },] }
|
2009 | ];
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 | class JhiPaginationUtil {
|
2052 | constructor() { }
|
2053 | |
2054 |
|
2055 |
|
2056 | parseAscending(sort) {
|
2057 | let sortArray = sort.split(',');
|
2058 | sortArray = sortArray.length > 1 ? sortArray : sort.split('%2C');
|
2059 | if (sortArray.length > 1) {
|
2060 | return sortArray.slice(-1)[0] === 'asc';
|
2061 | }
|
2062 |
|
2063 | return true;
|
2064 | }
|
2065 | |
2066 |
|
2067 |
|
2068 | parsePage(page) {
|
2069 | return parseInt(page, 10);
|
2070 | }
|
2071 | |
2072 |
|
2073 |
|
2074 | parsePredicate(sort) {
|
2075 | return sort.split(',')[0].split('%2C')[0];
|
2076 | }
|
2077 | }
|
2078 | JhiPaginationUtil.ɵprov = ɵɵdefineInjectable({ factory: function JhiPaginationUtil_Factory() { return new JhiPaginationUtil(); }, token: JhiPaginationUtil, providedIn: "root" });
|
2079 | JhiPaginationUtil.decorators = [
|
2080 | { type: Injectable, args: [{
|
2081 | providedIn: 'root'
|
2082 | },] }
|
2083 | ];
|
2084 | JhiPaginationUtil.ctorParameters = () => [];
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 | class JhiParseLinks {
|
2108 | constructor() { }
|
2109 | |
2110 |
|
2111 |
|
2112 | parse(header) {
|
2113 | if (header.length === 0) {
|
2114 | throw new Error('input must not be of zero length');
|
2115 | }
|
2116 |
|
2117 | const parts = header.split(',');
|
2118 | const links = {};
|
2119 |
|
2120 | parts.forEach(p => {
|
2121 | const section = p.split(';');
|
2122 | if (section.length !== 2) {
|
2123 | throw new Error('section could not be split on ";"');
|
2124 | }
|
2125 | const url = section[0].replace(/<(.*)>/, '$1').trim();
|
2126 | const queryString = {};
|
2127 | url.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'), ($0, $1, $2, $3) => (queryString[$1] = $3));
|
2128 | let page = queryString.page;
|
2129 | if (typeof page === 'string') {
|
2130 | page = parseInt(page, 10);
|
2131 | }
|
2132 | const name = section[1].replace(/rel="(.*)"/, '$1').trim();
|
2133 | links[name] = page;
|
2134 | });
|
2135 | return links;
|
2136 | }
|
2137 | }
|
2138 | JhiParseLinks.ɵprov = ɵɵdefineInjectable({ factory: function JhiParseLinks_Factory() { return new JhiParseLinks(); }, token: JhiParseLinks, providedIn: "root" });
|
2139 | JhiParseLinks.decorators = [
|
2140 | { type: Injectable, args: [{
|
2141 | providedIn: 'root'
|
2142 | },] }
|
2143 | ];
|
2144 | JhiParseLinks.ctorParameters = () => [];
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 | class JhiDataUtils {
|
2168 | constructor() { }
|
2169 | |
2170 |
|
2171 |
|
2172 | abbreviate(text, append = '...') {
|
2173 | if (text.length < 30) {
|
2174 | return text;
|
2175 | }
|
2176 | return text ? text.substring(0, 15) + append + text.slice(-10) : '';
|
2177 | }
|
2178 | |
2179 |
|
2180 |
|
2181 | byteSize(base64String) {
|
2182 | return this.formatAsBytes(this.size(base64String));
|
2183 | }
|
2184 | |
2185 |
|
2186 |
|
2187 | openFile(contentType, data) {
|
2188 | if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
2189 |
|
2190 | const byteCharacters = atob(data);
|
2191 | const byteNumbers = new Array(byteCharacters.length);
|
2192 | for (let i = 0; i < byteCharacters.length; i++) {
|
2193 | byteNumbers[i] = byteCharacters.charCodeAt(i);
|
2194 | }
|
2195 | const byteArray = new Uint8Array(byteNumbers);
|
2196 | const blob = new Blob([byteArray], {
|
2197 | type: contentType
|
2198 | });
|
2199 | window.navigator.msSaveOrOpenBlob(blob);
|
2200 | }
|
2201 | else {
|
2202 |
|
2203 | const fileURL = `data:${contentType};base64,${data}`;
|
2204 | const win = window.open();
|
2205 | win.document.write('<iframe src="' +
|
2206 | fileURL +
|
2207 | '" frameborder="0" style="border:0; top:0; left:0; bottom:0; right:0; width:100%; height:100%;" allowfullscreen></iframe>');
|
2208 | }
|
2209 | }
|
2210 | |
2211 |
|
2212 |
|
2213 | toBase64(file, cb) {
|
2214 | const fileReader = new FileReader();
|
2215 | fileReader.onload = function (e) {
|
2216 | const base64Data = e.target.result.substr(e.target.result.indexOf('base64,') + 'base64,'.length);
|
2217 | cb(base64Data);
|
2218 | };
|
2219 | fileReader.readAsDataURL(file);
|
2220 | }
|
2221 | |
2222 |
|
2223 |
|
2224 | clearInputImage(entity, elementRef, field, fieldContentType, idInput) {
|
2225 | if (entity && field && fieldContentType) {
|
2226 | if (Object.prototype.hasOwnProperty.call(entity, field)) {
|
2227 | entity[field] = null;
|
2228 | }
|
2229 | if (Object.prototype.hasOwnProperty.call(entity, fieldContentType)) {
|
2230 | entity[fieldContentType] = null;
|
2231 | }
|
2232 | if (elementRef && idInput && elementRef.nativeElement.querySelector('#' + idInput)) {
|
2233 | elementRef.nativeElement.querySelector('#' + idInput).value = null;
|
2234 | }
|
2235 | }
|
2236 | }
|
2237 | |
2238 |
|
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 | setFileData(event, entity, field, isImage) {
|
2248 | return new Promise((resolve, reject) => {
|
2249 | if (event && event.target && event.target.files && event.target.files[0]) {
|
2250 | const file = event.target.files[0];
|
2251 | if (isImage && !file.type.startsWith('image/')) {
|
2252 | reject(`File was expected to be an image but was found to be ${file.type}`);
|
2253 | }
|
2254 | else {
|
2255 | this.toBase64(file, base64Data => {
|
2256 | entity[field] = base64Data;
|
2257 | entity[`${field}ContentType`] = file.type;
|
2258 | resolve(entity);
|
2259 | });
|
2260 | }
|
2261 | }
|
2262 | else {
|
2263 | reject(`Base64 data was not set as file could not be extracted from passed parameter: ${event}`);
|
2264 | }
|
2265 | });
|
2266 | }
|
2267 | |
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 | loadFileToForm(event, editForm, field, isImage) {
|
2279 | return new Observable((observer) => {
|
2280 | const eventTarget = event.target;
|
2281 | if (eventTarget.files && eventTarget.files[0]) {
|
2282 | const file = eventTarget.files[0];
|
2283 | if (isImage && !file.type.startsWith('image/')) {
|
2284 | const error = {
|
2285 | message: `File was expected to be an image but was found to be '${file.type}'`,
|
2286 | key: 'not.image',
|
2287 | params: { fileType: file.type }
|
2288 | };
|
2289 | observer.error(error);
|
2290 | }
|
2291 | else {
|
2292 | const fieldContentType = field + 'ContentType';
|
2293 | this.toBase64(file, (base64Data) => {
|
2294 | editForm.patchValue({
|
2295 | [field]: base64Data,
|
2296 | [fieldContentType]: file.type
|
2297 | });
|
2298 | observer.next();
|
2299 | observer.complete();
|
2300 | });
|
2301 | }
|
2302 | }
|
2303 | else {
|
2304 | const error = {
|
2305 | message: 'Could not extract file',
|
2306 | key: 'could.not.extract',
|
2307 | params: { event }
|
2308 | };
|
2309 | observer.error(error);
|
2310 | }
|
2311 | });
|
2312 | }
|
2313 | |
2314 |
|
2315 |
|
2316 | downloadFile(contentType, data, fileName) {
|
2317 | const byteCharacters = atob(data);
|
2318 | const byteNumbers = new Array(byteCharacters.length);
|
2319 | for (let i = 0; i < byteCharacters.length; i++) {
|
2320 | byteNumbers[i] = byteCharacters.charCodeAt(i);
|
2321 | }
|
2322 | const byteArray = new Uint8Array(byteNumbers);
|
2323 | const blob = new Blob([byteArray], {
|
2324 | type: contentType
|
2325 | });
|
2326 | const tempLink = document.createElement('a');
|
2327 | tempLink.href = window.URL.createObjectURL(blob);
|
2328 | tempLink.download = fileName;
|
2329 | tempLink.target = '_blank';
|
2330 | tempLink.click();
|
2331 | }
|
2332 | endsWith(suffix, str) {
|
2333 | return str.includes(suffix, str.length - suffix.length);
|
2334 | }
|
2335 | paddingSize(value) {
|
2336 | if (this.endsWith('==', value)) {
|
2337 | return 2;
|
2338 | }
|
2339 | if (this.endsWith('=', value)) {
|
2340 | return 1;
|
2341 | }
|
2342 | return 0;
|
2343 | }
|
2344 | size(value) {
|
2345 | return (value.length / 4) * 3 - this.paddingSize(value);
|
2346 | }
|
2347 | formatAsBytes(size) {
|
2348 | return size.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ') + ' bytes';
|
2349 | }
|
2350 | }
|
2351 | JhiDataUtils.ɵprov = ɵɵdefineInjectable({ factory: function JhiDataUtils_Factory() { return new JhiDataUtils(); }, token: JhiDataUtils, providedIn: "root" });
|
2352 | JhiDataUtils.decorators = [
|
2353 | { type: Injectable, args: [{
|
2354 | providedIn: 'root'
|
2355 | },] }
|
2356 | ];
|
2357 | JhiDataUtils.ctorParameters = () => [];
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 | class JhiDateUtils {
|
2381 | constructor() {
|
2382 | this.pattern = 'yyyy-MM-dd';
|
2383 | this.datePipe = new DatePipe('en');
|
2384 | }
|
2385 | |
2386 |
|
2387 |
|
2388 | convertDateTimeFromServer(date) {
|
2389 | if (date) {
|
2390 | return new Date(date);
|
2391 | }
|
2392 | else {
|
2393 | return null;
|
2394 | }
|
2395 | }
|
2396 | |
2397 |
|
2398 |
|
2399 | convertLocalDateFromServer(date) {
|
2400 | if (date) {
|
2401 | const dateString = date.split('-');
|
2402 | return new Date(dateString[0], dateString[1] - 1, dateString[2]);
|
2403 | }
|
2404 | return null;
|
2405 | }
|
2406 | |
2407 |
|
2408 |
|
2409 | convertLocalDateToServer(date, pattern = this.pattern) {
|
2410 | if (date) {
|
2411 | const newDate = new Date(date.year, date.month - 1, date.day);
|
2412 | return this.datePipe.transform(newDate, pattern);
|
2413 | }
|
2414 | else {
|
2415 | return null;
|
2416 | }
|
2417 | }
|
2418 | |
2419 |
|
2420 |
|
2421 | dateformat() {
|
2422 | return this.pattern;
|
2423 | }
|
2424 |
|
2425 | toDate(date) {
|
2426 | if (date === undefined || date === null) {
|
2427 | return null;
|
2428 | }
|
2429 | const dateParts = date.split(/\D+/);
|
2430 | if (dateParts.length === 7) {
|
2431 | return new Date(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4], dateParts[5], dateParts[6]);
|
2432 | }
|
2433 | if (dateParts.length === 6) {
|
2434 | return new Date(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4], dateParts[5]);
|
2435 | }
|
2436 | return new Date(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4]);
|
2437 | }
|
2438 | }
|
2439 | JhiDateUtils.ɵprov = ɵɵdefineInjectable({ factory: function JhiDateUtils_Factory() { return new JhiDateUtils(); }, token: JhiDateUtils, providedIn: "root" });
|
2440 | JhiDateUtils.decorators = [
|
2441 | { type: Injectable, args: [{
|
2442 | providedIn: 'root'
|
2443 | },] }
|
2444 | ];
|
2445 | JhiDateUtils.ctorParameters = () => [];
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 | class JhiEventManager {
|
2469 | constructor() {
|
2470 | this.observable = Observable.create((observer) => {
|
2471 | this.observer = observer;
|
2472 | }).pipe(share());
|
2473 | }
|
2474 | |
2475 |
|
2476 |
|
2477 | broadcast(event) {
|
2478 | if (this.observer) {
|
2479 | this.observer.next(event);
|
2480 | }
|
2481 | }
|
2482 | |
2483 |
|
2484 |
|
2485 | subscribe(eventName, callback) {
|
2486 | const subscriber = this.observable
|
2487 | .pipe(filter((event) => {
|
2488 | if (typeof event === 'string') {
|
2489 | return event === eventName;
|
2490 | }
|
2491 | return event.name === eventName;
|
2492 | }), map((event) => {
|
2493 | if (typeof event !== 'string') {
|
2494 |
|
2495 |
|
2496 |
|
2497 | return event;
|
2498 | }
|
2499 | }))
|
2500 | .subscribe(callback);
|
2501 | return subscriber;
|
2502 | }
|
2503 | |
2504 |
|
2505 |
|
2506 | destroy(subscriber) {
|
2507 | subscriber.unsubscribe();
|
2508 | }
|
2509 | }
|
2510 | JhiEventManager.ɵprov = ɵɵdefineInjectable({ factory: function JhiEventManager_Factory() { return new JhiEventManager(); }, token: JhiEventManager, providedIn: "root" });
|
2511 | JhiEventManager.decorators = [
|
2512 | { type: Injectable, args: [{
|
2513 | providedIn: 'root'
|
2514 | },] }
|
2515 | ];
|
2516 | JhiEventManager.ctorParameters = () => [];
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 | class JhiEventWithContent {
|
2537 | constructor(name, content) {
|
2538 | this.name = name;
|
2539 | this.content = content;
|
2540 | }
|
2541 | }
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 | class JhiAlertService {
|
2562 | constructor(sanitizer, configService, ngZone, translateService) {
|
2563 | this.sanitizer = sanitizer;
|
2564 | this.configService = configService;
|
2565 | this.ngZone = ngZone;
|
2566 | this.translateService = translateService;
|
2567 | const config = this.configService.getConfig();
|
2568 | this.toast = config.alertAsToast;
|
2569 | this.i18nEnabled = config.i18nEnabled;
|
2570 | this.alertId = 0;
|
2571 | this.alerts = [];
|
2572 | this.timeout = config.alertTimeout;
|
2573 | }
|
2574 | clear() {
|
2575 | this.alerts.splice(0, this.alerts.length);
|
2576 | }
|
2577 | get() {
|
2578 | return this.alerts;
|
2579 | }
|
2580 | success(msg, params, position) {
|
2581 | return this.addAlert({
|
2582 | type: 'success',
|
2583 | msg,
|
2584 | params,
|
2585 | timeout: this.timeout,
|
2586 | toast: this.isToast(),
|
2587 | position
|
2588 | }, []);
|
2589 | }
|
2590 | error(msg, params, position) {
|
2591 | return this.addAlert({
|
2592 | type: 'danger',
|
2593 | msg,
|
2594 | params,
|
2595 | timeout: this.timeout,
|
2596 | toast: this.isToast(),
|
2597 | position
|
2598 | }, []);
|
2599 | }
|
2600 | warning(msg, params, position) {
|
2601 | return this.addAlert({
|
2602 | type: 'warning',
|
2603 | msg,
|
2604 | params,
|
2605 | timeout: this.timeout,
|
2606 | toast: this.isToast(),
|
2607 | position
|
2608 | }, []);
|
2609 | }
|
2610 | info(msg, params, position) {
|
2611 | return this.addAlert({
|
2612 | type: 'info',
|
2613 | msg,
|
2614 | params,
|
2615 | timeout: this.timeout,
|
2616 | toast: this.isToast(),
|
2617 | position
|
2618 | }, []);
|
2619 | }
|
2620 | addAlert(alertOptions, extAlerts) {
|
2621 | alertOptions.id = this.alertId++;
|
2622 | if (this.i18nEnabled && alertOptions.msg) {
|
2623 | alertOptions.msg = this.translateService.instant(alertOptions.msg, alertOptions.params);
|
2624 | }
|
2625 | const alert = this.factory(alertOptions);
|
2626 | if (alertOptions.timeout && alertOptions.timeout > 0) {
|
2627 |
|
2628 |
|
2629 | this.ngZone.runOutsideAngular(() => {
|
2630 | setTimeout(() => {
|
2631 | this.ngZone.run(() => {
|
2632 | this.closeAlert(alertOptions.id, extAlerts);
|
2633 | });
|
2634 | }, alertOptions.timeout);
|
2635 | });
|
2636 | }
|
2637 | return alert;
|
2638 | }
|
2639 | closeAlert(id, extAlerts) {
|
2640 | const thisAlerts = extAlerts && extAlerts.length > 0 ? extAlerts : this.alerts;
|
2641 | return this.closeAlertByIndex(thisAlerts.map(e => e.id).indexOf(id), thisAlerts);
|
2642 | }
|
2643 | closeAlertByIndex(index, thisAlerts) {
|
2644 | return thisAlerts.splice(index, 1);
|
2645 | }
|
2646 | isToast() {
|
2647 | return this.toast;
|
2648 | }
|
2649 | factory(alertOptions) {
|
2650 | const alert = {
|
2651 | type: alertOptions.type,
|
2652 | msg: this.sanitizer.sanitize(SecurityContext.HTML, alertOptions.msg),
|
2653 | id: alertOptions.id,
|
2654 | timeout: alertOptions.timeout,
|
2655 | toast: alertOptions.toast,
|
2656 | position: alertOptions.position ? alertOptions.position : 'top right',
|
2657 | scoped: alertOptions.scoped,
|
2658 | close: (alerts) => {
|
2659 | return this.closeAlert(alertOptions.id, alerts);
|
2660 | }
|
2661 | };
|
2662 | if (!alert.scoped) {
|
2663 | this.alerts.push(alert);
|
2664 | }
|
2665 | return alert;
|
2666 | }
|
2667 | }
|
2668 | JhiAlertService.ɵprov = ɵɵdefineInjectable({ factory: function JhiAlertService_Factory() { return new JhiAlertService(ɵɵinject(DomSanitizer), ɵɵinject(JhiConfigService), ɵɵinject(NgZone), ɵɵinject(TranslateService, 8)); }, token: JhiAlertService, providedIn: "root" });
|
2669 | JhiAlertService.decorators = [
|
2670 | { type: Injectable, args: [{
|
2671 | providedIn: 'root'
|
2672 | },] }
|
2673 | ];
|
2674 | JhiAlertService.ctorParameters = () => [
|
2675 | { type: DomSanitizer },
|
2676 | { type: JhiConfigService },
|
2677 | { type: NgZone },
|
2678 | { type: TranslateService, decorators: [{ type: Optional }] }
|
2679 | ];
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 | class JhiBase64Service {
|
2700 | constructor() {
|
2701 | this.keyStr = 'ABCDEFGHIJKLMNOP' + 'QRSTUVWXYZabcdef' + 'ghijklmnopqrstuv' + 'wxyz0123456789+/' + '=';
|
2702 | }
|
2703 | encode(input) {
|
2704 | let output = '';
|
2705 | let enc1 = '';
|
2706 | let enc2 = '';
|
2707 | let enc3 = '';
|
2708 | let enc4 = '';
|
2709 | let chr1 = '';
|
2710 | let chr2 = '';
|
2711 | let chr3 = '';
|
2712 | let i = 0;
|
2713 | while (i < input.length) {
|
2714 | chr1 = input.charCodeAt(i++);
|
2715 | chr2 = input.charCodeAt(i++);
|
2716 | chr3 = input.charCodeAt(i++);
|
2717 | enc1 = chr1 >> 2;
|
2718 | enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
2719 | enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
2720 | enc4 = chr3 & 63;
|
2721 | if (isNaN(chr2)) {
|
2722 | enc3 = enc4 = 64;
|
2723 | }
|
2724 | else if (isNaN(chr3)) {
|
2725 | enc4 = 64;
|
2726 | }
|
2727 | output = output + this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) + this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4);
|
2728 | chr1 = chr2 = chr3 = '';
|
2729 | enc1 = enc2 = enc3 = enc4 = '';
|
2730 | }
|
2731 | return output;
|
2732 | }
|
2733 | decode(input) {
|
2734 | let output = '';
|
2735 | let enc1 = '';
|
2736 | let enc2 = '';
|
2737 | let enc3 = '';
|
2738 | let enc4 = '';
|
2739 | let chr1 = '';
|
2740 | let chr2 = '';
|
2741 | let chr3 = '';
|
2742 | let i = 0;
|
2743 |
|
2744 | input = input.replace(/[^A-Za-z0-9+/=]/g, '');
|
2745 | while (i < input.length) {
|
2746 | enc1 = this.keyStr.indexOf(input.charAt(i++));
|
2747 | enc2 = this.keyStr.indexOf(input.charAt(i++));
|
2748 | enc3 = this.keyStr.indexOf(input.charAt(i++));
|
2749 | enc4 = this.keyStr.indexOf(input.charAt(i++));
|
2750 | chr1 = (enc1 << 2) | (enc2 >> 4);
|
2751 | chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
2752 | chr3 = ((enc3 & 3) << 6) | enc4;
|
2753 | output = output + String.fromCharCode(chr1);
|
2754 | if (enc3 !== 64) {
|
2755 | output = output + String.fromCharCode(chr2);
|
2756 | }
|
2757 | if (enc4 !== 64) {
|
2758 | output = output + String.fromCharCode(chr3);
|
2759 | }
|
2760 | chr1 = chr2 = chr3 = '';
|
2761 | enc1 = enc2 = enc3 = enc4 = '';
|
2762 | }
|
2763 | return output;
|
2764 | }
|
2765 | }
|
2766 | JhiBase64Service.ɵprov = ɵɵdefineInjectable({ factory: function JhiBase64Service_Factory() { return new JhiBase64Service(); }, token: JhiBase64Service, providedIn: "root" });
|
2767 | JhiBase64Service.decorators = [
|
2768 | { type: Injectable, args: [{
|
2769 | providedIn: 'root'
|
2770 | },] }
|
2771 | ];
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 |
|
2791 | class JhiResolvePagingParams {
|
2792 | constructor(paginationUtil) {
|
2793 | this.paginationUtil = paginationUtil;
|
2794 | }
|
2795 | resolve(route, state) {
|
2796 | const page = route.queryParams['page'] ? route.queryParams['page'] : '1';
|
2797 | const defaultSort = route.data['defaultSort'] ? route.data['defaultSort'] : 'id,asc';
|
2798 | const sort = route.queryParams['sort'] ? route.queryParams['sort'] : defaultSort;
|
2799 | return {
|
2800 | page: this.paginationUtil.parsePage(page),
|
2801 | predicate: this.paginationUtil.parsePredicate(sort),
|
2802 | ascending: this.paginationUtil.parseAscending(sort)
|
2803 | };
|
2804 | }
|
2805 | }
|
2806 | JhiResolvePagingParams.ɵprov = ɵɵdefineInjectable({ factory: function JhiResolvePagingParams_Factory() { return new JhiResolvePagingParams(ɵɵinject(JhiPaginationUtil)); }, token: JhiResolvePagingParams, providedIn: "root" });
|
2807 | JhiResolvePagingParams.decorators = [
|
2808 | { type: Injectable, args: [{
|
2809 | providedIn: 'root'
|
2810 | },] }
|
2811 | ];
|
2812 | JhiResolvePagingParams.ctorParameters = () => [
|
2813 | { type: JhiPaginationUtil }
|
2814 | ];
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 | export { JhiAlertService, JhiBase64Service, JhiBooleanComponent, JhiCapitalizePipe, JhiConfigService, JhiDataUtils, JhiDateUtils, JhiEventManager, JhiEventWithContent, JhiFilterPipe, JhiItemCountComponent, JhiKeysPipe, JhiLanguageService, JhiMaxValidatorDirective, JhiMaxbytesValidatorDirective, JhiMinValidatorDirective, JhiMinbytesValidatorDirective, JhiMissingTranslationHandler, JhiModuleConfig, JhiOrderByPipe, JhiPaginationUtil, JhiParseLinks, JhiPureFilterPipe, JhiResolvePagingParams, JhiSortByDirective, JhiSortDirective, JhiTranslateDirective, JhiTruncateCharactersPipe, JhiTruncateWordsPipe, NgJhipsterModule, missingTranslationHandler, translatePartialLoader, JHI_PIPES as ɵa, JHI_DIRECTIVES as ɵb, JHI_COMPONENTS as ɵc, JhiJvmMemoryComponent as ɵd, JhiJvmThreadsComponent as ɵe, JhiMetricsHttpRequestComponent as ɵf, JhiMetricsEndpointsRequestsComponent as ɵg, JhiMetricsCacheComponent as ɵh, JhiMetricsDatasourceComponent as ɵi, JhiMetricsSystemComponent as ɵj, JhiMetricsGarbageCollectorComponent as ɵk, JhiThreadModalComponent as ɵl };
|
2859 |
|