2024-02-24 11:16:21 +00:00
< div class = "main term" >
< h1 > < span class = "board" > /k/< / span > - Advanced Search< / h1 >
2024-02-24 19:31:15 +00:00
< ng-container * ngIf = "this.isLoadingSchema; else searchPanel" >
< div class = "text-center" >
< p > Loading schema...< / p >
< / div >
< / ng-container >
< ng-template # searchPanel >
< fieldset >
< legend > Table columns< / legend >
2024-02-25 12:09:27 +00:00
< ng-container * ngFor = "let category of ['user', 'beatmap', 'score', 'metrics']" >
2024-02-24 19:31:15 +00:00
< fieldset class = "mb-2" >
< legend > {{ category }} < button ( click ) = " this . selectEntireFieldCategory ( category ) " > Select all< / button > < button ( click ) = " this . deselectEntireFieldCategory ( category ) " > Deselect all< / button > < / legend >
< ng-container * ngFor = "let field of fields" >
< div * ngIf = "field.category === category" >
< label >
< input type = "checkbox" [ ( ngModel ) ] = " field . active " ( change ) = " this . saveSettingsToLocalStorage ( ) " / >
{{ field.name }} < span class = "text-muted" style = "margin-left: 6px" > {{ field.description }}< / span >
< / label >
< / div >
< / ng-container >
< / fieldset >
< / ng-container >
2024-02-24 11:16:21 +00:00
2024-02-24 19:31:15 +00:00
< / fieldset >
2024-02-24 11:16:21 +00:00
2024-02-24 19:31:15 +00:00
< div class = "search-container mt-2" * ngIf = "this.queries" >
2024-02-25 12:09:27 +00:00
< app-query-builder [ queries ] = " this . queries " [ fields ] = " fields " > < / app-query-builder >
2024-02-24 19:31:15 +00:00
< / div >
2024-02-24 11:16:21 +00:00
2024-02-24 19:31:15 +00:00
< fieldset class = "mt-2" * ngIf = "this.sortingOrder" >
< legend > sorting< / legend >
2024-02-24 11:16:21 +00:00
2024-02-24 19:31:15 +00:00
< select >
2024-02-25 12:09:27 +00:00
< ng-container * ngFor = "let category of ['user', 'beatmap', 'score', 'metrics']" >
< optgroup label = "{{ category }}" >
< ng-container * ngFor = "let field of fields" >
< ng-container * ngIf = "field.category === category" >
< option
[value]="field.name"
(click)="this.sortingOrder.field = field.name"
[selected]="field.name == this.sortingOrder.field"
>{{ field.name }}
< / option >
< / ng-container >
< / ng-container >
< / optgroup >
< / ng-container >
2024-02-24 19:31:15 +00:00
< / select >
2024-02-25 19:42:33 +00:00
< label style = "margin-left: 8px" >
2024-02-24 19:31:15 +00:00
< input type = "radio" name = "sortingOrder" [ ( ngModel ) ] = " this . sortingOrder . order " value = "ASC" / >
2024-02-25 19:42:33 +00:00
↑ ASC
2024-02-24 19:31:15 +00:00
< / label >
< label >
< input type = "radio" name = "sortingOrder" [ ( ngModel ) ] = " this . sortingOrder . order " value = "DESC" / >
2024-02-25 19:42:33 +00:00
↓ DESC
2024-02-24 19:31:15 +00:00
< / label >
< / fieldset >
2024-02-24 11:16:21 +00:00
2024-02-24 19:31:15 +00:00
< div class = "text-center mt-2" >
< button ( click ) = " exportSettings ( ) " > Export settings< / button >
< button ( click ) = " fileInput . click ( ) " style = "margin-left: 5px" > Import settings< / button >
< input type = "file" # fileInput style = "display: none" ( change ) = " uploadSettingsFile ( $ event ) " accept = ".json" >
< / div >
< div class = "text-center mt-1" >
2024-02-25 12:09:27 +00:00
< button ( click ) = " search ( ) " [ disabled ] = " this . isLoading " class = "mb-2" style = "font-size: 18px" > Search< / button >
2024-02-24 13:59:17 +00:00
< / div >
2024-02-24 16:58:10 +00:00
2024-02-24 19:31:15 +00:00
< ng-container * ngIf = "this.isLoading" >
< div class = "text-center" >
2024-02-25 12:09:27 +00:00
< p > Loading < app-cute-loading > < / app-cute-loading > < / p >
< p > please be patient - the database is working hard!< / p >
2024-02-24 13:59:17 +00:00
< / div >
2024-02-24 17:21:27 +00:00
< / ng-container >
2024-02-24 19:31:15 +00:00
< div class = "text-center alert-error" * ngIf = "this.isError" >
< p > Looks like something went wrong... :(< / p >
< p > I'll look into what caused the error - but feel free to get in touch.< / p >
< / div >
< ng-container * ngIf = "response" >
< ng-container * ngIf = "response.scores.length <= 0" >
< div class = "text-center alert-error" >
< p > No results for your query - try different parameters.< / p >
2024-02-24 17:21:27 +00:00
< / div >
2024-02-24 19:31:15 +00:00
< / ng-container >
< ng-container * ngIf = "response.scores.length > 0" >
< fieldset class = "mb-2" >
< legend > tools< / legend >
< div class = "text-center" >
< button ( click ) = " this . downloadFilesService . downloadCSV ( response . scores , getColumns ( ) , ' nise-search ' ) " > Download .csv< / button >
< button ( click ) = " this . downloadFilesService . downloadJSON ( response . scores , ' nise-search ' ) " > Download .json< / button >
< button ( click ) = " this . downloadFilesService . downloadXLSX ( response . scores , ' nise-search ' ) " > Download .xlsx< / button >
< / div >
< / fieldset >
< div class = "scrollable-table" >
< table class = "table-border" >
< thead >
< tr >
< th * ngFor = "let column of fields" [ hidden ] = " ! column . active " class = "text-center" >
{{ column.shortName }}
< / th >
2024-02-25 12:09:27 +00:00
< th > Links< / th >
2024-02-24 19:31:15 +00:00
< / tr >
< / thead >
< tbody >
2024-02-25 01:00:45 +00:00
< tr * ngFor = "let entry of response.scores" class = "score-entry" >
2024-02-24 19:31:15 +00:00
< td * ngFor = "let column of fields" [ hidden ] = " ! column . active " class = "text-center" style = "line-height: 32px" >
2024-02-25 12:09:27 +00:00
< ng-container * ngIf = "getValue(entry, column.name) !== null; else nullDisplay" >
< ng-container * ngIf = "column.type == 'number'" >
{{ getValue(entry, column.name) | number }}
2024-02-24 19:31:15 +00:00
< / ng-container >
2024-02-25 12:09:27 +00:00
< ng-container * ngIf = "column.type == 'flag'" >
< span class = "flag" [ title ] = " getValue ( entry , column . name ) " > {{ countryCodeToFlag(getValue(entry, column.name)) }}< / span >
< / ng-container >
< ng-container * ngIf = "column.type == 'grade'" >
< app-osu-grade [ grade ] = " getValue ( entry , column . name ) " > < / app-osu-grade >
< / ng-container >
< ng-container * ngIf = "column.type == 'datetime'" >
{{ getValue(entry, column.name) }}
< / ng-container >
< ng-container * ngIf = "column.type == 'boolean'" >
< ng-container * ngIf = "getValue(entry, column.name) == true" >
✓
< / ng-container >
< ng-container * ngIf = "getValue(entry, column.name) == false" >
✗
< / ng-container >
< / ng-container >
< ng-container * ngIf = "column.type == 'playtime'" >
{{ formatDuration(getValue(entry, column.name)) }}
< / ng-container >
< ng-container * ngIf = "column.type == 'string'" >
< ng-container * ngIf = "column.name == 'user_username'; else stringField" >
< a [ href ] = " ' / u / ' + getValue ( entry , column . name ) " target = "_blank" > {{ getValue(entry, column.name) }}< / a >
< / ng-container >
< ng-template # stringField >
{{ getValue(entry, column.name) }}
< / ng-template >
2024-02-24 19:31:15 +00:00
< / ng-container >
< / ng-container >
2024-02-25 12:09:27 +00:00
< ng-template # nullDisplay > < code > null< / code > < / ng-template >
< / td >
< td class = "text-center" style = "line-height: 32px" >
< a [ href ] = " ' / s / ' + this . getId ( entry ) " target = "_blank" >
details
< / a >
2024-02-24 19:31:15 +00:00
< / td >
< / tr >
< / tbody >
< / table >
< / div >
2024-02-24 13:59:17 +00:00
2024-02-24 19:31:15 +00:00
< div class = "text-center mt-2" >
< p > Total results: {{ response.pagination.totalResults | number }}< / p >
< p > Page: {{ response.pagination.currentPage | number }} / {{ response.pagination.totalPages | number }}< / p >
< div class = "mb-2" >
< button * ngIf = "response.pagination.currentPage > 5" ( click ) = " this . search ( 1 ) " style = "margin-right: 5px" > 1< / button >
< span * ngIf = "response.pagination.currentPage > 6" > ... < / span >
< button * ngFor = "let page of [].constructor(Math.min(response.pagination.totalPages, 10)) | calculatePageRange:response.pagination.currentPage:response.pagination.totalPages; let i = index"
(click)="this.search(page)"
[disabled]="page == response.pagination.currentPage"
style="margin-right: 5px">
{{ page }}
< / button >
< span * ngIf = "response.pagination.currentPage < response.pagination.totalPages - 5" > ... < / span >
< button * ngIf = "response.pagination.currentPage < response.pagination.totalPages - 4" ( click ) = " this . search ( response . pagination . totalPages ) " style = "margin-right: 5px" > {{ response.pagination.totalPages }}< / button >
< / div >
< button ( click ) = " this . search ( response . pagination . currentPage - 1 ) " [ disabled ] = " response . pagination . currentPage = = 1 " > ← Previous< / button >
< button ( click ) = " this . search ( response . pagination . currentPage + 1 ) " [ disabled ] = " response . pagination . currentPage = = response . pagination . totalPages " style = "margin-left: 5px" > Next →< / button >
2024-02-24 17:21:27 +00:00
< / div >
2024-02-24 19:31:15 +00:00
< / ng-container >
2024-02-24 13:59:17 +00:00
2024-02-24 19:31:15 +00:00
< / ng-container >
< / ng-template >
2024-02-24 11:16:21 +00:00
< / div >