From 43124258911521460dc06bac13d665c6678b6ecb Mon Sep 17 00:00:00 2001 From: OviOvocny Date: Mon, 18 Dec 2023 15:51:23 +0100 Subject: [PATCH] fix filter by hash type (it's stored in hashlists as code and not name, so the filter arg had to change) --- .../src/api/fitcrack/endpoints/hashlists/argumentsParser.py | 2 +- .../src/src/api/fitcrack/endpoints/hashlists/hashlists.py | 4 ++-- .../fitcrackFE/src/components/hashlist/hashListLister.vue | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/argumentsParser.py b/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/argumentsParser.py index b7b72b268..78fc9b924 100644 --- a/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/argumentsParser.py +++ b/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/argumentsParser.py @@ -12,7 +12,7 @@ hash_list_parser = pagination.copy() hash_list_parser.add_argument('name', type=str, required=False, help='filter by name') -hash_list_parser.add_argument('hash_type', type=str, required=False, help='filter by hash type') +hash_list_parser.add_argument('hash_type', type=int, required=False, help='filter by hash type code') hash_list_parser.add_argument('order_by', type=str, required=False, help='result ordering', choices=['name', 'hash_type']) #'hash_count', 'job_count' maybe later hash_list_parser.add_argument('descending', type=inputs.boolean, required=False) diff --git a/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/hashlists.py b/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/hashlists.py index 2ac928ede..db553191d 100644 --- a/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/hashlists.py +++ b/webadmin/fitcrackAPI/src/src/api/fitcrack/endpoints/hashlists/hashlists.py @@ -41,8 +41,8 @@ def get(self): if args.name: hash_list_query = hash_list_query.filter(FcHashList.name.like('%' + args.name + '%')) - if args.hash_type: - hash_list_query = hash_list_query.filter(FcHashList.hash_type.like('%' + args.hash_type + '%')) + if args.hash_type is not None: + hash_list_query = hash_list_query.filter(FcHashList.hash_type == args.hash_type) if args.order_by: orderBy = getattr(FcHashList, args.order_by) diff --git a/webadmin/fitcrackFE/src/components/hashlist/hashListLister.vue b/webadmin/fitcrackFE/src/components/hashlist/hashListLister.vue index e38517274..9ad769e6c 100644 --- a/webadmin/fitcrackFE/src/components/hashlist/hashListLister.vue +++ b/webadmin/fitcrackFE/src/components/hashlist/hashListLister.vue @@ -170,7 +170,7 @@ import HashTypeAutocomplete from './hashTypeAutocomplete.vue' 'order_by': this.orderBy, 'descending': this.dataTableOptions.sortDesc ? this.dataTableOptions.sortDesc[0] : false, 'name': this.search, - 'hash_type': this.hash_type ? this.hash_type.name : null, + 'hash_type': this.hash_type != null ? this.hash_type.code : null, 'showDeleted': this.isTrash, } }).then((response) => {