bazaar icon indicating copy to clipboard operation
bazaar copied to clipboard

Creating Worksapce + Adding the possibility to bookmark samples

Open evilcel3ri opened this issue 2 years ago • 2 comments

EDIT: new version:

This work prepares Pithus for the Workspace section discussed in the January 2022 meeting.

  • Renames the path my_rules to workspace and the appropriate paths
  • Created a model called Bookmarks stored in the DB
  • Bookmarks are show in the Workspace section
  • Each report has a bookmark button, only the hash and the user ID are stored in the DB for the bookmarks

Screenshot 2022-02-06 at 15-23-45 Pithus

The bookmark button is next to the download sample and export report: Screenshot from 2021-11-29 17-45-15


DEPRECATED

~~This new feature will allow you to bookmark some samples for further research. The samples are going to be displayed on the home page. This feature is only available for logged user.~~

~~Here are some screenshots of how it looks like; ~~

~~Search + bookmarked samples: Screenshot 2021-11-29 at 17-36-19 Pithus~~

~~Only bookmark samples: Screenshot 2021-11-29 at 17-36-34 Pithus~~

~~View as a logged out user: Screenshot 2021-11-29 at 17-36-46 Pithus~~

evilcel3ri avatar Nov 25 '21 14:11 evilcel3ri

Hello,

I've tried your PR on my local installation, I did a docker-compose -f local.yml build, then docker-compose -f local.yml up and got the following error while logged in. This error prevents pithus from displaying any sample, how can I fix it?

django_1         | [ERROR   ] root: relation "core_bookmark" does not exist
django_1         | LINE 1: ...okmark"."sample", "core_bookmark"."owner_id" FROM "core_book...
django_1         |                                                              ^
django_1         | Traceback (most recent call last):
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
django_1         |     return self.cursor.execute(sql, params)
django_1         | psycopg2.errors.UndefinedTable: relation "core_bookmark" does not exist
django_1         | LINE 1: ...okmark"."sample", "core_bookmark"."owner_id" FROM "core_book...
django_1         |                                                              ^
django_1         | 
django_1         | 
django_1         | The above exception was the direct cause of the following exception:
django_1         | 
django_1         | Traceback (most recent call last):
django_1         |   File "/app/./bazaar/front/view.py", line 153, in get
django_1         |     return render(request, 'front/report.html', {
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/shortcuts.py", line 19, in render
django_1         |     content = loader.render_to_string(template_name, context, request, using=using)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/loader.py", line 62, in render_to_string
django_1         |     return template.render(context, request)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
django_1         |     return self.template.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 170, in render
django_1         |     return self._render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
django_1         |     return self.nodelist.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
django_1         |     bit = node.render_annotated(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
django_1         |     return self.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
django_1         |     return compiled_parent._render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
django_1         |     return self.nodelist.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
django_1         |     bit = node.render_annotated(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
django_1         |     return self.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
django_1         |     result = block.nodelist.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
django_1         |     bit = node.render_annotated(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
django_1         |     return self.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
django_1         |     result = block.nodelist.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
django_1         |     bit = node.render_annotated(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
django_1         |     return self.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/defaulttags.py", line 312, in render
django_1         |     return nodelist.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 938, in render
django_1         |     bit = node.render_annotated(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
django_1         |     return self.render(context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/template/defaulttags.py", line 311, in render
django_1         |     if match:
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 284, in __bool__
django_1         |     self._fetch_all()
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
django_1         |     self._result_cache = list(self._iterable_class(self))
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
django_1         |     results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
django_1         |     cursor.execute(sql, params)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
django_1         |     return super().execute(sql, params)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
django_1         |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
django_1         |     return executor(sql, params, many, context)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
django_1         |     return self.cursor.execute(sql, params)
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
django_1         |     raise dj_exc_value.with_traceback(traceback) from exc_value
django_1         |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
django_1         |     return self.cursor.execute(sql, params)
django_1         | django.db.utils.ProgrammingError: relation "core_bookmark" does not exist
django_1         | LINE 1: ...okmark"."sample", "core_bookmark"."owner_id" FROM "core_book...

entropyqueen avatar Nov 28 '21 22:11 entropyqueen

Will modify the feature based on what we discussed in our previous meeting

evilcel3ri avatar Jan 25 '22 08:01 evilcel3ri