Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h4 class="modal-title">{{ isEdit ? "Edit label" : "New label" }}</h4>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" (click)="cancel()">Cancel</button>
<button type="button" class="btn btn-secondary" (click)="cancel()">Cancel</button>
<button type="button" class="btn btn-primary" [disabled]="!canSave()" (click)="save()">
{{ isEdit ? "Save" : "Create" }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ <h4 class="modal-title d-flex align-items-baseline" style="min-width: 0">
(click)="openCreateLabel()">
+ New label
</button>
<button *ngIf="hasSelection()" type="button" class="btn btn-outline-secondary" (click)="cancel()">Cancel</button>
<button type="button" class="btn btn-primary" [disabled]="saving" (click)="confirm()">
<span *ngIf="hasSelection()">Apply</span>
<span *ngIf="!hasSelection()">Close</span>
<button *ngIf="canApply()" type="button" class="btn btn-secondary" (click)="cancel()">Cancel</button>
<button
type="button"
class="btn"
[ngClass]="{ 'btn-primary': canApply(), 'btn-secondary': !canApply() }"
[disabled]="saving"
(click)="confirm()">
<span *ngIf="canApply()">Apply</span>
<span *ngIf="!canApply()">Close</span>
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export class LabelsModalComponent implements OnInit {
return this.selectedDatasets.length > 0;
}

/** There is something to apply only if files are selected and there are labels to check */
canApply(): boolean {
return this.hasSelection() && this.rows.length > 0;
}

toggleRow(row: LabelRow): void {
row.selection = row.selection === "checked" ? "unchecked" : "checked";
}
Expand Down