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

feat(operators): Add Migrate Organization Tool #6748

Merged
merged 5 commits into from
Jul 11, 2023

Conversation

abshierjoel
Copy link
Contributor

Allows operators to migrate all of an account's organizations or a specific organization to a different account.

image

Checklist

Authors and Reviewer(s), please verify the following:

  • A PR description, regardless of the triviality of this change, that communicates the value of this PR
  • Well-formatted conventional commit messages that provide context into the change
  • Documentation updated or issue created (provide link to issue/PR)
  • Signed CLA (if not already signed)
  • Feature flagged, if applicable

@abshierjoel abshierjoel requested a review from a team as a code owner June 28, 2023 21:36
Copy link
Contributor

@wdoconnell wdoconnell left a comment

Choose a reason for hiding this comment

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

Looks great - couple minor comments here, mainly around adding some notifications for error states for when support is using the migration overlay.

</>
)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind removing the default exports? 🙇‍♂️ Makes it harder to track down references than using a named export.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely!

src/operator/MigrateOrgOverlay.tsx Show resolved Hide resolved
} = useContext(AccountContext)

const migrateAccountOrgs = () => {
if (account?.type !== 'cancelled') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just an extra guard in case there's a race condition, like the account being canceled while the overlay is being opened - since we only render an empty fragment instead of the MigrateOrgsOverlay if the account is canceled?

Since this try / catch block is only hit if the account type isn't canceled, might still want a notification here so that support doesn't presume the migration works if they hit the migration button and nothing happens.

}

setMigrateOverlayVisible(false)
setMigrateStatus(RemoteDataState.Done)
Copy link
Contributor

Choose a reason for hiding this comment

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

I might reverse the order of lns 196 and 197 here, since migrateStatus is used in the migration overlay. By the time migrateStatus is Done I suspect the overlay will be removed from the DOM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. Changing it.

)
}

export default MigrateOrgOverlay
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here re: default exports. Let's make this a named import so that it's easier to trace and tree shake.


const submit = async () => {
if (toAccountId === '') {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a notification here - like "please enter an account to migrate to"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's a good point. This is a pretty blind failure. It seems like I can pull use the useDispatch() hook with notify to put up an error. Does that make sense?

Also, remocal is failing me... so I'm pushing up these changes to run in CI 😅 🤞

try {
const resp = await getOperatorAccount({accountId: toAccountId})
if (resp.status !== 200) {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Same - could we add a notification letting the user know there was an error retrieving the ToAccount?

wdoconnell
wdoconnell previously approved these changes Jul 10, 2023
Copy link
Contributor

@wdoconnell wdoconnell left a comment

Choose a reason for hiding this comment

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

Looks good - thanks for the commits to cover my comments 😄

@abshierjoel abshierjoel added this pull request to the merge queue Jul 11, 2023
Merged via the queue into master with commit 7cc762b Jul 11, 2023
1 check passed
@abshierjoel abshierjoel deleted the add-migrate-to-operator-ui branch July 11, 2023 18:19
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