Files
SimpleCloudNotifier/webapp/src/app/features/messages/message-list/message-list.component.html

123 lines
3.6 KiB
HTML

<div class="page-content">
<div class="page-header">
<h2>Messages</h2>
<button nz-button nzType="default" (click)="loadMessages()">
<span nz-icon nzType="reload"></span>
Refresh
</button>
</div>
<div class="search-bar">
<nz-input-group nzSearch [nzAddOnAfter]="searchButton">
<input
type="text"
nz-input
placeholder="Search messages..."
[(ngModel)]="searchText"
(keyup.enter)="applyFilters()"
/>
</nz-input-group>
<ng-template #searchButton>
<button nz-button nzType="primary" nzSearch (click)="applyFilters()">
<span nz-icon nzType="search"></span>
</button>
</ng-template>
</div>
@if (hasActiveFilters()) {
<div class="active-filters">
@if (appliedSearchText) {
<nz-tag nzMode="closeable" (nzOnClose)="clearSearch()">
"{{ appliedSearchText }}"
</nz-tag>
}
@for (channel of channelFilter; track channel) {
<nz-tag nzMode="closeable" (nzOnClose)="removeChannelFilter(channel)">
{{ getChannelDisplayName(channel) }}
</nz-tag>
}
@if (priorityFilter.length > 0) {
<nz-tag nzMode="closeable" (nzOnClose)="clearPriorityFilter()">
{{ getPriorityLabel(+priorityFilter[0]) }}
</nz-tag>
}
<a class="clear-all" (click)="clearAllFilters()">Clear all</a>
</div>
}
<nz-table
#messageTable
nzBordered
[nzData]="messages()"
[nzLoading]="loading()"
[nzShowPagination]="false"
[nzNoResult]="noResultTpl"
nzSize="middle"
>
<ng-template #noResultTpl></ng-template>
<thead>
<tr>
<th nzWidth="40%">Title</th>
<th
nzWidth="15%"
[nzFilters]="channelFilters()"
[nzFilterMultiple]="true"
(nzFilterChange)="onChannelFilterChange($event)"
>Channel</th>
<th nzWidth="15%">Sender</th>
<th
nzWidth="10%"
[nzFilters]="priorityFilters"
[nzFilterMultiple]="false"
(nzFilterChange)="onPriorityFilterChange($event)"
>Priority</th>
<th nzWidth="20%">Time</th>
</tr>
</thead>
<tbody>
@for (message of messages(); track message.message_id) {
<tr class="clickable-row" (click)="viewMessage(message)">
<td>
<div class="message-title">{{ message.title }}</div>
@if (message.content && !message.trimmed) {
<div class="message-preview">{{ message.content | slice:0:100 }}{{ message.content.length > 100 ? '...' : '' }}</div>
}
</td>
<td>
<span class="mono">{{ message.channel_internal_name }}</span>
</td>
<td>
{{ message.sender_name || '-' }}
</td>
<td>
<nz-tag [nzColor]="getPriorityColor(message.priority)">
{{ getPriorityLabel(message.priority) }}
</nz-tag>
</td>
<td>
<span nz-tooltip [nzTooltipTitle]="message.timestamp">
{{ message.timestamp | relativeTime }}
</span>
</td>
</tr>
} @empty {
<tr>
<td colspan="5">
<nz-empty nzNotFoundContent="No messages found"></nz-empty>
</td>
</tr>
}
</tbody>
</nz-table>
<div class="pagination-controls">
<nz-pagination
[nzPageIndex]="currentPage()"
[nzPageSize]="pageSize"
[nzTotal]="totalCount()"
[nzDisabled]="loading()"
(nzPageIndexChange)="goToPage($event)"
></nz-pagination>
</div>
</div>