diff --git a/app/api/datasets.py b/app/api/datasets.py index 926afde4..4871035b 100644 --- a/app/api/datasets.py +++ b/app/api/datasets.py @@ -1,3 +1,4 @@ +from flask import request from flask_restplus import Namespace, Resource, reqparse from flask_login import login_required, current_user from werkzeug.datastructures import FileStorage @@ -26,7 +27,7 @@ page_data = reqparse.RequestParser() page_data.add_argument('page', default=1, type=int) page_data.add_argument('limit', default=20, type=int) -page_data.add_argument('folder', required=False, default='', help='Folder for data') +page_data.add_argument('folder', default='', help='Folder for data') delete_data = reqparse.RequestParser() delete_data.add_argument('fully', default=False, type=bool, @@ -217,6 +218,25 @@ def get(self, dataset_id): page = args['page'] folder = args['folder'] + args = dict(request.args) + if args.get('limit') != None: + del args['limit'] + if args.get('page') != None: + del args['page'] + if args.get('folder') != None: + del args['folder'] + + query = {} + for key, value in args.items(): + lower = value.lower() + if lower in ["true", "false"]: + value = json.loads(lower) + + if len(lower) != 0: + query[key] = value + + # print(query, flush=True) + # Check if dataset exists dataset = current_user.datasets.filter(id=dataset_id, deleted=False).first() if dataset is None: @@ -233,9 +253,9 @@ def get(self, dataset_id): if not os.path.exists(directory): return {'message': 'Directory does not exist.'}, 400 - images = ImageModel.objects(dataset_id=dataset_id, path__startswith=directory, deleted=False) \ + images = ImageModel.objects(dataset_id=dataset_id, path__startswith=directory, deleted=False, **query) \ .order_by('file_name').only('id', 'file_name', 'annotating') - + pagination = Pagination(images.count(), limit, page) images = query_util.fix_ids(images[pagination.start:pagination.end]) diff --git a/app/api/images.py b/app/api/images.py index 9dbf0dd8..da428edd 100644 --- a/app/api/images.py +++ b/app/api/images.py @@ -19,7 +19,6 @@ image_all.add_argument('page', default=1, type=int) image_all.add_argument('perPage', default=50, type=int, required=False) - image_upload = reqparse.RequestParser() image_upload.add_argument('image', location='files', type=FileStorage, required=True, @@ -47,7 +46,7 @@ def get(self): args = image_all.parse_args() per_page = args['perPage'] page = args['page']-1 - fields = args.get('fields', "") + fields = args.get('fields', '') images = current_user.images.filter(deleted=False) total = images.count() diff --git a/client/src/components/annotator/panels/PanelButton.vue b/client/src/components/PanelButton.vue similarity index 100% rename from client/src/components/annotator/panels/PanelButton.vue rename to client/src/components/PanelButton.vue diff --git a/client/src/components/PanelButtonSelect.vue b/client/src/components/PanelButtonSelect.vue new file mode 100755 index 00000000..c449a83e --- /dev/null +++ b/client/src/components/PanelButtonSelect.vue @@ -0,0 +1,53 @@ + + + + + + + diff --git a/client/src/components/annotator/panels/PanelInputNumber.vue b/client/src/components/PanelInputNumber.vue similarity index 100% rename from client/src/components/annotator/panels/PanelInputNumber.vue rename to client/src/components/PanelInputNumber.vue diff --git a/client/src/components/annotator/panels/PanelInputString.vue b/client/src/components/PanelInputString.vue similarity index 89% rename from client/src/components/annotator/panels/PanelInputString.vue rename to client/src/components/PanelInputString.vue index 17fdad48..09f5a6d2 100755 --- a/client/src/components/annotator/panels/PanelInputString.vue +++ b/client/src/components/PanelInputString.vue @@ -3,7 +3,11 @@