UNPKG

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