Skip to content

Commit

Permalink
Merge pull request #1162 from exadel-inc/EFRS-1470_User_should_not_be…
Browse files Browse the repository at this point in the history
…_able_to_select_and_delete_invalid_images

Restrict_deleting_of_invalid_images_from_Subject_list
  • Loading branch information
pospielov authored Aug 19, 2023
2 parents 01b6eaa + ad74be6 commit 2625768
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 9 additions & 4 deletions ui/src/app/features/image-holder/image-holder.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
~ or implied. See the License for the specific language governing
~ permissions and limitations under the License.
-->
<div class="image-holder" [ngClass]="{ 'image-holder_selection-mode': selectionMode }" (click)="onItemClick()">
<div class="image-holder" [ngClass]="{ 'image-holder_selection-mode': selectionMode && !isLoadingFailed }" (click)="onItemClick()">
<ng-container *ngIf="item.url">
<div *ngIf="!selectionMode && isDeleteVisible" class="delete-icon">
<div *ngIf="!selectionMode && isDeleteVisible && !isLoadingFailed" class="delete-icon">
<button class="del-btn" (click)="onDelete.emit(item)"><mat-icon svgIcon="trash"></mat-icon></button>
</div>
<img [src]="item.url" />
<div *ngIf="selectionMode" class="selection-overlay">
<div *ngIf="selectionMode && !isLoadingFailed" class="selection-overlay">
<input type="checkbox" [(ngModel)]="item.isSelected" />
</div>
<circle-progress *ngIf="!selectionMode" [state]="item.status" (cancel)="onCancel.emit(item)" [error]="item.error"></circle-progress>
<circle-progress
*ngIf="!selectionMode || isLoadingFailed"
[state]="item.status"
(cancel)="onCancel.emit(item)"
[error]="item.error"
></circle-progress>
</ng-container>
</div>
5 changes: 3 additions & 2 deletions ui/src/app/features/image-holder/image-holder.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ export class ImageHolderComponent implements OnChanges {
@Input() selectionMode: CollectionItem;

isDeleteVisible: boolean;
isLoadingFailed: boolean;

@Output() onDelete = new EventEmitter<CollectionItem>();
@Output() onCancel = new EventEmitter<CollectionItem>();
@Output() onSelect = new EventEmitter<CollectionItem>();

ngOnChanges(changes: SimpleChanges): void {
if (changes.item?.currentValue) {
this.isDeleteVisible =
this.item.status === CircleLoadingProgressEnum.Uploaded || this.item.status === CircleLoadingProgressEnum.Failed;
this.isDeleteVisible = this.item.status === CircleLoadingProgressEnum.Uploaded;
this.isLoadingFailed = this.item.status === CircleLoadingProgressEnum.Failed;
}
}

Expand Down

0 comments on commit 2625768

Please sign in to comment.