Conversation
src/common/actions/create-snap.js
Outdated
@@ -54,10 +53,11 @@ function getSnapName(owner, name) { | |||
})); | |||
} | |||
|
|||
export function createSnap(repositoryUrl, location) { // location for tests | |||
export function createSnap(repository) { // location for tests |
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.
I discovered that all code calling createSnap already had a parsed repository object. Instead of parsing it twice I decided to just pass the repository object.
if (result.status !== 'success' || | ||
result.payload.code !== 'snap-created') { | ||
throw getError(response, result); | ||
if (result.status !== 'success' || result.payload.code !== 'snap-created') { |
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.
Unrelated codestyle change.
result.payload.code !== 'snap-created') { | ||
throw getError(response, result); | ||
if (result.status !== 'success' || result.payload.code !== 'snap-created') { | ||
return Promise.reject(getError(response, result)); |
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.
createSnap
is now called by createSnaps
, so instead of handling the success and failure scenarios here they are now handled by the createSnaps
promise.
src/common/actions/create-snap.js
Outdated
}); | ||
} | ||
}; | ||
} | ||
|
||
export function createSnaps(repositories, location) { |
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 action will eventually support batch creation of snaps. This is currently blocked in the LP auth API.
Until then, I've prepared this code to accept multiple repositories, but it actually only creates a snap for the first selected repository. This allows us work on the UI without breaking the staging website.
@@ -66,7 +66,7 @@ export const verify = (req, res, next) => { | |||
logger.info('User successfully authenticated'); | |||
|
|||
// Redirect to logged in URL | |||
res.redirect('/dashboard'); | |||
res.redirect('/dashboard/select-repositories'); |
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.
After logging in, redirect to the dashboard select-repositories view as if logging in for the first time.
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.
We don't technically need this change. Eventually, the user will only be redirected to the select-repositories view if they have no enabled repositories.
The reason I made this change now is that it will allow us to validate the "initial login" path before the smarter redirect is in-place. Our designers can see a more complete picture of the site before the "enabled-repositories" dashboard view is finished.
It's a small, meaningless change but I think it speaks a lot.
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.
OK.
We probably need full workflow (with usable dashboard and enabled repos list and 'smarter' redirect) before it's meaningful to discuss the complete picture, but it doesn't hurt to have this for now.
13023c7
to
d27a00f
Compare
src/common/actions/create-snap.js
Outdated
@@ -54,10 +53,11 @@ function getSnapName(owner, name) { | |||
})); | |||
} | |||
|
|||
export function createSnap(repositoryUrl, location) { // location for tests | |||
export function createSnap(repository) { // location for tests |
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.
The "location for tests" comment is now misplaced - it should be moved to createSnaps
, since that's where the location
parameter now lives.
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.
Arg, nice spot 😅
@@ -70,7 +70,7 @@ class SelectRepositoryList extends Component { | |||
const { selectedRepos } = this.props.selectRepositoriesForm; | |||
if (selectedRepos.length) { | |||
// TODO: Switch to batched repository action |
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 TODO comment is obsolete now, isn't it? That is, we still need changes inside createSnaps
but not here.
d27a00f
to
b5d3067
Compare
- Added initial support for batched snap creation to createSnap action creators - Changed redirect on successful login to "select repositories" dashboard view
b5d3067
to
eefde70
Compare
creators
dashboard view