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

refactor frontend structure into flask blueprints #8569

Merged
merged 9 commits into from
Nov 4, 2023
Merged

Conversation

miigotu
Copy link
Contributor

@miigotu miigotu commented Sep 30, 2023

Structure is coming together, but I need to fix a bug with blueprints and paths and then make that work with webpack.

Holding the forms and models and stuff back for now.

Summary by CodeRabbit

  • New Features

    • Added a search functionality across different media types (shows, movies, and configuration).
    • Introduced logging for improved tracking and debugging.
  • Improvements

    • Enhanced the Flask application setup with different configurations for development and production environments.
    • Improved the organization of the webpack configuration for better modularity.
  • Bug Fixes

    • Fixed import paths in the Flask application setup.
  • Documentation

    • Added docstrings to new modules and functions for better code understanding.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2023

Warning

Rate Limit Exceeded

@miigotu has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 11 minutes and 55 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per repository.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between f8915b1 and 468b3a9.

Walkthrough

The changes in this update focus on enhancing the SickChill Flask web server interface. Several new modules and blueprints are added to handle different media types (shows, movies, and configuration). The Flask application is now organized using a FlaskServer class, which provides methods to run and stop the server. The webpack configuration is also updated to support multiple entry points and includes the GenerateSW plugin for service workers.

Changes

File(s) Summary
frontend/app.py Added a FlaskServer class to manage the Flask application. Registered blueprints for config, movies, and shows. Updated logging configuration and added new configuration classes.
frontend/config/__init__.py
frontend/movies/__init__.py
frontend/shows/__init__.py
Added new modules for the web interface of SickChill configuration, movies, and shows. Each module uses the build_blueprint function to create a blueprint.
frontend/config/views/config.py
frontend/movies/views/movies.py
frontend/shows/views/shows.py
Added new route handler functions to the respective blueprints. These functions render templates and log messages.
frontend/utils.py Added a new function build_blueprint to generate a Flask blueprint for a frontend module.
webpack.config.js Restructured the webpack configuration to support multiple entry points. Replaced WorkboxWebpackPlugin with GenerateSW for service worker generation.

🐇🍂 "In the season of fall, as leaves gently sway,
CodeRabbit hops in, ready to play.
Blueprints and modules, oh what a delight,
SickChill's web server shines so bright.
With shows and movies, and settings too,
CodeRabbit's changes bring something new.
So let's celebrate this update grand,
As SickChill's web interface takes a stand!" 🎉🥕


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Commits Files that changed from the base of the PR and between bad2896 and d08d0e6.
Files selected for processing (9)
  • frontend/app.py (2 hunks)
  • frontend/config/init.py (1 hunks)
  • frontend/config/views/config.py (1 hunks)
  • frontend/movies/init.py (1 hunks)
  • frontend/movies/views/movies.py (1 hunks)
  • frontend/shows/init.py (1 hunks)
  • frontend/shows/views/shows.py (1 hunks)
  • frontend/utils.py (1 hunks)
  • webpack.config.js (1 hunks)
Files skipped from review due to trivial changes (1)
  • frontend/config/views/config.py
Additional comments (Suppressed): 19
webpack.config.js (6)
  • 6-6: The WorkboxWebpackPlugin has been replaced with GenerateSW from the same package. This change is in line with the PR summary and should improve the modularity of the webpack configuration.

  • 55-66: The configuration for the 'config' module has been added. The entry point, output path, and public path have been updated to match the new module structure. This change is in line with the PR summary and should improve the modularity of the webpack configuration.

  • 67-79: The configuration for the 'shows' module has been updated. The entry points, output path, and public path have been updated to match the new module structure. This change is in line with the PR summary and should improve the modularity of the webpack configuration.

  • 81-93: The configuration for the 'movies' module has been added. The entry point, output path, and public path have been updated to match the new module structure. This change is in line with the PR summary and should improve the modularity of the webpack configuration.

  • 95-105: The exported function has been updated to return an array of configurations for each module. The GenerateSW plugin is added to each configuration if the mode is "production". This change is in line with the PR summary and should improve the modularity of the webpack configuration.

  • 98-102: The GenerateSW plugin is added to the plugins array of each configuration if the mode is "production". This is a change from the old hunk where the WorkboxWebpackPlugin.GenerateSW() was added to the plugins array of the main configuration. This change should improve the modularity of the webpack configuration and ensure that a service worker is generated for each module in production mode.

frontend/movies/__init__.py (1)
  • 1-7: The build_blueprint utility function is used to create a Flask blueprint for the movies module. This is a good practice as it improves the modularity of the application. However, ensure that the build_blueprint function is thoroughly tested and handles potential errors gracefully.
frontend/shows/__init__.py (1)
  • 1-7: The build_blueprint utility function is used to create a Flask blueprint for the shows module. This is a good practice as it enhances modularity and organization of the code. However, ensure that the build_blueprint function is thoroughly tested and handles potential errors gracefully.
frontend/utils.py (1)
  • 10-24: The build_blueprint function seems to be well implemented. It creates a Flask blueprint for a frontend module, using the module's location and import name. The function also sets up the paths for the templates and static files for the module, and logs these paths for debugging purposes. However, it's important to ensure that the module_location and module_import parameters are always valid and exist in the file system before they are used to create the blueprint. This can prevent potential runtime errors.
frontend/app.py (5)
  • 1-21: The new hunk introduces additional blueprints for different parts of the application: config_blueprint, shows_blueprint, and movies_blueprint. This is a good practice as it modularizes the application, making it easier to manage and extend. However, ensure that these blueprints are correctly defined and that their routes do not conflict with each other.

  • 29-29: The configuration import path has been updated. Make sure that the new path is correct and that the DevelopmentConfig class exists at this location. If different configurations are used for different environments, consider dynamically selecting the configuration class based on the environment.

- self.app.config.from_object("frontend.app.DevelopmentConfig")
+ config_class = f"frontend.app.{os.getenv('FLASK_ENV', 'Development')}Config"
+ self.app.config.from_object(config_class)
  • 31-33: The application now registers multiple blueprints. Ensure that the order of registration does not cause any route conflicts. Flask uses the first matching route it finds, so if a blueprint with a catch-all route is registered first, it may overshadow routes in other blueprints.

  • 34-35: Logging of registered routes is a good practice for traceability and debugging. However, be aware that this could potentially expose sensitive route information in the logs. Consider logging this information only in development mode.

  • 45-68: The new hunk introduces different configuration classes for different environments. This is a good practice as it allows for environment-specific settings. However, ensure that these classes are used correctly throughout the application, and that sensitive information such as secret keys is not hard-coded but loaded from environment variables or secure storage.

frontend/config/__init__.py (1)
  • 1-7: The build_blueprint utility function is used to create a Flask blueprint for the configuration module. This is a good practice as it improves the modularity of the application. However, ensure that the build_blueprint function correctly handles the __file__ and __name__ parameters and that it is thoroughly tested, as any issues could impact the routing of the application.
frontend/movies/views/movies.py (2)
  • 15-16: The debug log message refers to settings.showList and settings.movie_list. Ensure that settings.showList is not a typo and that both settings.showList and settings.movie_list are defined and contain the expected data.

  • 18-18: Ensure that the "movies.html" template exists and is located in the correct directory. Also, verify that it can handle the movies variable being passed to it.

frontend/shows/views/shows.py (2)
  • 10-14: The route function shows is now only mapped to the root ("/") of the shows_blueprint. In the old hunk, it was also mapped to "/shows". If this change is intentional, ensure that all references to the "/shows" route in the codebase have been updated to use the root ("/") instead. If this is not intentional, consider adding the "/shows" route back.
- @shows_blueprint.route("/")
+ @shows_blueprint.route("/")
+ @shows_blueprint.route("/shows")
  • 17-21: The new route function show is mapped to "/show/" and returns a template with show=None. If this is a placeholder for future implementation, consider adding a comment to indicate this. If not, ensure that the template "show.html" can handle a None value for show without causing errors.

frontend/movies/views/movies.py Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 9

Commits Files that changed from the base of the PR and between 5a08281 and 2e292cb.
Files selected for processing (9)
  • frontend/app.py (2 hunks)
  • frontend/config/init.py (1 hunks)
  • frontend/config/views/config.py (1 hunks)
  • frontend/movies/init.py (1 hunks)
  • frontend/movies/views/movies.py (1 hunks)
  • frontend/shows/init.py (1 hunks)
  • frontend/shows/views/shows.py (1 hunks)
  • frontend/utils.py (1 hunks)
  • webpack.config.js (1 hunks)
Files not summarized due to errors (1)
  • frontend/config/views/config.py: Error: Server error
Additional comments (Suppressed): 9
frontend/config/__init__.py (1)
  • 1-7: The build_blueprint utility function is used to generate a Flask blueprint for the configuration module. This is a good practice as it improves modularity and organization of the code. However, ensure that the build_blueprint function is thoroughly tested and handles all edge cases, as it is a critical part of the application's routing mechanism.
frontend/shows/__init__.py (1)
  • 1-7: The new hunk introduces a blueprint for the shows media type using the build_blueprint utility function. This is a good practice as it improves the modularity and organization of the code. However, ensure that the build_blueprint function is thoroughly tested and handles all edge cases, as it is now a critical part of the application structure.
frontend/movies/__init__.py (1)
  • 1-7: The build_blueprint utility function is used to generate a Flask blueprint for the movies module. This is a good practice as it enhances modularity and organization of the code. However, ensure that the build_blueprint function correctly handles the __file__ and __name__ parameters and that the generated blueprint is correctly registered in the Flask application.
frontend/app.py (2)
  • 9-11: The new code imports blueprints for config, shows, and movies. Ensure that these blueprints are correctly defined and that their routes do not conflict with each other.

  • 26-37: The run method has been updated to register the new blueprints and log the routes. Ensure that the logging does not expose sensitive information. Also, verify that the DevelopmentConfig is the intended configuration for this context. If this code is meant for production, you should use ProductionConfig instead.

frontend/shows/views/shows.py (2)
  • 10-14: The route handler shows() is correctly refactored from the old index() function. It logs the loading of the shows page and the list of shows, then renders the "shows.html" template with the list of shows. This change is consistent with the PR's goal of improving modularity and organization.

  • 17-21: The new route handler show() is introduced to load the show details page. However, it currently returns the "show.html" template with show=None. This might be a placeholder for future implementation. If so, consider adding a comment to indicate this. If not, ensure that the appropriate show details are passed to the template.

frontend/config/views/config.py (1)
  • 8-11: The route handler config() logs a message and renders a template. However, the template path seems to be absolute (/config.html). In Flask, template paths are usually relative to the templates directory. If /config.html is not in the root of the templates directory, this could cause an error. Please verify the location of config.html and adjust the path accordingly.
-    return render_template("/config.html")
+    return render_template("config.html")
webpack.config.js (1)
  • 55-93: The context, entry, output, and name properties are set for each module configuration. This is a good practice as it allows for separate configurations for different modules, improving modularity and maintainability. However, ensure that the paths specified for context, entry, and output are correct and that the files and directories they refer to exist.

frontend/shows/views/shows.py Outdated Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
frontend/utils.py Outdated Show resolved Hide resolved
frontend/utils.py Outdated Show resolved Hide resolved
frontend/movies/views/movies.py Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d64f1a2 and b576af3.
Files selected for processing (9)
  • frontend/app.py (2 hunks)
  • frontend/config/init.py (1 hunks)
  • frontend/config/views/config.py (1 hunks)
  • frontend/movies/init.py (1 hunks)
  • frontend/movies/views/movies.py (1 hunks)
  • frontend/shows/init.py (1 hunks)
  • frontend/shows/views/shows.py (1 hunks)
  • frontend/utils.py (1 hunks)
  • webpack.config.js (1 hunks)
Files skipped from review due to trivial changes (6)
  • frontend/config/init.py
  • frontend/config/views/config.py
  • frontend/movies/init.py
  • frontend/movies/views/movies.py
  • frontend/shows/init.py
  • frontend/shows/views/shows.py
Additional comments: 8
frontend/app.py (2)
  • 16-18: The class FlaskServer now extends threading.Thread and is initialized with a host and port. This is a good practice as it allows the Flask server to run in its own thread, which can improve performance and responsiveness.

  • 27-37: The run method has been updated to register additional blueprints (config_blueprint and movies_blueprint) and log all routes. This is a good practice as it improves modularity and provides useful debugging information. However, ensure that the logging of routes does not expose sensitive information in a production environment.

webpack.config.js (4)
  • 3-6: The commented out plugins CopyPlugin and HtmlWebpackPlugin are still not used in the new configuration. If these plugins are not planned to be used in the future, consider removing these lines to improve code cleanliness.

  • 10-11: The mode is still set to either the value of NODE_ENV or 'development' if NODE_ENV is not set. This could lead to unexpected behavior if NODE_ENV is set to a value other than 'production' or 'development'. Consider explicitly checking if NODE_ENV is set to 'production' and defaulting to 'development' otherwise.

  • 81-93: The Object.assign method is still used to create copies of the config object for different modules. This is a shallow copy, meaning that changes to nested objects or arrays in the original config object will affect the copies. If this is not the intended behavior, consider using a deep copy method instead.

  • 98-102: The GenerateSW plugin is still added to the plugins array of each configuration if the mode is 'production'. However, this modifies the original plugins array in the config object due to the shallow copy issue mentioned above. This means that the GenerateSW plugin will be added multiple times if the mode is 'production'. Consider creating a new plugins array for each configuration to avoid this issue.

frontend/utils.py (2)
  • 13-15: The previous suggestion to optimize the use of Path(module_location).parent has been implemented correctly. This change improves the performance by avoiding redundant operations.

  • 18-18: The previous suggestion to simplify the joinpath method by passing multiple arguments has been implemented correctly. This change improves the readability of the code.

frontend/utils.py Outdated Show resolved Hide resolved
@miigotu miigotu marked this pull request as draft November 3, 2023 23:11
miigotu and others added 2 commits November 3, 2023 19:11
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…sources

Signed-off-by: miigotu <miigotu@gmail.com>
@miigotu miigotu marked this pull request as ready for review November 4, 2023 00:27
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 8

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b116251 and 2ce5196.
Files selected for processing (15)
  • frontend/app.py (1 hunks)
  • frontend/config/init.py (1 hunks)
  • frontend/config/static/config.js (1 hunks)
  • frontend/config/views.py (1 hunks)
  • frontend/movies/init.py (1 hunks)
  • frontend/movies/static/movie.js (1 hunks)
  • frontend/movies/static/movies.js (1 hunks)
  • frontend/movies/views.py (1 hunks)
  • frontend/shows/init.py (1 hunks)
  • frontend/shows/static/show.js (1 hunks)
  • frontend/shows/static/shows.js (3 hunks)
  • frontend/shows/templates/shows.html (1 hunks)
  • frontend/shows/views.py (1 hunks)
  • frontend/utils.py (1 hunks)
  • webpack.config.js (1 hunks)
Files skipped from review due to trivial changes (6)
  • frontend/config/static/config.js
  • frontend/movies/static/movie.js
  • frontend/movies/static/movies.js
  • frontend/shows/static/show.js
  • frontend/shows/static/shows.js
  • frontend/shows/views.py
Additional comments: 13
frontend/movies/__init__.py (1)
  • 1-5: The module is well-structured and imports the blueprint from the views module correctly. Ensure that the views module contains the blueprint object and it is correctly configured.
frontend/shows/__init__.py (1)
  • 1-5: The code looks good. It's a simple import of the blueprint object from the views module. Ensure that the views module correctly defines and exports the blueprint object.
frontend/utils.py (1)
  • 1-5: The logging functionality is commented out. If this is intentional and you don't want to use logging in this file, consider removing these lines to keep the code clean. If you want to use logging, uncomment these lines.
- # import logging
- #
- # logging.basicConfig(format="{asctime} {levelname} :: {threadName} :: {message}", style="{")
- # logger = logging.getLogger(__package__)
- # logger.setLevel(logging.DEBUG)
+ import logging
+ 
+ logging.basicConfig(format="{asctime} {levelname} :: {threadName} :: {message}", style="{")
+ logger = logging.getLogger(__package__)
+ logger.setLevel(logging.DEBUG)
frontend/config/views.py (2)
  • 1-5: The blueprint is correctly defined with a unique name, module, template folder, static folder, and URL prefix. Ensure that the template "config.html" exists in the specified template folder and that the static files are in the specified static folder.

  • 8-11: The route is correctly defined and mapped to the function config(). The function logs a message and then renders the template. Ensure that the logger is correctly configured and that the log message will not flood the logs if the config page is frequently accessed.

frontend/app.py (2)
  • 1-85: The changes in this hunk are generally good, improving the structure and modularity of the Flask application. However, there are a few points that need to be addressed.

  • 48-50: The blueprints are registered with the Flask app. Ensure that the blueprints are correctly defined in their respective modules and that the routes do not conflict.

frontend/movies/views.py (1)
  • 15-16: The debug log message refers to settings.showList which seems to be a typo as the context variable for the template is settings.movie_list. Please verify this.
-    logger.debug(f"movies: {settings.showList}")
+    logger.debug(f"movies: {settings.movie_list}")
frontend/shows/templates/shows.html (2)
  • 1-4: The title block is empty. Consider providing a default title or ensure that the title is being set in the parent template or view function.
-    <title>{% block title %}{% endblock title %}</title>
+    <title>{% block title %}SickChill Shows{% endblock title %}</title>

2, 20:
Ensure that the static files shows.css and shows.js exist and are correctly served from the /static/ route.

  • 6-17: The template assumes that shows is a list of objects with properties name, startyear, indexerid, and imdb_id. Ensure that the view function provides this data in the correct format.
webpack.config.js (3)
  • 1-6: The commented out plugins CopyPlugin and HtmlWebpackPlugin are not used in the new configuration. If these plugins are not planned to be used in the future, consider removing these lines to improve code cleanliness.

  • 10-11: The mode is set to either the value of NODE_ENV or 'development' if NODE_ENV is not set. This could lead to unexpected behavior if NODE_ENV is set to a value other than 'production' or 'development'. Consider explicitly checking if NODE_ENV is set to 'production' and defaulting to 'development' otherwise.

  • 98-102: The GenerateSW plugin is added to the plugins array of each configuration if the mode is 'production'. However, this modifies the original plugins array in the config object due to the shallow copy issue mentioned above. This means that the GenerateSW plugin will be added multiple times if the mode is 'production'. Consider creating a new plugins array for each configuration to avoid this issue.

frontend/config/__init__.py Outdated Show resolved Hide resolved
frontend/movies/views.py Outdated Show resolved Hide resolved
Comment on lines +9 to +15
{% for show in shows %}
<div class="col-3">
<p>{{ show.name }} ({{ show.startyear }})</p>
<p>tvdb: {{ show.indexerid }}</p>
<p>imdb: {{ show.imdb_id }}</p>
</div>
{% endfor %}
Copy link
Contributor

Choose a reason for hiding this comment

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

The template does not handle the case where shows is empty. Consider adding a message to inform the user when there are no shows to display.

+    {% if shows %}
      {% for show in shows %}
          <div class="col-3">
              <p>{{ show.name }} ({{ show.startyear }})</p>
              <p>tvdb: {{ show.indexerid }}</p>
              <p>imdb: {{ show.imdb_id }}</p>
          </div>
      {% endfor %}
+    {% else %}
+        <p>No shows to display.</p>
+    {% endif %}

Commitable suggestion

[!IMPORTANT]
Carefully review the code before committing. Make sure it correctly replaces the highlighted code, has no missing lines and indentaion issues.

Suggested change
{% for show in shows %}
<div class="col-3">
<p>{{ show.name }} ({{ show.startyear }})</p>
<p>tvdb: {{ show.indexerid }}</p>
<p>imdb: {{ show.imdb_id }}</p>
</div>
{% endfor %}
{% if shows %}
{% for show in shows %}
<div class="col-3">
<p>{{ show.name }} ({{ show.startyear }})</p>
<p>tvdb: {{ show.indexerid }}</p>
<p>imdb: {{ show.imdb_id }}</p>
</div>
{% endfor %}
{% else %}
<p>No shows to display.</p>
{% endif %}

webpack.config.js Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2ce5196 and be5a054.
Files selected for processing (1)
  • frontend/app.py (1 hunks)

frontend/app.py Show resolved Hide resolved
Signed-off-by: miigotu <miigotu@gmail.com>
Signed-off-by: miigotu <miigotu@gmail.com>
Signed-off-by: miigotu <miigotu@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 6

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2ce5196 and 58f9946.
Files selected for processing (3)
  • frontend/app.py (1 hunks)
  • package.json (1 hunks)
  • webpack.config.js (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json

frontend/app.py Show resolved Hide resolved
frontend/app.py Show resolved Hide resolved
frontend/app.py Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
Signed-off-by: miigotu <miigotu@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 58f9946 and f8915b1.
Files selected for processing (2)
  • frontend/movies/views.py (1 hunks)
  • webpack.config.js (1 hunks)
Additional comments: 5
frontend/movies/views.py (1)
  • 10-15: The function movies logs the showList from settings but it passes movie_list to the template. Ensure that the correct data is being logged and passed to the template.
webpack.config.js (4)
  • 1-5: The import statements have been updated to use single quotes instead of double quotes. This is a minor stylistic change and does not affect the functionality of the code. However, it's important to maintain consistency in code style throughout the project. If the project uses ESLint or another linter, ensure that it's configured to enforce the chosen style.

  • 5-5: The GenerateSW import from the workbox-webpack-plugin package has been added. This plugin will generate a service worker file using Workbox that will take care of caching and runtime responses. Make sure that the workbox-webpack-plugin package is installed in the project.

  • 54-94: The config object has been updated to include a name property for each configuration, and the context, entry, and output properties have been updated to point to the respective source directories, entry files, and output directories. This is a good practice as it makes the configuration more modular and easier to manage.

  • 96-107: A check for the mode property has been added to conditionally add the GenerateSW plugin for production mode. This is a good practice as it ensures that the service worker is only generated for production builds, which can improve build times during development.

-    const outputs = [configurations, shows, movies];
+    const outputs = [configurations, shows, movies].map(config => {
+        if (config.mode === 'production') {
+            const serviceWorker = new GenerateSW();
+            config.plugins.push(serviceWorker);
+        }
+        return config;
+    });

frontend/movies/views.py Show resolved Hide resolved
frontend/movies/views.py Show resolved Hide resolved
miigotu and others added 2 commits November 3, 2023 21:11
Signed-off-by: miigotu <miigotu@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@miigotu miigotu changed the title refactor frontend structure, needs blueprint paths fixes for routes refactor frontend structure into flask blueprints Nov 4, 2023
@miigotu miigotu merged commit 2f55ab9 into develop Nov 4, 2023
1 check passed
@miigotu miigotu deleted the flask-movies branch November 4, 2023 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant