2023-01-15 13:14:48 +02:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2023-01-15 13:14:48 +02:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
-->
|
2024-10-10 15:09:59 +03:00
|
|
|
<div [formGroup]="alarmCommentFormGroup" class="tb-alarm-comments flex flex-col">
|
|
|
|
|
<div class="header" [class.activity-only]="alarmActivityOnly">
|
2024-10-15 13:23:36 +03:00
|
|
|
<div class="header-container flex flex-row items-center justify-between"
|
2024-10-10 15:09:59 +03:00
|
|
|
[class.asc]="isDirectionAscending()"
|
|
|
|
|
[class.activity-only]="alarmActivityOnly">
|
2023-03-29 12:15:46 +03:00
|
|
|
<span class="header-title" translate>
|
|
|
|
|
alarm-activity.activity
|
|
|
|
|
</span>
|
|
|
|
|
<div style="margin-left: auto">
|
2023-03-31 15:35:25 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="exportAlarmActivity()"
|
|
|
|
|
matTooltip="{{ 'alarm-activity.export' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon class="material-icons" svgIcon="mdi:file-export"></mat-icon>
|
|
|
|
|
</button>
|
2023-03-29 12:15:46 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="changeSortDirection()"
|
|
|
|
|
[matTooltip]="getSortDirectionTooltipText()"
|
|
|
|
|
matTooltipPosition="above">
|
2023-12-01 16:05:43 +02:00
|
|
|
<tb-icon class="material-icons">{{ getSortDirectionIcon() }}</tb-icon>
|
2023-03-29 12:15:46 +03:00
|
|
|
</button>
|
|
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="loadAlarmComments()"
|
|
|
|
|
matTooltip="{{ 'alarm-activity.refresh' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon class="material-icons">refresh</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2023-02-10 16:17:12 +02:00
|
|
|
</div>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|
2024-10-10 15:09:59 +03:00
|
|
|
<div class="flex flex-col">
|
2023-03-29 12:15:46 +03:00
|
|
|
<ng-container *ngIf="!isDirectionAscending()">
|
2023-02-10 16:17:12 +02:00
|
|
|
<ng-container *ngTemplateOutlet="commentInput"></ng-container>
|
|
|
|
|
</ng-container>
|
2024-10-10 15:09:59 +03:00
|
|
|
<div class="comments-container flex flex-col gap-3" style="padding: 24px"
|
|
|
|
|
[class.asc]="isDirectionAscending()"
|
|
|
|
|
[class.activity-only]="alarmActivityOnly">
|
|
|
|
|
<div class="flex-1" *ngFor="let displayDataElement of displayData; index as i">
|
2023-04-07 12:15:31 +03:00
|
|
|
<div class="system-comment" *ngIf="displayDataElement.isSystemComment; else userComment">
|
2023-03-29 12:15:46 +03:00
|
|
|
<span class="system-text" style="margin-right: 8px">
|
|
|
|
|
{{ displayDataElement.commentText }}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="time" style="padding: 3px"
|
2023-03-31 15:35:25 +03:00
|
|
|
[matTooltip]="displayDataElement.createdTime"
|
2023-03-29 12:15:46 +03:00
|
|
|
matTooltipPosition="right">
|
|
|
|
|
{{ displayDataElement.createdDateAgo }}
|
|
|
|
|
</span>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|
2023-03-29 12:15:46 +03:00
|
|
|
<ng-template #userComment>
|
2024-10-15 13:23:36 +03:00
|
|
|
<div class="user-comment flex flex-row items-center justify-start gap-2"
|
2023-03-29 12:15:46 +03:00
|
|
|
*ngIf="!displayDataElement.edit; else commentEditing"
|
|
|
|
|
(mouseenter)="onCommentMouseEnter(displayDataElement.commentId, i)"
|
|
|
|
|
(mouseleave)="onCommentMouseLeave(i)">
|
2024-10-10 15:09:59 +03:00
|
|
|
<div *ngIf="displayDataElement.userExists; else userDeleted"
|
2024-10-15 13:23:36 +03:00
|
|
|
class="user-avatar flex flex-row items-center justify-center self-start xs:!hidden"
|
2023-01-15 13:14:48 +02:00
|
|
|
[style.background-color]="displayDataElement.avatarBgColor">
|
|
|
|
|
{{ getUserInitials(displayDataElement.displayName) }}
|
|
|
|
|
</div>
|
2024-09-19 18:52:23 +03:00
|
|
|
<ng-template #userDeleted>
|
2024-10-10 15:09:59 +03:00
|
|
|
<mat-icon class="mat-icon tb-mat-28 xs:!hidden">no_accounts</mat-icon>
|
2024-09-19 18:52:23 +03:00
|
|
|
</ng-template>
|
2024-10-10 15:09:59 +03:00
|
|
|
<div class="flex flex-1 flex-col" style="gap: 5px">
|
2024-10-15 13:23:36 +03:00
|
|
|
<div class="flex flex-row items-center justify-start gap-2">
|
2023-03-29 12:15:46 +03:00
|
|
|
<span class="user-name">{{ displayDataElement.displayName }}</span>
|
|
|
|
|
<span class="time"
|
2023-03-31 15:35:25 +03:00
|
|
|
[matTooltip]="displayDataElement.createdTime"
|
2023-03-29 12:15:46 +03:00
|
|
|
matTooltipPosition="right">
|
|
|
|
|
{{ displayDataElement.createdDateAgo }}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="time" *ngIf="displayDataElement.isEdited"
|
2023-03-31 15:35:25 +03:00
|
|
|
matTooltip="{{ displayDataElement.editedDateAgo }} {{ displayDataElement.editedTime }}"
|
2023-03-29 12:15:46 +03:00
|
|
|
matTooltipPosition="right">
|
|
|
|
|
Edited
|
|
|
|
|
</span>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|
2023-03-29 12:15:46 +03:00
|
|
|
<span class="text">{{ displayDataElement.commentText }}</span>
|
|
|
|
|
</div>
|
2024-10-10 15:09:59 +03:00
|
|
|
<div class="action-buttons flex flex-row xs:flex-col"
|
|
|
|
|
[class.show-buttons]="displayDataElement.showActions">
|
2023-03-29 12:15:46 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="editComment(displayDataElement.commentId)">
|
|
|
|
|
<mat-icon class="material-icons">edit</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="deleteComment(displayDataElement.commentId)">
|
|
|
|
|
<mat-icon class="material-icons">delete</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|
2023-03-29 12:15:46 +03:00
|
|
|
<ng-template #commentEditing>
|
2024-10-15 13:23:36 +03:00
|
|
|
<div class="flex flex-row items-center justify-start gap-2">
|
|
|
|
|
<div class="user-avatar flex flex-row items-center justify-center"
|
2023-03-29 12:15:46 +03:00
|
|
|
[style.background-color]="displayDataElement.avatarBgColor">
|
|
|
|
|
{{ getUserInitials(displayDataElement.displayName) }}
|
|
|
|
|
</div>
|
2024-10-10 15:09:59 +03:00
|
|
|
<mat-form-field class="mat-block tb-appearance-transparent flex-1">
|
2023-03-29 12:15:46 +03:00
|
|
|
<textarea matInput
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="{{ 'alarm-activity.add' | translate }}"
|
|
|
|
|
cdkTextareaAutosize
|
|
|
|
|
cdkAutosizeMinRows="1"
|
|
|
|
|
cols="1"
|
|
|
|
|
formControlName="alarmCommentEdit"
|
|
|
|
|
(keyup.enter)="saveEditedComment(displayDataElement.commentId)"
|
|
|
|
|
(keydown.enter)="$event.preventDefault()">
|
|
|
|
|
</textarea>
|
2024-10-10 15:09:59 +03:00
|
|
|
<div matSuffix class="flex flex-row">
|
2023-03-29 12:15:46 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
(click)="cancelEdit(displayDataElement.commentId)"
|
|
|
|
|
type="button">
|
|
|
|
|
<mat-icon class="material-icons red-button">close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="saveEditedComment(displayDataElement.commentId)">
|
|
|
|
|
<mat-icon class="material-icons green-button">check</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
2023-01-15 13:14:48 +02:00
|
|
|
</ng-template>
|
2023-03-29 12:15:46 +03:00
|
|
|
</div>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|
2023-02-10 16:17:12 +02:00
|
|
|
<ng-container *ngIf="isDirectionAscending()">
|
|
|
|
|
<ng-container *ngTemplateOutlet="commentInput"></ng-container>
|
|
|
|
|
</ng-container>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|
2023-02-10 16:17:12 +02:00
|
|
|
<ng-template #commentInput>
|
2023-03-29 12:15:46 +03:00
|
|
|
<div style="background-color: white" class="comment-input"
|
2024-10-10 15:09:59 +03:00
|
|
|
[class.newest-first]="!isDirectionAscending()"
|
|
|
|
|
[class.oldest-first]="isDirectionAscending()"
|
|
|
|
|
[class.activity-only]="alarmActivityOnly">
|
2024-10-15 13:23:36 +03:00
|
|
|
<div class="inner-wrap flex flex-row items-center justify-start gap-2">
|
|
|
|
|
<div class="user-avatar flex flex-row items-center justify-center"
|
2023-03-29 12:15:46 +03:00
|
|
|
*ngIf="userDisplayName$ | async; let userDisplayName"
|
|
|
|
|
[style.background-color]="getCurrentUserBgColor(userDisplayName)">
|
|
|
|
|
{{ getUserInitials(userDisplayName) }}
|
|
|
|
|
</div>
|
2024-10-10 15:09:59 +03:00
|
|
|
<mat-form-field class="mat-block tb-appearance-transparent flex-1">
|
2023-01-15 13:14:48 +02:00
|
|
|
<textarea matInput
|
|
|
|
|
type="text"
|
2023-03-29 12:15:46 +03:00
|
|
|
placeholder="{{ 'alarm-activity.add' | translate }}"
|
2023-01-15 13:14:48 +02:00
|
|
|
cdkTextareaAutosize
|
|
|
|
|
cdkAutosizeMinRows="1"
|
|
|
|
|
cols="1"
|
|
|
|
|
formControlName="alarmComment"
|
|
|
|
|
(keyup.enter)="saveComment()"
|
|
|
|
|
(keydown.enter)="$event.preventDefault()">
|
|
|
|
|
</textarea>
|
2023-03-29 12:15:46 +03:00
|
|
|
<button mat-icon-button
|
|
|
|
|
type="button"
|
|
|
|
|
matSuffix
|
|
|
|
|
*ngIf="getAlarmCommentFormControl().value"
|
|
|
|
|
(click)="saveComment()">
|
|
|
|
|
<mat-icon color="primary">
|
|
|
|
|
send
|
|
|
|
|
</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2023-02-10 16:17:12 +02:00
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
2023-01-15 13:14:48 +02:00
|
|
|
</div>
|