-
Notifications
You must be signed in to change notification settings - Fork 75
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
Pages Editor: implement Associated Subject Sets & fetch more data #7048
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with only a couple comments. One thing I wanted to surface is that I expected refreshing the page to keep me on the same tab "workflow settings".. Is this a bug? Or desired behavior? Personally, when a tab changes 50%+ of the page I assume refreshing the page / pushing the back button will take me back to the previous state. In this case, the back button also doesn't take me back to the "workflow settings" tab. This also might be future work so take this comment as is helpful!
workflow: null, | ||
status: 'error' | ||
}); | ||
} | ||
} | ||
|
||
fetchWorkflow(); | ||
fetchProjectAndWorkflow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want an await here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An await
is not needed here, as we want the fetch action to run asynchronously in the background; the state.apiData.status
is set to fetching
so users get to see a loading message while the data fetch occurs. 👌
@@ -140,7 +140,8 @@ export default function TasksPage() { | |||
update({ tasks: newTasks }); | |||
} | |||
|
|||
const previewUrl = 'https://frontend.preview.zooniverse.org/projects/darkeshard/example-1982/classify/workflow/3711?env=staging'; | |||
const previewEnv = getPreviewEnv(); | |||
const previewUrl = `https://frontend.preview.zooniverse.org/projects/${project?.slug}/classify/workflow/${workflow?.id}${previewEnv}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe do something different here if there isn't a project slug and workflow id? Because if its missing and it gets clicked on I would rather it send them somewhere predictable/debuggable instead of a default weird url with null/undefined/ect in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me think about this. 🤔
You're right that a URL like https://frontend.preview.zooniverse.org/projects/undefined/classify/workflow/undefined
would be pretty wonky. But it's a fairly safe assumption every project has a slug and every workflow has an ID. But but it's still good to have a safety for when those assumptions bork.
@@ -230,3 +231,21 @@ export default function TasksPage() { | |||
</div> | |||
); | |||
} | |||
|
|||
function getPreviewEnv() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function feels too important to bury in a file... I'd personally want something like this (with clear exceptions / responsive to our development URL schema) surfaced a bit higher. I'ts own file, part of a helper, or something that makes its purpose more surfaceable.
}); | ||
|
||
} catch (err) { | ||
console.error('AssosicatedSubjectSets: ', err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misspelling and would be useful to indicate its an error in the console.log(). I personally like using the following format:
console.log("AssociatedSubjectSets() fetchSubjectSets() error", err);
That way you have a guide in the console on how to find that console log (my future self really appreciates these guideposts). Only a suggestion though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Derp! I definitely need to fix that misspelling, thank you.
And thank you for the suggestion, I might also need to revise how I write our error messages. (At the moment I'm making the standards up as I go.)
a0361b0
to
0257819
Compare
Thanks Travis! I'm going to rebase, then address some of the smaller feedback in this PR, before merging. 👍 To respond to the point you raised:
Good point. Perhaps ideally, each "tab" should be its own sub-page with a URL, like EDIT: Wait, a thought occurs: |
…t project resource.
3a488d3
to
f3e5f37
Compare
PR Overview
Part of: Pages Editor MVP project and FEM Lab super-project
Follows #7046
Staging branch URL: https://pr-7048.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging
This PR implements the "Associated Subject Sets" feature on the Workflow Settings sub-page.
Also, some background work was required to fetch the Subject Sets, so the DataManager was updated as well.
Screenshot: example workflow with 3 available subject sets, 2 of which are linked.
Testing
Status
Ready for review!
This PR is currently targeting pages-editor-pt14 for review purposes. Do not merge until 6974 is ready and this branch's merge is re-targeted to
master
.