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

Add state field to workflow, allowing deprecated workflows to be hidden #213

Merged
merged 7 commits into from
Apr 19, 2019

Conversation

dleehr
Copy link
Member

@dleehr dleehr commented Apr 18, 2019

  • Adds state to workflow with two choices: Active (default) and Deprecated
  • Updates non-admin API lists to hide workflows and workflow versions for deprecated workflows
  • Adds workflow state to the filter fields for these APIs and preserves direct GET by id

In summary - setting a workflow's state to Deprecated will cause it to be hidden from bespin-ui and bespin-cli listings, but still allow the workflow to be accessed by direct URL.

- Also changes case on workflow types for consistency
…views

- ExcludeDeprecatedWorkflowsMixin applies this behavior to non-admin workflow/workflow-version List APIs
- Requires the workflow state field to be in the filter fields
- Applies an .exclude() to the QuerySet if the request does not otherwise filter on the field
@dleehr dleehr requested a review from johnbradley April 18, 2019 19:25
Copy link
Contributor

@johnbradley johnbradley left a comment

Choose a reason for hiding this comment

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

Code looks good. One question about ExcludeDeprecatedWorkflowsMixin.get_queryset.

data/api.py Outdated
raise(BespinAPIException(500, 'Cannot use ExcludeDeprecatedWorkflowsMixin without setting '
'state_filter_field to one of the filter_fields: {}'
.format(self.state_filter_field)))
queryset = self.queryset
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we are using self.queryset instead of calling super...get_queryset()?

- Makes mixin less fragile and more flexible
- Changes check to None, since empty querysets are falsy
- generics.py will raise if this is not set, behavior in mixin was redundant
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.

2 participants