Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic project overview page #110

Merged
merged 159 commits into from
May 10, 2022
Merged

Basic project overview page #110

merged 159 commits into from
May 10, 2022

Conversation

cbkerr
Copy link
Member

@cbkerr cbkerr commented Feb 8, 2022

Description

Overall changes:

  • Added project overview page
  • Add Project and Job links in the menubar
  • Modules are displayed and updated based on the appropriate JobContext or ProjectContext
  • Show Views ("list" vs "grid") and Modules in the sidebar in separate blocks

New module added only for ProjectContext:

  • Schema

Modules that now support ProjectContext:

  • DocumentList
  • ImageViewer
  • TextDisplay
  • VideoViewer

Modules that should be enabled eventually:

  • FileList
  • DocumentEditor
  • Notes

TODO:

  • update tests
  • document which modules support which contexts

Motivation and Context

Prototype to start addressing #27

Checklist:

@cbkerr cbkerr added the enhancement New feature or request label Feb 8, 2022
@codecov
Copy link

codecov bot commented Feb 8, 2022

Codecov Report

Attention: Patch coverage is 75.69444% with 35 lines in your changes missing coverage. Please review.

Project coverage is 72.42%. Comparing base (e8a000b) to head (b071220).

Files with missing lines Patch % Lines
signac_dashboard/views.py 25.00% 24 Missing ⚠️
signac_dashboard/dashboard.py 89.74% 4 Missing ⚠️
signac_dashboard/util.py 66.66% 3 Missing ⚠️
signac_dashboard/modules/video_viewer.py 77.77% 2 Missing ⚠️
signac_dashboard/module.py 80.00% 1 Missing ⚠️
signac_dashboard/modules/image_viewer.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #110      +/-   ##
==========================================
+ Coverage   63.32%   72.42%   +9.09%     
==========================================
  Files          18       20       +2     
  Lines         668      747      +79     
==========================================
+ Hits          423      541     +118     
+ Misses        245      206      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I have some comments attached. This PR scope is much smaller than I anticipated, at only +274 lines. I think the biggest improvement would be to support multiple contexts with a single module class via the context constructor argument, rather than introducing new module classes, especially if a fair amount of the logic can be re-used.

signac_dashboard/dashboard.py Outdated Show resolved Hide resolved
signac_dashboard/dashboard.py Outdated Show resolved Hide resolved
signac_dashboard/dashboard.py Outdated Show resolved Hide resolved
signac_dashboard/modules/project_document.py Outdated Show resolved Hide resolved
signac_dashboard/modules/__init__.py Outdated Show resolved Hide resolved
signac_dashboard/views.py Outdated Show resolved Hide resolved
signac_dashboard/views.py Outdated Show resolved Hide resolved
signac_dashboard/views.py Outdated Show resolved Hide resolved
signac_dashboard/views.py Outdated Show resolved Hide resolved
signac_dashboard/dashboard.py Show resolved Hide resolved
@cbkerr cbkerr merged commit ac20abd into master May 10, 2022
@cbkerr cbkerr deleted the project-overview-notes branch May 10, 2022 16:49
@cbkerr cbkerr mentioned this pull request Jun 22, 2022
javierbg pushed a commit to javierbg/signac-dashboard that referenced this pull request Nov 28, 2022
* Draft necessary additions

* Add questions in comments

* project_overview

* Add sidebar to project page

* Use module context to filter modules in job sidebar

* Use layout as parent for all pages again

* Decouple View options from Module options

* Show Modules in separate box

* Add Project view to side menu

* Don't make signac-dashoard name a link

* Make checkboxes only affect relevant modules.

I had to switch to session["context"] instead of g.context
for filtering

* Add different icon for project

* Copy in minimal code to display project doc

* Add project image viewer

* Additional changes for project image viewer

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix import order and year

* Refactor DocumentList to name based on context

* Fix html indendation

* Fix block syntax

* Update code comments

* Add whitespace control to multiline jinja expression

* Use snake_case

* Add argument to get_cards in Module

* Enable text display for project

* Add project schema view as copied from document list

* Update project overview page title

* Remove temp comment

* Shorten url

* Unify getting project and job files

* Separate modal label from job id

* Note how to use same render template for both

* Generalize image viewer

* Fix LazyView when mapping multiple urls to one endpoint

* Set multiple routes to the get_file endpoint

* Remove project image viewer specific files

* Add todo

* Add note on refactoring

* Remove project-only modules names from __all__

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix improper merge of layout

* Use send_from_directory for project files

* Add note for implementation

* Generalize video viewer module

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove project-specific modules from init

* Display number of jobs in project overview

* Remove extra newline

* Remove explanatory comment

* Refactor get_file

* Refactor image_viewer get_cards

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove unused import so flake8 passes.

* Fix import.

* Add trailing slash to top level pages

* Add project overview rendering test

* Add module enabled_contexts

* Add test of modules in all enabled_contexts

* Add test to raise error if bad context is given

* Apply black formatting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update docstrings and autodoc

* Add proposed changelog entry

* Default to JobContext

* Remove setting mimetype for log files

* Simplify job/project directory access

* Also catch LookupError with different message

* Apply doc changes from code review

* Use quicker way to count jobs

* Don't use OrderedDict for project schema

* Simplify context checking logic and readability

* Move context setting to render project and job methods

* Revert "Don't use OrderedDict for project schema"

This reverts commit e4be835.

* Use g.active_page instead of session["context"]

* Update link to source of code example

* Move enabled_contexts out of constructor

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move module name back to first argument

* Set session context to fix module change bug

* Remove obj argument in superclass

Co-authored-by: Bradley Dice <[email protected]>

* Replace OrderedDict with dict

* Fix sidebar box visibility

* Hide view options when viewing a single job

* Make project cards multicolumn

* Bring back view and module selecting on mobile

* Add no cards message / no modules message for project info

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Divide modules by context

- Replace enabled_modules list of indices with a dictionary with keys the contexts
- Duplicate modules by using modules_by_context, to be replaced in the future

* Simplify module enabling logic by using new data structure

* Fix test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename enabled_modules to enabled_module_indices

* Enable separate warning message when no modules are enabled

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix pre-commit errors

* Apply suggestions to initialize modules_by_context

Co-authored-by: Bradley Dice <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move Dashboard._prepare into __init__

* Fix errors for no modules added

* Use better name for unified template for schema and job document

* Fix dict iteration

* Factor out escaping truncated values

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix changelog version.

* Make _supported_contexts class level

* Make modules_by_context private

* Add more tests for module visibility

One is commented out because it fails.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update error message.

* Fix error type and message.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename parameter to data, add docstring.

* Convert to string with str.

* Fix TODO.

* Use dict literal.

* Fix GET request.

* Fix flake8.

* Fix JobContext module test

* Add docstring and subset parameter to SchemaView module

* Change SchemaView to Schema

* Rename schema_display file

* Add default empty set _supported_contexts

* Update copyright year

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename to escaped_dict_display

* Clean up views.py

* Update changelog

* Update readme and docstring examples

* Add Charlotte to contributors

* Add ProjectContext examples to the readme

* Fix changelog

* Update module docstring

* Update image and video viewer docstrings

* Small doc fixes

* Add (failing?) job sidebar test

* Fix tests

* Fix wrong default argument for Schema

* Fix tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Document each module's supported contexts

* Update changelog

* Fix long line

* Fix indentation in contributors

* Remove redundant check in render project view

* Fix problem initializing enabled_module_indices in session

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Set default enable_module_indices in injections

* Formatting

* Add test to catch the enabled_module_indices error

* Set better default value of enabled_module_indices

Co-authored-by: Charlotte Shiqi Zhao <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bradley Dice <[email protected]>
Co-authored-by: Tim Moore <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List View / Grid View / Jobs buttons Create project overview page
6 participants