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

Classifier: Add support for inactive (private) workflows #2940

Merged
merged 2 commits into from
Mar 31, 2022

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented Mar 10, 2022

  • swap project.links.workflows for project.links.active_workflows when validating workflow IDs in app-project.
  • add usePanoptesAuth, usePanoptesUser and useProjectRoles hooks to the classifier.
  • move useStores into the hooks directory.
  • check project roles during workflow selection in the classifier. Allow owners, testers and collaborators to select any project workflow. Otherwise, restrict selection to a project's active workflows.

To test this PR, add an inactive workflow to a project, in the project builder, then load that workflow directly by ID in either the dev classifier or the project app. It should load, if you are logged in as a user that has permission to view all project workflows. If not, you should see the usual error in the browser console: unable to load workflow X for project Y.

Package:
app-project
lib-classifier

Review Checklist

General

  • Are the tests passing locally and on Travis?
  • Is the documentation up to date?

Components

Apps

  • Does it work in all major browsers: Firefox, Chrome, Edge, Safari?
  • Does it work on mobile?
  • Can you yarn panic && yarn bootstrap or docker-compose up --build and app works as expected?

Publishing

  • Is the changelog updated?
  • Are the dependencies updated for apps and libraries that are using the newly published library?

Post-merging

@eatyourgreens eatyourgreens added the enhancement New feature or request label Mar 10, 2022
@eatyourgreens eatyourgreens marked this pull request as ready for review March 10, 2022 11:14
@eatyourgreens eatyourgreens force-pushed the private-workflows branch 5 times, most recently from 207c3fc to 986d85e Compare March 14, 2022 09:44
@eatyourgreens
Copy link
Contributor Author

Here's our previous discussion about the Panoptes user resource in the classifier.

@eatyourgreens eatyourgreens force-pushed the private-workflows branch 8 times, most recently from 7c50b5a to 673c862 Compare March 22, 2022 22:30
@eatyourgreens eatyourgreens mentioned this pull request Mar 23, 2022
18 tasks
@eatyourgreens eatyourgreens force-pushed the private-workflows branch 4 times, most recently from 513f65b to 6fac5b9 Compare March 23, 2022 19:39
@eatyourgreens eatyourgreens force-pushed the private-workflows branch 5 times, most recently from cfa5390 to ccd713f Compare March 24, 2022 10:04
@ErikOstlund ErikOstlund self-requested a review March 24, 2022 19:14
@ErikOstlund
Copy link
Contributor

Adding myself to the PR because this is related to some work I'm doing with the Solar Jets project and I'd like to be familiar with these updates. I will add a review, but because I'm just walking into this, it may be a good idea to have @shaunanoordin do a review.

@ErikOstlund
Copy link
Contributor

ErikOstlund commented Mar 28, 2022

Initial UI review:

The goal is to see an inactive workflow in a project.
In project 16201, I have two workflows:
18675 (active)
21160 (inactive)

Without being logged in and going to url:
localhost:8080/?env=production&project=16201&workflow=21160
I get the error: unable to load workflow 21160 for project 16201
This is expected. So far so good! ✅

Next, I log in and go to the same url:
localhost:8080/?env=production&project=16201&workflow=21160
The workflow loads! I can see the subject and the Tasks. I can submit a classification! ✅

Changing the workflow using the UI drop-down, does not update the url. ❌
If I'm at:
localhost:8080/?env=production&project=16201&workflow=21160
and use the Change workflow drop-down to select workflow #18675, the selected workflow does load, but the url is not updating:
Screen Shot 2022-03-28 at 12 03 51 PM

@ErikOstlund
Copy link
Contributor

All unit tests are passing. ✅

- swap `project.links.workflows` for `project.links.active_workflows` when validating workflow IDs in `app-project`.
- add a `useProjectRoles` hook to the classifier, which gets roles for a project, user and token.
- check project roles during workflow selection. Allow owners, testers and collaborators to select any project workflow.
- add a usePanoptesUser hook.
- add a usePanoptesAuth hook.
- move `useStores` to the hooks directory.
@eatyourgreens
Copy link
Contributor Author

Changing the workflow using the UI drop-down, does not update the url. ❌
If I'm at:
localhost:8080/?env=production&project=16201&workflow=21160
and use the Change workflow drop-down to select workflow #18675, the selected workflow does load, but the url is not updating:

I've opened #2993 to add some simple routing to the dev classifier, using history.pushState(), so that the window location updates when you change workflow.

@ErikOstlund
Copy link
Contributor

PR #2993 looks good and is approved. With this update, I believe this PR is good to go.
@shaunanoordin, do you have time to double check this one?

@github-actions github-actions bot added the approved This PR is approved for merging label Mar 31, 2022
@eatyourgreens eatyourgreens merged commit daa07b7 into master Mar 31, 2022
@eatyourgreens eatyourgreens deleted the private-workflows branch March 31, 2022 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved for merging enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants