{{ result.type !== 'client' ? result.type : '' }}
diff --git a/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts b/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts index b7e1385..72ff339 100644 --- a/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts +++ b/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts @@ -25,7 +25,6 @@ import { } from "../../../ogboot/pxe-boot-files/create-pxeBootFile/create-pxe-boot-file/create-pxe-boot-file.component"; import { JoyrideService } from 'ngx-joyride'; - @Component({ selector: 'app-advanced-search', templateUrl: './advanced-search.component.html', @@ -390,29 +389,37 @@ export class AdvancedSearchComponent { } - onCheckboxChange(event: any, name: string, uuid: string) { if (event.checked) { - this.selectedElements.push(uuid); + if (!this.selectedElements.includes(uuid)) { + this.selectedElements.push(uuid); + } } else { - const index = this.selectedElements.indexOf(name); + const index = this.selectedElements.indexOf(uuid); if (index > -1) { this.selectedElements.splice(index, 1); } } - - this.isAllSelected = this.selectedElements.length === this.filteredResults.length; + + this.isAllSelected = this.filteredResults.every(result => + this.selectedElements.includes(result['@id']) + ); } toggleSelectAll() { this.isAllSelected = !this.isAllSelected; - + if (this.isAllSelected) { this.selectedElements = this.filteredResults.map(result => result['@id']); } else { this.selectedElements = []; } + + this.filteredResults.forEach(result => { + result.selected = this.isAllSelected; + }); } + isSelected(name: string): boolean { return this.selectedElements.includes(name);