From a623800dc3f1aaf6f12ab2c574844e20213017a5 Mon Sep 17 00:00:00 2001 From: Ben Zhang Date: Mon, 1 Apr 2024 00:46:03 -0700 Subject: [PATCH] Refactor getting started documentation to include more information about registered affiliations (#2560) This makes it clear that new affiliations need to be registered. --- components/affiliation-list.tsx | 50 +++++++++++++++++++ components/ui/command.tsx | 4 +- lib/data.ts | 6 +++ pages/docs/compute-cluster/getting-access.mdx | 35 ++++++++----- scripts/generate-affiliation-info.py | 45 +++++++++++++++++ scripts/generate-fixtures.sh | 3 ++ 6 files changed, 129 insertions(+), 14 deletions(-) create mode 100644 components/affiliation-list.tsx create mode 100644 scripts/generate-affiliation-info.py diff --git a/components/affiliation-list.tsx b/components/affiliation-list.tsx new file mode 100644 index 0000000..27f7e90 --- /dev/null +++ b/components/affiliation-list.tsx @@ -0,0 +1,50 @@ +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, +} from "@/components/ui/command"; +import { AffiliationInfo } from "@/lib/data"; + +export function AffiliationList({ + affiliationInfo, +}: { + affiliationInfo: AffiliationInfo; +}) { + return ( + + + + No results found. + + {affiliationInfo.affiliations + .filter((a) => !a.is_legacy) + .map((a) => ( + + {a.name} + + ))} + + + + {affiliationInfo.affiliations + .filter((a) => a.is_legacy) + .map((a) => ( + + {a.name} + + ))} + + + + ); +} diff --git a/components/ui/command.tsx b/components/ui/command.tsx index c283b7b..2396889 100644 --- a/components/ui/command.tsx +++ b/components/ui/command.tsx @@ -44,13 +44,13 @@ const CommandInput = React.forwardRef< -)) +)); CommandInput.displayName = CommandPrimitive.Input.displayName diff --git a/lib/data.ts b/lib/data.ts index 6cf2e09..faffe50 100644 --- a/lib/data.ts +++ b/lib/data.ts @@ -10,6 +10,12 @@ export const sshInfo = SshInfoConvert.toSSHInfo(JSON.stringify(sshInfoJSON)) import sshInfoStrings from '@/build/fixtures/ssh-info-strings/strings' export { sshInfoStrings } +import affiliationInfoJSON from '@/build/fixtures/affiliation-info.json' +import { Convert as AffiliationInfoConvert } from '@/build/fixtures/affiliation-info' +export type { AffiliationInfo } from '@/build/fixtures/affiliation-info' +export const affiliationInfo = AffiliationInfoConvert.toAffiliationInfo(JSON.stringify(affiliationInfoJSON)) + + import websiteConfigJSON from '@/build/fixtures/website-config.json' import { Convert as WebsiteConfigConvert } from '@/build/fixtures/website-config' export type { WebsiteConfig } from '@/build/fixtures/website-config' diff --git a/pages/docs/compute-cluster/getting-access.mdx b/pages/docs/compute-cluster/getting-access.mdx index d26ca63..0475f7e 100644 --- a/pages/docs/compute-cluster/getting-access.mdx +++ b/pages/docs/compute-cluster/getting-access.mdx @@ -5,34 +5,45 @@ title: "Getting Access" # Getting Access to the Compute Cluster import { Steps } from 'nextra/components' +import { affiliationInfo } from '@/lib/data' +import { AffiliationList } from '@/components/affiliation-list' ### Determine your WATcloud contact -Every compute cluster user must have a WATcloud contact. Your WATcloud contact is responsible for approving your access request and helping -you with any issues you may have with the compute cluster. +Every WATcloud compute cluster user has a WATcloud contact. Your WATcloud contact is a designated person within your group (usually your group lead) +who is responsible for approving your access request and assisting you during the onboarding process. -If you are a member of a group in the following categories, your WATcloud contact is your group lead: -- [WUSA clubs](https://wusa.ca/clubs/) -- [SSDC teams](https://uwaterloo.ca/sedra-student-design-centre/directory-teams) -- UWaterloo research groups -- [UWaterloo capstone design teams](https://uwaterloo.ca/capstone-design/) +The following groups are registered with WATcloud: -If you are the lead of a group and would like to request access for your group, please email infra-outreach@watonomous.ca. + + +If your group is not listed or shows up as `[Legacy]`[^legacy-affiliation], please ask your group lead to [register the group][registered-affiliations] with WATcloud. + +[registered-affiliations]: ../registered-affiliations +[^legacy-affiliation]: A legacy affiliation is a group that was onboarded before the current [registered affiliations][registered-affiliations] system was in place. + Members of legacy affiliations can still access the compute cluster, but in order to use newer features like [SLURM](./slurm), the group must be registered. ### Fill out the onboarding form -Please fill out the [Onboarding form](https://cloud.watonomous.ca/docs/utilities/onboarding-form) and make sure to enable the "Compute Cluster" option. +Please fill out the [onboarding form](../utilities/onboarding-form) and make sure to enable the "Compute Cluster" option. ### Get approval from your WATcloud contact -Reach out to your WATcloud contact and ask them to approve your request. Your WATcloud contact is trained to help you with this process. +Reach out to your WATcloud contact and ask them to approve your request. ### Wait for your access to be provisioned After your request is approved, it usually takes about 15 minutes for your access to be provisioned. Your WATcloud contact has visibility -into the provisioning process and can work with the WATcloud team to resolve any technical issues that may arise. +into the provisioning pipeline and can work with the WATcloud team to resolve any technical issues that may arise. Once your access is provisioned, you will receive a welcome email. - \ No newline at end of file + + +{ +// Separate footnotes from the main content +} +import { Separator } from "@/components/ui/separator" + + \ No newline at end of file diff --git a/scripts/generate-affiliation-info.py b/scripts/generate-affiliation-info.py new file mode 100644 index 0000000..3fac539 --- /dev/null +++ b/scripts/generate-affiliation-info.py @@ -0,0 +1,45 @@ +import argparse +import csv +import json +import re +import sys +import textwrap +from itertools import chain +from pathlib import Path + +sys.path.append(str(Path(__file__).parent.parent.parent)) + +from directory.scripts.affiliation_utils import get_all_affiliations +from directory.scripts.directory_utils import get_directory_config + +def generate_affiliations(): + affiliations = get_all_affiliations() + directory_config = get_directory_config() + + ret = [] + for aff in affiliations: + ret.append({ + "name": aff["name"], + "is_legacy": False, + }) + + for aff_name in directory_config["legacy_affiliations"]: + ret.append({ + "name": aff_name, + "is_legacy": True, + }) + + return ret + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate affiliation information for the website.") + parser.add_argument("output_dir", type=str, help="The directory to output the affiliation information.") + args = parser.parse_args() + affiliations = generate_affiliations() + + + with open(Path(args.output_dir, "affiliation-info.json"), "w") as file: + json.dump({ + "affiliations": affiliations, + }, file, indent=2) + diff --git a/scripts/generate-fixtures.sh b/scripts/generate-fixtures.sh index c22fc89..eaf569e 100755 --- a/scripts/generate-fixtures.sh +++ b/scripts/generate-fixtures.sh @@ -62,6 +62,7 @@ if [ -n "$__fetch_from" ]; then wget --quiet -O "$PROJECT_DIR/build/fixtures/website-config.json" "$__fetch_from/website-config.json" wget --quiet -O "$PROJECT_DIR/build/fixtures/affiliation.schema.json" "$__fetch_from/affiliation.schema.json" wget --quiet -O "$PROJECT_DIR/build/fixtures/user.schema.json" "$__fetch_from/user.schema.json" + wget --quiet -O "$PROJECT_DIR/build/fixtures/affiliation-info.json" "$__fetch_from/affiliation-info.json" else echo "Generating fixtures..." # Create a new worktree @@ -72,6 +73,7 @@ else python3 "$SCRIPT_DIR/generate-website-config.py" "$PROJECT_DIR/../outputs" "$PROJECT_DIR/build/fixtures" cp "$PROJECT_DIR/../directory/affiliations/affiliation.schema.json" "$PROJECT_DIR/build/fixtures" cp "$PROJECT_DIR/../outputs/directory/users/user.schema.json" "$PROJECT_DIR/build/fixtures" + python3 "$SCRIPT_DIR/generate-affiliation-info.py" "$PROJECT_DIR/build/fixtures" fi # Add typescript types @@ -79,6 +81,7 @@ echo "Generating fixture types..." ./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/machine-info.{ts,json} ./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/ssh-info.{ts,json} ./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/website-config.{ts,json} +./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/affiliation-info.{ts,json} echo "Generating mdx files from data..." python3 "$SCRIPT_DIR/generate-mdx-strings.py" json-to-mdx "$PROJECT_DIR/build/fixtures/ssh-info.json" "$PROJECT_DIR/build/fixtures/ssh-info-strings"