Skip to content

Commit

Permalink
Remove old onboarding form (#3066)
Browse files Browse the repository at this point in the history
The old onboarding form has been deprecated in a while now
(WATonomous/infra-config#2777). This PR removes
the old onboarding form completely. `/onboarding-form` is replaced with
a placeholder page that redirects to the new onboarding form. The
initial form data query param is preserved for backwards compatibility.

The initial form data query param conversion is tested using the
following query param:
```
/onboarding-form?initialFormData=%7B%22compute_cluster%22%3A%20%7B%22additional_groups%22%3A%20%5B%22planning-research%22%5D%2C%20%22enabled%22%3A%20true%2C%20%22github_username%22%3A%20%22ben-z%22%2C%20%22linger%22%3A%20false%2C%20%22linux_shell%22%3A%20%22%2Fbin%2Fzsh%22%2C%20%22roles%22%3A%20%5B%22ADMIN%22%5D%2C%20%22ssh_public_keys%22%3A%20%5B%22ecdsa-sha2-nistp256%20AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLdGR4%2FAXCyUxsT%2F9zH5MIVkV9%2FnoAnLiBFtavcCk%2FYGQz9SVtOi6P%2BIAzdtbPF4tENKJI%2B27FYSjQ3yOf%2FVknc%3D%20wato%40secretive.MPB-19.local%22%2C%20%22port-forwarding%2Cno-pty%2Ccommand%3D%5C%22%2Fbin%2Ffalse%5C%22%20ecdsa-sha2-nistp256%20AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBG5RXpWbl8UXTGzTvDw6EGLytjjImdDskNxpsDO8T31fSNty6FaAx%2B6Ch1z02%2FCtyLym%2BZiijzWGX6IFxyGCD1k%3D%20wato-proxyjump%40secretive.MPB-19.local%22%2C%20%22ecdsa-sha2-nistp256%20AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBASa8mkCnrSuE2sB424myXkHUisHyiBlarYi5u76fT3ksFJw6Xz8MI6jiK2dIKoNbYPx608wK%2F2UZf0Y4p6%2FjFM%3D%20wato-noauth%40secretive.MPB-19.local%22%2C%20%22ssh-ed25519%20AAAAC3NzaC1lZDI1NTE5AAAAIDTZ1SUwgEIVwP9ZFoxe60wIc81isc8PfGu%2FJFkdyOhs%201password%20WATonomous%20SSH%20key%22%2C%20%22ssh-ed25519%20AAAAC3NzaC1lZDI1NTE5AAAAIOVkfo8KehqkIvNo%2F01nNVWr9itu%2BKWtvLlkViveM67x%20Termius%20iOS%22%5D%2C%20%22uid%22%3A%201507%2C%20%22username%22%3A%20%22ben%22%7D%2C%20%22discord%22%3A%20%7B%22discriminator%22%3A%20%22%22%2C%20%22enabled%22%3A%20true%2C%20%22is_owner%22%3A%20false%2C%20%22roles%22%3A%20%5B%22Admin%22%2C%20%22WATcloud%22%2C%20%22Core%20Member%22%5D%2C%20%22username%22%3A%20%22un1c0rnio%22%7D%2C%20%22finance_system%22%3A%20%7B%22enabled%22%3A%20false%7D%2C%20%22general%22%3A%20%7B%22affiliations%22%3A%20%5B%5D%2C%20%22contact_emails%22%3A%20%5B%22ben.zhang%40uwaterloo.ca%22%5D%2C%20%22name%22%3A%20%22Ben%20Zhang%22%2C%20%22send_onboarding_email%22%3A%20true%7D%2C%20%22github%22%3A%20%7B%22enabled%22%3A%20true%2C%20%22org_membership%22%3A%20%22Owner%22%2C%20%22teams%22%3A%20%5B%22WATonomous%20Team%22%5D%2C%20%22username%22%3A%20%22ben-z%22%7D%2C%20%22google_workspace%22%3A%20%7B%22emails%22%3A%20%5B%7B%22email_address%22%3A%20%22ben%40watorace.ca%22%2C%20%22groups%22%3A%20%5B%22%5BWATcloud%20team%5D%20Infrastructure%20Outreach%22%2C%20%22%5BWATcloud%20team%5D%20Elastic%22%5D%2C%20%22is_legacy_account%22%3A%20true%2C%20%22is_superadmin%22%3A%20false%7D%5D%2C%20%22enabled%22%3A%20true%2C%20%22first_name%22%3A%20%22Ben%22%2C%20%22last_name%22%3A%20%22Zhang%22%2C%20%22recovery_email%22%3A%20%22ben.zhang%40uwaterloo.ca%22%7D%2C%20%22internal_tools%22%3A%20%7B%22enabled%22%3A%20false%2C%20%22github_username%22%3A%20%22ben-z%22%7D%2C%20%22jira%22%3A%20%7B%22enabled%22%3A%20false%7D%2C%20%22sentry%22%3A%20%7B%22email%22%3A%20%22ben.zhang%40watonomous.ca%22%2C%20%22enabled%22%3A%20true%2C%20%22org_role%22%3A%20%22member%22%2C%20%22teams%22%3A%20%5B%22WATcloud%22%5D%7D%2C%20%22uw_gitlab%22%3A%20%7B%22enabled%22%3A%20false%7D%7D
```

Before/after:
<img width="1552" alt="image"
src="https://github.com/user-attachments/assets/3affda5c-8694-47f1-a453-debf99cb12c2">
  • Loading branch information
ben-z authored Aug 30, 2024
1 parent 26340e9 commit 220ecfc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/onboarding-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { deepEquals } from "@rjsf/utils"
import { useRouter } from "next/router";
import { encodeURI as b64EncodeURI, decode as b64Decode } from "js-base64";

const INITIAL_FORM_DATA_QUERY_PARAM = "initialformdatab64";
export const INITIAL_FORM_DATA_QUERY_PARAM = "initialformdatab64";
const FORM_STATE_KEY = "onboarding-form-state";

function saveFormState(obj: Record<string, any>) {
Expand Down
3 changes: 3 additions & 0 deletions pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
"theme": {
"timestamp": false
}
},
"onboarding-form": {
"display": "hidden"
}
}
20 changes: 20 additions & 0 deletions pages/onboarding-form.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Onboarding Form (Moved)

import { INITIAL_FORM_DATA_QUERY_PARAM } from '@/components/onboarding-form'
import { encodeURI as b64EncodeURI } from 'js-base64';
import { Link } from 'nextra-theme-docs'

export function RedirectLink({ children }) {
const urlParams = new URLSearchParams(typeof window === "undefined" ? "" : window.location.search);
const initialFormDataStr = urlParams.get('initialFormData');

const newURLParams = new URLSearchParams();
if (initialFormDataStr) {
newURLParams.append(INITIAL_FORM_DATA_QUERY_PARAM, b64EncodeURI(initialFormDataStr));
}
const newURLParamsStr = newURLParams.toString();

return <Link href={`/docs/utilities/onboarding-form${newURLParamsStr ? `?${newURLParamsStr}` : ""}`}>{children}</Link>
}

This page has moved! Please <RedirectLink>click here</RedirectLink> to go to the new location.

0 comments on commit 220ecfc

Please sign in to comment.