Skip to content
This repository has been archived by the owner on Jun 11, 2020. It is now read-only.

100: Batched repository selection #119

Merged
merged 1 commit into from Feb 10, 2017
Merged

Conversation

katiefenn
Copy link
Contributor

@katiefenn katiefenn commented Feb 10, 2017

  • Added initial support for batched snap creation to createSnap action
    creators
  • Changed redirect on successful login to "select repositories"
    dashboard view

@@ -54,10 +53,11 @@ function getSnapName(owner, name) {
}));
}

export function createSnap(repositoryUrl, location) { // location for tests
export function createSnap(repository) { // location for tests
Copy link
Contributor Author

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') {
Copy link
Contributor Author

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));
Copy link
Contributor Author

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.

});
}
};
}

export function createSnaps(repositories, location) {
Copy link
Contributor Author

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');
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@katiefenn katiefenn changed the title WIP 100: Batched repository selection Feb 10, 2017
@@ -54,10 +53,11 @@ function getSnapName(owner, name) {
}));
}

export function createSnap(repositoryUrl, location) { // location for tests
export function createSnap(repository) { // location for tests
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

- Added initial support for batched snap creation to createSnap action
  creators
- Changed redirect on successful login to "select repositories"
  dashboard view
@katiefenn katiefenn merged commit 5edb482 into master Feb 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants