Refactor logging component UI and logic
Simplified and modernized the logging.component.html layout, replacing nested cards and redundant markup with a cleaner structure. Refactored logging.component.ts to improve data flow: search, filtering, and pagination are now handled in the component instead of the template pipe. Updated page size options in app.constants.ts for better usability. Minor cleanup in setup-user.component.ts.dev-pending-20-01-2026-v1
parent
efbf56adbc
commit
6df0195ed8
@ -1,224 +1,164 @@
|
|||||||
<div id="layout-wrapper">
|
<div id="layout-wrapper">
|
||||||
<div class="inner-pg-sp">
|
<div class="inner-pg-sp">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<!-- SEARCH FORM -->
|
||||||
<div class="col-12">
|
<div class="col-xl-12 mt-4">
|
||||||
<div class="d-sm-flex align-items-center justify-content-between navbar-header p-0">
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
</div>
|
<div class="card-header font-edit-13-child">
|
||||||
</div>
|
{{ "loggerManager" | translate }}
|
||||||
</div>
|
</div>
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="col-xl-12 mt-4">
|
|
||||||
<div class="card border">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-section">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="card-body mt-2 p-0">
|
|
||||||
<div class="card mb-0 mt-2">
|
|
||||||
<div
|
|
||||||
class="card-header font-edit-13-child d-flex justify-content-between align-items-center">
|
|
||||||
{{'loggerManager' | translate}}
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form [formGroup]="logsSearchForm">
|
|
||||||
<div class="row g-3 mb-3">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="d-flex align-items-center gap-2">
|
|
||||||
<label for="fromDate" class="text-nowrap">
|
|
||||||
{{ 'fromDate' | translate }}<span
|
|
||||||
class="mandatory">*</span>
|
|
||||||
</label>
|
|
||||||
<div
|
|
||||||
class="password-wrapper position-relative w-100">
|
|
||||||
<div
|
|
||||||
class="d-flex flex-row align-items-stretch">
|
|
||||||
<input formControlName="fromDate"
|
|
||||||
type="date" id="fromDate"
|
|
||||||
class="form-control" appNoWhitespaces />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="text-danger"
|
|
||||||
*ngIf="logsSearchForm.get('fromDate')?.touched && logsSearchForm.get('fromDate')?.invalid">
|
|
||||||
{{ 'fieldRequired' | translate }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="d-flex align-items-start gap-2">
|
|
||||||
<label for="toDate" class="text-nowrap mt-2">
|
|
||||||
{{ 'toDate' | translate }}<span
|
|
||||||
class="mandatory">*</span>
|
|
||||||
</label>
|
|
||||||
<div
|
|
||||||
class="password-wrapper position-relative w-100">
|
|
||||||
|
|
||||||
<input formControlName="toDate" id="toDate"
|
|
||||||
type="date" class="form-control"
|
|
||||||
maxlength="500" appNoWhitespaces rows="3" />
|
|
||||||
<div class="text-danger" *ngIf="
|
|
||||||
logsSearchForm.get('toDate')?.touched &&
|
|
||||||
(logsSearchForm.get('toDate')?.invalid || logsSearchForm.errors?.['toDateInvalid'] || logsSearchForm.errors?.['toDateGreaterThanToday'])
|
|
||||||
">
|
|
||||||
<div
|
|
||||||
*ngIf="logsSearchForm.get('toDate')?.hasError('required')">
|
|
||||||
{{ 'fieldRequired' | translate }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
*ngIf="logsSearchForm.errors?.['toDateInvalid']">
|
|
||||||
{{ 'toDateInvalidError' | translate }}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
*ngIf="logsSearchForm.errors?.['toDateGreaterThanToday']">
|
|
||||||
{{ 'toDateGreaterThanToday' | translate }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row g-3 mb-3">
|
|
||||||
<div class="col-md-6 ms-auto text-end">
|
|
||||||
<button [disabled]="logsSearchForm.invalid"
|
|
||||||
(click)="getlogsData()"
|
|
||||||
class="btn btn-primary waves-effect waves-light">{{'findLogs'
|
|
||||||
| translate}}</button>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<form [formGroup]="logsSearchForm">
|
||||||
|
<div class="row g-3 mb-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label>
|
||||||
|
{{ "fromDate" | translate }}
|
||||||
|
<span class="mandatory">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="date"
|
||||||
|
formControlName="fromDate"
|
||||||
|
class="form-control"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
<div class="col-md-6">
|
||||||
</div>
|
<label>
|
||||||
</div>
|
{{ "toDate" | translate }} <span class="mandatory">*</span>
|
||||||
</div>
|
</label>
|
||||||
</div>
|
<input
|
||||||
</div>
|
type="date"
|
||||||
</div>
|
formControlName="toDate"
|
||||||
</div>
|
class="form-control"
|
||||||
</div>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-end">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary"
|
||||||
|
[disabled]="logsSearchForm.invalid"
|
||||||
|
(click)="getlogsData()"
|
||||||
|
>
|
||||||
|
{{ "findLogs" | translate }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TABLE -->
|
||||||
|
<div class="col-xl-12 mt-4">
|
||||||
|
<div class="card border">
|
||||||
|
<div
|
||||||
|
class="card-header d-flex justify-content-between align-items-center"
|
||||||
|
>
|
||||||
|
{{ "loggerManagerDetails" | translate }}
|
||||||
|
|
||||||
|
<div class="d-flex gap-2" *ngIf="allItems.length">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control form-control-sm"
|
||||||
|
placeholder="{{ 'search' | translate }}"
|
||||||
|
[(ngModel)]="searchText"
|
||||||
|
(ngModelChange)="applySearch()"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<i
|
||||||
|
class="fa fa-download cursor-pointer"
|
||||||
|
(click)="exportDataInExcel()"
|
||||||
|
></i>
|
||||||
|
|
||||||
|
<i class="cursor-pointer" (click)="toggleTableCard()">
|
||||||
|
<i
|
||||||
|
*ngIf="logsDataExpanded; else down"
|
||||||
|
class="dripicons-chevron-up"
|
||||||
|
></i>
|
||||||
|
<ng-template #down>
|
||||||
|
<i class="dripicons-chevron-down"></i>
|
||||||
|
</ng-template>
|
||||||
|
</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="container-fluid">
|
</div>
|
||||||
<div class="col-xl-12 mt-4">
|
|
||||||
<div class="card border">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-section">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="card-body mt-2 p-0">
|
|
||||||
<div class="card mb-0 mt-2">
|
|
||||||
<div
|
|
||||||
class="card-header font-edit-13-child d-flex justify-content-between align-items-center">
|
|
||||||
{{'loggerManagerDetails' | translate}}
|
|
||||||
<div class="d-flex align-items-center gap-2" *ngIf="allItems.length">
|
|
||||||
<div class="search-box">
|
|
||||||
<input type="text" class="form-control form-control-sm" [(ngModel)]="searchText"
|
|
||||||
placeholder="{{ 'search' | translate }}">
|
|
||||||
<i class="fas fa-search search-icon"></i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<i (click)="exportDataInExcel()" id="downloadReport" class="fa fa-download"></i>
|
<div class="card-body" *ngIf="logsDataExpanded">
|
||||||
|
<!-- NO RECORDS -->
|
||||||
<i class="materialdesignicons" (click)="toggleTableCard()">
|
<div *ngIf="!filteredItems.length" class="text-center text-muted">
|
||||||
<ng-container *ngIf="logsDataExpanded; else collapsedIcon">
|
{{ "noLoggingDetailsFound" | translate }}
|
||||||
<i class="dripicons-chevron-up float-end"></i>
|
</div>
|
||||||
</ng-container>
|
|
||||||
<ng-template #collapsedIcon>
|
|
||||||
<i class="dripicons-chevron-down float-end"></i>
|
|
||||||
</ng-template>
|
|
||||||
</i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body" *ngIf="logsDataExpanded && allItems.length; else noRecordsFound">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table mb-0 border">
|
|
||||||
<thead class="table-light">
|
|
||||||
<tr>
|
|
||||||
<th>{{'loggingID' | translate}}</th>
|
|
||||||
<th>{{'loggingRequestUri' | translate}}</th>
|
|
||||||
<th>{{'loggingResponseCode' | translate}}</th>
|
|
||||||
<th>{{'loggingRemoteIP' | translate}}</th>
|
|
||||||
<th>{{'loggingDateTime' | translate}}</th>
|
|
||||||
<th>{{'loggingMethod' | translate}}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr
|
|
||||||
*ngFor="let logs of (allItems | tableFilter: searchText: ['id','method','remoteIp','requestBody','requestUri','responseCode','userId','dateTime']).slice((currentPage-1)*itemsPerPage, currentPage*itemsPerPage)">
|
|
||||||
<td>{{logs?.id}}</td>
|
|
||||||
<td>{{logs?.requestUri}}</td>
|
|
||||||
<td>{{logs?.responseCode}}</td>
|
|
||||||
<td>{{logs?.remoteIp}}</td>
|
|
||||||
<td>{{logs?.dateTime | date:'dd-MM-yyyy, hh:mm a'}}</td>
|
|
||||||
<td>{{logs?.method}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div
|
|
||||||
class="d-flex justify-content-between align-items-center mt-3">
|
|
||||||
<div class="form-group mb-0">
|
|
||||||
<ng-select class="form-select-sm"
|
|
||||||
[items]="pageSizeOptions" bindLabel="label"
|
|
||||||
bindValue="value" [(ngModel)]="itemsPerPage"
|
|
||||||
[searchable]="false"
|
|
||||||
(change)="itemsPerPageChanged()" [clearable]="false"
|
|
||||||
[dropdownPosition]="'top'">
|
|
||||||
</ng-select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-muted" *ngIf="allItems.length > 1">
|
<!-- TABLE -->
|
||||||
{{'page' | translate}} {{currentPage}} {{'of' |
|
<div *ngIf="filteredItems.length" class="table-responsive">
|
||||||
translate}} {{totalPages()}} ({{allItems.length}}
|
<table class="table table-bordered mb-0">
|
||||||
{{'totalItems' | translate}})
|
<thead class="table-light">
|
||||||
</div>
|
<tr>
|
||||||
<div class="text-muted" *ngIf="allItems.length === 0">
|
<th>{{ "loggingID" | translate }}</th>
|
||||||
{{'no_record' | translate}}
|
<th>{{ "loggingRequestUri" | translate }}</th>
|
||||||
</div>
|
<th>{{ "loggingResponseCode" | translate }}</th>
|
||||||
<div class="text-muted" *ngIf="allItems.length === 1">
|
<th>{{ "loggingRemoteIP" | translate }}</th>
|
||||||
{{'page' | translate}} {{currentPage}} {{'of' |
|
<th>{{ "loggingDateTime" | translate }}</th>
|
||||||
translate}} {{totalPages()}} ({{allItems.length}}
|
<th>{{ "loggingMethod" | translate }}</th>
|
||||||
{{'record' | translate}})
|
</tr>
|
||||||
</div>
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let logs of pagedItems">
|
||||||
|
<td>{{ logs.id }}</td>
|
||||||
|
<td>{{ logs.requestUri }}</td>
|
||||||
|
<td>{{ logs.responseCode }}</td>
|
||||||
|
<td>{{ logs.remoteIp }}</td>
|
||||||
|
<td>{{ logs.dateTime | date: "dd-MM-yyyy, hh:mm a" }}</td>
|
||||||
|
<td>{{ logs.method }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- FOOTER -->
|
||||||
|
<div
|
||||||
|
class="d-flex justify-content-between align-items-center mt-3"
|
||||||
|
>
|
||||||
|
<ng-select
|
||||||
|
[items]="pageSizeOptions"
|
||||||
|
bindLabel="label"
|
||||||
|
bindValue="value"
|
||||||
|
[(ngModel)]="itemsPerPage"
|
||||||
|
(change)="itemsPerPageChanged()"
|
||||||
|
[searchable]="false"
|
||||||
|
[clearable]="false">
|
||||||
|
</ng-select>
|
||||||
|
|
||||||
|
<div class="text-muted">
|
||||||
|
{{ "page" | translate }} {{ currentPage }}
|
||||||
|
{{ "of" | translate }} {{ totalPages() }} ({{
|
||||||
|
filteredItems.length
|
||||||
|
}}
|
||||||
|
{{ "totalItems" | translate }})
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-primary waves-effect waves-light"
|
<button
|
||||||
(click)="previousPage()"
|
class="btn btn-primary"
|
||||||
[disabled]="currentPage === 1">
|
(click)="previousPage()"
|
||||||
{{ 'previous' | translate }}
|
[disabled]="currentPage === 1"
|
||||||
</button>
|
>
|
||||||
<button class="btn btn-primary waves-effect waves-light"
|
{{ "previous" | translate }}
|
||||||
(click)="nextPage()"
|
</button>
|
||||||
[disabled]="currentPage >= totalPages()">
|
|
||||||
{{ 'next' | translate }}
|
<button
|
||||||
</button>
|
class="btn btn-primary"
|
||||||
</div>
|
(click)="nextPage()"
|
||||||
</div>
|
[disabled]="currentPage >= totalPages()"
|
||||||
</div>
|
>
|
||||||
</div>
|
{{ "next" | translate }}
|
||||||
</div>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ng-template #noRecordsFound>
|
|
||||||
<div *ngIf="!isLoading && logsList.length === 0" class="text-center text-muted mt-3">
|
|
||||||
<p>{{'noLoggingDetailsFound' | translate}}</p>
|
|
||||||
</div>
|
|
||||||
</ng-template>
|
|
||||||
Loading…
Reference in New Issue