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

Custom test groups feature #1154

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

EXTREMOPHILARUM
Copy link
Contributor

@EXTREMOPHILARUM EXTREMOPHILARUM commented Jul 13, 2021

A feature to create custom plugin groups from the front end. The user can select plugins and create groups according to their convenience and execute a custom list of plugins

Description

Add groups functionality:

Steps:

  1. Select plugins & click add group
    add_group

  2. Enter plugin group name
    entername

Groups added:

group_added_in_plugin
group_added

Delete groups functionality:

  1. Select plugin group & click Delete group

delete_group

Motivation and Context

The reason for adding this feature is to make it easy for the user to run specific plugins that they run frequently and need to select them repeatedly. This feature aims to reduce this hassle.

Reviewers

@viyatb @sharmamohit123

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other

Checklist:

  • My code follows the code style (modified PEP8) of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link
Member

@viyatb viyatb left a comment

Choose a reason for hiding this comment

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

left some comments. I would add some tests for the backend and frontend changes so that we can be sure that these changes don't break the existing functionality.

if action == "add":
plugin_data_list = plugin_data.split("&")
plugin_dict = {}
for plugin_element in plugin_data_list:
Copy link
Member

Choose a reason for hiding this comment

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

this parsing seems weird -- I think urlparsing these parameters into a dictionary or a list would be a cleaner approach.

plugin_dict = {}
for plugin_element in plugin_data_list:
plugin_dict[plugin_element.split("=")[0]] = plugin_element.split("=")[1]
custom_group_name = plugin_dict['group'].split('%3B')[-1]
Copy link
Member

Choose a reason for hiding this comment

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

ditto

plugin_data = plugin_data.split("=")
if plugin_data[0] == "group":
if "%" in plugin_data[1]:
groups = plugin_data[1].split('%2C')
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@@ -198,9 +198,30 @@ def plugin_gen_query(session, criteria):
query = query.filter(Plugin.type.in_(criteria["type"]))
if criteria.get("group", None):
if isinstance(criteria["group"], str):
query = query.filter(Plugin.group == criteria["group"])
plugin_groups_list = Plugin.get_all_plugin_groups(session)
Copy link
Member

Choose a reason for hiding this comment

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

can you write some tests for this? this is a critical piece of code which might break functionality

const requestURL = `${API_BASE_URL}group/add`;
const options = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
Copy link
Member

Choose a reason for hiding this comment

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

JSON based POST will be simpler than form encoded parameters to parse here imo

const requestURL = `${API_BASE_URL}group/delete`;
const options = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@EXTREMOPHILARUM
Copy link
Contributor Author

EXTREMOPHILARUM commented Aug 17, 2021

Thank you! Working on them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants